blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 905
values | visit_date timestamp[us]date 2015-08-09 11:21:18 2023-09-06 10:45:07 | revision_date timestamp[us]date 1997-09-14 05:04:47 2023-09-17 19:19:19 | committer_date timestamp[us]date 1997-09-14 05:04:47 2023-09-06 06:22:19 | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us]date 2012-06-07 00:51:45 2023-09-14 21:58:39 ⌀ | gha_created_at timestamp[us]date 2008-03-27 23:40:48 2023-08-21 23:17:38 ⌀ | gha_language stringclasses 141
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 115
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
db1fc46c0aa7c32d8b0dc4c97e894c6b343de814 | bb5ee5f3082b52d0281f02aad96a64b234101c62 | /PP/tmp.cpp | 7bade5e46f6014d6180a62dae5508e113a40b9d4 | [] | no_license | rbmm/partial | 2d3fc002541ab840cd08c9b2708369145fb97bf1 | 9d318e3bca4d0e1e75a5c98cba57d209750e0e1c | refs/heads/master | 2022-12-11T16:24:14.644537 | 2022-12-05T02:40:19 | 2022-12-05T02:40:19 | 136,465,901 | 12 | 9 | null | null | null | null | UTF-8 | C++ | false | false | 8,320 | cpp | #include "StdAfx.h"
_NT_BEGIN
#include <ntlsa.h>
#include "buf.h"
extern OBJECT_ATTRIBUTES zoa;
extern volatile UCHAR guz;
BOOL Impersonate(PCLIENT_ID ClientId)
{
BOOL f = FALSE;
HANDLE hThread;
if (0 <= ZwOpenThread(&hThread, THREAD_DIRECT_IMPERSONATION, &zoa, ClientId))
{
static SECURITY_QUALITY_OF_SERVICE sqos = {
sizeof sqos, SecurityImpersonation, SECURITY_DYNAMIC_TRACKING, FALSE
};
if (0 <= ZwImpersonateThread(NtCurrentThread(), hThread, &sqos))
{
f = TRUE;
}
NtClose(hThread);
}
return f;
}
PCSTR GetLogonTypeName(ULONG LogonType, PSTR buf)
{
#define CASE_LT(x) case x: return #x;
switch(LogonType)
{
CASE_LT(UndefinedLogonType)
CASE_LT(Interactive)
CASE_LT(Network)
CASE_LT(Batch)
CASE_LT(Service)
CASE_LT(Proxy)
CASE_LT(Unlock)
CASE_LT(NetworkCleartext)
CASE_LT(NewCredentials)
CASE_LT(RemoteInteractive)
CASE_LT(CachedInteractive)
CASE_LT(CachedRemoteInteractive)
CASE_LT(CachedUnlock)
}
sprintf(buf, "%x", LogonType);
return buf;
}
BOOL Impersonate(PVOID buf)
{
union {
PBYTE pb;
PVOID pv;
PSYSTEM_PROCESS_INFORMATION sp;
};
pv = buf;
ULONG NextEntryOffset = 0;
do
{
pb += NextEntryOffset;
if (sp->NumberOfThreads )
{
if (Impersonate(&sp->TH->ClientId))
{
return TRUE;
}
}
} while( NextEntryOffset = sp->NextEntryOffset);
return FALSE;
}
void Update(WLog& log, PVOID Ptr)
{
union {
PBYTE pb;
PVOID pv;
PSYSTEM_PROCESS_INFORMATION pspi;
};
pv = Ptr;
ULONG NextEntryOffset = 0, rcb;
do
{
pb += NextEntryOffset;
CLIENT_ID cid = { pspi->UniqueProcessId };
if (cid.UniqueProcess)
{
HANDLE hProcess, hToken;
NTSTATUS status;
if (0 > (status = NtOpenProcess(&hProcess, PROCESS_QUERY_LIMITED_INFORMATION, &zoa, &cid)))
{
log(L"OpenProcess(%p,%wZ)=%x\r\n", cid.UniqueProcess, &pspi->ImageName, status);
}
else
{
if (0 > (status = NtOpenProcessToken(hProcess, TOKEN_QUERY, &hToken)))
{
log(L"OpenProcessToken(%p,%wZ)=%x\r\n", cid.UniqueProcess, &pspi->ImageName, status);
}
else
{
TOKEN_STATISTICS ts;
if (0 > (status = NtQueryInformationToken(hToken, TokenStatistics, &ts, sizeof(ts), &rcb)))
{
log(L"QueryInformationToken(%p,%wZ)=%x\r\n", cid.UniqueProcess, &pspi->ImageName, status);
}
else
{
pspi->ReadTransferCount.LowPart = ts.AuthenticationId.LowPart;
pspi->ReadTransferCount.HighPart = ts.AuthenticationId.HighPart;
}
NtClose(hToken);
}
NtClose(hProcess);
}
}
else
{
pspi->ReadTransferCount.QuadPart = 0;
}
} while (NextEntryOffset = pspi->NextEntryOffset);
}
void AddProToLS(WLog& log, PLUID LogonSessionList, PVOID Ptr)
{
union {
PBYTE pb;
PVOID pv;
PSYSTEM_PROCESS_INFORMATION pspi;
};
pv = Ptr;
TIME_FIELDS tf;
ULONG NextEntryOffset = 0;
LARGE_INTEGER li;
GetSystemTimeAsFileTime((PFILETIME)&li);
do
{
pb += NextEntryOffset;
if (LogonSessionList->LowPart == pspi->ReadTransferCount.LowPart &&
LogonSessionList->HighPart == pspi->ReadTransferCount.HighPart)
{
RtlTimeToTimeFields(&pspi->CreateTime, &tf);
LARGE_INTEGER t;
t.QuadPart = (li.QuadPart - pspi->CreateTime.QuadPart)/10000000;
log(L"\t%u %05x(%05x) %d-%02d:%02d:%02d[%u-%02u-%02u %02u:%02u:%02u] %wZ\r\n",
pspi->SessionId,
(ULONG)(ULONG_PTR)pspi->UniqueProcessId,
(ULONG)(ULONG_PTR)pspi->InheritedFromUniqueProcessId,
(DWORD)(t.QuadPart / (3600*24)),
(DWORD)((t.QuadPart / 3600) % 24),
(DWORD)((t.QuadPart / 60) % 60),
(DWORD)(t.QuadPart % 60),
tf.Year, tf.Month, tf.Day, tf.Hour, tf.Minute, tf.Second, &pspi->ImageName);
}
} while (NextEntryOffset = pspi->NextEntryOffset);
}
PCSTR GetSidNameUseName(SID_NAME_USE snu)
{
switch (snu)
{
case SidTypeUser: return "User";
case SidTypeGroup: return "Group";
case SidTypeDomain: return "Domain";
case SidTypeAlias: return "Alias";
case SidTypeWellKnownGroup: return "WellKnownGroup";
case SidTypeDeletedAccount: return "DeletedAccount";
case SidTypeInvalid: return "Invalid";
case SidTypeUnknown: return "Unknown";
case SidTypeComputer: return "Computer";
case SidTypeLabel: return "Label";
case SidTypeLogonSession: return "LogonSession";
}
return "?";
}
class LSA_LOOKUP
{
LSA_HANDLE PolicyHandle;
public:
LSA_LOOKUP()
{
LSA_OBJECT_ATTRIBUTES ObjectAttributes = { sizeof(ObjectAttributes) };
if (0 > LsaOpenPolicy(0, &ObjectAttributes, POLICY_LOOKUP_NAMES, &PolicyHandle))
{
PolicyHandle = 0;
}
}
~LSA_LOOKUP()
{
if (PolicyHandle)
{
LsaClose(PolicyHandle);
}
}
LSA_LOOKUP_HANDLE operator()()
{
return PolicyHandle;
}
};
void DumpSessions(WLog& log, PVOID pspi)
{
ULONG LogonSessionCount;
PLUID LogonSessionList;
NTSTATUS status;
if (0 > (status = LsaEnumerateLogonSessions(&LogonSessionCount, &LogonSessionList)))
{
log(L"LsaEnumerateLogonSessions=%x\r\n", status);
}
else
{
PVOID Buffer = LogonSessionList;
if (LogonSessionCount)
{
LSA_LOOKUP ll;
do
{
SECURITY_LOGON_SESSION_DATA *LogonSessionData;
if (0 > (status = LsaGetLogonSessionData(LogonSessionList, &LogonSessionData)))
{
log(L"LsaGetLogonSessionData(%08x-%08x)=%x\r\n", LogonSessionList->HighPart, LogonSessionList->LowPart, status);
}
else
{
TIME_FIELDS tf;
char cc[16];
RtlTimeToTimeFields(&LogonSessionData->LogonTime, &tf);
PSID Sid = LogonSessionData->Sid;
log(L"=================================================\r\n"
L"LogonId:\t%08x-%08x\r\n"
L"Session:\t%u\r\n"
L"LogonType:\t%S\r\n"
L"LogonTime\t%u-%02u-%02u %02u:%02u:%02u\r\n"
L"Username:\t%wZ\r\n"
L"LogonDomain:\t%wZ\r\n"
L"AuthenticationPackage:\t%wZ\r\n"
L"LogonServer:\t%wZ\r\n"
L"DnsDomainName:\t%wZ\r\n"
L"Sid:",
LogonSessionData->LogonId.HighPart, LogonSessionData->LogonId.LowPart,
LogonSessionData->Session,
GetLogonTypeName(LogonSessionData->LogonType, cc),
tf.Year, tf.Month, tf.Day, tf.Hour, tf.Minute, tf.Second,
&LogonSessionData->UserName,
&LogonSessionData->LogonDomain,
&LogonSessionData->AuthenticationPackage,
&LogonSessionData->LogonServer,
&LogonSessionData->DnsDomainName
);
if (Sid)
{
UNICODE_STRING us;
if (0 > RtlConvertSidToUnicodeString(&us, Sid, TRUE))
{
us.Length = 0, us.Buffer = 0;
}
PLSA_REFERENCED_DOMAIN_LIST ReferencedDomains;
PLSA_TRANSLATED_NAME Names;
ULONG Entries = 0;
PLSA_TRUST_INFORMATION Domains = 0;
const static UNICODE_STRING emptyUS{};
PCUNICODE_STRING Name = &emptyUS;
PCUNICODE_STRING Domain = &emptyUS;
SID_NAME_USE Use = SidTypeUnknown;
if (0 <= (status = LsaLookupSids(ll(), 1, &Sid, &ReferencedDomains, &Names)))
{
Entries = ReferencedDomains->Entries;
Domains = ReferencedDomains->Domains;
Name = &Names->Name;
Use = Names->Use;
ULONG DomainIndex = Names->DomainIndex;
if (DomainIndex < Entries)
{
Domain = &Domains[DomainIndex].Name;
}
}
log(L"\t[%wZ] '%wZ\\%wZ' [%S]\r\n", &us, Domain, Name, GetSidNameUseName(Use));
if (0 <= status)
{
LsaFreeMemory(Names);
LsaFreeMemory(ReferencedDomains);
}
RtlFreeUnicodeString(&us);
}
log << '\r' << '\n';
LsaFreeReturnBuffer(LogonSessionData);
AddProToLS(log, LogonSessionList, pspi);
}
} while (LogonSessionList++, --LogonSessionCount);
}
LsaFreeReturnBuffer(Buffer);
}
}
void els(WLog& log)
{
NTSTATUS status;
DWORD cb = 0x40000;
do
{
status = STATUS_INSUFFICIENT_RESOURCES;
if (PVOID pv = new BYTE[cb])
{
if (0 <= (status = NtQuerySystemInformation(SystemProcessInformation, pv, cb, &cb)))
{
if (!Impersonate(pv))
{
log(L"Impersonate error\r\n");
}
Update(log, pv);
DumpSessions(log, pv);
}
delete [] pv;
}
} while (status == STATUS_INFO_LENGTH_MISMATCH);
if (0 > status)
{
log(L"QuerySystemInformation(SystemProcessInformation)=%x\r\n", status);
}
}
void ShowSessions(HWND hwnd)
{
if (PWSTR buf = (PWSTR)LocalAlloc(0, 0x80000))
{
WLog log(buf, 0x80000);
els(log);
SetThreadToken(0, 0);
log >> hwnd;
}
}
_NT_END | [
"8209FBFB017DB41D@yopmail.com"
] | 8209FBFB017DB41D@yopmail.com |
fcbbc324e98ce4dd61b3223dc85dc06e7d122ed5 | 780a6c5326a6c3b1b15a7ea805585678265136ea | /src/similarity/time.h | ee7d787845fd668f00757e4701bfb5958110a95f | [] | no_license | phecy/ImageSorter | b45489688a189757b16f6467d096ec4471cd5d16 | 3a875b20a683a683149a436abe484b72bf70e1cf | refs/heads/master | 2021-01-22T14:03:20.743417 | 2012-04-16T09:48:54 | 2012-04-16T09:48:54 | 9,881,214 | 4 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 968 | h | #ifndef SIMILARITYTIME_H
#define SIMILARITYTIME_H
#include <map>
#include "vimage.h"
// For readability
typedef unsigned long long int ExifTime;
class SimilarityTime
{
public:
SimilarityTime(vector<VImage*> allImages);
// Given two images, compares averages of logs of gaps
// of everything between, as well as outside of them within
// the WINDOW_SIZE
//
// e.g. gets everything between two images, WINDOWSIZE before first,
// and WINDOWSIZE after second
float calculateSimilarity(const VImage* first, const VImage* second);
private:
// Add this image to the internal structure (updates sumGapLogs)
void addImage(VImage*);
// Maps an image to its index in times and gapFinder
std::map<QImage*, int> timeIndexFinder;
// The list of times a picture was taken
vector<ExifTime> times;
// index[i] = sum of logs of gaps between 0 and i
vector<long double> sumGapLogs;
};
#endif // SIMILARITYTIME_H
| [
"ksamii@ucsc.edu"
] | ksamii@ucsc.edu |
c9cd5c6686dff2a90e79c8129497368736acdcc6 | e4876db4acffc32cd3262c38d8936dd10baae50b | /methods/bobopt_yield_complex.cpp | af92ce18847b107e3efacfc0db8f69215c417f49 | [] | no_license | menjek/bobopt | 0ccc1226011e5822464ba7f7c8de9578eaf32528 | 2e2821d741db38ae8001f4c1b2ad8ee6716568be | refs/heads/master | 2021-01-22T05:33:06.967773 | 2014-12-04T07:49:00 | 2014-12-04T07:49:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 47,466 | cpp | #include <methods/bobopt_yield_complex.hpp>
#include <bobopt_config.hpp>
#include <bobopt_debug.hpp>
#include <bobopt_inline.hpp>
#include <bobopt_macros.hpp>
#include <bobopt_optimizer.hpp>
#include <bobopt_text_utils.hpp>
#include <bobopt_utils.hpp>
#include <clang/bobopt_clang_utils.hpp>
#include <clang/bobopt_clang_prolog.hpp>
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTTypeTraits.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/Stmt.h"
#include "clang/Analysis/CFG.h"
#include "clang/Frontend/CompilerInstance.h"
#include <clang/bobopt_clang_epilog.hpp>
#include <algorithm>
#include <iterator>
#include <limits>
#include <memory>
#include <numeric>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace clang;
using namespace clang::tooling;
using namespace clang::ast_matchers;
using namespace clang::ast_type_traits;
namespace bobopt
{
namespace methods
{
// Configuration.
//======================================================================
/// \brief Configuration group name.
static config_group config("yield complex");
/// \brief Complexity of not inlined non trivial call. Call defined probably in different TU.
static config_variable<unsigned> config_call_default_complexity(config, "call_default_complexity", 40u);
/// \brief Complexity of trivial call. Trivial function is function that doesn't require code generation, i.e., body is empty.
static config_variable<unsigned> config_call_trivial_complexity(config, "call_trivial_complexity", 0u);
/// \brief Complexity of function defined as inline. User should be carefull with inline keyword.
static config_variable<unsigned> config_call_inline_complexity(config, "call_inline_complexity", 10u);
/// \brief Complexity of contexpr function call. Call is resolved at compile time.
static config_variable<unsigned> config_call_constexpr_complexity(config, "call_constexpr_complexity", 0u);
/// \brief Multiplier for body complexity of for loop.
static config_variable<unsigned> config_multiplier_for(config, "multiplier_for", 5u);
/// \brief Multiplier for body complexity of while and do/while loops.
static config_variable<unsigned> config_multiplier_while(config, "multiplier_while", 15u);
/// \brief Optimal complexity for box execution.
/// It is equivalent of 2 inner for loops with 2 calls to not inlined non trivial function rounded up in tens of thousands.
static config_variable<unsigned> config_threshold(config, "threshold", 2000u);
/// \brief Enable insertion of yield before all function calls from predefined set of functions.
static config_variable<bool> config_yield_predefined(config, "yield_predefined", false);
// TU helpers.
//======================================================================
namespace
{
/// \brief Function detects whether call expression is Bobox yield().
bool is_yield_call(const CallExpr* call_expr)
{
BOBOPT_ASSERT(call_expr != nullptr);
const CXXMemberCallExpr* member_call_expr = llvm::dyn_cast<CXXMemberCallExpr>(call_expr);
if (member_call_expr == nullptr)
{
return false;
}
const CXXMethodDecl* method_decl = member_call_expr->getMethodDecl();
const CXXRecordDecl* record_decl = member_call_expr->getRecordDecl();
return (method_decl->getNameAsString() == "yield") && (record_decl->getNameAsString() == "basic_box");
}
/// \brief Function returns complexity of call expression.
unsigned get_call_complexity(const CallExpr* call_expr)
{
BOBOPT_ASSERT(call_expr != nullptr);
const FunctionDecl* callee = call_expr->getDirectCallee();
if (callee->hasTrivialBody())
{
return config_call_trivial_complexity.get();
}
if (callee->isConstexpr())
{
return config_call_constexpr_complexity.get();
}
if (callee->isInlined())
{
return config_call_inline_complexity.get();
}
return config_call_default_complexity.get();
}
/// \brief Function returns complexity of single CFG element.
unsigned get_element_complexity(const CFGElement& element)
{
if (element.getKind() != CFGElement::Kind::Statement)
{
return 1u;
}
const Stmt* stmt = element.castAs<CFGStmt>().getStmt();
BOBOPT_ASSERT(stmt != nullptr);
nodes_collector<CallExpr> collector;
collector.TraverseStmt(const_cast<Stmt*>(stmt));
unsigned result = 1u;
for (auto it = collector.nodes_begin(), end = collector.nodes_end(); it != end; ++it)
{
const CallExpr* call_expr = *it;
if (is_yield_call(call_expr))
{
return 0u;
}
result += get_call_complexity(call_expr);
}
return result;
}
} // namespace
// cfg_data implementation.
//======================================================================
/// \brief Structure used to hold additional data to analyzer CFG.
///
/// Such additional data are paths passing through block, their
/// complexities, whether block is yield and some temporary data for
/// handling loops.
class cfg_data
{
public:
/// \brief Additional data for single block.
struct block_data_type
{
/// \brief Additional data for paths with the same complexity.
struct path_data_type
{
std::vector<unsigned> ids;
unsigned complexity;
};
/// \brief Determines yield state of block.
enum class yield_state
{
no,
planned,
present
};
yield_state yield;
std::vector<path_data_type> paths;
std::unordered_map<unsigned, unsigned> loops;
};
typedef std::unordered_map<unsigned, block_data_type> data_type;
private:
typedef std::vector<std::pair<unsigned, block_data_type::yield_state> > yields_type;
static block_data_type::path_data_type make_path_data(unsigned id, unsigned complexity)
{
block_data_type::path_data_type result;
result.ids.push_back(id);
result.complexity = complexity;
return result;
}
public:
explicit cfg_data(const CFG& cfg)
: cfg_(cfg)
, data_()
{
cfg_data_builder builder(cfg);
data_ = builder.build();
}
bool optimize()
{
unsigned goodness = get_goodness(data_);
bool optimized = false;
for (;;)
{
auto result = optimize_step(data_);
if (!result.second)
{
break;
}
unsigned temp_goodness = get_goodness(result.first);
if (temp_goodness < goodness)
{
optimized = true;
goodness = temp_goodness;
data_.swap(result.first);
}
else
{
break;
}
}
return optimized;
}
/// \brief Return calculated data.
data_type get_data() const
{
return data_;
}
private:
BOBOPT_NONCOPYMOVABLE(cfg_data);
/// \brief Builder of additional CFG data from analyzer CFG.
///
/// Class uses context when building additional data and tries to
/// encapsulate this context into single class for being less
/// error-prone.
class cfg_data_builder
{
public:
explicit cfg_data_builder(const CFG& cfg)
: cfg_(cfg)
, data_()
, id_(0)
, yields_()
, path_stack_()
, loop_stack_()
{
}
data_type build(const yields_type& yields = yields_type())
{
yields_ = yields;
preprocess();
process(cfg_.getEntry(), next_id(), 0u);
postprocess();
#ifndef NDEBUG
debug_check();
#endif // NDEBUG
return data_;
}
private:
BOBOPT_NONCOPYMOVABLE(cfg_data_builder);
/// \brief Guard internal stacks. Class is responsible for push
/// and pop of elements using RAII.
template <typename T>
class stack_guard_type
{
public:
stack_guard_type(std::vector<T>& stack, T value)
: stack_(stack)
#ifndef NDEBUG
, value_(value)
#endif // NDEBUG
{
BOBOPT_ASSERT(std::find(std::begin(stack_), std::end(stack_), value) == std::end(stack_));
stack_.push_back(std::move(value));
}
~stack_guard_type()
{
BOBOPT_ASSERT(!stack_.empty() && (stack_.back() == value_));
stack_.pop_back();
}
private:
stack_guard_type();
BOBOPT_NONCOPYMOVABLE(stack_guard_type);
std::vector<T>& stack_;
#ifndef NDEBUG
unsigned value_;
#endif // NDEBUG
};
#ifndef NDEBUG
void debug_check() const
{
BOBOPT_ASSERT(path_stack_.empty());
BOBOPT_ASSERT(loop_stack_.empty());
for (const auto& block_pair : data_)
{
for (const auto& path_data : block_pair.second.paths)
{
BOBOPT_ASSERT(std::is_sorted(std::begin(path_data.ids), std::end(path_data.ids)));
BOBOPT_ASSERT(!path_data.ids.empty());
BOBOPT_ASSERT(path_data.ids.back() < id_);
BOBOPT_ASSERT(std::adjacent_find(std::begin(path_data.ids), std::end(path_data.ids)) == std::end(path_data.ids));
}
BOBOPT_ASSERT(block_pair.second.loops.empty());
}
}
#endif // NDEBUG
BOBOPT_INLINE unsigned next_id()
{
return id_++;
}
BOBOPT_INLINE block_data_type::yield_state get_block_yield(unsigned id) const
{
for (const auto& block : yields_)
{
if (block.first == id)
{
return block.second;
}
}
return block_data_type::yield_state::no;
}
BOBOPT_INLINE bool check_path_stack(unsigned id) const
{
const auto found = std::find(std::begin(path_stack_), std::end(path_stack_), id) != std::end(path_stack_);
return !found;
}
void preprocess()
{
data_.clear();
id_ = 0;
path_stack_.clear();
loop_stack_.clear();
}
void postprocess()
{
for (auto& block_pair : data_)
{
for (auto& path : block_pair.second.paths)
{
std::sort(std::begin(path.ids), std::end(path.ids));
}
block_pair.second.loops.clear();
}
}
std::vector<unsigned> process(const CFGBlock& block, unsigned path, unsigned complexity)
{
auto block_id = block.getBlockID();
// Check whether we are in loop.
if (!check_path_stack(block_id))
{
BOBOPT_ASSERT(!loop_stack_.empty());
data_[loop_stack_.back()].loops[path] = complexity;
return std::vector<unsigned>();
}
stack_guard_type<unsigned> guard(path_stack_, block_id);
BOBOPT_UNUSED_EXPRESSION(guard);
auto& block_data = data_[block_id];
block_data.yield = get_block_yield(block_id);
unsigned block_complexity = 0u;
if (block_data.yield == block_data_type::yield_state::no)
{
for (const CFGElement& element : block)
{
auto stmt_comlexity = get_element_complexity(element);
block_complexity += stmt_comlexity;
// There was call to Bobox yield() in element.
// I consider this blocks complexity equal to zero.
if (stmt_comlexity == 0u)
{
block_complexity = 0u;
block_data.yield = block_data_type::yield_state::present;
break;
}
}
}
if (block_data.yield != block_data_type::yield_state::no)
{
// Save ending path.
block_data.paths.push_back(make_path_data(path, complexity));
// Start new path and ignore returned paths.
process_succ(block, next_id(), 0u);
return std::vector<unsigned>();
}
// Continue path.
auto total_complexity = complexity + block_complexity;
auto input_path = make_path_data(path, total_complexity);
auto from_input_path = process_succ(block, path, total_complexity);
append(input_path.ids, from_input_path);
block_data.paths.push_back(std::move(input_path));
return from_input_path;
}
std::vector<unsigned> process_succ(const CFGBlock& block, unsigned path, unsigned complexity)
{
// Handle of branching traversal.
CFGTerminator terminator = block.getTerminator();
if (terminator)
{
const Stmt* stmt = terminator.getStmt();
BOBOPT_ASSERT(stmt != nullptr);
if (llvm::dyn_cast<BinaryOperator>(stmt) != nullptr)
{
auto begin = block.succ_begin();
auto end = block.succ_end();
if (begin != end)
{
++begin;
if (begin != end)
{
return process(**begin, path, complexity);
}
}
return std::vector<unsigned>();
}
if (llvm::dyn_cast<ForStmt>(stmt) != nullptr)
{
return process_succ_loop(block, path, complexity, config_multiplier_for.get());
}
if (llvm::dyn_cast<WhileStmt>(stmt) != nullptr)
{
return process_succ_loop(block, path, complexity, config_multiplier_while.get());
}
if (llvm::dyn_cast<DoStmt>(stmt) != nullptr)
{
return process_succ_loop(block, path, complexity, config_multiplier_while.get());
}
}
std::vector<unsigned> return_paths;
// Process all successing blocks.
// The first branch is deep branch where current path continues.
// For all other branches, there's new path created.
auto block_it = block.succ_begin();
if ((block_it != block.succ_end()) && (*block_it != nullptr))
{
append(return_paths, process(**block_it, path, complexity));
++block_it;
for (auto end = block.succ_end(); block_it != end; ++block_it)
{
if (*block_it == nullptr)
{
continue;
}
auto id = next_id();
return_paths.push_back(id);
append(return_paths, process(**block_it, id, complexity));
}
}
return return_paths;
}
std::vector<unsigned> process_succ_loop(const CFGBlock& block, unsigned path, unsigned complexity, unsigned multiplier)
{
auto it = block.succ_begin();
BOBOPT_ASSERT(it != block.succ_end());
BOBOPT_ASSERT(*it != nullptr);
const CFGBlock& body = **it;
++it;
BOBOPT_ASSERT(it != block.succ_end());
BOBOPT_ASSERT(*it != nullptr);
const CFGBlock& skip = **it;
++it;
BOBOPT_ASSERT(it == block.succ_end());
// Process body with new path using zero complexity.
// Complexity value will be multiplied further in evaluation.
auto& block_data = data_[block.getBlockID()];
if (block_data.loops.empty())
{
stack_guard_type<unsigned> guard(loop_stack_, block.getBlockID());
BOBOPT_UNUSED_EXPRESSION(guard);
process(body, path, 0u);
}
std::vector<unsigned> return_paths;
for (auto body_path : block_data.loops)
{
body_path.second *= multiplier;
body_path.second += complexity;
if (body_path.first != path)
{
return_paths.push_back(body_path.first);
}
append(return_paths, process(skip, body_path.first, body_path.second));
}
// Process input path as the one that skipped loop body.
block_data.loops.clear();
return return_paths;
}
const CFG& cfg_;
data_type data_;
unsigned id_;
yields_type yields_;
std::vector<unsigned> path_stack_;
std::vector<unsigned> loop_stack_;
}; // cfg_data_builder
std::pair<data_type, bool> optimize_step(const data_type& src_data)
{
yields_type yields;
// Find all blocks where paths end, i.e., exit and yield blocks.
std::vector<const block_data_type*> end_blocks;
for (const auto& block : src_data)
{
if (block.second.yield != block_data_type::yield_state::no)
{
end_blocks.push_back(&(block.second));
yields.emplace_back(block.first, block.second.yield);
}
}
auto exit_block_it = src_data.find(cfg_.getExit().getBlockID());
BOBOPT_ASSERT(exit_block_it != std::end(src_data));
end_blocks.push_back(&(exit_block_it->second));
// Iterate through all blocks and calculate what we can achieve
// by placing yield inside block.
unsigned goodness = std::numeric_limits<unsigned>::max();
unsigned block_id = 0u;
bool optimized = false;
for (const auto& block : src_data)
{
if (block.second.yield != block_data_type::yield_state::no)
{
continue;
}
if (block.first == cfg_.getExit().getBlockID())
{
continue;
}
auto result = optimize_block(block.second, end_blocks);
if (result.second && (result.first < goodness))
{
block_id = block.first;
goodness = result.first;
optimized = true;
}
}
// If there is block worth optimizing, insert yield into
// destination data structure and recalculate cfg.
if (optimized)
{
yields.emplace_back(block_id, block_data_type::yield_state::planned);
cfg_data_builder builder(cfg_);
return std::make_pair(builder.build(yields), true);
}
return std::make_pair(data_type(), false);
}
static std::vector<block_data_type::path_data_type>::const_iterator find_path(unsigned id, const block_data_type& block)
{
return std::find_if(std::begin(block.paths),
std::end(block.paths),
[id](const block_data_type::path_data_type& path)
{ return std::find(std::begin(path.ids), std::end(path.ids), id) != std::end(path.ids); });
}
std::pair<unsigned, bool> optimize_block(const block_data_type& block, const std::vector<const block_data_type*>& end_blocks)
{
unsigned distance = 0u;
unsigned count = 0u;
// Check whether block is worth optimizing.
bool over_threshold = false;
for (const auto& path : block.paths)
{
unsigned ids_size = static_cast<unsigned>(path.ids.size());
count += ids_size;
if (path.complexity > config_threshold.get())
{
over_threshold = true;
}
distance += ids_size * value_distance(config_threshold.get(), path.complexity);
}
if (!over_threshold)
{
return std::make_pair(0u, false);
}
// Evaluate blocks at the end of paths.
for (const auto* end_block : end_blocks)
{
for (const auto& path : end_block->paths)
{
const auto path_distance = value_distance(config_threshold.get(), path.complexity);
for (auto id : path.ids)
{
++count;
const auto found_it = find_path(id, block);
if (found_it == std::end(block.paths))
{
distance += path_distance;
continue;
}
auto new_complexity = path.complexity - found_it->complexity;
distance += value_distance(config_threshold.get(), new_complexity);
}
}
}
return std::make_pair(distance, true);
}
unsigned get_goodness(const data_type& data) const
{
auto exit_it = data.find(cfg_.getExit().getBlockID());
BOBOPT_ASSERT(exit_it != std::end(data));
BOBOPT_ASSERT(exit_it->second.yield != block_data_type::yield_state::planned);
unsigned distance = 0u;
unsigned count = 0u;
// Paths ending in Exit block.
for (const auto& path : exit_it->second.paths)
{
const auto ids_count = static_cast<unsigned>(path.ids.size());
count += ids_count;
distance += ids_count * value_distance(config_threshold.get(), path.complexity);
}
// Paths ending in yielded blocks.
for (const auto& block : data)
{
if (block.second.yield != block_data_type::yield_state::no)
{
for (const auto& path : block.second.paths)
{
const auto ids_count = static_cast<unsigned>(path.ids.size());
count += ids_count;
distance += ids_count * value_distance(config_threshold.get(), path.complexity);
}
}
}
return distance;
}
const CFG& cfg_;
data_type data_;
};
// yield_complex implementation.
//==============================================================================
// constants:
const yield_complex::method_override yield_complex::BOX_EXEC_METHOD_OVERRIDES[] = { { { "sync_mach_etwas" }, { "bobox::basic_box" } },
{ { "async_mach_etwas" }, { "bobox::basic_box" } },
{ { "body_mach_etwas" }, { "bobox::basic_box" } },
{ { "push_envelope_impl" }, { "bobox::box" } },
{ { "sync_body" }, { "bobox::basic_box" } } };
/// \brief Create default constructed unusable object.
yield_complex::yield_complex()
: box_(nullptr)
, replacements_(nullptr)
{
}
/// \brief Deletable through pointer to base.
yield_complex::~yield_complex()
{
}
/// \brief Inherited optimization member function.
/// It just checks and stores optmization parameters and forwards job to dedicated member function.
void yield_complex::optimize(CXXRecordDecl* box, tooling::Replacements* replacements)
{
BOBOPT_ASSERT(box != nullptr);
BOBOPT_ASSERT(replacements != nullptr);
box_ = box;
replacements_ = replacements;
optimize_methods();
}
/// \brief Main optimization pass.
/// Function iterates through box methods and if it matches method in array it calls dedicated function to
/// optimize single method.
void yield_complex::optimize_methods()
{
BOBOPT_ASSERT(box_ != nullptr);
for (auto method_it = box_->method_begin(); method_it != box_->method_end(); ++method_it)
{
CXXMethodDecl* method = *method_it;
for (const auto& exec_method : BOX_EXEC_METHOD_OVERRIDES)
{
if ((method->getNameAsString() == exec_method.method_name) && overrides(method, exec_method.parent_name))
{
optimize_method(method);
}
}
}
}
/// \brief Main optimization pass for single method.
void yield_complex::optimize_method(CXXMethodDecl* method)
{
BOBOPT_ASSERT(method != nullptr);
if (!method->hasBody())
{
return;
}
CompoundStmt* body = llvm::dyn_cast_or_null<CompoundStmt>(method->getBody());
if (body == nullptr)
{
return;
}
CFG::BuildOptions options;
std::unique_ptr<CFG> cfg(CFG::buildCFG(method, body, &method->getASTContext(), options));
if (cfg == nullptr)
{
llvm::errs() << "[ERROR] Failed to build CFG from function body.\n";
return;
}
optimize_body(method, body, *cfg);
}
typedef std::unordered_map<unsigned, const CFGBlock*> id_block_map;
/// \brief Build map from block ids to pointers to blocks.
static id_block_map build_block_map(const CFG& cfg)
{
id_block_map result;
std::vector<const CFGBlock*> proceed;
proceed.reserve(cfg.size());
proceed.push_back(&cfg.getEntry());
while (!proceed.empty())
{
const CFGBlock* block = proceed.back();
proceed.pop_back();
BOBOPT_ASSERT(result.count(block->getBlockID()) == 0);
result[block->getBlockID()] = block;
for (auto it = block->succ_begin(), end = block->succ_end(); it != end; ++it)
{
const CFGBlock* succ = *it;
if ((succ != nullptr) && (result.count(succ->getBlockID()) == 0))
{
proceed.push_back(succ);
}
}
}
return result;
}
/// \brief Emit box optimization header.
static void emit_header(CXXRecordDecl* decl)
{
llvm::raw_ostream& out = llvm::outs();
out.changeColor(llvm::raw_ostream::WHITE, true);
out << "[yield complex]";
out.resetColor();
out << " optimization of box ";
out.changeColor(llvm::raw_ostream::MAGENTA, true);
out << decl->getNameAsString();
out.resetColor();
out << "\n\n";
}
/// \brief Optimize member function body represented by CFG.
void yield_complex::optimize_body(CXXMethodDecl* method, CompoundStmt* body, const CFG& cfg)
{
if (config_yield_predefined.get() && yield_predefined(cfg, body))
{
return;
}
cfg_data data(cfg);
if (!data.optimize())
{
return;
}
auto optimized_data = data.get_data();
auto map = build_block_map(cfg);
std::vector<unsigned> ids;
for (const auto& block : optimized_data)
{
if (block.second.yield == cfg_data::block_data_type::yield_state::planned)
{
ids.push_back(block.first);
}
}
nodes_collector<CompoundStmt> compound_collector;
compound_collector.TraverseStmt(body);
std::vector<const CompoundStmt*> stmts(compound_collector.nodes_begin(), compound_collector.nodes_end());
endl_ = detect_line_end(get_optimizer().get_compiler().getSourceManager(), box_);
if (get_optimizer().verbose())
{
emit_header(box_);
auto& diag = get_optimizer().get_diagnostic();
diag.emit(diag.get_message_decl(diagnostic_message::types::info, method, "method takes too long time on some paths:"));
}
// Insert yields.
for (auto id : ids)
{
BOBOPT_ASSERT(map.count(id) == 1);
const CFGBlock& block = *(map.find(id)->second);
BOBOPT_CHECK(inserter(block, stmts));
}
}
namespace
{
struct predefined_callback : public MatchFinder::MatchCallback
{
predefined_callback()
: yield(false)
, statements()
{
}
virtual void run(const MatchFinder::MatchResult& result)
{
if (result.Nodes.getNodeAs<Stmt>("yield") != nullptr)
{
yield = true;
return;
}
const Stmt* predefined = result.Nodes.getNodeAs<Stmt>("predefined");
if (predefined == nullptr)
{
return;
}
if (!yield)
{
statements.push_back(predefined);
}
yield = false;
}
bool yield;
std::vector<const Stmt*> statements;
};
class cfg_match_finder
{
public:
cfg_match_finder(MatchFinder& finder, predefined_callback& callback, ASTContext& context)
: finder_(finder)
, callback_(callback)
, context_(context)
{
}
void process(const CFGBlock& block)
{
stack_.push_back(block.getBlockID());
auto count = callback_.statements.size();
for (auto it = block.begin(), end = block.end(); it != end; ++it)
{
const CFGElement& elem = *it;
if (elem.getKind() != CFGElement::Statement)
{
continue;
}
const Stmt* stmt = elem.castAs<CFGStmt>().getStmt();
if (stmt == nullptr)
{
continue;
}
finder_.match(*stmt, context_);
if (callback_.statements.size() == count + 1)
{
break;
}
}
process_succ(block);
stack_.pop_back();
}
private:
BOBOPT_NONCOPYMOVABLE(cfg_match_finder);
void process_succ(const CFGBlock& block)
{
bool yield = callback_.yield;
for (auto it = block.succ_begin(), end = block.succ_end(); it != end; ++it)
{
if (*it == nullptr)
{
continue;
}
const CFGBlock& block = **it;
if (std::find(std::begin(stack_), std::end(stack_), block.getBlockID()) == std::end(stack_))
{
callback_.yield = yield;
process(block);
}
}
}
MatchFinder& finder_;
predefined_callback& callback_;
ASTContext& context_;
std::vector<unsigned> stack_;
};
}
bool yield_complex::yield_predefined(const CFG& cfg, CompoundStmt* body)
{
// yield call expr
static const auto box_yield = memberCallExpr(
callee(functionDecl(hasName("yield"))),
argumentCountIs(0)
).bind("yield");
// member call expr on envelope
static const auto on_envelope = anyOf(
on(hasType(recordDecl(hasName("envelope")))),
on(hasType(pointsTo(recordDecl(hasName("envelope")))))
);
// const column &envelope::get_column(column_index_type idx) const;
static const auto envelope_get_column = memberCallExpr(
on_envelope,
callee(functionDecl(hasName("get_column"))),
argumentCountIs(1)
).bind("predefined");
// const columns_type &envelope::get_columns() const;
static const auto envelope_get_columns = memberCallExpr(
on_envelope,
callee(functionDecl(hasName("get_columns"))),
argumentCountIs(0)
).bind("predefined");
// void **envelope::get_columns_raw_data() const
static const auto envelope_get_columns_raw_data = memberCallExpr(
on_envelope,
callee(functionDecl(hasName("get_columns_raw_data"))),
argumentCountIs(0)
).bind("predefined");
// template <typename T> T **envelope::get_columns_data() const
static const auto envelope_get_columns_data = memberCallExpr(
on_envelope,
callee(functionDecl(hasName("get_columns_data"))),
argumentCountIs(0)
).bind("predefined");
//void *envelope::get_raw_data(column_index_type index) const
static const auto envelope_get_raw_data = memberCallExpr(
on_envelope,
callee(functionDecl(hasName("get_raw_data"))),
argumentCountIs(1)
).bind("predefined");
// template <typename T> T *envelope::get_data(column_index_type index) const
static const auto envelope_get_data = memberCallExpr(
on_envelope,
callee(functionDecl(hasName("get_data"))),
argumentCountIs(1)
).bind("predefined");
MatchFinder finder;
predefined_callback callback;
finder.addMatcher(box_yield, &callback);
finder.addMatcher(envelope_get_column, &callback);
finder.addMatcher(envelope_get_columns, &callback);
finder.addMatcher(envelope_get_columns_raw_data, &callback);
finder.addMatcher(envelope_get_columns_data, &callback);
finder.addMatcher(envelope_get_raw_data, &callback);
finder.addMatcher(envelope_get_data, &callback);
cfg_match_finder cfg_finder(finder, callback, get_optimizer().get_compiler().getASTContext());
cfg_finder.process(cfg.getEntry());
if (callback.statements.empty())
{
return false;
}
// make_unique
std::sort(std::begin(callback.statements), std::end(callback.statements));
auto newEnd = std::unique(std::begin(callback.statements), std::end(callback.statements));
callback.statements.erase(newEnd, std::end(callback.statements));
endl_ = detect_line_end(get_optimizer().get_compiler().getSourceManager(), box_);
nodes_collector<CompoundStmt> collector;
collector.TraverseStmt(body);
bool inserted = false;
for (auto* stmt : callback.statements)
{
for (auto it = collector.nodes_begin(), end = collector.nodes_end(); it != end; ++it)
{
if (inserter(stmt, *it))
{
inserted = true;
break;
}
}
}
return inserted;
}
namespace
{
/// \brief Helper for looking up statement in AST subtree.
class recursive_stmt_find_helper : public RecursiveASTVisitor<recursive_stmt_find_helper>
{
public:
recursive_stmt_find_helper(const Stmt* stmt)
: stmt_(stmt)
{
}
bool VisitStmt(Stmt* stmt)
{
return !(stmt_ == stmt);
}
private:
const Stmt* stmt_;
};
} // namespace
/// \brief Final phase for inserting \c yield() call to source code.
void yield_complex::inserter_invoke(Stmt* stmt, SourceLocation location) const
{
auto& sm = get_optimizer().get_compiler().getSourceManager();
location = sm.getExpansionLoc(location);
bool update_code = false;
if (get_optimizer().verbose())
{
auto& diag = get_optimizer().get_diagnostic();
diag.emit(diag.get_message_stmt(diagnostic_message::types::suggestion, stmt, "placing yield() call just before statement:"));
if (get_optimizer().get_mode() == MODE_INTERACTIVE)
{
if (ask_yesno("Do you want to place yield() call to code?"))
{
update_code = true;
}
llvm::outs() << "\n\n";
}
}
if (update_code || (get_optimizer().get_mode() == MODE_BUILD))
{
std::string yield_code = "yield();" + endl_ + location_indent(sm, location);
replacements_->insert(Replacement(sm, location, 0, yield_code));
}
}
/// \brief Helper to analyze subtree of single statement in compound statement.
bool yield_complex::inserter_helper(Stmt* dst_stmt, const Stmt* src_stmt) const
{
recursive_stmt_find_helper helper(src_stmt);
IfStmt* if_stmt = llvm::dyn_cast<IfStmt>(dst_stmt);
if (if_stmt != nullptr)
{
if (!helper.TraverseStmt(if_stmt->getCond()))
{
inserter_invoke(if_stmt, if_stmt->getLocStart());
return true;
}
return false;
}
ForStmt* for_stmt = llvm::dyn_cast<ForStmt>(dst_stmt);
if (for_stmt != nullptr)
{
if (!helper.TraverseStmt(for_stmt->getInit()))
{
inserter_invoke(for_stmt, for_stmt->getLocStart());
return true;
}
recursive_stmt_find_helper helper1(src_stmt);
if (!helper1.TraverseStmt(for_stmt->getInc()))
{
const CompoundStmt* body = llvm::dyn_cast_or_null<const CompoundStmt>(for_stmt->getBody());
inserter_invoke(for_stmt->getInc(), body->getRBracLoc());
return true;
}
recursive_stmt_find_helper helper2(src_stmt);
if (!helper1.TraverseStmt(for_stmt->getCond()))
{
inserter_invoke(for_stmt->getCond(), for_stmt->getLocStart());
return true;
}
return false;
}
WhileStmt* while_stmt = llvm::dyn_cast<WhileStmt>(dst_stmt);
if (while_stmt != nullptr)
{
if (!helper.TraverseStmt(while_stmt->getCond()))
{
inserter_invoke(while_stmt, while_stmt->getLocStart());
return true;
}
return false;
}
SwitchStmt* switch_stmt = llvm::dyn_cast<SwitchStmt>(dst_stmt);
if (switch_stmt != nullptr)
{
if (!helper.TraverseStmt(switch_stmt->getCond()))
{
inserter_invoke(switch_stmt, switch_stmt->getLocStart());
return true;
}
return false;
}
CompoundStmt* compound_stmt = llvm::dyn_cast<CompoundStmt>(dst_stmt);
if (compound_stmt != nullptr)
{
return false;
}
if (!helper.TraverseStmt(dst_stmt))
{
inserter_invoke(dst_stmt, dst_stmt->getLocStart());
return true;
}
return false;
}
/// \brief Helper for insert yield for block into compound statement.
bool yield_complex::inserter(const Stmt* stmt, const CompoundStmt* compound_stmt) const
{
for (auto it = compound_stmt->body_begin(), end = compound_stmt->body_end(); it != end; ++it)
{
if (inserter_helper(*it, stmt))
{
return true;
}
}
return false;
}
/// \brief Helper for insert of block yield into single compound statement from set of compound statements.
bool yield_complex::inserter(const CFGBlock& block, const std::vector<const CompoundStmt*>& stmts) const
{
if (block.empty())
{
return false;
}
const Stmt* block_stmt = nullptr;
for (auto it = block.begin(), end = block.end(); it != end; ++it)
{
if (it->getKind() == CFGElement::Kind::Statement)
{
block_stmt = it->castAs<CFGStmt>().getStmt();
break;
}
}
if (block_stmt == nullptr)
{
return false;
}
for (const auto* stmt : stmts)
{
if (inserter(block_stmt, stmt))
{
return true;
}
}
return false;
}
} // namespace
basic_method* create_yield_complex()
{
return new methods::yield_complex;
}
} // namespace
| [
"menjek@gmail.com"
] | menjek@gmail.com |
9bcc28034be6c38950ec868a137393505debe32a | 6d0afaa1073f63ab83ac9f8e55c03c910b31b7e9 | /include/main.h | 90a29236436ffef75cd28e23b2024970074a8bdd | [] | no_license | Dzemail/kviz_za_informatiku_9razred | 043fc5211bf09323018d7fac60d1cb578ff40b66 | 701d8a8a42ec2b0cd79c4d5022f396fe142702ec | refs/heads/master | 2023-03-27T00:10:45.517853 | 2021-03-21T13:29:48 | 2021-03-21T13:29:48 | 350,003,737 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 89 | h | #include <wx/wx.h>
class myapp : public wxApp{
public:
virtual bool OnInit();
}; | [
"Dzemaiil@outlook.com"
] | Dzemaiil@outlook.com |
9c21542dc3cf37fd2aa8596d158bb91312d09147 | a6bb89b2ff6c1fc8c45a4f105ef528416100a360 | /contrib/framewave_1.3.1_src/SampleConvert/SRC/process_flowpass.cpp | cf39d86f351b8fd50c254419c37b5086fbbb3ecf | [
"Apache-2.0"
] | permissive | dudochkin-victor/ngxe | 2c03717c45431b5a88a7ca4f3a70a2f23695cd63 | 34687494bcbb4a9ce8cf0a7327a7296bfa95e68a | refs/heads/master | 2016-09-06T02:28:20.233312 | 2013-01-05T19:59:28 | 2013-01-05T19:59:28 | 7,311,793 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,727 | cpp | /*
Copyright (c) 2006-2009 Advanced Micro Devices, Inc. All Rights Reserved.
This software is subject to the Apache v2.0 License.
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#include"globals.h"
#include"process_API.h"
/*!
*************************************************************************************
* \function process_flowpass
*
* \brief
* This function processes Lowpass Filter operation.
*
*
*************************************************************************************
*/
void
process_flowpass(st_API_parameters *p)
{
int api_return_val = 0;
TIME_START /* Start Timer */
/*--------------------------------------------------------------------------------*/
/* Calling API "fwiFilterLowpass_8u_C3R" : */
/* */
/* This function steps through an ROI in a source buffer, */
/* applies a low-pass operator to the source data, */
/* and writes the filtered data to a destination buffer. */
/* The function uses a 3X3 kernel. */
/* */
/* */
/*--------------------------------------------------------------------------------*/
#ifndef SOL
api_return_val = fwiFilterLowpass_8u_C3R(p->pSrc , p->srcStep, &p->pDst[(p->bor_width * 3) + 3] , p->dstStep, p->dstRoiSize, p->maskSize_filter);
#endif
TIME_FINISH(p) /* Stop Timer */
if (api_return_val<0)
throw api_return_val ;
}
| [
"dudochkin.victor@gmail.com"
] | dudochkin.victor@gmail.com |
d07546f5f802e36748b8b394766141b05ac9748a | 1560fd37c2abd1c4d04f8d44159d40c160aabc99 | /improved_training/NNtraining.cpp | 57a2753ff9c996277ed4e12dc9892c58b846c5eb | [] | no_license | cassid1/personalwebsite | d282ad2469cec1a4ce136280107d0a9edf4a24c8 | de0a1d6b89da3714986316aa0bba2a3032ca7ede | refs/heads/master | 2022-12-14T09:28:21.783991 | 2020-09-10T01:51:23 | 2020-09-10T01:51:23 | 275,948,827 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,194 | cpp |
#include"connect4.h"
int main(){
srand(time(NULL));
//bool compGoesFirst = false;
// other dim {7*6*3,100,75,50, 7};
const vector<int> dimensions = {7*6*2,200,100, 7};
GameBoard a;
//a.playUserGame(compGoesFirst);
int totalBlackWins = 0;
int totalRedWins = 0;
int totalVertWins = 0;
int totalDiagWins = 0;
int totalHorizWins = 0;
int totalChoices = 0;
int totalMoves = 0;
for(int i=0; i<200; i++){
a.playCPUGame();
totalBlackWins += a.getBlackWins();
totalRedWins += a.getRedWins();
totalDiagWins += a.getDiagonalWins();
totalVertWins += a.getVerticalWins();
totalHorizWins += a.getHorizontalWins();
totalChoices += a.getNumChoices();
totalMoves += a.getMoveNumber();
}
cout<<"Black (O) Wins: "<<totalBlackWins<<endl;
cout<<"Red (X) Wins: "<<totalRedWins<<"\n"<<endl;
cout<<"Vertical Wins: "<<totalVertWins<<endl;
cout<<"Horizontal Wins: "<<totalHorizWins<<endl;
cout<<"Diagonal Wins: "<<totalDiagWins<<"\n"<<endl;
cout<<"Total Selections: "<<totalChoices<<endl;
cout<<"Total Moves: "<<totalMoves<<endl;
return 1;
}
| [
"cassid1@stolaf.edu"
] | cassid1@stolaf.edu |
8fa3c6b72d6afed9441898d577b9304c6c2c7b9f | 80be8105d8b5887b864435807e52fbf0a639ca27 | /c++/problem59/problem59/problem59.cpp | d4b6ea685e3b472f9b4b9c4ecea03ae17438ab27 | [] | no_license | koutali/project_euler | 5a25f25a45e5a65f5bacc2563508781ad41f3563 | d16065440113c6c3be7625147931af8ab63d2436 | refs/heads/master | 2021-01-19T08:14:07.859844 | 2015-04-14T07:25:39 | 2015-04-14T07:25:39 | 33,916,693 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,409 | cpp | // problem59.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
char GetAscii(const int val)
{
return ((val % 26) + 97);
}
int _tmain(int argc, _TCHAR* argv[])
{
std::ifstream file("cipher1.txt", std::ios::in);
if (!file)
{
std::cout << "Failed to open file. Exiting application" << std::endl;
return -1;
}
std::istream_iterator<int> start(file), end;
std::vector<int> numbers(start, end);
int first = 103;
int second = 111;
int third = 100;
std::string result;
for (size_t i = 0; i < numbers.size() - 3; i += 3)
{
char firstC = char(numbers.at(i) ^ first);
result += firstC;
char secondC = char(numbers.at(i + 1) ^ second);
result += secondC;
char thirdC = char(numbers.at(i + 2) ^ third);
result += thirdC;
}
int sumOfChars = 0;
for (size_t i = 0; i < result.size(); ++i)
{
sumOfChars += (int)result.at(i);
}
std::ofstream outfile("out.txt", std::ios::out);
if (!outfile)
{
std::cout << "Could not create the output file. Will write to stdout" << std::endl;
std::cout << result << std::endl;
std::cout << "Sum of characters in the text: " << sumOfChars << std::endl;
}
else
{
std::cout << "Writing results to file..." << std::endl;
outfile << result << std::endl;
std::cout << "Sum of characters in the text: " << sumOfChars << std::endl;
std::cout << "Done!" << std::endl;
outfile.close();
}
return 0;
}
| [
"senembeken@gmail.com"
] | senembeken@gmail.com |
cec1c9054a0253c8513786ae91f62d91ede19116 | 46b1fa8fe679dec71c66ec4587d3048bcbdc23e3 | /include/xflens/cxxlapack/interface/ggbal.tcc | ee57b48f2e7c80262114497bdaaaca5ba3eaeeb8 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | potpath/xtensor-blas | dccfcc10a184806778e21a538ec2f083bc76bfad | 5d2cb7d4d2162a4e0c0c787ef88299663c9ef71a | refs/heads/master | 2020-04-07T00:50:09.897253 | 2018-11-16T16:39:39 | 2018-11-16T16:39:39 | 157,920,622 | 1 | 0 | BSD-3-Clause | 2018-11-16T20:59:32 | 2018-11-16T20:59:32 | null | UTF-8 | C++ | false | false | 5,944 | tcc | /*
* Copyright (c) 2012, Michael Lehn, Klaus Pototzky
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2) Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3) Neither the name of the FLENS development group nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CXXLAPACK_INTERFACE_GGBAL_TCC
#define CXXLAPACK_INTERFACE_GGBAL_TCC 1
#include <iostream>
#include "xflens/cxxlapack/interface/interface.h"
#include "xflens/cxxlapack/netlib/netlib.h"
namespace cxxlapack {
template <typename IndexType>
IndexType
ggbal(char job,
IndexType n,
float *A,
IndexType ldA,
float *B,
IndexType ldB,
IndexType ilo,
IndexType ihi,
float *lscale,
float *rscale,
float *work)
{
CXXLAPACK_DEBUG_OUT("sggbal");
IndexType info;
LAPACK_IMPL(sggbal)(&job,
&n,
A,
&ldA,
B,
&ldB,
&ilo,
&ihi,
lscale,
rscale,
work,
&info);
# ifndef NDEBUG
if (info<0) {
std::cerr << "info = " << info << std::endl;
}
# endif
ASSERT(info>=0);
return info;
}
template <typename IndexType>
IndexType
ggbal(char job,
IndexType n,
double *A,
IndexType ldA,
double *B,
IndexType ldB,
IndexType ilo,
IndexType ihi,
double *lscale,
double *rscale,
double *work)
{
CXXLAPACK_DEBUG_OUT("dggbal");
IndexType info;
LAPACK_IMPL(dggbal)(&job,
&n,
A,
&ldA,
B,
&ldB,
&ilo,
&ihi,
lscale,
rscale,
work,
&info);
# ifndef NDEBUG
if (info<0) {
std::cerr << "info = " << info << std::endl;
}
# endif
ASSERT(info>=0);
return info;
}
template <typename IndexType>
IndexType
ggbal(char job,
IndexType n,
std::complex<float > *A,
IndexType ldA,
std::complex<float > *B,
IndexType ldB,
IndexType ilo,
IndexType ihi,
float *lscale,
float *rscale,
double *work)
{
CXXLAPACK_DEBUG_OUT("cggbal");
IndexType info;
LAPACK_IMPL(cggbal)(&job,
&n,
reinterpret_cast<float *>(A),
&ldA,
reinterpret_cast<float *>(B),
&ldB,
&ilo,
&ihi,
lscale,
rscale,
work,
&info);
# ifndef NDEBUG
if (info<0) {
std::cerr << "info = " << info << std::endl;
}
# endif
ASSERT(info>=0);
return info;
}
template <typename IndexType>
IndexType
ggbal(char job,
IndexType n,
std::complex<double> *A,
IndexType ldA,
std::complex<double> *B,
IndexType ldB,
IndexType ilo,
IndexType ihi,
double *lscale,
double *rscale,
double *work)
{
CXXLAPACK_DEBUG_OUT("zggbal");
IndexType info;
LAPACK_IMPL(zggbal)(&job,
&n,
reinterpret_cast<double *>(A),
&ldA,
reinterpret_cast<double *>(B),
&ldB,
&ilo,
&ihi,
lscale,
rscale,
work,
&info);
# ifndef NDEBUG
if (info<0) {
std::cerr << "info = " << info << std::endl;
}
# endif
ASSERT(info>=0);
return info;
}
} // namespace cxxlapack
#endif // CXXLAPACK_INTERFACE_GGBAL_TCC
| [
"w.vollprecht@gmail.com"
] | w.vollprecht@gmail.com |
44576955d54255a4bb974ee0575aa5854c42d16a | 0186865ee06ed397dd9f5470efb4785c206c9e1a | /JCTerminal/source/Texture/Texture.h | 413805dc17ab12352c3cc7ad988a3b4d9f4d861b | [] | no_license | JonathanCline/JCTerminal | e2d412d6309edb1cf469c2802a2c2d65a8a318e6 | 1ca0e4e730f95235bd8da0fb090a04697a5f68e8 | refs/heads/main | 2023-03-25T00:38:45.679254 | 2021-03-01T22:14:31 | 2021-03-01T22:14:31 | 342,132,332 | 0 | 0 | null | 2021-03-01T22:14:31 | 2021-02-25T05:22:49 | C++ | UTF-8 | C++ | false | false | 1,646 | h | #pragma once
#include "Impl/Texture.h"
#include <SAELib_PunWrapper.h>
#include <array>
#include <cstdint>
namespace jct
{
namespace tx
{
namespace impl
{
struct TexelDef
{
union
{
struct
{
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
};
std::array<uint8_t, 4> arr{ 255, 255, 255, 255 };
};
constexpr TexelDef() noexcept = default;
constexpr TexelDef(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a) noexcept :
arr{ _r, _g, _b, _a }
{};
};
};
template <>
struct Texel<TEXTURE_ENCODING_E::RGBA_8> : public sae::PunWrapper<impl::TexelDef, &impl::TexelDef::arr>
{
using sae::PunWrapper<impl::TexelDef, &impl::TexelDef::arr>::PunWrapper;
};
};
// RGBA Texel value
using Texel = tx::Texel<tx::TEXTURE_ENCODING_E::RGBA_8>;
// RGBA Texture
using Texture = tx::Texture<tx::TEXTURE_ENCODING_E::RGBA_8>;
namespace tx
{
namespace impl
{
struct MaskTexelDef
{
union
{
struct
{
uint8_t a;
};
std::array<uint8_t, 1> arr{ 255 };
};
constexpr MaskTexelDef() noexcept = default;
constexpr MaskTexelDef(uint8_t _a) noexcept :
arr{ _a }
{};
};
};
template <>
struct Texel<TEXTURE_ENCODING_E::R_8> : public sae::PunWrapper<impl::MaskTexelDef, &impl::MaskTexelDef::arr>
{
using sae::PunWrapper<impl::MaskTexelDef, &impl::MaskTexelDef::arr>::PunWrapper;
};
};
// Single alpha value for use in masking textures
using MaskTexel = tx::Texel<tx::TEXTURE_ENCODING_E::R_8>;
// Alpha mask texture
using MaskTexture = tx::Texture<tx::TEXTURE_ENCODING_E::R_8>;
};
| [
"59320680+JonathanCline@users.noreply.github.com"
] | 59320680+JonathanCline@users.noreply.github.com |
54c07e607aa5d2a6c701d115da268b2b584554af | af76ebfa7fff99eb831338c9698a571ce718d2d4 | /nSkinz/item_definitions.hpp | 8cdf9d4ea153cf2a4b3e6617904f28681ec2cf3c | [
"Unlicense"
] | permissive | testcc2c/hvh-cheat | b7e7b9c902d173ad21ece324eb849f9b07e639cd | 89c7f394e5e3418bc795c0a1fae097c443c4c748 | refs/heads/main | 2023-01-31T06:59:46.703401 | 2020-12-02T17:10:25 | 2020-12-02T17:10:25 | 350,192,748 | 4 | 1 | Unlicense | 2021-03-22T03:20:20 | 2021-03-22T03:20:19 | null | UTF-8 | C++ | false | false | 5,434 | hpp | /* This file is part of nSkinz by namazso, licensed under the MIT license:
*
* MIT License
*
* Copyright (c) namazso 2018
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#pragma once
#include <map>
#include <vector>
#include "../sdk/misc/Enums.hpp"
static auto is_knife(const int i) -> bool
{
return (i >= WEAPON_KNIFE_BAYONET && i < GLOVE_STUDDED_BLOODHOUND) || i == WEAPON_KNIFE_T || i == WEAPON_KNIFE;
}
//extern const std::map<size_t, weapon_info> k_weapon_info;
namespace game_data
{
// Stupid MSVC requires separate constexpr constructors for any initialization
struct weapon_info
{
constexpr weapon_info(const char* model, const char* icon = nullptr) :
model(model),
icon(icon)
{}
const char* model;
const char* icon;
};
struct weapon_name
{
constexpr weapon_name(const int definition_index, const char* name) :
definition_index(definition_index),
name(name)
{}
int definition_index = 0;
const char* name = nullptr;
};
struct quality_name
{
constexpr quality_name(const int index, const char* name) :
index(index),
name(name)
{}
int index = 0;
const char* name = nullptr;
};
const weapon_info* get_weapon_info(int defindex);
constexpr weapon_name knife_names[]{
{0, "Default"},
{WEAPON_KNIFE_BAYONET, "Bayonet"},
{WEAPON_KNIFE_CSS, "Classic Knife"},
{WEAPON_KNIFE_SKELETON, "Skeleton Knife"},
{WEAPON_KNIFE_OUTDOOR, "Nomad Knife"},
{WEAPON_KNIFE_CORD, "Paracord Knife"},
{WEAPON_KNIFE_CANIS, "Survival Knife"},
{WEAPON_KNIFE_FLIP, "Flip Knife"},
{WEAPON_KNIFE_GUT, "Gut Knife"},
{WEAPON_KNIFE_KARAMBIT, "Karambit"},
{WEAPON_KNIFE_M9_BAYONET, "M9 Bayonet"},
{WEAPON_KNIFE_TACTICAL, "Huntsman Knife"},
{WEAPON_KNIFE_FALCHION, "Falchion Knife"},
{WEAPON_KNIFE_SURVIVAL_BOWIE, "Bowie Knife"},
{WEAPON_KNIFE_BUTTERFLY, "Butterfly Knife"},
{WEAPON_KNIFE_PUSH, "Shadow Daggers"},
{WEAPON_KNIFE_URSUS, "Ursus Knife"},
{WEAPON_KNIFE_GYPSY_JACKKNIFE, "Navaja Knife"},
{WEAPON_KNIFE_STILETTO, "Stiletto Knife"},
{WEAPON_KNIFE_WIDOWMAKER, "Talon Knife"}
};
constexpr weapon_name glove_names[]{
{0, "Default"},
{GLOVE_STUDDED_BLOODHOUND, "Bloodhound"},
{GLOVE_T_SIDE, "Default (Terrorists)"},
{GLOVE_CT_SIDE, "Default (Counter-Terrorists)"},
{GLOVE_SPORTY, "Sporty"},
{GLOVE_SLICK, "Slick"},
{GLOVE_LEATHER_WRAP, "Handwrap"},
{GLOVE_MOTORCYCLE, "Motorcycle"},
{GLOVE_SPECIALIST, "Specialist"},
{GLOVE_HYDRA, "Hydra"}
};
constexpr weapon_name weapon_names[]{
{WEAPON_KNIFE, "Knife"},
{GLOVE_T_SIDE, "Glove"},
{WEAPON_AK47, "AK-47"},
{WEAPON_AUG, "AUG"},
{WEAPON_AWP, "AWP"},
{WEAPON_CZ75A, "CZ75 Auto"},
{WEAPON_DEAGLE, "Desert Eagle"},
{WEAPON_ELITE, "Dual Berettas"},
{WEAPON_FAMAS, "FAMAS"},
{WEAPON_FIVESEVEN, "Five-SeveN"},
{WEAPON_G3SG1, "G3SG1"},
{WEAPON_GALILAR, "Galil AR"},
{WEAPON_GLOCK, "Glock-18"},
{WEAPON_M249, "M249"},
{WEAPON_M4A1_SILENCER, "M4A1-S"},
{WEAPON_M4A1, "M4A4"},
{WEAPON_MAC10, "MAC-10"},
{WEAPON_MAG7, "MAG-7"},
{WEAPON_MP5SD, "MP5-SD"},
{WEAPON_MP7, "MP7"},
{WEAPON_MP9, "MP9"},
{WEAPON_NEGEV, "Negev"},
{WEAPON_NOVA, "Nova"},
{WEAPON_HKP2000, "P2000"},
{WEAPON_P250, "P250"},
{WEAPON_P90, "P90"},
{WEAPON_BIZON, "PP-Bizon"},
{WEAPON_REVOLVER, "R8 Revolver"},
{WEAPON_SAWEDOFF, "Sawed-Off"},
{WEAPON_SCAR20, "SCAR-20"},
{WEAPON_SSG08, "SSG 08"},
{WEAPON_SG553, "SG 553"},
{WEAPON_TEC9, "Tec-9"},
{WEAPON_UMP45, "UMP-45"},
{WEAPON_USP_SILENCER, "USP-S"},
{WEAPON_XM1014, "XM1014"},
};
constexpr quality_name quality_names[]{
{0, "Default"},
{1, "Genuine"},
{2, "Vintage"},
{3, "Unusual"},
{5, "Community"},
{6, "Developer"},
{7, "Self-Made"},
{8, "Customized"},
{9, "Strange"},
{10, "Completed"},
{12, "Tournament"}
};
}
| [
"testezediscord@gmail.com"
] | testezediscord@gmail.com |
8be2f2054cf3938cac7c66cae079a0fcc2125097 | 1af3b229e5df18828565881f10a1fb330f8177d5 | /rijeci.cpp | e7069adc1f2601b03f9e2949724511a2ec35247b | [] | no_license | ConnorAustin/ProgrammingCompetition | 56597439f9b3626062bef6c6d0702cd623ecf6c4 | 1f1cb9e2b593199bceae5be5113ae2eea0262212 | refs/heads/master | 2021-01-22T01:43:11.290764 | 2017-09-03T00:11:08 | 2017-09-03T00:11:08 | 102,230,533 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 446 | cpp | #include <iostream>
int fibVals[46];
int fib(int f) {
if(f == 0) {
return 0;
}
if(f == 1) {
return 1;
}
if(fibVals[f] == -1) {
int result = fib(f - 1) + fib(f - 2);
fibVals[f] = result;
return result;
}
return fibVals[f];
}
int main() {
int presses;
std::cin >> presses;
for(int i = 0; i < 46; ++i) {
fibVals[i] = -1;
}
std::cout << fib(presses - 1) << " " << fib(presses) << std::endl;
}
| [
"cjaustin42@gmail.com"
] | cjaustin42@gmail.com |
b29a1da6f44210aa1684ec3d26d6a8e70864349f | 709c34ca3914312f25d4405afc7cf79848fe414d | /Headers/json.h | 7050e8643edc0da6fd2014fa7d0fffe3d5edff9f | [] | no_license | jasonodonnell/twitchcreep | 3938220293899b1ea64132b3bb494d63ab11071b | 02cba4fb430eb9a857d404e3f14061f732d486bc | refs/heads/master | 2021-05-28T23:02:00.794134 | 2015-06-27T23:14:46 | 2015-06-27T23:14:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 599 | h | #ifndef JSONRETRIEVER_H
#define JSONRETRIEVER_H
#include <QObject>
#include <QJsonObject>
#include <QJsonDocument>
#include <QJsonArray>
#include <QStringList>
#include <QDebug>
class json : public QObject
{
Q_OBJECT
public:
explicit json(QObject *parent = 0);
~json();
bool checkUsernameExists(QByteArray data);
QList<QStringList> getFeaturedStreamData(QByteArray);
QList<QStringList> getGameStreamData(QByteArray data);
QStringList getStreamData(QByteArray);
QStringList getStreamerFollowedList(QByteArray);
signals:
public slots:
private:
};
#endif // JSON_H
| [
"odonnelljp01@gmail.com"
] | odonnelljp01@gmail.com |
2a4ee4f93d03323c8413c70c97d109b9b6c6641e | 5e7b5330f395d408b667ee0d290ef8f0081829cd | /Code/tp5/pb1/memoire_24.h | 480d79aee923be28f5a1fde9ca2e15eaa536d288 | [
"MIT"
] | permissive | joabda/Robot | 1266d598de77150df4a3e91d5adc34cf8ec8d2df | ce27e2e615cb87480c05f9e0ce32124648f9baff | refs/heads/master | 2021-07-19T18:17:54.072988 | 2020-05-24T22:14:04 | 2020-05-24T22:14:04 | 171,281,897 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,825 | h | /******************************************************************************/
/* */
/* Isidore Lauzier - 9 juillet 2005 */
/* */
/* Cet exemple d'utilisation d'une memoire eeprom i2c est une modification du */
/* programme de Joerg Wunsch twitest.c fourni avec Winavr. Il est compatible */
/* aux eeprom 24C128, 24C256 et 24c512. Ce programme a ete simplifie afin */
/* d'illustrer la programmation du bus TWI et des memoires I2C. */
/* */
/* NOTE IMPORTANTE: Le protocule I2C utilise les broches C0 et C1 sur un */
/* microcontroleur Atmel ATMega16. */
/* */
/* Modifications mineures: */
/* - Pour refaire l'indentation - ete 2007 - Jerome Collin */
/* - Pour preciser les broches utilisees - novembre 2008 - Jerome Collin */
/* - ajouts de commentaires - septembre 2017 - Jerome Collin */
/* */
/******************************************************************************/
#ifndef MEMOIRE_24_H
#define MEMOIRE_24_H
#include <avr/io.h>
#include <util/twi.h>
class Memoire24CXXX
{
public:
Memoire24CXXX(); // le constructeur appelle init() decrit plus bas
~Memoire24CXXX();
// procedure d'initialisation appelee par le constructeur
void init();
// la procedure init() initialize a zero le "memory bank".
// appeler cette methode uniquement si l'adresse doit changer
static uint8_t choisir_banc(const uint8_t banc);
// deux variantes pour la lecture, celle-ci et la suivante
// une donnee a la fois
uint8_t lecture(const uint16_t adresse, uint8_t *donnee);
// bloc de donnees : longueur doit etre de 127 et moins
uint8_t lecture(const uint16_t adresse, uint8_t *donnee,
const uint8_t longueur);
// deux variantes pour la l'ecriture egalement:
// une donnee a la fois
uint8_t ecriture(const uint16_t adresse, const uint8_t donnee);
// bloc de donnees : longueur doit etre de 127 et moins
uint8_t ecriture(const uint16_t adresse, uint8_t *donnee,
const uint8_t longueur);
private:
// pour l'ecriture
uint8_t ecrire_page(const uint16_t adresse, uint8_t *donnee,
const uint8_t longueur);
private:
// donnees membres
static uint8_t m_adresse_peripherique;
const uint8_t PAGE_SIZE;
};
#endif /* MEMOIRE_24_H */
| [
"joe-abdo3@hotmail.com"
] | joe-abdo3@hotmail.com |
8a5bac74d6e221d3f9fccfecbd683b3d7258bb92 | e407582cdcf9dc63f8eba0205735e2ee3baac7e1 | /Plugins/OpenXRHandTrackingCrossPlatform/Source/OpenXRHandTrackingCrossPlatform/Private/OpenXRHandTrackingCrossPlatformLiveLink.cpp | f5fe33a53a5d0e7db7b7b7c421777332a7c464db | [
"MIT"
] | permissive | Mystfit/NectoXRTemplate | 4d23852c5c3c9ec024cebe878a3fccf95f9bb7d6 | db0c684af47d3ee5d17bde6c6eb6ef854ee70a27 | refs/heads/main | 2023-05-24T15:04:06.006970 | 2021-06-28T05:53:42 | 2021-06-28T05:53:42 | 380,920,644 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,161 | cpp | // Copyright Epic Games, Inc. All Rights Reserved.
#include "OpenXRHandTrackingCrossPlatform.h"
#include "IOpenXRHandTrackingCrossPlatformModule.h"
#include "CoreMinimal.h"
#include "UObject/Package.h"
#include "UObject/UObjectGlobals.h"
#include "UObject/ObjectMacros.h"
#include "Engine/Engine.h"
#include "LiveLinkSourceFactory.h"
#include "ILiveLinkClient.h"
#include "Roles/LiveLinkAnimationRole.h"
#include "Roles/LiveLinkAnimationTypes.h"
#define LOCTEXT_NAMESPACE "OpenXRHandTrackingCrossPlatform"
void FOpenXRHandTrackingCrossPlatform::ReceiveClient(ILiveLinkClient* InClient, FGuid InSourceGuid)
{
LiveLinkClient = InClient;
LiveLinkSourceGuid = InSourceGuid;
bNewLiveLinkClient = true;
LiveLinkLeftHandTrackingSubjectKey.Source = InSourceGuid;
LiveLinkLeftHandTrackingSubjectKey.SubjectName = LiveLinkLeftHandTrackingSubjectName;
LiveLinkRightHandTrackingSubjectKey.Source = InSourceGuid;
LiveLinkRightHandTrackingSubjectKey.SubjectName = LiveLinkRightHandTrackingSubjectName;
UpdateLiveLink();
}
bool FOpenXRHandTrackingCrossPlatform::IsSourceStillValid() const
{
return LiveLinkClient != nullptr;
}
bool FOpenXRHandTrackingCrossPlatform::RequestSourceShutdown()
{
LiveLinkClient = nullptr;
LiveLinkSourceGuid.Invalidate();
return true;
}
FText FOpenXRHandTrackingCrossPlatform::GetSourceMachineName() const
{
return FText().FromString(FPlatformProcess::ComputerName());
}
FText FOpenXRHandTrackingCrossPlatform::GetSourceStatus() const
{
return LOCTEXT("OpenXRHandTrackingLiveLinkStatus", "Active");
}
FText FOpenXRHandTrackingCrossPlatform::GetSourceType() const
{
return LOCTEXT("OpenXRHandTrackingLiveLinkSourceType", "OpenXR Hand Tracking");
}
void FOpenXRHandTrackingCrossPlatform::SetupLiveLinkData()
{
check(IsInGameThread());
LiveLinkSkeletonStaticData.InitializeWith(FLiveLinkSkeletonStaticData::StaticStruct(), nullptr);
FLiveLinkSkeletonStaticData* SkeletonDataPtr = LiveLinkSkeletonStaticData.Cast<FLiveLinkSkeletonStaticData>();
check(SkeletonDataPtr);
TArray<FName>& BoneNames = SkeletonDataPtr->BoneNames;
BoneNames.Reserve(EHandKeypointCount);
// Array of bone indices to parent bone index
BoneParents.Reserve(EHandKeypointCount);
BoneKeypoints.Reserve(EHandKeypointCount);
const UEnum* EnumPtr = FindObject<UEnum>(ANY_PACKAGE, TEXT("EHandKeypoint"), true);
check(EnumPtr != nullptr);
// Iterate through all of the Keypoints building the skeleton info for it
for (int32 Keypoint = 0; Keypoint < EHandKeypointCount; Keypoint++)
{
BoneKeypoints.Add((EHandKeypoint)Keypoint);
BoneNames.Add(FOpenXRHandTrackingCrossPlatform::ParseEOpenXRHandKeypointEnumName(EnumPtr->GetNameByValue(Keypoint)));
}
// Manually build the parent hierarchy starting at the wrist which has no parent (-1)
BoneParents.Add(1); // Palm
BoneParents.Add(-1); // Wrist -> Palm
BoneParents.Add(1); // ThumbMetacarpal -> Wrist
BoneParents.Add(2); // ThumbProximal -> ThumbMetacarpal
BoneParents.Add(3); // ThumbDistal -> ThumbProximal
BoneParents.Add(4); // ThumbTip -> ThumbDistal
BoneParents.Add(1); // IndexMetacarpal -> Wrist
BoneParents.Add(6); // IndexProximal -> IndexMetacarpal
BoneParents.Add(7); // IndexIntermediate -> IndexProximal
BoneParents.Add(8); // IndexDistal -> IndexIntermediate
BoneParents.Add(9); // IndexTip -> IndexDistal
BoneParents.Add(1); // MiddleMetacarpal -> Wrist
BoneParents.Add(11); // MiddleProximal -> MiddleMetacarpal
BoneParents.Add(12); // MiddleIntermediate -> MiddleProximal
BoneParents.Add(13); // MiddleDistal -> MiddleIntermediate
BoneParents.Add(14); // MiddleTip -> MiddleDistal
BoneParents.Add(1); // RingMetacarpal -> Wrist
BoneParents.Add(16); // RingProximal -> RingMetacarpal
BoneParents.Add(17); // RingIntermediate -> RingProximal
BoneParents.Add(18); // RingDistal -> RingIntermediate
BoneParents.Add(19); // RingTip -> RingDistal
BoneParents.Add(1); // LittleMetacarpal -> Wrist
BoneParents.Add(21); // LittleProximal -> LittleMetacarpal
BoneParents.Add(22); // LittleIntermediate -> LittleProximal
BoneParents.Add(23); // LittleDistal -> LittleIntermediate
BoneParents.Add(24); // LittleTip -> LittleDistal
SkeletonDataPtr->SetBoneParents(BoneParents);
}
void FOpenXRHandTrackingCrossPlatform::UpdateLiveLinkTransforms(TArray<FTransform>& OutTransforms, const FOpenXRHandTrackingCrossPlatform::FHandState& HandState)
{
// Live link transforms need to be in the hierarchical skeleton, so each in the space of its parent.
// The hand tracking transforms are in world space.
for (int32 Index = 0; Index < EHandKeypointCount; ++Index)
{
const FTransform& BoneTransform = HandState.GetTransform(BoneKeypoints[Index]);
int32 ParentIndex = BoneParents[Index];
if (ParentIndex < 0)
{
// We are at the root, so use it.
OutTransforms[Index] = BoneTransform;
}
else
{
const FTransform& ParentTransform = HandState.GetTransform(BoneKeypoints[ParentIndex]);
OutTransforms[Index] = BoneTransform * ParentTransform.Inverse();
}
}
}
void FOpenXRHandTrackingCrossPlatform::UpdateLiveLink()
{
check(IsInGameThread());
if (LiveLinkClient)
{
// One time initialization:
if (LeftAnimationTransforms.Num() == 0)
{
check(EHandKeypointCount > 0); // ensure the num() test above is a valid way to detect initialization
SetupLiveLinkData();
LeftAnimationTransforms.Reserve(EHandKeypointCount);
RightAnimationTransforms.Reserve(EHandKeypointCount);
// Init to identity all of the Keypoint transforms
for (uint32 Count = 0; Count < EHandKeypointCount; ++Count)
{
LeftAnimationTransforms.Add(FTransform::Identity);
RightAnimationTransforms.Add(FTransform::Identity);
}
}
// Per ReceiveClient initialization:
if (bNewLiveLinkClient)
{
FLiveLinkStaticDataStruct SkeletalDataLeft;
SkeletalDataLeft.InitializeWith(LiveLinkSkeletonStaticData);
FLiveLinkStaticDataStruct SkeletalDataRight;
SkeletalDataRight.InitializeWith(LiveLinkSkeletonStaticData);
LiveLinkClient->RemoveSubject_AnyThread(LiveLinkLeftHandTrackingSubjectKey);
LiveLinkClient->RemoveSubject_AnyThread(LiveLinkRightHandTrackingSubjectKey);
LiveLinkClient->PushSubjectStaticData_AnyThread(LiveLinkLeftHandTrackingSubjectKey, ULiveLinkAnimationRole::StaticClass(), MoveTemp(SkeletalDataLeft));
LiveLinkClient->PushSubjectStaticData_AnyThread(LiveLinkRightHandTrackingSubjectKey, ULiveLinkAnimationRole::StaticClass(), MoveTemp(SkeletalDataRight));
bNewLiveLinkClient = false;
}
// Every frame updates:
// Update the transforms for each subject from tracking data
UpdateLiveLinkTransforms(LeftAnimationTransforms, GetLeftHandState());
UpdateLiveLinkTransforms(RightAnimationTransforms, GetRightHandState());
{
// Note these structures will be Moved to live link, leaving them invalid.
FLiveLinkFrameDataStruct LiveLinkLeftFrameDataStruct(FLiveLinkAnimationFrameData::StaticStruct());
FLiveLinkAnimationFrameData& LiveLinkLeftAnimationFrameData = *LiveLinkLeftFrameDataStruct.Cast<FLiveLinkAnimationFrameData>();
FLiveLinkFrameDataStruct LiveLinkRightFrameDataStruct(FLiveLinkAnimationFrameData::StaticStruct());
FLiveLinkAnimationFrameData& LiveLinkRightAnimationFrameData = *LiveLinkRightFrameDataStruct.Cast<FLiveLinkAnimationFrameData>();
static FName HandednessName (TEXT("Handedness"));
LiveLinkLeftAnimationFrameData.MetaData.StringMetaData.Add(HandednessName, TEXT("Left"));
LiveLinkRightAnimationFrameData.MetaData.StringMetaData.Add(HandednessName, TEXT("Right"));
LiveLinkLeftAnimationFrameData.WorldTime = LiveLinkRightAnimationFrameData.WorldTime = FPlatformTime::Seconds();
//Copy transforms over to transient structure
LiveLinkLeftAnimationFrameData.Transforms = LeftAnimationTransforms;
LiveLinkRightAnimationFrameData.Transforms = RightAnimationTransforms;
// Share the data locally with the LiveLink client
LiveLinkClient->PushSubjectFrameData_AnyThread(LiveLinkLeftHandTrackingSubjectKey, MoveTemp(LiveLinkLeftFrameDataStruct));
LiveLinkClient->PushSubjectFrameData_AnyThread(LiveLinkRightHandTrackingSubjectKey, MoveTemp(LiveLinkRightFrameDataStruct));
}
}
}
#undef LOCTEXT_NAMESPACE
| [
"byronated@gmail.com"
] | byronated@gmail.com |
db3ef9beca2b5937e2226c11a49528673333584e | d98c7664a9b8eef087f9ee5562566ea0dffbb819 | /day_04/this_pointer/Room.hpp | 8af42c9d875a7e41eaf4fb8f472f29edfe8d348b | [
"Apache-2.0"
] | permissive | waitwalker/cpp_projects | 053582a3487651f5fa17886a2600123660f414b8 | 1f8af8a0104f155f493402f9cc3bb0bfb8bd56c5 | refs/heads/main | 2023-06-02T05:36:55.054773 | 2021-06-25T08:47:54 | 2021-06-25T08:47:54 | 370,961,027 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 611 | hpp | //
// Room.hpp
// this_pointer
//
// Created by waitwalker on 2021/6/2.
//
#ifndef Room_hpp
#define Room_hpp
#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;
class Room {
/// 将GoodGay作为Room的友元类
/// GoodGay可以访问Room中所有的成员函数 可以访问Room的私有数据
friend class GoodGay;
friend void visit(Room &ro);
friend void visit2(Room &ro);
private:
string bedRoom;
public:
string sittingRoom;
Room();
Room(string bed, string sit);
Room(const Room &room);
~Room();
};
#endif /* Room_hpp */
| [
"waitwalker@163.com"
] | waitwalker@163.com |
3258a0e6795990a7f5080ccd5f183307c9d0ec51 | 18dc828ecac141107d32a41e3063b2c8f4880667 | /tom_1/chapter_08/07/externconst.cpp | e4af8eb336daaf1e928818a103b1124b0d9a008d | [] | no_license | novikov-ilia-softdev/thinking_cpp | 4ffde847627b6cfdabcead8d833c24408314792d | bfa0348eaa89b2c24639a3f76d385dbc834b913d | refs/heads/master | 2021-09-19T05:59:06.310055 | 2018-07-24T06:20:21 | 2018-07-24T06:20:21 | 70,487,830 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 32 | cpp | extern const float PI = 3.1415;
| [
"smartnlg.ilia.novikov@gmail.com"
] | smartnlg.ilia.novikov@gmail.com |
34c41789696f325dfc25536ef6c0f02e3c997e35 | 1b8aae3cac6076df5be57b472dc472d841dbdf8b | /DeviceAdapters/Tofra/Tofra.cpp | 01147aff5b2fad0183fa16f36c84d961b93bfbe9 | [] | no_license | jakebolewski/micromanager-upstream | dd7e7ad1691b7ff79eaf3cba6c0b01d7cff55180 | cecb8e09b18307ad1a5cf9735123e34b84330542 | refs/heads/master | 2020-12-26T04:15:25.268099 | 2013-11-27T07:20:28 | 2013-11-27T07:20:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 103,102 | cpp | ///////////////////////////////////////////////////////////////////////////////
// FILE: Tofra.cpp
// PROJECT: Micro-Manager
// SUBSYSTEM: DeviceAdapters
//-----------------------------------------------------------------------------
// DESCRIPTION: Adapter for TOFRA devices
//
// COPYRIGHT: TOFRA, Inc., Palo Alto, CA
// University of California, San Francisco, CA
//
// LICENSE: This file is distributed under the BSD license.
// License text is included with the source distribution.
//
// This file 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.
//
// IN NO EVENT SHALL THE COPYRIGHT OWNER(S) OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES.
//
// AUTHOR: Ilya Ravkin, based on Code by Nenad Amodaj and Nico Stuurman
//
#ifdef WIN32
#include <windows.h>
#define snprintf _snprintf
#endif
#include "Tofra.h"
#include <cstdio>
#include <string>
#include <math.h>
#include "../../MMDevice/ModuleInterface.h"
#include "../../MMDevice/DeviceBase.h"
#include "../../MMDevice/DeviceUtils.h"
#include <sstream>
using namespace std;
const char* g_WheelDeviceName = "TOFRA Filter Wheel";
const char* g_ZStageDeviceName = "TOFRA Z-Drive";
const char* g_XYStageDeviceName = "TOFRA XYStage";
const char* g_SliderDeviceName = "TOFRA Cube Slider";
const char* g_rgbLEDDeviceName = "TOFRA RGB LED";
///////////////////////////////////////////////////////////////////////////////
// Exported MMDevice API
///////////////////////////////////////////////////////////////////////////////
MODULE_API void InitializeModuleData()
{
AddAvailableDeviceName(g_WheelDeviceName, "TOFRA Filter Wheel with Integrated Controller");
AddAvailableDeviceName(g_ZStageDeviceName, "TOFRA Z-Drive with Integrated Controller");
AddAvailableDeviceName(g_XYStageDeviceName, "TOFRA XYStage with Integrated Controller");
AddAvailableDeviceName(g_SliderDeviceName, "TOFRA Filter Cube Slider with Integrated Controller");
AddAvailableDeviceName(g_rgbLEDDeviceName, "TOFRA RGB LED Light Source");
}
MODULE_API MM::Device* CreateDevice(const char* deviceName)
{
if (deviceName == 0) return 0;
if (strcmp(deviceName, g_WheelDeviceName) == 0){
// create filter wheel
return new TofraFilterWheel();
}
else if (strcmp(deviceName, g_ZStageDeviceName) == 0){
// create Z-Drive
return new ZStage();
}
else if (strcmp(deviceName, g_XYStageDeviceName) == 0){
// create XYStage
return new XYStage();
}
else if (strcmp(deviceName, g_SliderDeviceName) == 0){
// create CubeSlider
return new CubeSlider();
}
else if (strcmp(deviceName, g_rgbLEDDeviceName) == 0){
// create rgbLED
return new rgbLED();
}
// ...supplied name not recognized
return 0;
}
MODULE_API void DeleteDevice(MM::Device* pDevice)
{
delete pDevice;
}
///////////////////////////////////////////////////////////////////////////////
// TOFRA Filter Wheel Implementation
///////////////////////////////////////////////////////////////////////////////
TofraFilterWheel::TofraFilterWheel() :
ControllerName("1"),
HomeOffset(0), // offset from flag to pos 1 in microsteps, usually in [-4, +2]
SlewVelocity(5000), // microsteps/sec; default value assumes microstep = 1/16 of step
InitVelocity(500), // microsteps/sec; default value assumes microstep = 1/16 of step
Acceleration(10),
HoldCurrent(5), // in % of max (which is 2A)
RunCurrent (60),
NumPos(10),
busy_(false),
initialized_(false),
changedTime_(0.0),
position_(0),
port_("")
{
InitializeDefaultErrorMessages();
// create pre-initialization properties
CPropertyAction* pAct;
// Name
CreateProperty(MM::g_Keyword_Name, g_WheelDeviceName, MM::String, true);
// Description
CreateProperty(MM::g_Keyword_Description, "TOFRA Filter Wheel with Integrated Controller 10, 12, 18 or 22 pos.", MM::String, true);
// Com port
pAct = new CPropertyAction (this, &TofraFilterWheel::OnCOMPort);
CreateProperty(MM::g_Keyword_Port, "", MM::String, false, pAct, true);
// State
pAct = new CPropertyAction (this, &TofraFilterWheel::OnState);
CreateProperty(MM::g_Keyword_State, "0", MM::Integer, false, pAct, true);
// Label
pAct = new CPropertyAction (this, &CStateBase::OnLabel);
CreateProperty(MM::g_Keyword_Label, "", MM::String, false, pAct, true);
// Number of positions
pAct = new CPropertyAction (this, &TofraFilterWheel::OnNumPos);
CreateProperty("NumPos", "10", MM::Integer, false, pAct, true);
// Create default positions and labels
const int bufSize = 1024;
char buf[bufSize];
for (long i=0; i<NumPos; i++)
{
snprintf(buf, bufSize, "Filter-%.2ld", i + 1);
SetPositionLabel(i, buf);
}
// ControllerName - Name (number) of the motor controller on the serial line
pAct = new CPropertyAction (this, &TofraFilterWheel::OnControllerName);
CreateProperty("ControllerName", "1", MM::String, false, pAct, true);
// HomeOffset
pAct = new CPropertyAction (this, &TofraFilterWheel::OnHomeOffset);
CreateProperty("HomeOffset", "0", MM::Integer, false, pAct, true);
// SlewVelocity
pAct = new CPropertyAction (this, &TofraFilterWheel::OnSlewVelocity);
CreateProperty("SlewVelocity", "5000", MM::Integer, false, pAct, true);
// InitVelocity
pAct = new CPropertyAction (this, &TofraFilterWheel::OnInitVelocity);
CreateProperty("InitVelocity", "500", MM::Integer, false, pAct, true);
// Acceleration
pAct = new CPropertyAction (this, &TofraFilterWheel::OnAcceleration);
CreateProperty("Acceleration", "10", MM::Integer, false, pAct, true);
// HoldCurrent
pAct = new CPropertyAction (this, &TofraFilterWheel::OnHoldCurrent);
CreateProperty("HoldCurrent", "5", MM::Integer, false, pAct, true);
// RunCurrent
pAct = new CPropertyAction (this, &TofraFilterWheel::OnRunCurrent);
CreateProperty("RunCurrent", "60", MM::Integer, false, pAct, true);
EnableDelay(); // signals that the delay setting will be used
}
TofraFilterWheel::~TofraFilterWheel()
{
Shutdown();
}
void TofraFilterWheel::GetName(char* Name) const
{
CDeviceUtils::CopyLimitedString(Name, g_WheelDeviceName);
}
int TofraFilterWheel::Initialize()
{
int ret;
// Update Status
ret = UpdateStatus();
if (ret != DEVICE_OK) return ret;
// Initialize and Home
position_ = 0;
ret = InitializeFilterWheel();
if (ret != DEVICE_OK) return ret;
changedTime_ = GetCurrentMMTime();
initialized_ = true;
return DEVICE_OK;
}
int TofraFilterWheel::Shutdown()
{
if (initialized_) initialized_ = false;
return DEVICE_OK;
}
bool TofraFilterWheel::Busy()
{
// In case of error we postulate that device is not busy
// Clear serial port from previous stuff
int ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return false;
// Query current status
const int bufSize = 20;
char buf[bufSize];
snprintf(buf, bufSize, "/%sQ", ControllerName.c_str());
ret = SendSerialCommand(port_.c_str(),buf,"\r");
if (ret != DEVICE_OK) return false;
// Read response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return false;
// Analyze response
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return false;
if (answer.substr(ret,1).compare("@") == 0) return true;
return false;
}
///////////////////////////////////////////////////////////////////////////////
// Action handlers - Filter Wheel
///////////////////////////////////////////////////////////////////////////////
int TofraFilterWheel::OnState(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet)
{
pProp->Set(position_);
// nothing to do, let the caller use the cached property
}
else if (eAct == MM::AfterSet)
{
// Set timer for the Busy signal
changedTime_ = GetCurrentMMTime();
long pos;
pProp->Get(pos);
if (pos >= NumPos || pos < 0)
{
pProp->Set(position_);
return ERR_UNKNOWN_POSITION;
}
if (position_ == pos) return DEVICE_OK;
// form relative move command
int msteps,d1,d2;
double mstepsperfilt;
const int bufSize = 40;
char buf[bufSize];
mstepsperfilt = (double)3200./NumPos;
d1 = pos - position_;
if (d1<0) d1 = d1 + NumPos;
d2 = position_ - pos;
if (d2<0) d2 = d2 + NumPos;
if (d1<=d2) {
msteps = (int)floor(d1*mstepsperfilt+0.5);
snprintf(buf, bufSize, "/%sP%dR", ControllerName.c_str(), msteps);
} else {
msteps = (int)floor(d2*mstepsperfilt+0.5);
snprintf(buf, bufSize, "/%sD%dR", ControllerName.c_str(), msteps);
}
// Clear serial port from previous stuff
int ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return ret;
// Send move command
ret = SendSerialCommand(port_.c_str(),buf,"\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
position_ = pos;
}
return DEVICE_OK;
}
int TofraFilterWheel::OnCOMPort(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet)
{
pProp->Set(port_.c_str());
}
else if (eAct == MM::AfterSet)
{
if (initialized_)
{
pProp->Set(port_.c_str()); // revert
}
pProp->Get(port_);
}
return DEVICE_OK;
}
int TofraFilterWheel::OnControllerName(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(ControllerName.c_str());
}
else if (eAct == MM::AfterSet) {
pProp->Get(ControllerName);
}
return DEVICE_OK;
}
int TofraFilterWheel::OnHomeOffset(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(HomeOffset);
}
else if (eAct == MM::AfterSet) {
pProp->Get(HomeOffset);
}
return DEVICE_OK;
}
int TofraFilterWheel::OnSlewVelocity(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(SlewVelocity);
}
else if (eAct == MM::AfterSet) {
pProp->Get(SlewVelocity);
//changedTime_ = GetCurrentMMTime();
//const int bufSize = 40;
//char cbuf[bufSize];
//snprintf(cbuf,bufSize, "/%sV%ldR", ControllerName.c_str(), SlewVelocity);
//int ret = SendSerialCommand(port_.c_str(),cbuf,"\r");
//if (ret != DEVICE_OK) return ret;
//std::string answer;
//ret = GetSerialAnswer(port_.c_str(), "\r", answer);
//if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int TofraFilterWheel::OnInitVelocity(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(InitVelocity);
}
else if (eAct == MM::AfterSet) {
pProp->Get(InitVelocity);
//changedTime_ = GetCurrentMMTime();
//const int bufSize = 40;
//char cbuf[bufSize];
//// snprintf(cbuf,bufSize, "/%sv%ldR", ControllerName.c_str(), InitVelocity);
//int ret = SendSerialCommand(port_.c_str(),cbuf,"\r");
//if (ret != DEVICE_OK) return ret;
//std::string answer;
//ret = GetSerialAnswer(port_.c_str(), "\r", answer);
//if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int TofraFilterWheel::OnAcceleration(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(Acceleration);
}
else if (eAct == MM::AfterSet) {
pProp->Get(Acceleration);
//changedTime_ = GetCurrentMMTime();
//const int bufSize = 40;
//char cbuf[bufSize];
//// snprintf(cbuf,bufSize, "/%sL%ldR", ControllerName.c_str(), Acceleration);
//int ret = SendSerialCommand(port_.c_str(),cbuf,"\r");
//if (ret != DEVICE_OK) return ret;
//std::string answer;
//ret = GetSerialAnswer(port_.c_str(), "\r", answer);
//if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int TofraFilterWheel::OnHoldCurrent(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(HoldCurrent);
}
else if (eAct == MM::AfterSet) {
pProp->Get(HoldCurrent);
//changedTime_ = GetCurrentMMTime();
//const int bufSize = 40;
//char cbuf[bufSize];
//// snprintf(cbuf,bufSize, "/%sh%ldR", ControllerName.c_str(), HoldCurrent);
//int ret = SendSerialCommand(port_.c_str(),cbuf,"\r");
//if (ret != DEVICE_OK) return ret;
//std::string answer;
//ret = GetSerialAnswer(port_.c_str(), "\r", answer);
//if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int TofraFilterWheel::OnRunCurrent(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(RunCurrent);
}
else if (eAct == MM::AfterSet) {
pProp->Get(RunCurrent);
//changedTime_ = GetCurrentMMTime();
//const int bufSize = 40;
//char cbuf[bufSize];
//// snprintf(cbuf,bufSize, "/%sm%ldR", ControllerName.c_str(), RunCurrent);
//int ret = SendSerialCommand(port_.c_str(),cbuf,"\r");
//if (ret != DEVICE_OK) return ret;
//std::string answer;
//ret = GetSerialAnswer(port_.c_str(), "\r", answer);
//if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int TofraFilterWheel::OnNumPos(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(NumPos);
}
else if (eAct == MM::AfterSet) {
pProp->Get(NumPos);
// (re)create default positions and labels
const int bufSize = 1024;
char buf[bufSize];
for (long i=0; i<NumPos; i++)
{
snprintf(buf, bufSize, "Filter-%.2ld", i + 1);
SetPositionLabel(i, buf);
}
// Update Status - what does it do?
int ret = UpdateStatus();
if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int TofraFilterWheel::InitializeFilterWheel()
{
int ret;
// Clear serial port from previous stuff
ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return ret;
// Set controller parameters and do homing
const int bufSize = 200;
char cbuf[bufSize],hbuf[bufSize];
// Form command for home offset
if(HomeOffset>0) snprintf(hbuf,bufSize,"D%ld",HomeOffset);
else if(HomeOffset<0) snprintf(hbuf,bufSize,"P%ld",-HomeOffset);
else snprintf(hbuf,bufSize,"");
// Form command string to set current values of parameters and home the wheel
// Homing is at "higher speed" to the beginning of flag, then at "lower speed" to the end of flag
snprintf(cbuf,bufSize, "/%sj16h%ldm%ldV%ldv%ldL%ldf0n0gD10S13G0D1gD1S03G0%sR",ControllerName.c_str(),HoldCurrent,RunCurrent,SlewVelocity,InitVelocity,Acceleration,hbuf);
ret = SendSerialCommand(port_.c_str(),cbuf,"\r");
// Change for faster homing ...D40... or ...D20... instead of ...D10...
// ret = SendSerialCommand(port_.c_str(),"/1j16h5m60V5000v500L12f0n0gD40S13G0D1gD1S03G0D2R","\r");
// Default parameters:
// Parameters: "/1j16h5m60V5000v500L12f0n0R"
// Homing: "/1gD10S13G0D1gD1S03G0D2R"
if (ret != DEVICE_OK) return ret;
// Read response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
// Analyze response
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int AnalyzeAnswer(std::string answer)
{
//Search for /0 in answer and return index after it
//basic_string <char>::size_type ind;
size_t ind;
ind = answer.find("/0",0);
if (ind == string::npos) return ERR_BAD_CONTROLLER_RESPONSE;
return (int)ind+2;
}
int ClearPort(MM::Device& device, MM::Core& core, std::string port)
{
// Clear contents of serial port
const int bufSize = 255;
unsigned char clear[bufSize];
unsigned long read = bufSize;
int ret;
while ((int) read == bufSize)
{
ret = core.ReadFromSerial(&device, port.c_str(), clear, bufSize, read);
if (ret != DEVICE_OK)
return ret;
}
return DEVICE_OK;
}
int isnumeric(const char *str)
{
while(*str)
{
if(!(isdigit(*str)||(strncmp(str,".",1)==0))) return 0;
str++;
}
return 1;
}
///////////////////////////////////////////////////////////////////////////////
// TOFRA Z Drive Implementation
///////////////////////////////////////////////////////////////////////////////
ZStage::ZStage() :
ControllerName("2"),
SlewVelocity(40), // microns/sec
InitVelocity(4), // microns/sec
Acceleration(1), // microns/sec^2
HoldCurrent(5), // in % of max (which is 2A)
RunCurrent (25), // in % of max (which is 2A)
MotorSteps(400), // steps in one revolution
FullTurnUm(100), // microns per full turn of fine focus knob
WithLimits(0), // 1 if Z-drive includes limits
Position(""), // Numeric or symbolic (ORIGIN, HOME, LIM1, LIM2) position
Speed(0), // Speed for continuous move in microns/sec; to stop set to 0
busy_(false),
initialized_(false),
changedTime_(0.0),
stepSizeUm_(0.0009765625), //assuming 100um full turn of focus knob and 400 step motor; actual value is calculated
port_("")
{
InitializeDefaultErrorMessages();
// create pre-initialization properties
CPropertyAction* pAct;
// Name
CreateProperty(MM::g_Keyword_Name, g_ZStageDeviceName, MM::String, true);
// Description
CreateProperty(MM::g_Keyword_Description, "TOFRA Z-Drive with Integrated Controller", MM::String, true);
// Port
pAct = new CPropertyAction (this, &ZStage::OnPort);
CreateProperty(MM::g_Keyword_Port, "", MM::String, false, pAct, true);
// ControllerName - Name (number) of the motor controller on the serial line
pAct = new CPropertyAction (this, &ZStage::OnControllerName);
CreateProperty("ControllerName", "2", MM::String, false, pAct, true);
// SlewVelocity
pAct = new CPropertyAction (this, &ZStage::OnSlewVelocity);
CreateProperty("SlewVelocity", "40", MM::Float, false, pAct, true);
// InitVelocity
pAct = new CPropertyAction (this, &ZStage::OnInitVelocity);
CreateProperty("InitVelocity", "4", MM::Float, false, pAct, true);
// Acceleration
pAct = new CPropertyAction (this, &ZStage::OnAcceleration);
CreateProperty("Acceleration", "1", MM::Float, false, pAct, true);
// HoldCurrent
pAct = new CPropertyAction (this, &ZStage::OnHoldCurrent);
CreateProperty("HoldCurrent", "5", MM::Integer, false, pAct, true); // set to 0 for easy manual operation of the fine focus
// RunCurrent
pAct = new CPropertyAction (this, &ZStage::OnRunCurrent);
CreateProperty("RunCurrent", "25", MM::Integer, false, pAct, true);
// MotorSteps
pAct = new CPropertyAction (this, &ZStage::OnMotorSteps);
CreateProperty("MotorSteps", "400", MM::Integer, false, pAct, true);
// FullTurnUm
pAct = new CPropertyAction (this, &ZStage::OnFullTurnUm);
CreateProperty("FullTurnUm", "100", MM::Integer, false, pAct, true);
// WithLimits
pAct = new CPropertyAction (this, &ZStage::OnWithLimits);
CreateProperty("WithLimits", "0", MM::Integer, false, pAct, true);
//EnableDelay(); // signals that the delay setting will be used ????
}
ZStage::~ZStage()
{
Shutdown();
}
void ZStage::GetName(char* Name) const
{
CDeviceUtils::CopyLimitedString(Name, g_ZStageDeviceName);
}
int ZStage::Initialize()
{
// create pre-initialization properties
CPropertyAction* pAct;
// Position - Numeric or symbolic value of position
pAct = new CPropertyAction (this, &ZStage::OnPosition);
CreateProperty("Position", "", MM::String, false, pAct);
// Out1 - Digital output 1
pAct = new CPropertyAction (this, &ZStage::OnOut1);
CreateProperty("Out1", "", MM::Integer, false, pAct);
// Out2 - Digital output 2
pAct = new CPropertyAction (this, &ZStage::OnOut2);
CreateProperty("Out2", "", MM::Integer, false, pAct);
// Execute
pAct = new CPropertyAction (this, &ZStage::OnExecute);
CreateProperty("Execute", "", MM::String, false, pAct);
// Speed for continuous move
pAct = new CPropertyAction (this, &ZStage::OnSpeed);
CreateProperty("Speed", "", MM::Float, false, pAct);
int ret = UpdateStatus();
if (ret != DEVICE_OK) return ret;
ret = InitializeZDrive();
if (ret != DEVICE_OK) return ret;
changedTime_ = GetCurrentMMTime();
initialized_ = true;
return DEVICE_OK;
}
int ZStage::Shutdown()
{
if (initialized_) initialized_ = false;
return DEVICE_OK;
}
///////////////////////////////////////////////////////////////////////////////
// Action handlers - Z Drive
///////////////////////////////////////////////////////////////////////////////
int ZStage::OnPort(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet)
{
pProp->Set(port_.c_str());
}
else if (eAct == MM::AfterSet)
{
if (initialized_)
{
pProp->Set(port_.c_str()); // revert
}
pProp->Get(port_);
}
return DEVICE_OK;
}
int ZStage::OnControllerName(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(ControllerName.c_str());
}
else if (eAct == MM::AfterSet) {
pProp->Get(ControllerName);
}
return DEVICE_OK;
}
int ZStage::OnSlewVelocity(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(SlewVelocity);
}
else if (eAct == MM::AfterSet) {
pProp->Get(SlewVelocity);
}
return DEVICE_OK;
}
int ZStage::OnInitVelocity(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(InitVelocity);
}
else if (eAct == MM::AfterSet) {
pProp->Get(InitVelocity);
}
return DEVICE_OK;
}
int ZStage::OnAcceleration(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(Acceleration);
}
else if (eAct == MM::AfterSet) {
pProp->Get(Acceleration);
}
return DEVICE_OK;
}
int ZStage::OnHoldCurrent(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(HoldCurrent);
}
else if (eAct == MM::AfterSet) {
pProp->Get(HoldCurrent);
}
return DEVICE_OK;
}
int ZStage::OnRunCurrent(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(RunCurrent);
}
else if (eAct == MM::AfterSet) {
pProp->Get(RunCurrent);
}
return DEVICE_OK;
}
int ZStage::OnMotorSteps(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(MotorSteps);
}
else if (eAct == MM::AfterSet) {
pProp->Get(MotorSteps);
}
return DEVICE_OK;
}
int ZStage::OnFullTurnUm(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(FullTurnUm);
}
else if (eAct == MM::AfterSet) {
pProp->Get(FullTurnUm);
}
return DEVICE_OK;
}
int ZStage::OnWithLimits(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(WithLimits);
}
else if (eAct == MM::AfterSet) {
long wthlim;
pProp->Get(wthlim);
if (wthlim != 0) wthlim = 1;
WithLimits = wthlim;
pProp->Set(WithLimits);
}
return DEVICE_OK;
}
int ZStage::OnPosition(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
double pos;
const int bufSize = 40;
char buf[bufSize];
int ret = GetPositionUm(pos);
if (ret != DEVICE_OK) return ret;
snprintf(buf, bufSize, "%f", pos);
pProp->Set(buf);
}
else if (eAct == MM::AfterSet) {
pProp->Get(Position);
if(Position.compare("ORIGIN") == 0) return SetOrigin();
if(Position.compare("HOME") == 0) return Home();
// if(Position.compare("LIM1") == 0) return ToLimit(1);
// if(Position.compare("LIM2") == 0) return ToLimit(2);
if(isnumeric(Position.c_str())){
double pos;
pos = atof(Position.c_str());
return SetPositionUm(pos);
}
}
return DEVICE_OK;
}
int ZStage::OnSpeed(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(Speed);
}
else if (eAct == MM::AfterSet) {
pProp->Get(Speed);
int ret = Move(Speed);
if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int ZStage::OnOut1(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(Out1);
}
else if (eAct == MM::AfterSet) {
pProp->Get(Out1);
int ret = Out();
if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int ZStage::OnOut2(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(Out2);
}
else if (eAct == MM::AfterSet) {
pProp->Get(Out2);
int ret = Out();
if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int ZStage::OnExecute(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(Execute.c_str());
}
else if (eAct == MM::AfterSet) {
pProp->Get(Execute);
int ret = SendCommand(Execute.c_str());
if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
////////////////////////////////////////////////////////////////
bool ZStage::Busy()
{
// In case of error we postulate that device is not busy
// Clear serial port from previous stuff
int ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return false;
// Query current status
const int bufSize = 20;
char buf[bufSize];
snprintf(buf, bufSize, "/%sQ", ControllerName.c_str());
ret = SendSerialCommand(port_.c_str(),buf,"\r");
if (ret != DEVICE_OK) return false;
// Read response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return false;
// Analyze response
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return false;
if (answer.substr(ret,1).compare("@") == 0) return true;
return false;
}
int ZStage::SetPositionUm(double pos)
{
long steps = (long) (pos / stepSizeUm_ + 0.5);
return SetPositionSteps(steps);
}
int ZStage::GetPositionUm(double& pos)
{
long steps;
int ret = GetPositionSteps(steps);
if (ret != DEVICE_OK) return ret;
pos = steps * stepSizeUm_;
return DEVICE_OK;
}
int ZStage::SetPositionSteps(long pos)
{
// First Clear serial port from previous stuff
int ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return ret;
// form absolute move command
const int bufSize = 40;
char buf[bufSize];
snprintf(buf, bufSize, "/%sA%ldR", ControllerName.c_str(), pos);
// send command
ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int ZStage::GetPositionSteps(long& steps)
{
// First Clear serial port from previous stuff
int ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return ret;
// send command to read position
const int bufSize = 40;
char buf[bufSize];
snprintf(buf,bufSize, "/%s?0", ControllerName.c_str());
ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return false;
// Analyze response
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
steps = atol(answer.substr(ret+1,answer.length()-ret-1).c_str());
return DEVICE_OK;
}
int ZStage::SetOrigin()
{
// Form origin command
const int bufSize = 40;
char buf[bufSize];
snprintf(buf, bufSize, "/%sz0R", ControllerName.c_str());
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int ZStage::GetLimits(double& min, double& max)
{
// Placeholder for now
min = 0.0;
max = 10000.0;
return DEVICE_OK;
}
int ZStage::Stop()
{
// Form stop command
const int bufSize = 40;
char buf[bufSize];
snprintf(buf, bufSize, "/%sT", ControllerName.c_str());
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int ZStage::Home()
{
if (WithLimits==0) return SetOrigin();
// Form home command (will use SlewVelocity as speed)
const int bufSize = 40;
char buf[bufSize];
snprintf(buf, bufSize, "/%sZ1000000000R", ControllerName.c_str());
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int ZStage::SetRelativePositionUm(double d)
{
if(d==0) return DEVICE_OK;
long steps = (long) (d / stepSizeUm_ + 0.5);
// Form relative move command
const int bufSize = 40;
char buf[bufSize];
if(steps>0) snprintf(buf, bufSize, "/%sP%ldR", ControllerName.c_str(), steps);
if(steps<0) snprintf(buf, bufSize, "/%sD%ldR", ControllerName.c_str(), -steps);
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int ZStage::Move(double speed)
{
// Speed is in um/sec
// This will change max velocity, so after finished in velocity mode - initialize
if(speed==0) return Stop();
long stepspeed = (long) (speed / stepSizeUm_ + 0.5);
// Form constant speed move command
const int bufSize = 40;
char buf[bufSize];
if(stepspeed>0) snprintf(buf, bufSize, "/%sV%ldP0R", ControllerName.c_str(), stepspeed);
if(stepspeed<0) snprintf(buf, bufSize, "/%sV%ldD0R", ControllerName.c_str(), -stepspeed);
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int ZStage::Out()
{
// Two outputs 1 and 2 with values 0 and 1
const int bufSize = 40;
char buf[bufSize];
snprintf(buf, bufSize, "/%sJ%ldR", ControllerName.c_str(), Out1+2*Out2);
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int ZStage::InitializeZDrive()
{
// Calculate step size
stepSizeUm_ = (double)FullTurnUm/(256.*MotorSteps);
// From microns to microsteps
long slvel = (long) (SlewVelocity / stepSizeUm_ + 0.5);
long invel = (long) (InitVelocity / stepSizeUm_ + 0.5);
long accel = (long) (Acceleration / stepSizeUm_ + 0.5);
int ret;
// Clear serial port from previous stuff
ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return ret;
// Set controller parameters
const int bufSize = 200;
char buf[bufSize];
// snprintf(buf,bufSize, "/%sj256h%ldm%ldV%ldv%ldL%ldn0R", ControllerName.c_str(),HoldCurrent,RunCurrent,SlewVelocity,InitVelocity,Acceleration);
snprintf(buf,bufSize, "/%sj256h%ldm%ldV%ldv%ldL%ldn%ldR", ControllerName.c_str(),HoldCurrent,RunCurrent,slvel,invel,accel,WithLimits*2);
ret = SendSerialCommand(port_.c_str(),buf,"\r");
if (ret != DEVICE_OK) return ret;
// Read response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
// Analyze response
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int ZStage::SendCommand(const char* cmd)
{
const int bufSize = 1024;
char buf[bufSize];
snprintf(buf, bufSize, "/%s%s", ControllerName.c_str(), cmd);
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
///////////////////////////////////////////////////////////////////////////////
// TOFRA XYStage Implementation
///////////////////////////////////////////////////////////////////////////////
XYStage::XYStage() :
ControllerNameX("3"), // name (number) of controller for X axis
StepDivideX(256), // microsteps in one full step
SlewVelocityX(1000), // microns/sec
InitVelocityX(100), // microns/sec
AccelerationX(10), // microns/sec^2
HoldCurrentX(5), // in % of max (which is 2A)
RunCurrentX(50), // in % of max (which is 2A)
MotorStepsX(200), // steps in one revolution
LeadUmX(1000), // microns per full motor turn (for 1mm lead screw)
PositionX(""), // Numeric or symbolic (ORIGIN, HOME, LIM1, LIM2) position
SpeedX(0), // Speed for continuous move in microns/sec; to stop set to 0
Out1X(0), // Output 1
Out2X(0), // Output 2
LimitPolarityX(0), // limit polarity: 0 normally closed, 1 mormally open
stepSizeUmX_(0.01953125), // assuming 1000um lead and 200 step motor; actual value is calculated
ControllerNameY("4"), // name (number) of controller for Y axis
StepDivideY(256), // microsteps in one full step
SlewVelocityY(1000), // microns/sec
InitVelocityY(100), // microns/sec
AccelerationY(10), // microns/sec^2
HoldCurrentY(5), // in % of max (which is 2A)
RunCurrentY(50), // in % of max (which is 2A)
MotorStepsY(200), // steps in one revolution
LeadUmY(1000), // microns per full motor turn (for 1mm lead screw)
PositionY(""), // Numeric or symbolic (ORIGIN, HOME, LIM1, LIM2) position
SpeedY(0), // Speed for continuous move in microns/sec; to stop set to 0
Out1Y(0), // Output 1
Out2Y(0), // Output 2
LimitPolarityY(0), // limit polarity: 0 normally closed, 1 mormally open
stepSizeUmY_(0.01953125), // assuming 1000um lead and 200 step motor; actual value is calculated
//originX_(0),
//originY_(0),
//mirrorX_(false),
//mirrorY_(false),
busy_(false),
initialized_(false),
changedTime_(0.0),
port_("")
{
InitializeDefaultErrorMessages();
// create pre-initialization properties
CPropertyAction* pAct;
// Name
CreateProperty(MM::g_Keyword_Name, g_XYStageDeviceName, MM::String, true);
// Description
CreateProperty(MM::g_Keyword_Description, "TOFRA XYStage with Integrated Controller", MM::String, true);
// Port
pAct = new CPropertyAction (this, &XYStage::OnPort);
CreateProperty(MM::g_Keyword_Port, "", MM::String, false, pAct, true);
// ControllerName - Name (number) of the motor controller on the serial line
pAct = new CPropertyAction (this, &XYStage::OnControllerNameX);
CreateProperty("ControllerNameX", "3", MM::String, false, pAct, true);
pAct = new CPropertyAction (this, &XYStage::OnControllerNameY);
CreateProperty("ControllerNameY", "4", MM::String, false, pAct, true);
// StepDivide
pAct = new CPropertyAction (this, &XYStage::OnStepDivideX);
CreateProperty("StepDivideX", "256", MM::Integer, false, pAct, true);
pAct = new CPropertyAction (this, &XYStage::OnStepDivideY);
CreateProperty("StepDivideY", "256", MM::Integer, false, pAct, true);
// SlewVelocity
pAct = new CPropertyAction (this, &XYStage::OnSlewVelocityX);
CreateProperty("SlewVelocityX", "1000", MM::Float, false, pAct, true);
pAct = new CPropertyAction (this, &XYStage::OnSlewVelocityY);
CreateProperty("SlewVelocityY", "1000", MM::Float, false, pAct, true);
// InitVelocity
pAct = new CPropertyAction (this, &XYStage::OnInitVelocityX);
CreateProperty("InitVelocityX", "100", MM::Float, false, pAct, true);
pAct = new CPropertyAction (this, &XYStage::OnInitVelocityY);
CreateProperty("InitVelocityY", "100", MM::Float, false, pAct, true);
// Acceleration
pAct = new CPropertyAction (this, &XYStage::OnAccelerationX);
CreateProperty("AccelerationX", "10", MM::Float, false, pAct, true);
pAct = new CPropertyAction (this, &XYStage::OnAccelerationY);
CreateProperty("AccelerationY", "10", MM::Float, false, pAct, true);
// HoldCurrent
pAct = new CPropertyAction (this, &XYStage::OnHoldCurrentX);
CreateProperty("HoldCurrentX", "5", MM::Integer, false, pAct, true);
pAct = new CPropertyAction (this, &XYStage::OnHoldCurrentY);
CreateProperty("HoldCurrentY", "5", MM::Integer, false, pAct, true);
// RunCurrent
pAct = new CPropertyAction (this, &XYStage::OnRunCurrentX);
CreateProperty("RunCurrentX", "50", MM::Integer, false, pAct, true);
pAct = new CPropertyAction (this, &XYStage::OnRunCurrentY);
CreateProperty("RunCurrentY", "50", MM::Integer, false, pAct, true);
// MotorSteps
pAct = new CPropertyAction (this, &XYStage::OnMotorStepsX);
CreateProperty("MotorStepsX", "200", MM::Integer, false, pAct, true);
pAct = new CPropertyAction (this, &XYStage::OnMotorStepsY);
CreateProperty("MotorStepsY", "200", MM::Integer, false, pAct, true);
// LeadUm
pAct = new CPropertyAction (this, &XYStage::OnLeadUmX);
CreateProperty("LeadUmX", "1000", MM::Integer, false, pAct, true);
pAct = new CPropertyAction (this, &XYStage::OnLeadUmY);
CreateProperty("LeadUmY", "1000", MM::Integer, false, pAct, true);
// Limit polarity
pAct = new CPropertyAction (this, &XYStage::OnLimitPolarityX);
CreateProperty("LimitPolarityX", "", MM::Integer, false, pAct, true);
pAct = new CPropertyAction (this, &XYStage::OnLimitPolarityY);
CreateProperty("LimitPolarityY", "", MM::Integer, false, pAct, true);
//EnableDelay(); // signals that the delay setting will be used ????
}
XYStage::~XYStage()
{
Shutdown();
}
void XYStage::GetName(char* Name) const
{
CDeviceUtils::CopyLimitedString(Name, g_XYStageDeviceName);
}
int XYStage::Initialize()
{
CPropertyAction* pAct;
// Position - Numeric or symbolic value of position
pAct = new CPropertyAction (this, &XYStage::OnPositionX);
CreateProperty("PositionX", "", MM::String, false, pAct);
pAct = new CPropertyAction (this, &XYStage::OnPositionY);
CreateProperty("PositionY", "", MM::String, false, pAct);
// Execute string
pAct = new CPropertyAction (this, &XYStage::OnExecuteX);
CreateProperty("ExecuteX", "", MM::String, false, pAct);
pAct = new CPropertyAction (this, &XYStage::OnExecuteY);
CreateProperty("ExecuteY", "", MM::String, false, pAct);
// Speed - for continuous move
pAct = new CPropertyAction (this, &XYStage::OnSpeedX);
CreateProperty("SpeedX", "", MM::Float, false, pAct);
pAct = new CPropertyAction (this, &XYStage::OnSpeedY);
CreateProperty("SpeedY", "", MM::Float, false, pAct);
// Out1 - Digital output 1 from stage controller
pAct = new CPropertyAction (this, &XYStage::OnOut1X);
CreateProperty("Out1X", "", MM::Integer, false, pAct);
pAct = new CPropertyAction (this, &XYStage::OnOut1Y);
CreateProperty("Out1Y", "", MM::Integer, false, pAct);
// Out2 - Digital output 2 from stage controller
pAct = new CPropertyAction (this, &XYStage::OnOut2X);
CreateProperty("Out2X", "", MM::Integer, false, pAct);
pAct = new CPropertyAction (this, &XYStage::OnOut2Y);
CreateProperty("Out2Y", "", MM::Integer, false, pAct);
int ret = UpdateStatus();
if (ret != DEVICE_OK) return ret;
ret = InitializeXYStage();
if (ret != DEVICE_OK) return ret;
changedTime_ = GetCurrentMMTime();
initialized_ = true;
return DEVICE_OK;
}
int XYStage::Shutdown()
{
if (initialized_) initialized_ = false;
return DEVICE_OK;
}
///////////////////////////////////////////////////////////////////////////////
// Action handlers - XYStage
///////////////////////////////////////////////////////////////////////////////
int XYStage::OnPort(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet)
{
pProp->Set(port_.c_str());
}
else if (eAct == MM::AfterSet)
{
if (initialized_)
{
pProp->Set(port_.c_str()); // revert
}
pProp->Get(port_);
}
return DEVICE_OK;
}
int XYStage::OnControllerNameX(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(ControllerNameX.c_str());
}
else if (eAct == MM::AfterSet) {
pProp->Get(ControllerNameX);
}
return DEVICE_OK;
}
int XYStage::OnControllerNameY(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(ControllerNameY.c_str());
}
else if (eAct == MM::AfterSet) {
pProp->Get(ControllerNameY);
}
return DEVICE_OK;
}
int XYStage::OnSlewVelocityX(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(SlewVelocityX);
}
else if (eAct == MM::AfterSet) {
pProp->Get(SlewVelocityX);
}
return DEVICE_OK;
}
int XYStage::OnSlewVelocityY(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(SlewVelocityY);
}
else if (eAct == MM::AfterSet) {
pProp->Get(SlewVelocityY);
}
return DEVICE_OK;
}
int XYStage::OnInitVelocityX(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(InitVelocityX);
}
else if (eAct == MM::AfterSet) {
pProp->Get(InitVelocityX);
}
return DEVICE_OK;
}
int XYStage::OnInitVelocityY(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(InitVelocityY);
}
else if (eAct == MM::AfterSet) {
pProp->Get(InitVelocityY);
}
return DEVICE_OK;
}
int XYStage::OnAccelerationX(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(AccelerationX);
}
else if (eAct == MM::AfterSet) {
pProp->Get(AccelerationX);
}
return DEVICE_OK;
}
int XYStage::OnAccelerationY(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(AccelerationY);
}
else if (eAct == MM::AfterSet) {
pProp->Get(AccelerationY);
}
return DEVICE_OK;
}
int XYStage::OnHoldCurrentX(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(HoldCurrentX);
}
else if (eAct == MM::AfterSet) {
pProp->Get(HoldCurrentX);
}
return DEVICE_OK;
}
int XYStage::OnHoldCurrentY(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(HoldCurrentY);
}
else if (eAct == MM::AfterSet) {
pProp->Get(HoldCurrentY);
}
return DEVICE_OK;
}
int XYStage::OnRunCurrentX(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(RunCurrentX);
}
else if (eAct == MM::AfterSet) {
pProp->Get(RunCurrentX);
}
return DEVICE_OK;
}
int XYStage::OnRunCurrentY(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(RunCurrentY);
}
else if (eAct == MM::AfterSet) {
pProp->Get(RunCurrentY);
}
return DEVICE_OK;
}
int XYStage::OnMotorStepsX(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(MotorStepsX);
}
else if (eAct == MM::AfterSet) {
pProp->Get(MotorStepsX);
}
return DEVICE_OK;
}
int XYStage::OnMotorStepsY(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(MotorStepsY);
}
else if (eAct == MM::AfterSet) {
pProp->Get(MotorStepsY);
}
return DEVICE_OK;
}
int XYStage::OnLeadUmX(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(LeadUmX);
}
else if (eAct == MM::AfterSet) {
pProp->Get(LeadUmX);
}
return DEVICE_OK;
}
int XYStage::OnLeadUmY(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(LeadUmY);
}
else if (eAct == MM::AfterSet) {
pProp->Get(LeadUmY);
}
return DEVICE_OK;
}
int XYStage::OnLimitPolarityX(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(LimitPolarityX);
}
else if (eAct == MM::AfterSet) {
pProp->Get(LimitPolarityX);
}
return DEVICE_OK;
}
int XYStage::OnLimitPolarityY(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(LimitPolarityY);
}
else if (eAct == MM::AfterSet) {
pProp->Get(LimitPolarityY);
}
return DEVICE_OK;
}
int XYStage::OnPositionX(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
double pos;
const int bufSize = 40;
char buf[bufSize];
int ret = GetPositionUmX(pos);
if (ret != DEVICE_OK) return ret;
snprintf(buf, bufSize, "%f", pos);
pProp->Set(buf);
}
else if (eAct == MM::AfterSet) {
pProp->Get(PositionX);
if(PositionX.compare("ORIGIN") == 0) return SetOriginX();
if(PositionX.compare("HOME") == 0) return HomeX();
// if(PositionX.compare("LIM1") == 0) return ToLimitX(1);
// if(PositionX.compare("LIM2") == 0) return ToLimitX(2);
if(isnumeric(PositionX.c_str())){
double pos;
pos = atof(PositionX.c_str());
return SetPositionUmX(pos);
}
}
return DEVICE_OK;
}
int XYStage::OnPositionY(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
double pos;
const int bufSize = 40;
char buf[bufSize];
int ret = GetPositionUmY(pos);
if (ret != DEVICE_OK) return ret;
snprintf(buf, bufSize, "%f", pos);
pProp->Set(buf);
}
else if (eAct == MM::AfterSet) {
pProp->Get(PositionY);
if(PositionY.compare("ORIGIN") == 0) return SetOriginY();
if(PositionY.compare("HOME") == 0) return HomeY();
// if(PositionY.compare("LIM1") == 0) return ToLimitY(1);
// if(PositionY.compare("LIM2") == 0) return ToLimitY(2);
if(isnumeric(PositionY.c_str())){
double pos;
pos = atof(PositionY.c_str());
return SetPositionUmY(pos);
}
}
return DEVICE_OK;
}
int XYStage::OnSpeedX(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(SpeedX);
}
else if (eAct == MM::AfterSet) {
pProp->Get(SpeedX);
int ret = MoveX(SpeedX);
if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int XYStage::OnSpeedY(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(SpeedY);
}
else if (eAct == MM::AfterSet) {
pProp->Get(SpeedY);
int ret = MoveY(SpeedY);
if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int XYStage::OnOut1X(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(Out1X);
}
else if (eAct == MM::AfterSet) {
pProp->Get(Out1X);
int ret = OutX();
if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int XYStage::OnOut1Y(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(Out1Y);
}
else if (eAct == MM::AfterSet) {
pProp->Get(Out1Y);
int ret = OutY();
if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int XYStage::OnOut2X(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(Out2X);
}
else if (eAct == MM::AfterSet) {
pProp->Get(Out2X);
int ret = OutX();
if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int XYStage::OnOut2Y(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(Out2Y);
}
else if (eAct == MM::AfterSet) {
pProp->Get(Out2Y);
int ret = OutY();
if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int XYStage::OnExecuteX(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(ExecuteX.c_str());
}
else if (eAct == MM::AfterSet) {
pProp->Get(ExecuteX);
int ret = SendCommand(ControllerNameX.c_str(), ExecuteX.c_str());
if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int XYStage::OnExecuteY(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(ExecuteY.c_str());
}
else if (eAct == MM::AfterSet) {
pProp->Get(ExecuteY);
int ret = SendCommand(ControllerNameY.c_str(), ExecuteY.c_str());
if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int XYStage::OnStepDivideX(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(StepDivideX);
}
else if (eAct == MM::AfterSet) {
pProp->Get(StepDivideX);
}
return DEVICE_OK;
}
int XYStage::OnStepDivideY(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(StepDivideY);
}
else if (eAct == MM::AfterSet) {
pProp->Get(StepDivideY);
}
return DEVICE_OK;
}
////////////////////////////////////////////////////////////////
bool XYStage::BusyX()
{
// In case of error we postulate that device is not busy
// Clear serial port from previous stuff
int ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return false;
// Query current status
const int bufSize = 20;
char buf[bufSize];
snprintf(buf, bufSize, "/%sQ", ControllerNameX.c_str());
ret = SendSerialCommand(port_.c_str(),buf,"\r");
if (ret != DEVICE_OK) return false;
// Read response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return false;
// Analyze response
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return false;
if (answer.substr(ret,1).compare("@") == 0) return true;
return false;
}
bool XYStage::BusyY()
{
// In case of error we postulate that device is not busy
// Clear serial port from previous stuff
int ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return false;
// Query current status
const int bufSize = 20;
char buf[bufSize];
snprintf(buf, bufSize, "/%sQ", ControllerNameY.c_str());
ret = SendSerialCommand(port_.c_str(),buf,"\r");
if (ret != DEVICE_OK) return false;
// Read response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return false;
// Analyze response
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return false;
if (answer.substr(ret,1).compare("@") == 0) return true;
return false;
}
bool XYStage::Busy()
{
if(BusyX()) return true;
if(BusyY()) return true;
return false;
}
int XYStage::SetPositionUmX(double pos)
{
long steps = (long) (pos / stepSizeUmX_ + 0.5);
return SetPositionStepsX(steps);
}
int XYStage::SetPositionUmY(double pos)
{
long steps = (long) (pos / stepSizeUmY_ + 0.5);
return SetPositionStepsY(steps);
}
int XYStage::SetPositionUm(double x, double y)
{
int ret = SetPositionUmX(x);
if (ret != DEVICE_OK) return ret;
return SetPositionUmY(y);
}
int XYStage::GetPositionUmX(double& pos)
{
long steps;
int ret = GetPositionStepsX(steps);
if (ret != DEVICE_OK) return ret;
pos = steps * stepSizeUmX_;
return DEVICE_OK;
}
int XYStage::GetPositionUmY(double& pos)
{
long steps;
int ret = GetPositionStepsY(steps);
if (ret != DEVICE_OK) return ret;
pos = steps * stepSizeUmY_;
return DEVICE_OK;
}
int XYStage::GetPositionUm(double& x, double& y)
{
int retx = GetPositionUmX(x);
int rety = GetPositionUmY(y);
if (retx != DEVICE_OK) return retx;
return rety;
}
int XYStage::SetPositionStepsX(long pos)
{
// First Clear serial port from previous stuff
int ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return ret;
// form absolute move command
const int bufSize = 40;
char buf[bufSize];
snprintf(buf, bufSize, "/%sA%ldR", ControllerNameX.c_str(), pos);
// send command
ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::SetPositionStepsY(long pos)
{
// First Clear serial port from previous stuff
int ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return ret;
// form absolute move command
const int bufSize = 40;
char buf[bufSize];
snprintf(buf, bufSize, "/%sA%ldR", ControllerNameY.c_str(), pos);
// send command
ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::SetPositionSteps(long x, long y)
{
int retx = SetPositionStepsX(x);
int rety = SetPositionStepsY(y);
if (retx != DEVICE_OK) return retx;
return rety;
}
int XYStage::GetPositionStepsX(long& steps)
{
// First Clear serial port from previous stuff
int ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return ret;
// send command to read position
const int bufSize = 40;
char buf[bufSize];
snprintf(buf,bufSize, "/%s?0", ControllerNameX.c_str());
ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return false;
// Analyze response
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
steps = atol(answer.substr(ret+1,answer.length()-ret-1).c_str());
return DEVICE_OK;
}
int XYStage::GetPositionStepsY(long& steps)
{
// First Clear serial port from previous stuff
int ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return ret;
// send command to read position
const int bufSize = 40;
char buf[bufSize];
snprintf(buf,bufSize, "/%s?0", ControllerNameY.c_str());
ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return false;
// Analyze response
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
steps = atol(answer.substr(ret+1,answer.length()-ret-1).c_str());
return DEVICE_OK;
}
int XYStage::GetPositionSteps(long& x, long& y)
{
int retx = GetPositionStepsX(x);
int rety = GetPositionStepsY(y);
if (retx != DEVICE_OK) return retx;
return rety;
}
int XYStage::SetOriginX()
{
// Form origin command
const int bufSize = 40;
char buf[bufSize];
snprintf(buf, bufSize, "/%sz0R", ControllerNameX.c_str());
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::SetOriginY()
{
// Form origin command
const int bufSize = 40;
char buf[bufSize];
snprintf(buf, bufSize, "/%sz0R", ControllerNameY.c_str());
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::SetOrigin()
{
int retx = SetOriginX();
int rety = SetOriginY();
if (retx != DEVICE_OK) return retx;
return rety;
}
int XYStage::GetLimitsUm(double& /*xMin*/, double& /*xMax*/, double& /*yMin*/, double& /*yMax*/)
{
return DEVICE_UNSUPPORTED_COMMAND;
}
int XYStage::GetStepLimits(long& /*xMin*/, long& /*xMax*/, long& /*yMin*/, long& /*yMax*/)
{
return DEVICE_UNSUPPORTED_COMMAND;
}
int XYStage::StopX()
{
// Form stop command
const int bufSize = 40;
char buf[bufSize];
snprintf(buf, bufSize, "/%sT", ControllerNameX.c_str());
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::StopY()
{
// Form stop command
const int bufSize = 40;
char buf[bufSize];
snprintf(buf, bufSize, "/%sT", ControllerNameY.c_str());
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::Stop()
{
int retx = StopX();
int rety = StopY();
if (retx != DEVICE_OK) return retx;
return rety;
}
int XYStage::HomeX()
{
// Form home command (will use SlewVelocity as speed)
const int bufSize = 40;
char buf[bufSize];
snprintf(buf, bufSize, "/%sZ1000000000R", ControllerNameX.c_str());
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::HomeY()
{
// Form home command (will use SlewVelocity as speed)
const int bufSize = 40;
char buf[bufSize];
snprintf(buf, bufSize, "/%sZ1000000000R", ControllerNameY.c_str());
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::Home()
{
int retx = HomeX();
int rety = HomeY();
if (retx != DEVICE_OK) return retx;
return rety;
}
int XYStage::SetRelativePositionStepsX(long steps)
{
if(steps==0) return DEVICE_OK;
// Form relative move command
const int bufSize = 40;
char buf[bufSize];
if(steps>0) snprintf(buf, bufSize, "/%sP%ldR", ControllerNameX.c_str(), steps);
if(steps<0) snprintf(buf, bufSize, "/%sD%ldR", ControllerNameX.c_str(), -steps);
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::SetRelativePositionStepsY(long steps)
{
if(steps==0) return DEVICE_OK;
// Form relative move command
const int bufSize = 40;
char buf[bufSize];
if(steps>0) snprintf(buf, bufSize, "/%sP%ldR", ControllerNameY.c_str(), steps);
if(steps<0) snprintf(buf, bufSize, "/%sD%ldR", ControllerNameY.c_str(), -steps);
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::SetRelativePositionSteps(long x, long y)
{
int retx = SetRelativePositionStepsX(x);
int rety = SetRelativePositionStepsY(y);
if (retx != DEVICE_OK) return retx;
return rety;
}
int XYStage::SetRelativePositionUmX(double d)
{
if(d==0) return DEVICE_OK;
long steps = (long) (d / stepSizeUmX_ + 0.5);
return SetRelativePositionStepsX(steps);
}
int XYStage::SetRelativePositionUmY(double d)
{
if(d==0) return DEVICE_OK;
long steps = (long) (d / stepSizeUmY_ + 0.5);
return SetRelativePositionStepsY(steps);
}
int XYStage::SetRelativePositionUm(double dx, double dy)
{
int retx = SetRelativePositionUmX(dx);
int rety = SetRelativePositionUmY(dy);
if (retx != DEVICE_OK) return retx;
return rety;
}
int XYStage::MoveX(double speed)
{
// Speed is in um/sec
// This will change max velocity, so after finished in velocity mode - initialize
if(speed==0) return StopX();
long stepspeed = (long) (speed / stepSizeUmX_ + 0.5);
// Form constant speed move command
const int bufSize = 40;
char buf[bufSize];
if(stepspeed>0) snprintf(buf, bufSize, "/%sV%ldP0R", ControllerNameX.c_str(), stepspeed);
if(stepspeed<0) snprintf(buf, bufSize, "/%sV%ldD0R", ControllerNameX.c_str(), -stepspeed);
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::MoveY(double speed)
{
// Speed is in um/sec
// This will change max velocity, so after finished in velocity mode - initialize
if(speed==0) return StopY();
long stepspeed = (long) (speed / stepSizeUmY_ + 0.5);
// Form constant speed move command
const int bufSize = 40;
char buf[bufSize];
if(stepspeed>0) snprintf(buf, bufSize, "/%sV%ldP0R", ControllerNameY.c_str(), stepspeed);
if(stepspeed<0) snprintf(buf, bufSize, "/%sV%ldD0R", ControllerNameY.c_str(), -stepspeed);
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::Move(double speedx, double speedy)
{
int retx = MoveX(speedx);
int rety = MoveY(speedy);
if (retx != DEVICE_OK) return retx;
return rety;
}
int XYStage::OutX()
{
// Two outputs 1 and 2 with values 0 and 1
const int bufSize = 40;
char buf[bufSize];
snprintf(buf, bufSize, "/%sJ%ldR", ControllerNameX.c_str(), Out1X+2*Out2X);
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::OutY()
{
// Two outputs 1 and 2 with values 0 and 1
const int bufSize = 40;
char buf[bufSize];
snprintf(buf, bufSize, "/%sJ%ldR", ControllerNameY.c_str(), Out1Y+2*Out2Y);
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::SendCommand(const char* con, const char* cmd)
{
const int bufSize = 1024;
char buf[bufSize];
snprintf(buf, bufSize, "/%s%s", con, cmd);
// Send command
int ret = SendSerialCommand(port_.c_str(), buf, "\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::InitializeXYStageX()
{
// Calculate step size
stepSizeUmX_ = (double)LeadUmX/((double)StepDivideX*MotorStepsX);
// From microns to microsteps
long slvel = (long) (SlewVelocityX / stepSizeUmX_ + 0.5);
long invel = (long) (InitVelocityX / stepSizeUmX_ + 0.5);
long accel = (long) (AccelerationX / stepSizeUmX_ + 0.5);
int ret;
// Clear serial port from previous stuff
ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return ret;
// Set controller parameters
const int bufSize = 200;
char buf[bufSize];
snprintf(buf,bufSize, "/%sj%ldh%ldm%ldV%ldv%ldL%ldn2f%ldR", ControllerNameX.c_str(),StepDivideX,HoldCurrentX,RunCurrentX,slvel,invel,accel,LimitPolarityX);
ret = SendSerialCommand(port_.c_str(),buf,"\r");
if (ret != DEVICE_OK) return ret;
// Read response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
// Analyze response
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::InitializeXYStageY()
{
// Calculate step size
stepSizeUmY_ = (double)LeadUmY/((double)StepDivideY*MotorStepsY);
// From microns to microsteps
long slvel = (long) (SlewVelocityY / stepSizeUmY_ + 0.5);
long invel = (long) (InitVelocityY / stepSizeUmY_ + 0.5);
long accel = (long) (AccelerationY / stepSizeUmY_ + 0.5);
int ret;
// Clear serial port from previous stuff
ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return ret;
// Set controller parameters
const int bufSize = 200;
char buf[bufSize];
snprintf(buf,bufSize, "/%sj%ldh%ldm%ldV%ldv%ldL%ldn2f%ldR", ControllerNameY.c_str(),StepDivideY,HoldCurrentY,RunCurrentY,slvel,invel,accel,LimitPolarityY);
ret = SendSerialCommand(port_.c_str(),buf,"\r");
if (ret != DEVICE_OK) return ret;
// Read response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
// Analyze response
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
int XYStage::InitializeXYStage()
{
int retx = InitializeXYStageX();
int rety = InitializeXYStageY();
if (retx != DEVICE_OK) return retx;
return rety;
}
///////////////////////////////////////////////////////////////////////////////
// TOFRA CubeSlider Implementation
///////////////////////////////////////////////////////////////////////////////
CubeSlider::CubeSlider() :
ControllerName("6"), // name (number) of controller for X axis
SlewVelocity(400000), // microns/sec
InitVelocity(200000), // microns/sec
Acceleration(1000), // microns/sec^2
HomeSlewVel(50000), // microns/sec
HomeInitVel(5000), // microns/sec
HomeAccel(100), // microns/sec^2
stepSizeUm_(0), // microstep size in microns (calculated)
HoldCurrent(5), // in % of max (which is 2A)
RunCurrent(70), // in % of max (which is 2A)
NumPos(6), // number of cubes in slider
HomeOffsetUm(700), // offset from switch to pos 1 in microns
BetweenPosUm(40000), // distance between centers of adjacent cubes in microns
LeadUm(25400), // microns of linear motion per full motor turn
MotorSteps(200), // steps in one revolution
StepDivide(16), // microsteps in one full step
busy_(false),
initialized_(false),
changedTime_(0.0),
position_(0),
port_("")
{
InitializeDefaultErrorMessages();
// create pre-initialization properties
CPropertyAction* pAct;
// Name
CreateProperty(MM::g_Keyword_Name, g_SliderDeviceName, MM::String, true);
// Description
CreateProperty(MM::g_Keyword_Description, "TOFRA CubeSlider with Integrated Controller", MM::String, true);
// Com port
pAct = new CPropertyAction (this, &CubeSlider::OnCOMPort);
CreateProperty(MM::g_Keyword_Port, "", MM::String, false, pAct, true);
// State
pAct = new CPropertyAction (this, &CubeSlider::OnState);
CreateProperty(MM::g_Keyword_State, "0", MM::Integer, false, pAct, true);
// Label
pAct = new CPropertyAction (this, &CStateBase::OnLabel);
CreateProperty(MM::g_Keyword_Label, "", MM::String, false, pAct, true);
// Number of positions
pAct = new CPropertyAction (this, &CubeSlider::OnNumPos);
CreateProperty("NumPos", "6", MM::Integer, false, pAct, true);
// Create default positions and labels
const int bufSize = 1024;
char buf[bufSize];
for (long i=0; i<NumPos; i++)
{
snprintf(buf, bufSize, "Cube-%.2ld", i + 1);
SetPositionLabel(i, buf);
}
// ControllerName - Name (number) of the motor controller on the serial line
pAct = new CPropertyAction (this, &CubeSlider::OnControllerName);
CreateProperty("ControllerName", "6", MM::String, false, pAct, true);
// SlewVelocity
pAct = new CPropertyAction (this, &CubeSlider::OnSlewVelocity);
CreateProperty("SlewVelocity", "400000", MM::Float, false, pAct, true);
// InitVelocity
pAct = new CPropertyAction (this, &CubeSlider::OnInitVelocity);
CreateProperty("InitVelocity", "200000", MM::Float, false, pAct, true);
// Acceleration
pAct = new CPropertyAction (this, &CubeSlider::OnAcceleration);
CreateProperty("Acceleration", "1000", MM::Float, false, pAct, true);
// HomeSlewVel
pAct = new CPropertyAction (this, &CubeSlider::OnHomeSlewVel);
CreateProperty("HomeSlewVel", "50000", MM::Float, false, pAct, true);
// HomeInitVel
pAct = new CPropertyAction (this, &CubeSlider::OnHomeInitVel);
CreateProperty("HomeInitVel", "5000", MM::Float, false, pAct, true);
// HomeAccel
pAct = new CPropertyAction (this, &CubeSlider::OnHomeAccel);
CreateProperty("HomeAccel", "100", MM::Float, false, pAct, true);
// HoldCurrent
pAct = new CPropertyAction (this, &CubeSlider::OnHoldCurrent);
CreateProperty("HoldCurrent", "5", MM::Integer, false, pAct, true);
// RunCurrent
pAct = new CPropertyAction (this, &CubeSlider::OnRunCurrent);
CreateProperty("RunCurrent", "70", MM::Integer, false, pAct, true);
// HomeOffsetUm
pAct = new CPropertyAction (this, &CubeSlider::OnHomeOffsetUm);
CreateProperty("HomeOffsetUm", "700", MM::Integer, false, pAct, true);
// BetweenPosUm
pAct = new CPropertyAction (this, &CubeSlider::OnBetweenPosUm);
CreateProperty("BetweenPosUm", "40000", MM::Integer, false, pAct, true);
// LeadUm
pAct = new CPropertyAction (this, &CubeSlider::OnLeadUm);
CreateProperty("LeadUm", "25400", MM::Integer, false, pAct, true);
// MotorSteps
pAct = new CPropertyAction (this, &CubeSlider::OnMotorSteps);
CreateProperty("MotorSteps", "200", MM::Integer, false, pAct, true);
// StepDivide
pAct = new CPropertyAction (this, &CubeSlider::OnStepDivide);
CreateProperty("StepDivide", "16", MM::Integer, false, pAct, true);
EnableDelay(); // signals that the delay setting will be used
}
CubeSlider::~CubeSlider()
{
Shutdown();
}
void CubeSlider::GetName(char* Name) const
{
CDeviceUtils::CopyLimitedString(Name, g_SliderDeviceName);
}
int CubeSlider::Initialize()
{
int ret;
// Update Status
ret = UpdateStatus();
if (ret != DEVICE_OK) return ret;
// Initialize and Home
position_ = 0;
ret = InitializeCubeSlider();
if (ret != DEVICE_OK) return ret;
changedTime_ = GetCurrentMMTime();
initialized_ = true;
return DEVICE_OK;
}
int CubeSlider::Shutdown()
{
if (initialized_) initialized_ = false;
return DEVICE_OK;
}
bool CubeSlider::Busy()
{
// In case of error we postulate that device is not busy
// Clear serial port from previous stuff
int ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return false;
// Query current status
const int bufSize = 20;
char buf[bufSize];
snprintf(buf, bufSize, "/%sQ", ControllerName.c_str());
ret = SendSerialCommand(port_.c_str(),buf,"\r");
if (ret != DEVICE_OK) return false;
// Read response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return false;
// Analyze response
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return false;
if (answer.substr(ret,1).compare("@") == 0) return true;
return false;
}
///////////////////////////////////////////////////////////////////////////////
// Action handlers - CubeSlider
///////////////////////////////////////////////////////////////////////////////
int CubeSlider::OnState(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet)
{
pProp->Set(position_);
// nothing to do, let the caller use the cached property
}
else if (eAct == MM::AfterSet)
{
// Set timer for the Busy signal
changedTime_ = GetCurrentMMTime();
long pos;
pProp->Get(pos);
if (pos >= NumPos || pos < 0)
{
pProp->Set(position_);
return ERR_UNKNOWN_POSITION;
}
if (position_ == pos) return DEVICE_OK;
// form absolute move command
long utarget,mtarget;
const int bufSize = 1024;
char buf[bufSize];
char mbuf[bufSize];
utarget = pos * BetweenPosUm + HomeOffsetUm;
mtarget = (long) (utarget / stepSizeUm_ + 0.5);
snprintf(mbuf, bufSize, "Target Position %ld, Command A%ldR", pos, mtarget);
LogMessage(mbuf, true);
snprintf(buf, bufSize, "/%sA%ldR", ControllerName.c_str(), mtarget);
// Clear serial port from previous stuff
int ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return ret;
// Send move command
ret = SendSerialCommand(port_.c_str(),buf,"\r");
if (ret != DEVICE_OK) return ret;
// Read and analyze response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
position_ = pos;
}
return DEVICE_OK;
}
int CubeSlider::OnNumPos(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(NumPos);
}
else if (eAct == MM::AfterSet) {
pProp->Get(NumPos);
// (re)create default positions and labels
const int bufSize = 1024;
char buf[bufSize];
for (long i=0; i<NumPos; i++)
{
snprintf(buf, bufSize, "Cube-%.2ld", i + 1);
SetPositionLabel(i, buf);
}
// Update Status - what does it do?
int ret = UpdateStatus();
if (ret != DEVICE_OK) return ret;
}
return DEVICE_OK;
}
int CubeSlider::OnCOMPort(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet)
{
pProp->Set(port_.c_str());
}
else if (eAct == MM::AfterSet)
{
if (initialized_)
{
pProp->Set(port_.c_str()); // revert
}
pProp->Get(port_);
}
return DEVICE_OK;
}
int CubeSlider::OnControllerName(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(ControllerName.c_str());
}
else if (eAct == MM::AfterSet) {
pProp->Get(ControllerName);
}
return DEVICE_OK;
}
int CubeSlider::OnSlewVelocity(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(SlewVelocity);
}
else if (eAct == MM::AfterSet) {
pProp->Get(SlewVelocity);
}
return DEVICE_OK;
}
int CubeSlider::OnInitVelocity(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(InitVelocity);
}
else if (eAct == MM::AfterSet) {
pProp->Get(InitVelocity);
}
return DEVICE_OK;
}
int CubeSlider::OnAcceleration(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(Acceleration);
}
else if (eAct == MM::AfterSet) {
pProp->Get(Acceleration);
}
return DEVICE_OK;
}
int CubeSlider::OnHomeSlewVel(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(HomeSlewVel);
}
else if (eAct == MM::AfterSet) {
pProp->Get(HomeSlewVel);
}
return DEVICE_OK;
}
int CubeSlider::OnHomeInitVel(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(HomeInitVel);
}
else if (eAct == MM::AfterSet) {
pProp->Get(HomeInitVel);
}
return DEVICE_OK;
}
int CubeSlider::OnHomeAccel(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(HomeAccel);
}
else if (eAct == MM::AfterSet) {
pProp->Get(HomeAccel);
}
return DEVICE_OK;
}
int CubeSlider::OnHoldCurrent(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(HoldCurrent);
}
else if (eAct == MM::AfterSet) {
pProp->Get(HoldCurrent);
}
return DEVICE_OK;
}
int CubeSlider::OnRunCurrent(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(RunCurrent);
}
else if (eAct == MM::AfterSet) {
pProp->Get(RunCurrent);
}
return DEVICE_OK;
}
int CubeSlider::OnHomeOffsetUm(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(HomeOffsetUm);
}
else if (eAct == MM::AfterSet) {
pProp->Get(HomeOffsetUm);
}
return DEVICE_OK;
}
int CubeSlider::OnBetweenPosUm(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(BetweenPosUm);
}
else if (eAct == MM::AfterSet) {
pProp->Get(BetweenPosUm);
}
return DEVICE_OK;
}
int CubeSlider::OnLeadUm(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(LeadUm);
}
else if (eAct == MM::AfterSet) {
pProp->Get(LeadUm);
}
return DEVICE_OK;
}
int CubeSlider::OnMotorSteps(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(MotorSteps);
}
else if (eAct == MM::AfterSet) {
pProp->Get(MotorSteps);
}
return DEVICE_OK;
}
int CubeSlider::OnStepDivide(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(StepDivide);
}
else if (eAct == MM::AfterSet) {
pProp->Get(StepDivide);
}
return DEVICE_OK;
}
int CubeSlider::InitializeCubeSlider()
{
// Calculate step size
stepSizeUm_ = (double)LeadUm/((double)StepDivide*MotorSteps);
// From microns to microsteps
long slvel = (long) (SlewVelocity / stepSizeUm_ + 0.5);
long invel = (long) (InitVelocity / stepSizeUm_ + 0.5);
long accel = (long) (Acceleration / stepSizeUm_ + 0.5);
long hslvel = (long) (HomeSlewVel / stepSizeUm_ + 0.5);
long hinvel = (long) (HomeInitVel / stepSizeUm_ + 0.5);
long haccel = (long) (HomeAccel / stepSizeUm_ + 0.5);
int ret;
// Clear serial port from previous stuff
ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return ret;
// for absolute move command for first position
long mtarget;
mtarget = (long) (HomeOffsetUm / stepSizeUm_ + 0.5);
// Set controller parameters and do homing
const int bufSize = 1024;
char cbuf[bufSize];
// Form command string to set current values of parameters and home the slider
//snprintf(cbuf,bufSize, "/%sj%ldh%ldm%ldV%ldv%ldL%ldZ1000000000R",ControllerName.c_str(),
// StepDivide,HoldCurrent,RunCurrent,slvel,invel,accel);
snprintf(cbuf,bufSize, "/%sj%ldh%ldm%ldV%ldv%ldL%ldZ1000000000A%ldV%ldv%ldL%ldR",ControllerName.c_str(),
StepDivide,HoldCurrent,RunCurrent,hslvel,hinvel,haccel,mtarget,slvel,invel,accel);
ret = SendSerialCommand(port_.c_str(),cbuf,"\r");
if (ret != DEVICE_OK) return ret;
// Read response
std::string answer;
ret = GetSerialAnswer(port_.c_str(), "\r", answer);
if (ret != DEVICE_OK) return ret;
// Analyze response
ret = AnalyzeAnswer(answer);
if (ret == ERR_BAD_CONTROLLER_RESPONSE) return ERR_BAD_CONTROLLER_RESPONSE;
return DEVICE_OK;
}
///////////////////////////////////////////////////////////////////////////////
// TOFRA rgbLED Implementation
///////////////////////////////////////////////////////////////////////////////
rgbLED::rgbLED() :
busy_(false),
initialized_(false),
changedTime_(0.0),
position_(0),
port_(""),
delay_(20),
Channel1Intensity(0), // Intensity in scale [0 1] of Channel 1
Channel2Intensity(0), // Intensity in scale [0 1] of Channel 2
Channel3Intensity(0), // Intensity in scale [0 1] of Channel 3
Channel4Intensity(0), // Intensity in scale [0 1] of Channel 4
NumPos(5) // number of states in rgbLED (R, G, B, A, Off)
{
InitializeDefaultErrorMessages();
// create pre-initialization properties
CPropertyAction* pAct;
// Name
CreateProperty(MM::g_Keyword_Name, g_rgbLEDDeviceName, MM::String, true);
// Description
CreateProperty(MM::g_Keyword_Description, "TOFRA rgbLED", MM::String, true);
// Com port
pAct = new CPropertyAction (this, &rgbLED::OnCOMPort);
CreateProperty(MM::g_Keyword_Port, "", MM::String, false, pAct, true);
// State
pAct = new CPropertyAction (this, &rgbLED::OnState);
CreateProperty(MM::g_Keyword_State, "0", MM::Integer, false, pAct, true);
// Label
pAct = new CPropertyAction (this, &CStateBase::OnLabel);
CreateProperty(MM::g_Keyword_Label, "", MM::String, false, pAct, true);
// Number of positions
pAct = new CPropertyAction (this, &rgbLED::OnNumPos);
CreateProperty("NumPos", "5", MM::Integer, false, pAct, true);
// Create default positions and labels
SetPositionLabel(0, "Off");
SetPositionLabel(1, "R");
SetPositionLabel(2, "G");
SetPositionLabel(3, "B");
SetPositionLabel(4, "A");
// Channel1Intensity
pAct = new CPropertyAction (this, &rgbLED::OnChannel1Intensity);
CreateProperty("Channel1Intensity", "0", MM::Float, false, pAct, true);
// Channel2Intensity
pAct = new CPropertyAction (this, &rgbLED::OnChannel2Intensity);
CreateProperty("Channel2Intensity", "0", MM::Float, false, pAct, true);
// Channel3Intensity
pAct = new CPropertyAction (this, &rgbLED::OnChannel3Intensity);
CreateProperty("Channel3Intensity", "0", MM::Float, false, pAct, true);
// Channel4Intensity
pAct = new CPropertyAction (this, &rgbLED::OnChannel4Intensity);
CreateProperty("Channel4Intensity", "0", MM::Float, false, pAct, true);
EnableDelay(); // signals that the delay setting will be used
}
rgbLED::~rgbLED()
{
Shutdown();
}
void rgbLED::GetName(char* Name) const
{
CDeviceUtils::CopyLimitedString(Name, g_rgbLEDDeviceName);
}
int rgbLED::Initialize()
{
int ret;
// Update Status
ret = UpdateStatus();
if (ret != DEVICE_OK) return ret;
// Initialize
position_ = 0;
ret = InitializergbLED();
if (ret != DEVICE_OK) return ret;
changedTime_ = GetCurrentMMTime();
initialized_ = true;
return DEVICE_OK;
}
int rgbLED::Shutdown()
{
if (initialized_) initialized_ = false;
return DEVICE_OK;
}
bool rgbLED::Busy()
{
return false;
}
///////////////////////////////////////////////////////////////////////////////
// Action handlers - rgbLED
///////////////////////////////////////////////////////////////////////////////
int rgbLED::OnState(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet)
{
pProp->Set(position_);
// nothing to do, let the caller use the cached property
}
else if (eAct == MM::AfterSet)
{
// Set timer for the Busy signal
changedTime_ = GetCurrentMMTime();
long pos;
pProp->Get(pos);
if (pos >= NumPos || pos < 0)
{
pProp->Set(position_);
return ERR_UNKNOWN_POSITION;
}
if (position_ == pos) return DEVICE_OK;
// Clear serial port from previous stuff
int ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return ret;
// Send Intensity Values
const char* rOff = "AVA500"; const char* rMax = "AVA000";
const char* gOff = "AVB500"; const char* gMax = "AVB000";
const char* bOff = "AVC500"; const char* bMax = "AVC000";
const char* aOff = "AVD500"; const char* aMax = "AVD000";
switch(pos)
{
case 0:
ret = SendSerialCommand(port_.c_str(),rOff,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),gOff,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),bOff,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),aOff,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
break;
case 1:
ret = SendSerialCommand(port_.c_str(),gOff,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),bOff,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),aOff,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),rMax,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
break;
case 2:
ret = SendSerialCommand(port_.c_str(),rOff,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),bOff,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),aOff,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),gMax,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
break;
case 3:
ret = SendSerialCommand(port_.c_str(),rOff,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),gOff,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),aOff,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),bMax,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
break;
case 4:
ret = SendSerialCommand(port_.c_str(),rOff,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),gOff,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),bOff,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),aMax,"\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
break;
}
position_ = pos;
}
return DEVICE_OK;
}
int rgbLED::OnNumPos(MM::PropertyBase* pProp, MM::ActionType eAct)
{
long np;
if (eAct == MM::BeforeGet) {
pProp->Set(NumPos);
}
else if (eAct == MM::AfterSet) {
pProp->Get(np);
// Ignore set
}
return DEVICE_OK;
}
int rgbLED::OnCOMPort(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet)
{
pProp->Set(port_.c_str());
}
else if (eAct == MM::AfterSet)
{
if (initialized_)
{
pProp->Set(port_.c_str()); // revert
}
pProp->Get(port_);
}
return DEVICE_OK;
}
int rgbLED::OnChannel1Intensity(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(Channel1Intensity);
}
else if (eAct == MM::AfterSet) {
pProp->Get(Channel1Intensity);
ChannelIntensity(1,Channel1Intensity);
}
return DEVICE_OK;
}
int rgbLED::OnChannel2Intensity(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(Channel2Intensity);
}
else if (eAct == MM::AfterSet) {
pProp->Get(Channel2Intensity);
ChannelIntensity(2,Channel2Intensity);
}
return DEVICE_OK;
}
int rgbLED::OnChannel3Intensity(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(Channel3Intensity);
}
else if (eAct == MM::AfterSet) {
pProp->Get(Channel3Intensity);
ChannelIntensity(3,Channel3Intensity);
}
return DEVICE_OK;
}
int rgbLED::OnChannel4Intensity(MM::PropertyBase* pProp, MM::ActionType eAct)
{
if (eAct == MM::BeforeGet) {
pProp->Set(Channel4Intensity);
}
else if (eAct == MM::AfterSet) {
pProp->Get(Channel4Intensity);
ChannelIntensity(4,Channel4Intensity);
}
return DEVICE_OK;
}
int rgbLED::InitializergbLED()
{
int ret;
// Clear serial port from previous stuff
ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return ret;
// Turn off all channels
ret = SendSerialCommand(port_.c_str(),"AVA500","\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),"AVB500","\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),"AVC500","\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
ret = SendSerialCommand(port_.c_str(),"AVD500","\r"); if (ret != DEVICE_OK) return ret; CDeviceUtils::SleepMs(delay_);
return DEVICE_OK;
}
int rgbLED::ChannelIntensity(long channel, double intensity)
{
if (intensity > 1 || intensity < 0) return DEVICE_INVALID_PROPERTY_VALUE;
int ret;
// Clear serial port from previous stuff
ret = ClearPort(*this, *GetCoreCallback(), port_);
if (ret != DEVICE_OK) return ret;
// Recalculate intensity into [500 0] scale
int val;
val = (int) floor(500 - intensity*500);
// Form channel letter
const char* sch;
switch(channel)
{
case 1: sch = "A"; break;
case 2: sch = "B"; break;
case 3: sch = "C"; break;
case 4: sch = "D"; break;
default: sch = " ";
}
// Form command and send it
const int bufSize = 1024;
char cbuf[bufSize];
snprintf(cbuf,bufSize, "AV%s%.3d",sch,val);
ret = SendSerialCommand(port_.c_str(),cbuf,"\r");
if (ret != DEVICE_OK) return ret;
// Wait
CDeviceUtils::SleepMs(delay_);
return DEVICE_OK;
}
| [
"arthur@d0ab736e-dc22-4aeb-8dc9-08def0aa14fd"
] | arthur@d0ab736e-dc22-4aeb-8dc9-08def0aa14fd |
a8ded18ff3601068350fa2a2bba0d85954833c80 | f1cead17de6d330567c8b876ab54af19c7a5ac62 | /Peephole.hpp | 7a96c05565bfa5021d9ac81f02896379874f8577 | [] | no_license | lgratian/compiler | 27f077e95d8628b92f3c6bca3cdd7ff1bae4c4aa | 82a7f2f4d9fdcf122d22d296985ee6f5575995cf | refs/heads/master | 2021-01-19T07:17:38.689025 | 2012-07-01T09:06:33 | 2012-07-01T09:06:33 | 4,561,695 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 42,047 | hpp | // Peephole.hpp
// Copyright (c) Lup Gratian
//
// Defines the module that performs peephole optimizations. This is not exactly
// the "peephole" optimization described in the literature, but it's close enough.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#ifndef PC_OPTIMIZATION_PEEPHOLE_HPP
#define PC_OPTIMIZATION_PEEPHOLE_HPP
#include "../IR/Instructions.hpp"
#include "../IR/Operand.hpp"
#include "../IR/Constants.hpp"
#include "../IR/References.hpp"
#include "../IR/IRGenerator.hpp"
#include "../Analysis/PatternMatching.hpp"
#include "../Analysis/ConstantFolder.hpp"
#include "../Analysis/IntArithmetic.hpp"
#include "../Analysis/FloatArithmetic.hpp"
#include "../Analysis/SafetyInfo.hpp"
#include "../Analysis/OperandInfo.hpp"
#include "../Compilation Pass/Pass.hpp"
#include "../Base/ObjectDumper.hpp"
#include "../Base/List.hpp"
#include "../Base/StaticList.hpp"
#include "../Base/Log.hpp"
using namespace IR;
using namespace Analysis;
using namespace Base;
using namespace CompilationPass;
namespace Optimization {
// Used to log where a peephole replacement takes place.
// Useful when we want to know witch pattern matched.
#ifdef LOG
#error "LOG already defined"
#elif 1
#define LOG(value) LogReplacement(__FILE__, __LINE__, #value), value
#else
#define LOG(value) value
#endif
class Peephole : public Pass {
private:
enum CmpCmpComparand {
CmpCmp_Zero,
CmpCmp_Left,
CmpCmp_Right
};
// Represents a value range from a constant global variable.
struct ConstantRange {
__int64 Value; // The value represented by the range.
__int64 StartIndex; // The first position where the value is found.
__int64 Count; // The number of consecutive values.
ConstantRange() {}
ConstantRange(__int64 value, __int64 startIndex, __int64 count = 0) :
Value(value), StartIndex(startIndex), Count(count) {}
ConstantRange(const ConstantRange& other) :
Value(other.Value), StartIndex(other.StartIndex), Count(other.Count) {}
};
typedef IntArithmetic IA;
typedef FloatArithmetic FA;
typedef Analysis::TypeInfo TI;
typedef StaticList<ConstantRange, 64> RangeList;
typedef StaticList<__int64, 4> IndexList;
typedef StaticList<Instruction*, 32> InstructionList;
typedef StaticList<Operand*, 32> OperandList;
typedef StaticList<Block*, 32> BlockList;
Operand* resultOp_; // The result of the simplification.
IRGenerator irGen_; // The helper IR generator.
ConstantFolder folder_;
List<Instruction*> worklist_;
OperandInfo opInfo_;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
__int64 GetMaxConstArraySize() {
//! This should consider the optimization level!!! (256 for max - an ASCII table)
return 64;
}
bool ShouldLoadFromConstStruct() {
//! This should return false for lower optimization levels!!!
return true;
}
int MaxConstNestedLevels() {
//! This should return 5-6 for maximum optimization level!!!
return 3;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for logging.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LogReplacement(const char* file, int line, const char* value);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for obtaining a constant having a specific value.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IntConstant* GetZeroInt(const Type* type) {
return irGen_.GetIntConst(type, 0);
}
IntConstant* GetZeroInt(Operand* base) {
return GetZeroInt(base->GetType());
}
IntConstant* GetOneInt(const Type* type) {
return irGen_.GetIntConst(type, 1);
}
IntConstant* GetOneInt(Operand* base) {
return GetOneInt(base->GetType());
}
FloatConstant* GetOneFloat(const Type* type) {
return irGen_.GetFloatingConst(type, 1.0);
}
FloatConstant* GetOneFloat(Operand* base) {
return GetOneFloat(base->GetType());
}
IntConstant* GetBool(bool state, const Type* type = nullptr) {
// If no type was provided we use 'int32'.
if(type == nullptr) {
type = IntegerType::GetInt32();
}
if(state) return GetOneInt(type);
else return GetZeroInt(type);
}
IntConstant* GetBool(bool state, Operand* base) {
return GetBool(state, base->GetType());
}
IntConstant* GetMinusOneInt(const Type* type) {
return irGen_.GetIntConst(type, -1);
}
IntConstant* GetMinusOneInt(Operand* base) {
const IntegerType* type = base->GetType()->As<IntegerType>();
return GetMinusOneInt(type);
}
FloatConstant* GetZeroFloat(const Type* type) {
return irGen_.GetFloatingConst(type, 0.0);
}
FloatConstant* GetZeroFloat(Operand* base) {
const FloatingType* type = base->GetType()->As<FloatingType>();
return GetZeroFloat(type);
}
UndefinedConstant* GetUndefined(const Type* type) {
return irGen_.GetUndefinedConst(type);
}
UndefinedConstant* GetUndefined(Operand* base) {
return irGen_.GetUndefinedConst(base->GetType());
}
NullConstant* GetNullptr(const Type* type) {
return irGen_.GetNullConst(type);
}
NullConstant* GetNullptr(Operand* base) {
return irGen_.GetNullConst(base->GetType());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Some helper methods.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InstructionSimplified(Instruction* before, Operand* after);
// Returns a temporary having the type of the specified operand.
Operand* GetTemporary(Operand* base) {
return irGen_.GetTemporary(base->GetType());
}
Operand* GetTemporary(const Type* type) {
return irGen_.GetTemporary(type);
}
IntConstant* AsIntConstant(Operand* op, Block* testBlock) {
OperandInfo opInfo(irGen_.GetUnit(), GetTarget());
return opInfo.GetIntConstant(op, testBlock);
}
bool IsZeroInt(Operand* op, Block* testBlock) {
if(op->IsZeroInt()) return true;
else {
OperandInfo opInfo(irGen_.GetUnit(), GetTarget());
return opInfo.IsZero(op, testBlock);
}
}
bool IsNotZeroInt(Operand* op, Block* testBlock) {
if(op->IsZeroInt()) return true;
else {
OperandInfo opInfo(irGen_.GetUnit(), GetTarget());
return opInfo.IsNotZero(op, testBlock);
}
}
bool IsOneInt(Operand* op, Block* testBlock) {
if(op->IsOneInt()) return true;
else if(auto intConst = AsIntConstant(op, testBlock)) {
return intConst->IsOne();
}
else return false;
}
bool IsMinusOneInt(Operand* op, Block* testBlock) {
if(op->IsMinusOneInt()) return true;
else if(auto intConst = AsIntConstant(op, testBlock)) {
return intConst->IsMinusOne();
}
else return false;
}
bool AreEqual(Operand* a, Operand* b, Block* testBlock) {
if(a == b) return true;
OperandInfo opInfo(irGen_.GetUnit());
return opInfo.AreEqual(a, b, testBlock) == Result_Yes;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying frequent tasks.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// If 'opA' is a constant and 'opB' is not it swaps the operands.
bool MoveConstantToRight(Operand*& opA, Operand*& opB);
// Returns 'true' if the operand performs '~a'.
bool IsLogicalNot(Operand* op, Operand** result = nullptr);
// Returns the specified integer operand negated.
Operand* NegateInt(Operand* op);
// Returns the specified floating operand negated.
Operand* NegateFloat(Operand* op);
// Returns 'true' if 'b == a + 1'.
bool IsLeftRightMinusOne(IntConstant* a, IntConstant* b);
// Creates a 'ptop' instruction if the operand's type
// is not 'originalType'.
Operand* InsertPtopIfRequired(Operand* op, const Type* originalType);
// Creates a 'sext' or 'zext' instruction (depends on 'isSigned')
// if the operand's type is not 'type'.
Operand* CreateIntCastIfRequired(Operand* op, const Type* type,
bool isSigned = true);
// Strips all pointer cast from the specified operand.
Operand* WithoutPointerCasts(Operand* op);
// Creates a binary instruction ('add', 'or', for ex.).
Operand* CreateBinaryInstruction(Opcode opcode, Operand* leftOp,
Operand* rightOp, const Type* resultType,
Instruction* insertionPoint = nullptr,
Instruction* previousInsertionPoint = nullptr,
FloatMode mode = FP_Exact);
// Returns '~op' (the bitwise complement).
Operand* GetNegated(Operand* op) {
auto xorOp = GetTemporary(op);
irGen_.GetXor(op, GetMinusOneInt(op), xorOp);
return xorOp;
}
// Transfers the 'undefined signed overflow' flag
// from 'instr' to the instruction that defines 'op'.
Operand* PreserveUSO(Instruction* instr, Operand* op);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying the task of creating comparisons.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Creates an instruction that compares the two operands
// using the specified order.
Operand* CreateCompare(Operand* opA, Operand* opB, OrderType order,
const Type* resultType, bool isUcmp = false);
// Creates an instruction that verifies if the operand
// lies between the specified integer constants.
// 'op > leftConst && op < rightConst'
Operand* CreateRangeCompare(Operand* op, IntConstant* leftConst,
IntConstant* rightConst, const Type* resultType,
bool isUcmp = false, bool noLeftInc = false);
// Creates an instruction that verifies if the operand
// lies outside the specified integer constants.
// 'op < leftConst || op > rightConst'
Operand* CreateOutOfRangeCompare(Operand* op, IntConstant* leftConst,
IntConstant* rightConst, const Type* resultType,
bool isUcmp = false, bool noLeftInc = false);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'add' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleAdd(Operand* opA, Operand* opB, Block* block,
bool constMoveAllowed = true);
Operand* HandleAddSimple(Operand* opA, Operand* opB, Block* block,
bool createAllowed = true);
Operand* HandleAddComplex(Operand* opA, Operand* opB, Block* block);
Operand* HandleAddDistributive(Operand* opA, Operand* opB, Block* block);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'fadd' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleFadd(Operand* opA, Operand* opB, FloatMode mode);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'sub' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleSub(Operand* opA, Operand* opB, Block* block);
Operand* HandleSubSimple(Operand* opA, Operand* opB, Block* block,
bool createAllowed = true);
Operand* HandleSubAssociative(Operand* opA, Operand* opB, Block* block);
Operand* HandleSubComplex(Operand* opA, Operand* opB, Block* block);
Operand* HandleSubPointers(Operand* opA, Operand* opB);
Operand* CreateBaseDifference(Operand* baseOpA, Operand* baseOpB,
const Type* castType);
Operand* CreateMultipliedOffset(const Type* offsetType,Operand* offsetOp,
const Type* resultType,
bool negatedOffsetOp = false);
Operand* CreateFieldOffset(ElementInstr* elemInstr, const Type* resultType,
bool negateOffset = false);
Operand* HandleSubPointersAddrIndex(AddressInstr* addrInstrA,
AddressInstr* addrInstrB,
const Type* castType);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'fsub' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleFsub(Operand* opA, Operand* opB, FloatMode mode);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'mul' and 'fadd' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleMul(Operand* opA, Operand* opB, Block* block,
bool constMoveAllowed = true);
Operand* HandleMulSimple(Operand* opA, Operand* opB, Block* block,
bool createAllowed = true);
Operand* HandleMulComplex(Operand* opA, Operand* opB, Block* block);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'fmul' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleFmul(Operand* opA, Operand* opB, FloatMode mode);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'div' and 'udiv' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleDiv(Operand* opA, Operand* opB, Block* block,
bool hasNoRemainder = false);
Operand* HandleUdiv(Operand* opA, Operand* opB, Block* block);
Operand* HandleDivCommon(Operand* opA, Operand* opB, Block* block, bool isDiv);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'fdiv' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleFdiv(Operand* opA, Operand* opB, FloatMode mode);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'mod' and 'umod' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleMod(Operand* opA, Operand* opB, Block* block);
Operand* HandleUmod(Operand* opA, Operand* opB, Block* block);
Operand* HandleModCommon(Operand* opA, Operand* opB, Block* block, bool isMod);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'and' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleAnd(Operand* opA, Operand* opB, Block* block,
bool constMoveAllowed = true);
Operand* HandleAndSimple(Operand* opA, Operand* opB, Block* block,
bool createAllowed = true);
Operand* HandleAndCmpCmp(Operand* opA, Operand* opB, Block* block);
Operand* HandleAndOneConst(Operand* opA, Operand* opB, Block* block);
Operand* HandleAndTwoConst(Operand* opA, Operand* opB, Block* block);
Operand* HandleAndIntCmp(Operand* opA, Operand* opB, Block* block);
Operand* HandleAndIntCmpConst(CmpInstrBase* leftCmp, CmpInstrBase* rightCmp,
IntConstant* leftConst, IntConstant* rightConst);
Operand* HandleAndIntCmpSameConst(CmpInstrBase* leftCmp, CmpInstrBase* rightCmp,
Block* block);
Operand* HandleAndFloatCmp(Operand* opA, Operand* opB);
Operand* HandleAndBit(Operand* opA, Operand* opB, Block* block);
Operand* HandleAndOperandInfo(Operand* opA, Operand* opB, Block* block);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'or' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleOr(Operand* opA, Operand* opB, Block* block,
bool constMoveAllowed = true);
Operand* HandleOrSimple(Operand* opA, Operand* opB, Block* block,
bool createAllowed = true);
Operand* HandleOrCmpCmp(Operand* opA, Operand* opB, Block* block);
Operand* HandleOrOperandInfo(Operand* opA, Operand* opB);
Operand* HandleOrIntCmp(Operand* opA, Operand* opB, Block* block);
Operand* HandleOrIntCmpConst(CmpInstrBase* leftCmp, CmpInstrBase* rightCmp,
IntConstant* leftConst, IntConstant* rightConst);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'xor' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleXor(Operand* opA, Operand* opB, Block* block,
bool constMoveAllowed = true);
Operand* HandleXorSimple(Operand* opA, Operand* opB, Block* block,
bool createAllowed = true);
Operand* HandleXorIntCmp(Operand* opA, Operand* opB, Block* block);
Operand* HandleXorConst(Operand* opA, Operand* opB, Block* block);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying shift instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleShl(ShlInstr* instr);
Operand* HandleShr(ShrInstr* instr);
Operand* HandleUshr(UshrInstr* instr);
Operand* HandleShiftCommon(LogicalInstr* instr);
Operand* HandleShiftSimple(Operand* opA, Operand* opB, bool isShl,
Block* block, bool createAllowed = true);
Operand* HandleShiftConst(Operand* opA, Operand* opB, LogicalInstr* instr);
bool CanSimplifyShiftWithConst(LogicalInstr* instr);
bool CanSimplifyShiftWithConstImpl(Operand* op, IntConstant* shiftAmount, bool isLeft);
Operand* SimplifyShiftWithConst(Operand* op, IntConstant* shiftAmount, bool isLeft);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying comparison instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleCmp(CmpInstr* instr);
Operand* HandleUcmp(UcmpInstr* instr);
Operand* HandleFcmp(FcmpInstr* instr);
Operand* HandleFcmpFraction(FcmpInstr* instr, ConversionInstr* itofInstr,
FloatConstant* floatConst, __int64 floatToInt);
Operand* TestItofRange(FcmpInstr* instr, ConversionInstr* itofInstr,
FloatConstant* floatConst);
void ShrinkIntegerCmpConstants(CmpInstrBase* instr);
void CanonicalizeIntegerCmp(CmpInstrBase* instr);
bool MatchCmpCmpOperands(CmpInstrBase* cmpInstrA, CmpInstrBase* cmpInstrB,
CmpCmpComparand comp, bool expectAnd,
Operand*& a, Operand*& b, Operand*& d);
Operand* HandleUcmpAddress(UcmpInstr* instr);
Operand* HandleIntegerCmp(CmpInstrBase* instr);
Operand* HandleIntegerCmpWithZero(Operand* opA, Operand* opB,
Operand* resultOp, OrderType order,
bool isUnsigned, Block* block);
Operand* HandleIntegerCmpConstGeneric(Operand* opA, IntConstant* intConst,
Operand* resultOp, OrderType order,
bool isSigned, Block* block);
Operand* HandleIntegerCmpConst(Operand* opA, IntConstant* intConst,
Operand* resultOp, OrderType order,
Block* block);
Operand* HandleIntegerCmpBool(Operand* opA, Operand* opB, Operand* resultOp,
OrderType order, bool isSigned, Block* block);
Operand* HandleIntegerCmpExtension(Operand* opA, Operand* opB, Operand* resultOp,
OrderType order, bool isSigned, Block* block);
bool EstimateOperandRange(Operand* opA, IntConstant* intConst,
bool& minInclusive, bool& maxInclusive,
__int64& rangeMin, __int64& rangeMax,
Block* block);
Operand* HandleIntegerCmpPtr(Operand* opA, Operand* opB, Operand* resultOp,
OrderType order);
Operand* HandleIntegerCmpBin(Operand* opA, Operand* opB, Operand* resultOp,
OrderType order, bool isSigned, Block* block);
Operand* HandleIntegerCmpAddSubConst(Operand* opA, Operand* opB, Operand* resultOp,
OrderType order, bool isSigned, Block* block);
Operand* HandleIntegerCmpNegated(Operand* opA, Operand* opB, Operand* resultOp,
OrderType order, bool isSigned, Block* block);
Operand* HandleIntegerCmpLogical(LogicalInstr* logicalInstrA,
LogicalInstr* logicalInstrB, Operand* resultOp,
OrderType order, bool isSigned, Block* block);
Operand* HandleIntegerCmpMul(MulInstr* mulInstrA, MulInstr* mulInstrB,
Operand* resultOp, OrderType order,
bool isSigned, Block* block);
Operand* HandleIntegerCmpXor(XorInstr* xorInstr, IntConstant* intConst,
Operand* resultOp, OrderType order,
bool isSigned, Block* block);
Operand* HandleIntegerCmpAnd(AndInstr* andInstr, IntConstant* intConst,
Operand* resultOp, OrderType order,
bool isSigned, Block* block);
Operand* HandleIntegerCmpAndZeroBits(AndInstr* andInstr, IntConstant* intConst,
Operand* resultOp, OrderType order,
bool isSigned, Block* block);
Operand* HandleIntegerCmpOr(OrInstr* orInstr, IntConstant* intConst,
Operand* resultOp, OrderType order,
bool isSigned, Block* block);
Operand* HandleIntegerCmpShl(ShlInstr* shlInstr, IntConstant* intConst,
Operand* resultOp, OrderType order,
bool isSigned, Block* block);
Operand* HandleIntegerCmpShr(LogicalInstr* shrInstr, IntConstant* intConst,
Operand* resultOp, OrderType order,
bool isSigned, Block* block);
Operand* HandleIntegerCmpDiv(ArithmeticInstr* divInstr, IntConstant* intConst,
Operand* resultOp, OrderType order,
bool isSigned, Block* block);
__int64 ComputeIntegerCmpDivBounds(ArithmeticInstr* divInstr, IntConstant* C1,
IntConstant* C2, OrderType& order,
__int64& low, __int64& high, bool& lowOverflow,
bool& highOverflow, bool& lowOverflowLess,
bool& highOverflowLess);
Operand* HandleIntegerCmpEquality(Instruction* instr, IntConstant* intConst,
Operand* resultOp, OrderType order,
bool isSigned, Block* block);
Operand* HandleIntegerCmpEqualityAnd(AndInstr* instr, IntConstant* intConst,
Operand* resultOp, OrderType order,
bool isSigned, Block* block);
Operand* HandleIntegerCmpEqualityXor(XorInstr* instr, IntConstant* intConst,
Operand* resultOp, OrderType order,
bool isSigned, Block* block);
Operand* HandleIntegerCmpEqualityMul(MulInstr* instr, IntConstant* intConst,
Operand* resultOp, OrderType order,
bool isSigned, Block* block);
Operand* HandleIntegerCmpXorEquality(Operand* opA, Operand* opB, Operand* resultOp,
OrderType order, bool isSigned, Block* block);
Operand* HandleIntegerCmpSelf(Operand* opA, Operand* opB, Operand* resultOp,
OrderType order, bool isSigned);
Operand* HandleIntegerCmpLoad(LoadInstr* instr, IntConstant* intConst,
Operand* resultOp, OrderType order, bool isSigned,
IntConstant* intConstInstr = nullptr,
Opcode opcode = Instr_Add);
Operand* HandleCmpOnQuestion(CmpInstrBase* instr);
Operand* HandleCmpOnQuestQuest(QuestionInstr* instrA, QuestionInstr* instrB,
OrderType order, bool isSigned);
// Methods for combining two comparison orders.
OrderType CombineOrdersAnd(OrderType a, OrderType b, bool& orderFalse);
OrderType CombineOrdersOr(OrderType a, OrderType b, bool& orderTrue);
OrderType CombineOrdersXor(OrderType a, OrderType b, bool& orderFalse,
bool& orderTrue);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying conversion instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleTrunc(TruncInstr* instr);
Operand* HandleTruncOperandInfo(TruncInstr* instr);
Operand* HandleZext(ZextInstr* instr);
Operand* HandleZextOperandInfo(ZextInstr* instr);
Operand* HandleZextOnTrunc(ZextInstr* instr);
Operand* HandleZextOnCmp(CmpInstrBase* instr, const IntegerType* castType);
Operand* HandleSext(SextInstr* instr);
Operand* HandleSextOperandInfo(SextInstr* instr);
Operand* HandleCastCast(Opcode opcode, Operand* op, const Type* castType);
Operand* HandleCastCastTrunc(ConversionInstr* innerCast, const Type* castType);
Operand* HandleCastCastSext(ConversionInstr* innerCast, const Type* castType);
Operand* HandleCastCastZext(ConversionInstr* innerCast, const Type* castType);
Operand* HandleCastCastItop(ConversionInstr* innerCast, const Type* castType);
Operand* HandleCastCastPtoi(ConversionInstr* innerCast, const Type* castType);
Operand* HandleFtrunc(FtruncInstr* instr);
Operand* HandleFext(FextInstr* instr);
Operand* HandleFtoi(FtoiInstr* instr);
Operand* HandleFtoui(FtouiInstr* instr);
Operand* HandleFtoiItofPair(ConversionInstr* instr);
Operand* HandleItof(ItofInstr* instr);
Operand* HandleItop(ItopInstr* instr);
Operand* HandlePtoi(PtoiInstr* instr);
Operand* HandleUitof(UitofInstr* instr);
Operand* HandlePtop(PtopInstr* instr);
int GetMaximumConversionDepth() const {
//! TODO: should be a control
//? should consider optimization level
return 8;
}
bool CanBeTruncated(Operand* op, const Type* truncType,
int depth = 0);
bool CanBeZeroExtended(Operand* op, const Type* zextType,
int& maskedBits, int depth = 0);
bool CanBeZeroExtendedInstruction(Instruction* instr, const Type* zextType,
int& maskedBits, int depth);
bool CanBeZeroExtendedInstructionUshr(Instruction* instr, const Type* zextType,
int& maskedBits, int depth);
bool CanBeSignExtended(Operand* op, const Type* sextType,
int depth = 0);
Operand* ChangeExpressionType(Operand* op, const Type* newType,
Opcode opcode);
Operand* CreateShlShrPair(Operand* op, IntConstant* amountOp,
const Type* type);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'call' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleCall(CallInstr* instr);
Operand* HandleCallPtop(CallInstr* instr, PtopInstr* ptopInstr);
bool VerifyCallPtop(CallInstr* instr, PtopInstr* ptopInstr,
const FunctionType* functionType);
Operand* HandleCallVarargs(CallInstr* instr, const FunctionType* functionType);
UndefinedConstant* GetCallUndefined(CallInstr* instr);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'if' and 'switch' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool HandleIf(IfInstr* instr);
void InvertIfTargets(IfInstr* instr);
bool HandleSwitch(SwitchInstr* instr);
bool HandleSwitchOnAddSub(SwitchInstr* switchInstr, ArithmeticInstr* arithInstr);
bool HandleSwitchOnShl(SwitchInstr* switchInstr, ShlInstr* shlInstr);
bool HandleSwitchOnMod(SwitchInstr* switchInstr);
bool HandleSwitchOnExtension(SwitchInstr* switchInstr);
bool HandleSwitchOperandInfo(SwitchInstr* switchInstr);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'addr' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleAddress(AddressInstr* instr);
Operand* HandleAddrAddr(AddressInstr* addrInstr, Operand* baseOp, Operand* indexOp);
Operand* HandleAddrItop(IntConstant* intConst, const Type* pointerType,
Operand* baseOp, IntConstant* indexOp);
Operand* HandleAddrPtopAddr(PtopInstr* ptopInstr, AddressInstr* addrInstr,
Operand* baseOp, Operand* indexOp);
Operand* HandleAddrPtopIndex(PtopInstr* ptopInstr, IndexInstr* indexInstr,
Operand* baseOp, Operand* indexOp);
Operand* HandleAddrPtopElem(PtopInstr* ptopInstr, ElementInstr* elemInstr,
Operand* baseOp, Operand* indexOp);
Operand* HandleAddrPtopArray(PtopInstr* ptopInstr, const ArrayType* arrayType,
Operand* baseOp, Operand* indexOp);
Operand* HandleAddrPtopRecord(PtopInstr* ptopInstr, const RecordType* recordType,
Operand* baseOp, Operand* indexOp);
Operand* HandleAddrIndex(IndexInstr* indexInstr, Operand* baseOp, Operand* indexOp);
Operand* HandleAddrElem(ElementInstr* elemInstr, Operand* baseOp, Operand* indexOp);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'elem' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleElement(ElementInstr* instr);
int FieldAtOffset(const RecordType* recordType, __int64 offset);
bool ElementAtOffset(const ArrayType* arrayType, __int64 offset,
__int64& fieldIndex);
Operand* CreateAddressOfField(Operand* baseOp, int fieldIndex,
const RecordType* recordType);
Operand* CreateAddressOfElement(Operand* baseOp, int index,
const ArrayType* arrayType);
Operand* CreateAddressOfElement(Operand* baseOp, Operand* indexOp,
const ArrayType* arrayType);
const RecordType* GetPointedRecord(Operand* op);
const ArrayType* GetPointedArray(Operand* op);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'index' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleIndex(IndexInstr* instr);
Operand* HandleIndexDifference(Operand* opA, Operand* opB);
Operand* SubtractIndexOps(Operand* opA, Operand* opB, const Type* resultType);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying associative, commutative
// and distributive instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleAssociative(Opcode opcode, Operand* opA, Operand* opB,
Block* block, FloatMode mode = FP_Exact);
Operand* HandleAssociativeAndCommutative(Opcode opcode, Operand* opA,
Operand* opB, Block* block,
FloatMode mode = FP_Exact);
Operand* HandleDistributive(Opcode opcode, Operand* opA, Operand* opB,
Block* block, FloatMode mode = FP_Exact);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying calls to intrinsics.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleIntrinsic(CallInstr* instr, Intrinsic* intrinsic);
Operand* HandleCopyMemoryIntr(CallInstr* instr);
Operand* HandleSetMemoryIntr(CallInstr* instr);
Operand* HandleFmulIntrinsics(Operand* opA, Operand* opB, FloatMode mode);
Operand* HandleFdivIntrinsics(Operand* opA, Operand* opB, FloatMode mode);
Operand* CreateSetMemoryValue(Operand* valueOp, int size,
const IntegerType* storeType);
Operand* HandleAbsIntrinsic(CallInstr* instr);
Operand* HandleSqrtIntrinsic(CallInstr* instr);
Operand* HandlePowIntrinsic(CallInstr* instr);
Operand* CreatePow2(Operand* op);
Operand* CreatePow4(Operand* op);
Operand* CreateFmul(Operand* opA, Operand* opB);
Operand* CreateTwoArgCall(Operand* targetOp, Operand* arg1, Operand* arg2,
const Type* resultType);
Operand* CreateOneArgCall(Operand* targetOp, Operand* argument, const Type* resultType);
Operand* HandleFmulPowOperandIntr(CallInstr* instr, Operand* op, FloatMode mode);
Operand* HandleFmulPowPowIntr(CallInstr* instrA, CallInstr* instrB, FloatMode mode);
Operand* HandleFmulIntrIntr(CallInstr* instrA, CallInstr* instrB,
MathIntrinsic* mathIntrA, MathIntrinsic* mathIntrB,
FloatMode mode);
Operand* HandleFdivPowOperandIntr(CallInstr* instr, Operand* op, FloatMode mode,
bool reversed);
Operand* HandleFdivIntrIntr(CallInstr* instrA, CallInstr* instrB,
MathIntrinsic* mathIntrA, MathIntrinsic* mathIntrB,
FloatMode mode);
Operand* HandleCmpIntrinsic(CmpInstrBase* instr);
Operand* HandleMinMaxIntrinsics(CallInstr* instr);
Operand* HandleMinMaxIntrCmp(CallInstr* instrA, CallInstr* instrB,
MathIntrinsic* mathIntrA, MathIntrinsic* mathIntrB,
OrderType order, const Type* resultType,
bool isUnsigned);
Operand* HandleMinIntrConstCmp(CallInstr* instrA, IntConstant* intConst,
OrderType order, const Type* resultType,
bool isUnsigned);
Operand* HandleMinIntrOpCmp(CallInstr* instrA, Operand* opB,
OrderType order, const Type* resultType,
bool isUnsigned);
Operand* HandleMaxIntrConstCmp(CallInstr* instrA, IntConstant* intConst,
OrderType order, const Type* resultType,
bool isUnsigned);
Operand* HandleMaxIntrOpCmp(CallInstr* instrA, Operand* opB,
OrderType order, const Type* resultType,
bool isUnsigned);
Operand* HandleMinMaxOnQuestion(QuestionInstr* instr,
IntConstant* intConst, bool isMax);
Operand* HandleMinMaxOnQuestion(QuestionInstr* instrA,
QuestionInstr* instrB, bool isMax);
bool SameMinMaxOperands(CallInstr* instrA, CallInstr* instrB);
Operand* HandleAbsIntrOpCmp(CallInstr* instrA, Operand* opB, OrderType order,
const Type* resultType, bool isUnsigned);
Operand* HandleSqrtIntrConstCmp(Operand* a, FloatConstant* C, OrderType order,
const Type* resultType);
Operand* HandleByteSwapIntrinsic(CallInstr* instr);
Operand* HandleRotateIntrinsic(CallInstr* instr);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'quest' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleQuestion(QuestionInstr* instr);
Operand* HandleOperationOnQuest(Opcode opcode, Operand* opA, Operand* opB);
Operand* HandleOperationOnQuestAndOther(Opcode opcode, QuestionInstr* instrA,
Operand* op);
Operand* HandleOperationOnQuestAndQuest(Opcode opcode, QuestionInstr* instr,
QuestionInstr* instrB);
Operand* HandleQuestionOnBool(QuestionInstr* instr);
Operand* ExpandQuestToLogical(QuestionInstr* instr, CmpInstr* cmpInstr);
Operand* HandleQuestionOnBinary(QuestionInstr* instr);
bool HasOnlyOneOrZeroResult(Operand* op, Block* testBlock, int level = 0);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'phi' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandlePhi(PhiInstr* instr);
Operand* HandlePhiWithUndef(PhiInstr* instr);
Operand* HandlePhiOnLoad(PhiInstr* instr);
Operand* HandlePhiOnInstructions(PhiInstr* instr);
bool HandlePhiCopyCycle(PhiInstr* instr);
Operand* HandleInstructionOnPhi(Opcode opcode, Operand* opA, Operand* opB);
bool ShouldApplyOperatorOnPhi(PhiInstr* instr, Operand* otherOp);
bool CollectPhiInstructionOps(PhiInstr* instr, InstructionList& instrs,
BlockList& incomingBlock, Opcode& lastOpcode);
Operand* GetCommonOperand(InstructionList& instrs, OperandList& diffOps,
Opcode lastOpcode, bool& commonOnRight);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'load' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleLoad(LoadInstr* instr);
bool IsLoadFromConstArray(LoadInstr* instr, GlobalVariable*& globalVar,
Operand*& indexOp, IndexList& subindexList);
int ComputeConstRanges(GlobalVariable* globalVar, IntConstant* intConst,
OrderType order, RangeList& ranges, IndexList& subindexList,
IntConstant* intConstInstr, Opcode opcode);
void AddToCurrentRange(__int64 value, __int64 requiredValue, __int64 index,
ConstantRange*& currentRange, RangeList& ranges,
OrderType order, IntConstant* intConstInstr, Opcode opcode);
bool MatchesRequiredValue(__int64 value, __int64 requiredValue, OrderType order,
IntConstant* intConstInstr, Opcode opcode);
int ComputeRangesCost(RangeList& ranges, bool isNotEquality);
Operand* CreateRangeTest(ConstantRange& range, Operand* indexOp, bool isEquality,
const Type* resultType);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods for simplifying 'store' instructions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* HandleStore(StoreInstr* instr);
bool SafeToForwardStore(StoreInstr* instr);
StoreInstr* FindAvailableStore(Block* block, Operand* addressOp);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Methods that drive the peephole optimizations.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operand* Simplify(Instruction* instr);
Operand* SimplifyBinary(Opcode opcode, Operand* opA, Operand* opB,
Block* block, FloatMode mode = FP_Exact,
bool constMoveAllowed = true);
// Removes all instructions from the function that are definitely dead.
void DeleteDeadInstructions(Function* function);
// Adds all eligible instructions from the function to the worklist.
// These are the instructions that are considered for simplification.
void BuildWorklist(Function* function);
// Tries to simplify all the instructions in the worklist.
bool DoOneIteration(Function* function);
// Tries to simplify a branching instruction.
bool ProcessBranching(Instruction* instr);
// Handles an instruction that has been simplified to 'undef'.
// It handles some special cases like modified calls and deleted stores.
bool HandleUndefinedResult(Instruction* instr);
void HandleSpecialCases(Instruction* instr, Operand* result);
// Simplifies the instructions from the function until
// there is an iteration when no instruction is simplified anymore.
// 'maxIterations' can be used to limit the number of iterations
// (-1 for an unbounded number).
void IterateToFixedpoint(Function* function, int maxIterations = -1);
public:
Peephole() : resultOp_(nullptr) {}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// 'maxIterations' can be used to limit the number of iterations
// (-1 for an unbounded number).
void Execute(Function* function, int maxIterations = -1);
// Tries to simplify the specified instruction using only simple rules.
// If 'createAllowed' is false no simplification that requires
// the creation of new instructions0 is performed.
Operand* SimplifyInstruction(Instruction* instr,
bool createAllowed = false);
Operand* SimplifyInstruction(Opcode opcode, Operand* opA, Operand* opB,
Unit* unit, Block* block = nullptr,
bool createAllowed = false,
Instruction* instr = nullptr);
};
} // namespace Optimization
#endif | [
"lgratian@gmail.com"
] | lgratian@gmail.com |
4e5666bfcbc3e7ae8e9230b9781071a32c59ed7b | 4995bf8749beaeaa0f7c41c2ccfaee191012deb3 | /voice_synthesis/stdafx.cpp | 431f9de79c1ac4a18c0f9b44468b109ff756671e | [] | no_license | ljjyxz123/intel_ros | bac01b64fe2169b26dfd0ac5829d274cdd413eca | 313f4edea8666189805d8cb4afb0f6d08fe5d504 | refs/heads/master | 2021-01-22T13:58:15.184837 | 2013-08-20T19:14:41 | 2013-08-20T19:14:41 | 27,821,639 | 1 | 0 | null | null | null | null | GB18030 | C++ | false | false | 267 | cpp | // stdafx.cpp : 只包括标准包含文件的源文件
// voice_synthesis.pch 将作为预编译头
// stdafx.obj 将包含预编译类型信息
#include "stdafx.h"
// TODO: 在 STDAFX.H 中
// 引用任何所需的附加头文件,而不是在此文件中引用
| [
"yuanboshe@yeah.net"
] | yuanboshe@yeah.net |
b8cafa1bdd7201e8bb0cd185fc03d74d30e17146 | 5acba5b00fc0954154812b0b984184d1b672dc17 | /data/tplcache/f39d5b6b8edf659d30eb5f6e82b1f831.inc | 3520685f825fd2d9cfd9edd5155be20143f3ca8f | [] | no_license | jichuangsi/resource-manager | c206feb7e911def4938666bf520e42f82f393c13 | 67126de1f14263dc328841bcdd587e38309de77a | refs/heads/master | 2020-05-07T16:58:25.220676 | 2019-04-15T06:54:31 | 2019-04-15T06:54:31 | 180,705,851 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 38 | inc | [field:c function="null2zero(@me)/]次 | [
"2601754903@qq.com"
] | 2601754903@qq.com |
7f8d3b07777df5b003c4ba179d1d57b278a1956a | d50a1a364647c810410e7eaf5f3a710dc97e3f50 | /include/cl/handler.hxx | b941ea78a73193b37d37a652d4b5000b1171bb3c | [
"MIT"
] | permissive | nshcat/cl | 2d91e8b3ae3c41ccc4ed5faecb0c1b38ae1cdde6 | 186146d6f1a2845ce370e40a4d98b2fbeb30a78a | refs/heads/master | 2020-12-29T02:19:34.404881 | 2018-06-30T19:57:37 | 2018-06-30T19:57:37 | 64,277,055 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,557 | hxx | #pragma once
#include <type_traits>
#include <ut/type_traits.hxx>
#include <ut/array_view.hxx>
#include <ut/observer_ptr.hxx>
#include "handler_base.hxx"
#include "command.hxx"
#include "meta.hxx"
namespace cl
{
namespace internal
{
enum class placeholder
{
first
};
}
class handler
: public internal::handler_base,
public command<internal::placeholder>
{
using input_type = ut::array_view<const char*>;
using base_type = internal::handler_base;
using command_type = command<internal::placeholder>;
public:
template< typename... Ts,
typename = ::std::enable_if_t<
not ::std::is_same<
handler,
::std::decay_t<ut::first_t<Ts...>>
>::value
>
>
handler(Ts&&... p_args)
: command_type(::std::forward<Ts>(p_args)...)
{
// It is ok to access global option tags here despite being forwarded beforehand,
// because cl::command will ignore all global option tags completely.
const auto x = { (this->base_type::dispatch(::std::forward<Ts>(p_args)), 0)... };
(void)x;
this->set_global_data({&this->m_Data});
}
handler()
{
this->set_global_data({&this->m_Data});
}
handler(const handler&) = delete;
handler(handler&&) = default;
handler& operator=(const handler&) = delete;
handler& operator=(handler&&) = default;
public:
auto read(input_type)
-> bool;
auto read(int p_argc, const char** p_argv)
-> bool;
};
}
| [
"nshcat@users.noreply.github.com"
] | nshcat@users.noreply.github.com |
28790e75f3565b53226a00cb1a1bc58a4724bc5e | 6f08433e2ce3aa8cfbed055600d3c44587bc5ccd | /demogui/WidgetWave.hh | eda0d888c800a0c758a5a8fc08ed04d0933ebe2b | [] | no_license | praveenmunagapati/AaltoASR-online-demo | aa5c124c7bc1e3af8e303fa8c1b70a29f0828943 | 46f2e2dcff3b1f6ad68e5303881d341b84f37d5c | refs/heads/master | 2021-05-30T15:45:34.068919 | 2015-12-08T14:52:18 | 2015-12-08T14:52:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 769 | hh |
#ifndef WIDGETWAVE_HH_
#define WIDGETWAVE_HH_
#include "WidgetAudioView.hh"
/** A scrollable view of the audio wave. */
class WidgetWave : public WidgetAudioView
{
public:
/**
* \param parent Parent widget.
* \param rect Rectangle area of the widget.
* \param audio_input Source of audio data.
* \param pixels_per_second Time resolution. */
WidgetWave(PG_Widget *parent,
const PG_Rect &rect,
AudioInputController *audio_input,
unsigned int pixels_per_second);
virtual ~WidgetWave() { };
virtual void initialize();
protected:
virtual void draw_screen_vector(SDL_Surface *surface, unsigned int x);
private:
Uint32 m_foreground_color; //!< Color of the wave.
};
#endif /*WIDGETWAVE_HH_*/
| [
"jaakko.luttinen@aalto.fi"
] | jaakko.luttinen@aalto.fi |
bf145fe00bb134d6f3f430325d45766aa6bd7696 | 18e6ec0c2f6574d430d77671e27185679f08d5ca | /Rpg场景转换优化/Rpg2.0/GameMenu.h | 4592443ea87600146fcc5cc231ef7e32b5232d0e | [] | no_license | sanwututu/c_plusplus | dd1c50261a0db664fdfffa3bb5452ba3d5c6bc50 | e7bcdc6f155ed4764e8bd5dd3b38c00cfc696f27 | refs/heads/master | 2023-02-11T02:19:05.199983 | 2021-01-06T12:16:45 | 2021-01-06T12:16:45 | 296,315,754 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 177 | h | #pragma once
#include "Scene.h"
class CGameMenu: public CScene
{
public:
CGameMenu();
~CGameMenu();
void render();
void update();
static CGameMenu* create();
private:
};
| [
"2498106306@qq.com"
] | 2498106306@qq.com |
b0bd8a67b6131184fa8a3746406ffc3d42cca266 | 3c9f984766c81ba95f1f4f828fd9c4e6efef9da1 | /SupplyFinanceChain/src/SupplyFinanceChain/json/impl/json_valueiterator.cpp | 839054d48bf2f53385ff5222c52e21b6c95b18eb | [
"LicenseRef-scancode-public-domain-disclaimer"
] | permissive | SCF-Team/scfchain | 5f73e3c3a41ac5e33d2637980f428a9b8173fda5 | 41f020da81e1c69a61d0c1698df04cf33b20fc63 | refs/heads/master | 2020-06-26T21:51:29.263077 | 2019-08-05T11:11:24 | 2019-08-05T11:11:24 | 199,766,740 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,560 | cpp | //------------------------------------------------------------------------------
/*
This file is part of SupplyFinanceChaind: https://github.com/SupplyFinanceChain/SupplyFinanceChaind
Copyright (c) 2012, 2013 SupplyFinanceChain Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
// included by json_value.cpp
#include <SupplyFinanceChain/json/json_value.h>
namespace Json {
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// class ValueIteratorBase
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
ValueIteratorBase::ValueIteratorBase ()
: current_ ()
, isNull_ ( true )
{
}
ValueIteratorBase::ValueIteratorBase ( const Value::ObjectValues::iterator& current )
: current_ ( current )
, isNull_ ( false )
{
}
Value&
ValueIteratorBase::deref () const
{
return current_->second;
}
void
ValueIteratorBase::increment ()
{
++current_;
}
void
ValueIteratorBase::decrement ()
{
--current_;
}
ValueIteratorBase::difference_type
ValueIteratorBase::computeDistance ( const SelfType& other ) const
{
// Iterator for null value are initialized using the default
// constructor, which initialize current_ to the default
// std::map::iterator. As begin() and end() are two instance
// of the default std::map::iterator, they can not be compared.
// To allow this, we handle this comparison specifically.
if ( isNull_ && other.isNull_ )
{
return 0;
}
// Usage of std::distance is not portable (does not compile with Sun Studio 12 RogueWave STL,
// which is the one used by default).
// Using a portable hand-made version for non random iterator instead:
// return difference_type( std::distance( current_, other.current_ ) );
difference_type myDistance = 0;
for ( Value::ObjectValues::iterator it = current_; it != other.current_; ++it )
{
++myDistance;
}
return myDistance;
}
bool
ValueIteratorBase::isEqual ( const SelfType& other ) const
{
if ( isNull_ )
{
return other.isNull_;
}
return current_ == other.current_;
}
void
ValueIteratorBase::copy ( const SelfType& other )
{
current_ = other.current_;
}
Value
ValueIteratorBase::key () const
{
const Value::CZString czstring = (*current_).first;
if ( czstring.c_str () )
{
if ( czstring.isStaticString () )
return Value ( StaticString ( czstring.c_str () ) );
return Value ( czstring.c_str () );
}
return Value ( czstring.index () );
}
UInt
ValueIteratorBase::index () const
{
const Value::CZString czstring = (*current_).first;
if ( !czstring.c_str () )
return czstring.index ();
return Value::UInt ( -1 );
}
const char*
ValueIteratorBase::memberName () const
{
const char* name = (*current_).first.c_str ();
return name ? name : "";
}
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// class ValueConstIterator
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
ValueConstIterator::ValueConstIterator ( const Value::ObjectValues::iterator& current )
: ValueIteratorBase ( current )
{
}
ValueConstIterator&
ValueConstIterator::operator = ( const ValueIteratorBase& other )
{
copy ( other );
return *this;
}
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// class ValueIterator
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
ValueIterator::ValueIterator ( const Value::ObjectValues::iterator& current )
: ValueIteratorBase ( current )
{
}
ValueIterator::ValueIterator ( const ValueConstIterator& other )
: ValueIteratorBase ( other )
{
}
ValueIterator::ValueIterator ( const ValueIterator& other )
: ValueIteratorBase ( other )
{
}
ValueIterator&
ValueIterator::operator = ( const SelfType& other )
{
copy ( other );
return *this;
}
} // Json
| [
"ghubdevelop@protonmail.com"
] | ghubdevelop@protonmail.com |
9370e9f607340c83517ec162a9e85e1f57686f2a | 57475ab39034e0ea1cc2e25643eb19d909504c85 | /firmware/GPIO Lab/L5_Application/main.cpp | fe5af7a0df722e1c24b836bca4db9dd6e51da625 | [] | no_license | InfallibleProgrammer/CmpE146-Embedded_Systems | c684fe91e337c61083f8a90e0e49826b53b50ab1 | 83dab5fb43967f575d72908d5757fc5709972ac0 | refs/heads/master | 2020-03-22T00:07:38.233642 | 2019-06-08T05:09:46 | 2019-06-08T05:09:46 | 139,225,862 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,873 | cpp | /*
* SocialLedge.com - Copyright (C) 2013
*
* This file is part of free software framework for embedded processors.
* You can use it and/or distribute it as long as this copyright header
* remains unmodified. The code is free for personal use and requires
* permission to use in a commercial product.
*
* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
* I SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
*
* You can reach the author of this software at :
* p r e e t . w i k i @ g m a i l . c o m
*/
/**
* @file
* @brief This is the application entry point.
*/
#include <stdio.h>
#include "utilities.h"
#include <LabGPIO_0.h>
#include "LPC17xx.h"
#include "io.hpp"
#include <stdint.h>
//LPC_GPIO_TypeDef* port = (LPC_GPIO_TypeDef*) LPC_GPIO0;
uint8_t pin = 0;
uint8_t port = 1;
uint8_t pin1 = 9;
uint8_t port1 = 1;
uint8_t pin2 = 1;
uint8_t port2 = 0;
uint8_t pin3 = 1;
uint8_t port3 = 0;
uint8_t high = 1;
uint8_t readLevel = 0;
uint8_t output = 1;
int main (void)
{
uint8_t x=0;
uint8_t y=0;
uint16_t z = 40000;
y = (uint8_t)z;
x = (uint8_t)(z>>8);
printf("x: %i\n", x);
printf("%i\n", z);
printf("y: %i\n",y);
printf("%i\n", z);
return 0;
// LabGPIO_0 AG(pin,port);
// LabGPIO_0 AG1(pin1,port1);
// LabGPIO_0 AG2(pin2, port2);
// AG.setDirection(output);
// AG1.setDirection(!output);
// while(1==1){
// readLevel = AG1.getLevel();
// if(readLevel){
// AG.set(!high);
// delay_ms(500);
// }
// else{
// AG.set(high);
// delay_ms(500);
// }
// }
}
| [
"akashv@Akashs-MacBook-Pro.local"
] | akashv@Akashs-MacBook-Pro.local |
1350a0f387af2cf857f5d2b15e03f27b59e3898b | 4f4e9fa2276a3dae7428f55616ba5ca30c864af5 | /src/steps.cpp | 29a386b0ee017e63122d56495a62ba3336fef0c9 | [
"MIT"
] | permissive | semeniuta/CarND-PathPlanning | 9bf0941cb981cb9468ebfa018e7725dcbc256e41 | 5e1598e55c12f4e49675174cf07ad1b689159ed4 | refs/heads/master | 2020-04-27T12:03:32.204214 | 2019-03-11T09:48:36 | 2019-03-11T09:48:36 | 174,319,786 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,669 | cpp | //
// Created by Oleksandr Semeniuta on 2019-03-04.
//
#include "steps.h"
#include <iostream>
#include "helpers.h"
#include "geometry.h"
ReferenceState prepareReferenceState(const pp_input& in, long index) {
// Prepare the reference state
ReferenceState ref{};
auto prev_path_size = in.previous_path_x.size();
if (index == -1) {
index = prev_path_size - 1;
}
std::vector<Eigen::VectorXd> points;
if (prev_path_size < 2) {
ref.xy_h << in.car_x,
in.car_y,
1;
ref.yaw = deg2rad(in.car_yaw);
} else {
ref.xy_h << in.previous_path_x[index],
in.previous_path_y[prev_path_size - 1],
1;
double prev_x = in.previous_path_x[index - 1];
double prev_y = in.previous_path_y[index - 1];
ref.yaw = atan2(ref.getY() - prev_y, ref.getX() - prev_x);
}
return ref;
}
ReferencePoses createPoses(const ReferenceState& ref) {
// Create homogeneous transformations (ego-in-world, world-in-ego)
ReferencePoses poses{};
poses.ego_in_world = createPose(ref.getX(), ref.getY(), ref.yaw);
poses.world_in_ego = invertPose(poses.ego_in_world);
return poses;
}
Eigen::VectorXd fitPolynomial(const pp_input& in,
const map_waypoints& wp,
const ReferenceState& ref,
const std::vector<frenet_coord>& next_frenet_points,
const ReferencePoses& poses,
bool use_car) {
// when use_car is false,
// start with ref as the first anchor point
// otherwise, use car's current position
std::vector<Eigen::VectorXd> points;
points.push_back(ref.xy_h);
double start_s = in.car_s;
if (!use_car) {
auto ref_frenet = getFrenet(ref.getX(), ref.getY(), ref.yaw, wp.x, wp.y);
start_s = ref_frenet[0];
}
for (const frenet_coord& fp : next_frenet_points) {
auto xy = getXY(start_s + fp.s, fp.d, wp.s, wp.x, wp.y);
Eigen::VectorXd p{3};
p << xy[0], xy[1], 1;
points.push_back(p);
}
Eigen::VectorXd anchor_x{points.size()};
Eigen::VectorXd anchor_y{points.size()};
for (unsigned int i = 0; i < points.size(); i++) {
Eigen::VectorXd p = points[i];
Eigen::VectorXd p_t = poses.world_in_ego * p;
anchor_x(i) = getXFromH(p_t);
anchor_y(i) = getYFromH(p_t);
}
Eigen::VectorXd coeffs = polyfit(anchor_x, anchor_y, 3);
return coeffs;
}
void fillNextXYFromPrevious(pp_output* out, const pp_input& in, long n_take) {
// Fill the next x/y values with the previous path
auto prev_path_size = in.previous_path_x.size();
if (n_take == -1 || n_take > prev_path_size) { // Take all
n_take = prev_path_size;
}
if (!in.previous_path_x.empty()) {
for (unsigned i = 0; i < n_take; i++) {
out->next_x_vals.push_back(in.previous_path_x[i]);
out->next_y_vals.push_back(in.previous_path_y[i]);
}
}
}
void fillNextXYTargetV(pp_output* out,
const pp_input& in,
double target_velocity_mph,
const ReferencePoses& poses,
const Eigen::VectorXd& coeffs) {
// Fill the rest of the next x/y values with
// the values based on the polynomial
//auto prev_path_size = in.previous_path_x.size();
auto prev_path_size = out->next_x_vals.size();
double target_velocity = MPH2Metric(target_velocity_mph);
double delta = target_velocity * DT;
auto n_poly_points = TRAJ_SIZE - prev_path_size;
double x = 0;
for (unsigned int i = 0; i < n_poly_points; i++) {
double y1 = polyeval(coeffs, x);
double y2 = polyeval(coeffs, x + delta);
double dy = y2 - y1;
double angle = atan2(dy, delta);
double dx = delta * cos(angle);
std::cout << "dx = " << dx << ", delta = " << delta << "\n";
x = (i + 1) * dx;
double y = polyeval(coeffs, x);
Eigen::VectorXd p{3};
p << x, y, 1;
Eigen::VectorXd p_world = poses.ego_in_world * p;
out->next_x_vals.push_back(getXFromH(p_world));
out->next_y_vals.push_back(getYFromH(p_world));
}
}
void fillNextNYFirstTime(pp_output* out,
double accel_to_mph,
const ReferencePoses& poses,
const Eigen::VectorXd& coeffs,
double accel_from_mph) {
auto accel_increments = accel(MPH2Metric(accel_from_mph), MPH2Metric(accel_to_mph), 1.);
double x = 0.;
for (double dx : accel_increments) {
x += dx;
double y = polyeval(coeffs, x);
Eigen::VectorXd p{3};
p << x, y, 1;
Eigen::VectorXd p_world = poses.ego_in_world * p;
out->next_x_vals.push_back(getXFromH(p_world));
out->next_y_vals.push_back(getYFromH(p_world));
}
}
bool checkForCarInFront(const pp_input& in,
int current_lane,
double s_threshold) {
for (const sf_vehicle& vehicle : in.sensor_fusion) {
int v_lane = getCarLane(vehicle);
if (v_lane == current_lane && vehicle.s > in.car_s) {
double v_dist = vehicle.s - in.car_s;
if (v_dist < s_threshold) {
return true;
}
}
}
return false;
}
std::vector<vehicle_info> lookAround(const pp_input& in) {
std::vector<vehicle_info> res{};
for (const sf_vehicle& vehicle : in.sensor_fusion) {
vehicle_info info{};
info.id = vehicle.id;
info.lane = getCarLane(vehicle);
info.s_dist = vehicle.s - in.car_s;
res.push_back(info);
}
return res;
}
double updateTargetVelocity(bool too_close,
double target_velocity,
double velocity_increment,
double min_speed) {
if (too_close) {
target_velocity -= velocity_increment;
if (target_velocity <= min_speed) {
target_velocity = min_speed;
}
} else {
if (target_velocity < MAX_SPEED_MPH) {
target_velocity += velocity_increment;
}
}
return target_velocity;
}
int checkIfSafeToChangeLane(const pp_input& in, int current_lane) {
// If safe, return index of the lane
// otherwise, return -1
auto vehiles_info = lookAround(in);
auto neighbor_lanes = neighbors(current_lane);
for (int candidate_lane : neighbor_lanes) {
if (safeInLane(candidate_lane, vehiles_info))
return candidate_lane;
}
return -1;
}
pp_output JMTLaneChange(const pp_input& in,
const map_waypoints& wp,
double d0,
double d1,
double s_dist) {
// --------------------------------------------------
// Example of usage:
// double d_src = laneD(source_lane_);
// double d_dst = laneD(target_lane_);
// out = JMTLaneChange(in, wp, d_src, d_dst, 20);
// --------------------------------------------------
double s0 = in.car_s;
double s1 = s0 + s_dist;
double v0 = in.car_speed;
double v1 = 30;
double t = 1.;
// position, velocity, acceleration
std::vector<double> d_start = {d0, 0, 0};
std::vector<double> d_end = {d1, 0, 0};
std::vector<double> s_start = {s0, v0, 0};
std::vector<double> s_end = {s1, v1, 0};
auto jmt_d = JMT(d_start, d_end, t);
auto jmt_s = JMT(s_start, s_end, t);
pp_output out{};
double t_now;
double s;
double d;
for (int i = 1; i < 50; i++) {
t_now = i * DT;
s = QuinticPoly(jmt_s, t_now);
d = QuinticPoly(jmt_d, t_now);
auto xy = getXY(s, d, wp.s, wp.x, wp.y);
out.next_x_vals.push_back(xy[0]);
out.next_y_vals.push_back(xy[1]);
}
return out;
}
| [
"oleksandr.semeniuta@gmail.com"
] | oleksandr.semeniuta@gmail.com |
36677e901c931d292b5db43ccaa89d91469a6298 | 57d177fbd7d1bac2d97acaf081ff4fa75ed8ba53 | /third_party/WebKit/Source/web/WebInputEvent.cpp | 3b98e3ddc41eba3a4e44f5ce559ef9f54140947a | [
"BSD-3-Clause"
] | permissive | venkatarajasekhar/chromium-42.0.2311.135 | 676241bb228810a892e3074968c1844d26d187df | 8d6b0c3b1481b2d4bf6ec75a08b686c55e06c707 | refs/heads/master | 2021-01-13T11:57:38.761197 | 2015-05-04T12:43:44 | 2015-05-11T12:58:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,789 | cpp | /*
* Copyright (C) 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "public/web/WebInputEvent.h"
#include "platform/KeyboardCodes.h"
#include "wtf/Assertions.h"
#include "wtf/StringExtras.h"
#include <ctype.h>
namespace blink {
struct SameSizeAsWebInputEvent {
int inputData[5];
};
struct SameSizeAsWebKeyboardEvent : public SameSizeAsWebInputEvent {
int keyboardData[13];
};
struct SameSizeAsWebMouseEvent : public SameSizeAsWebInputEvent {
int mouseData[10];
};
struct SameSizeAsWebMouseWheelEvent : public SameSizeAsWebMouseEvent {
int mousewheelData[11];
};
struct SameSizeAsWebGestureEvent : public SameSizeAsWebInputEvent {
int gestureData[10];
};
struct SameSizeAsWebTouchEvent : public SameSizeAsWebInputEvent {
WebTouchPoint touchPoints[WebTouchEvent::touchesLengthCap];
int touchData[2];
};
static_assert(sizeof(WebInputEvent) == sizeof(SameSizeAsWebInputEvent), "WebInputEvent should not have gaps");
static_assert(sizeof(WebKeyboardEvent) == sizeof(SameSizeAsWebKeyboardEvent), "WebKeyboardEvent should not have gaps");
static_assert(sizeof(WebMouseEvent) == sizeof(SameSizeAsWebMouseEvent), "WebMouseEvent should not have gaps");
static_assert(sizeof(WebMouseWheelEvent) == sizeof(SameSizeAsWebMouseWheelEvent), "WebMouseWheelEvent should not have gaps");
static_assert(sizeof(WebGestureEvent) == sizeof(SameSizeAsWebGestureEvent), "WebGestureEvent should not have gaps");
static_assert(sizeof(WebTouchEvent) == sizeof(SameSizeAsWebTouchEvent), "WebTouchEvent should not have gaps");
static const char* staticKeyIdentifiers(unsigned short keyCode)
{
switch (keyCode) {
case VKEY_MENU:
return "Alt";
case VKEY_CONTROL:
return "Control";
case VKEY_SHIFT:
return "Shift";
case VKEY_CAPITAL:
return "CapsLock";
case VKEY_LWIN:
case VKEY_RWIN:
return "Win";
case VKEY_CLEAR:
return "Clear";
case VKEY_DOWN:
return "Down";
case VKEY_END:
return "End";
case 0x0A: // Carriage return
case VKEY_RETURN:
return "Enter";
case VKEY_EXECUTE:
return "Execute";
case VKEY_F1:
return "F1";
case VKEY_F2:
return "F2";
case VKEY_F3:
return "F3";
case VKEY_F4:
return "F4";
case VKEY_F5:
return "F5";
case VKEY_F6:
return "F6";
case VKEY_F7:
return "F7";
case VKEY_F8:
return "F8";
case VKEY_F9:
return "F9";
case VKEY_F10:
return "F10";
case VKEY_F11:
return "F11";
case VKEY_F12:
return "F12";
case VKEY_F13:
return "F13";
case VKEY_F14:
return "F14";
case VKEY_F15:
return "F15";
case VKEY_F16:
return "F16";
case VKEY_F17:
return "F17";
case VKEY_F18:
return "F18";
case VKEY_F19:
return "F19";
case VKEY_F20:
return "F20";
case VKEY_F21:
return "F21";
case VKEY_F22:
return "F22";
case VKEY_F23:
return "F23";
case VKEY_F24:
return "F24";
case VKEY_HELP:
return "Help";
case VKEY_HOME:
return "Home";
case VKEY_INSERT:
return "Insert";
case VKEY_LEFT:
return "Left";
case VKEY_NEXT:
return "PageDown";
case VKEY_PRIOR:
return "PageUp";
case VKEY_PAUSE:
return "Pause";
case VKEY_SNAPSHOT:
return "PrintScreen";
case VKEY_RIGHT:
return "Right";
case VKEY_SCROLL:
return "Scroll";
case VKEY_SELECT:
return "Select";
case VKEY_UP:
return "Up";
case VKEY_DELETE:
return "U+007F"; // Standard says that DEL becomes U+007F.
case VKEY_MEDIA_NEXT_TRACK:
return "MediaNextTrack";
case VKEY_MEDIA_PREV_TRACK:
return "MediaPreviousTrack";
case VKEY_MEDIA_STOP:
return "MediaStop";
case VKEY_MEDIA_PLAY_PAUSE:
return "MediaPlayPause";
case VKEY_VOLUME_MUTE:
return "VolumeMute";
case VKEY_VOLUME_DOWN:
return "VolumeDown";
case VKEY_VOLUME_UP:
return "VolumeUp";
default:
return 0;
}
}
void WebKeyboardEvent::setKeyIdentifierFromWindowsKeyCode()
{
const char* id = staticKeyIdentifiers(windowsKeyCode);
if (id) {
strncpy(keyIdentifier, id, sizeof(keyIdentifier) - 1);
keyIdentifier[sizeof(keyIdentifier) - 1] = '\0';
} else
snprintf(keyIdentifier, sizeof(keyIdentifier), "U+%04X", toupper(windowsKeyCode));
}
// static
int WebKeyboardEvent::windowsKeyCodeWithoutLocation(int keycode)
{
switch (keycode) {
case VK_LCONTROL:
case VK_RCONTROL:
return VK_CONTROL;
case VK_LSHIFT:
case VK_RSHIFT:
return VK_SHIFT;
case VK_LMENU:
case VK_RMENU:
return VK_MENU;
default:
return keycode;
}
}
// static
int WebKeyboardEvent::locationModifiersFromWindowsKeyCode(int keycode)
{
switch (keycode) {
case VK_LCONTROL:
case VK_LSHIFT:
case VK_LMENU:
case VK_LWIN:
return IsLeft;
case VK_RCONTROL:
case VK_RSHIFT:
case VK_RMENU:
case VK_RWIN:
return IsRight;
default:
return 0;
}
}
} // namespace blink
| [
"jonathan.anderson@ieee.org"
] | jonathan.anderson@ieee.org |
a6f6df66899fa575b5e4bcc07373a1acf0177c85 | 995b97669b12a932954bbc6ae1d3da3dc9d76309 | /Roteiro 4/MOEDAS.cpp | 24a4c19ac20e64a022da4ba68b7bb6473bb900cb | [] | no_license | wcordeiro/SPC | 22508da202c61f035d265c7372e338bca7b60912 | 6a7d4fd10b9c7e3e9d5b448c32523d61263ae306 | refs/heads/master | 2021-01-19T05:25:49.068482 | 2015-06-24T21:25:52 | 2015-06-24T21:25:52 | 33,312,070 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 780 | cpp |
#include <algorithm>
#include <iostream>
#include <cstring>
using namespace std;
int pval[50002];
int val, nmoedas;
int vmoedas[102];
int main(){
while ((cin >> val) && val){
cin >> nmoedas;
memset(pval,0,sizeof(pval));
for (int i = 0; i < nmoedas; i++){
cin >> vmoedas[i];
pval[vmoedas[i]] = 1;
}
for (int i = 1; i <= val; i++){
if (pval[i])
for (int a = 0; a < nmoedas; a++){
if (i + vmoedas[a] > val) break;
if (pval[i + vmoedas[a]] == 0) pval[i + vmoedas[a]] = pval[i] + 1;
else pval[i + vmoedas[a]] = min(pval[i + vmoedas[a]],pval[i] + 1);
}
}
if (pval[val]) cout << pval[val];
else cout << "Impossivel";
cout << "\n";
//fill(&pval[0],&pval[val+1],0);
// fill(&vmoedas[0],&vmoedas[nmoedas],0);
}
return 0;
}
| [
"wilson.cordeiro@outlook.com"
] | wilson.cordeiro@outlook.com |
e6192f186565011a90ff9e7bceaeddacb226f5c6 | b08fad6bdfbf0f801d9fbaae08198e3e722546be | /dep/MathGeoLib/Geometry/AABB.h | 524df301c7ab3980b78e399694dc83d6d0a6397b | [
"BSD-3-Clause"
] | permissive | liangpengcheng/tng | 6e25e14eb0d4a0742219796e539aa6b2b6dc47a6 | 01c6517f734d5db01f7d59bf95b225f6d1642b6e | refs/heads/master | 2021-01-14T08:21:38.686206 | 2017-04-15T10:04:31 | 2017-04-15T10:04:31 | 55,823,586 | 3 | 4 | null | null | null | null | ISO-8859-1 | C++ | false | false | 30,464 | h | /* Copyright Jukka Jylänki
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
/** @file AABB.h
@author Jukka Jylänki
@brief The Axis-Aligned Bounding Box (AABB) geometry object. */
#pragma once
#include "../MathGeoLibFwd.h"
#include "../Math/float3.h"
#include "../Math/SSEMath.h"
#ifdef MATH_AUTOMATIC_SSE
#include "../Math/float4.h"
#endif
#ifdef MATH_OGRE_INTEROP
#include <OgreAxisAlignedBox.h>
#endif
MATH_BEGIN_NAMESPACE
/// A 3D axis-aligned bounding box.
/** This data structure can be used to represent coarse bounds of objects, in situations where detailed triangle-level
computations can be avoided. In physics systems, bounding boxes are used as an efficient early-out test for geometry
intersection queries.
The 'axis-aligned' part in the name means that the local axes of this bounding box are restricted to align with the
axes of the world space coordinate system. This makes computations involving AABB's very fast, since AABB's cannot
be arbitrarily oriented in the space with respect to each other.
If you need to represent a box in 3D space with arbitrary orientation, see the class OBB. */
class ALIGN16 AABB
{
public:
/// Specifies the minimum extent of this AABB in the world space x, y and z axes.
vec minPoint;
/// Specifies the maximum extent of this AABB in the world space x, y and z axes. [similarOverload: minPoint]
vec maxPoint;
/// The default constructor does not initialize any members of this class.
/** This means that the values of the members minPoint and maxPoint are undefined after creating a new AABB using this
default constructor. Remember to assign to them before use.
@see minPoint, maxPoint. */
AABB() {}
/// Constructs this AABB by specifying the minimum and maximum extending corners of the box.
/** @see minPoint, maxPoint. */
AABB(const vec &minPoint, const vec &maxPoint);
/// Constructs this AABB to enclose the given OBB.
/** This constructor computes the optimal minimum volume AABB that encloses the given OBB.
@note Since an AABB cannot generally represent an OBB, this conversion is not exact, but the returned AABB
specifies a larger volume.
@see class OBB. */
explicit AABB(const OBB &obb);
/// Constructs this AABB to enclose the given Sphere.
/** @see class Sphere. */
explicit AABB(const Sphere &s);
FORCE_INLINE static int NumFaces() { return 6; }
FORCE_INLINE static int NumEdges() { return 12; }
FORCE_INLINE static int NumVertices() { return 8; }
/// Returns the minimum world-space coordinate along the given axis.
float MinX() const { return minPoint.x; }
float MinY() const { return minPoint.y; } ///< [similarOverload: MinX]
float MinZ() const { return minPoint.z; } ///< [similarOverload: MinX]
/// Returns the maximum world-space coordinate along the given axis.
float MaxX() const { return maxPoint.x; }
float MaxY() const { return maxPoint.y; } ///< [similarOverload: MaxX]
float MaxZ() const { return maxPoint.z; } ///< [similarOverload: MaxX]
/// Sets this structure to a degenerate AABB that does not have any volume.
/** This function is useful for initializing the AABB to "null" before a loop of calls to Enclose(),
which incrementally expands the bounds of this AABB to enclose the given objects.
@see Enclose(). */
void SetNegativeInfinity();
/// Sets this AABB by specifying its center and size.
/** @param center The center point of this AABB.
@param size A vector that specifies the size of this AABB in x, y and z directions.
@see SetFrom(), FromCenterAndSize(). */
void SetFromCenterAndSize(const vec ¢er, const vec &size);
/// Sets this AABB to enclose the given OBB.
/** This function computes the minimal axis-aligned bounding box for the given oriented bounding box. If the orientation
of the OBB is not aligned with the world axes, this conversion is not exact and loosens the volume of the bounding box.
@param obb The oriented bounding box to convert into this AABB.
@todo Implement SetFrom(Polyhedron).
@see SetCenter(), class OBB. */
void SetFrom(const OBB &obb);
// Computes the minimal enclosing AABB of the given polyhedron.
/* This function computes the smallest AABB (in terms of volume) that contains the given polyhedron, and stores
the result in this structure.
@note An AABB cannot generally exactly represent a polyhedron. Converting a polyhedron to an AABB loses some
features of the polyhedron.
@return If the given polyhedron is closed, this function succeeds and returns true. If the polyhedron is uncapped
(has infinite volume), this function does not modify this data structure, but returns false. */
// bool SetFrom(const Polyhedron &polyhedron);
/// Sets this AABB to enclose the given sphere.
/** This function computes the smallest possible AABB (in terms of volume) that contains the given sphere, and stores the result in this structure. */
void SetFrom(const Sphere &s);
/// Sets this AABB to enclose the given set of points.
/** @param pointArray A pointer to an array of points to enclose inside an AABB.
@param numPoints The number of elements in the pointArray list.
@see MinimalEnclosingAABB(). */
void SetFrom(const vec *pointArray, int numPoints);
/// Converts this AABB to a polyhedron.
/** This function returns a polyhedron representation of this AABB. This conversion is exact, meaning that the returned
polyhedron represents the same set of points that this AABB does.
@see class Polyhedron, ToPBVolume(), ToOBB(). */
Polyhedron ToPolyhedron() const;
/// Converts this AABB to a PBVolume.
/** This function returns a plane-bounded volume representation of this AABB. The conversion is exact, meaning that the
returned PBVolume<6> represents exactly the same set of points that this AABB does.
@see ToPolyhedron(), ToOBB(). */
PBVolume<6> ToPBVolume() const;
/// Converts this AABB to an OBB.
/** This function returns an OBB representation of this AABB. This conversion is exact, meaning that the returned
OBB represents the same set of points than this AABB.
@see class OBB, ToPolyhedron(), ToPBVolume(). */
OBB ToOBB() const;
/// Returns the smallest sphere that contains this AABB.
/** This function computes the minimal volume sphere that contains all the points inside this AABB.
@see MaximalContainedSphere(). */
Sphere MinimalEnclosingSphere() const;
/// Returns the largest sphere that can fit inside this AABB.
/** This function computes the largest sphere that can fit inside this AABB. This sphere is unique up to the center point
of the sphere. The returned sphere will be positioned to the same center point as this AABB.
@see MinimalEnclosingSphere(). */
Sphere MaximalContainedSphere() const;
/// Tests if this AABB is finite.
/** @return True if the member variables of this AABB are valid floats and do not contain NaNs or infs, and false otherwise.
@see IsDegenerate(), minPoint, maxPoint. */
bool IsFinite() const;
/// Tests if this AABB is degenerate.
/** @return True if this AABB does not span a strictly positive volume.
@see IsFinite(), Volume(), minPoint, maxPoint. */
bool IsDegenerate() const;
/// @return The center point of this AABB.
vec CenterPoint() const;
/// [similarOverload: CenterPoint]
vec Centroid() const { return CenterPoint(); }
/// Quickly returns an arbitrary point inside this AABB. Used in GJK intersection test.
vec AnyPointFast() const { return minPoint; }
/// Generates a point inside this AABB.
/** @param x A normalized value between [0,1]. This specifies the point position along the world x axis.
@param y A normalized value between [0,1]. This specifies the point position along the world y axis.
@param z A normalized value between [0,1]. This specifies the point position along the world z axis.
@return A point inside this AABB at point specified by given parameters.
@see Edge(), CornerPoint(), PointOnEdge(), FaceCenterPoint(), FacePoint(). */
vec PointInside(float x, float y, float z) const;
/// Returns an edge of this AABB.
/** @param edgeIndex The index of the edge line segment to get, in the range [0, 11].
@todo Specify which index generates which edge.
@see PointInside(), CornerPoint(), PointOnEdge(), FaceCenterPoint(), FacePoint(). */
LineSegment Edge(int edgeIndex) const;
/// Returns a corner point of this AABB.
/** This function generates one of the eight corner points of this AABB.
@param cornerIndex The index of the corner point to generate, in the range [0, 7].
The points are returned in the order 0: ---, 1: --+, 2: -+-, 3: -++, 4: +--, 5: +-+, 6: ++-, 7: +++. (corresponding the XYZ axis directions).
@todo Draw which index generates which corner point.
@see PointInside(), Edge(), PointOnEdge(), FaceCenterPoint(), FacePoint(), GetCornerPoints(). */
vec CornerPoint(int cornerIndex) const;
/// Computes an extreme point of this AABB in the given direction.
/** An extreme point is a farthest point of this AABB in the given direction. Given a direction,
this point is not necessarily unique.
@param direction The direction vector of the direction to find the extreme point. This vector may
be unnormalized, but may not be null.
@return An extreme point of this AABB in the given direction. The returned point is always a
corner point of this AABB.
@see CornerPoint(). */
vec ExtremePoint(const vec &direction) const;
vec ExtremePoint(const vec &direction, float &projectionDistance) const;
/// Returns a point on an edge of this AABB.
/** @param edgeIndex The index of the edge to generate a point to, in the range [0, 11]. @todo Document which index generates which one.
@param u A normalized value between [0,1]. This specifies the relative distance of the point along the edge.
@see PointInside(), CornerPoint(), CornerPoint(), FaceCenterPoint(), FacePoint(). */
vec PointOnEdge(int edgeIndex, float u) const;
/// Returns the point at the center of the given face of this AABB.
/** @param faceIndex The index of the AABB face to generate the point at. The valid range is [0, 5].
This index corresponds to the planes in the order (-X, +X, -Y, +Y, -Z, +Z).
@see PointInside(), CornerPoint(), PointOnEdge(), PointOnEdge(), FacePoint(). */
vec FaceCenterPoint(int faceIndex) const;
/// Generates a point at the surface of the given face of this AABB.
/** @param faceIndex The index of the AABB face to generate the point at. The valid range is [0, 5].
This index corresponds to the planes in the order (-X, +X, -Y, +Y, -Z, +Z).
@param u A normalized value between [0, 1].
@param v A normalized value between [0, 1].
@see PointInside(), CornerPoint(), PointOnEdge(), PointOnEdge(), FaceCenterPoint(). */
vec FacePoint(int faceIndex, float u, float v) const;
/// Returns the surface normal direction vector the given face points towards.
/** @param faceIndex The index of the AABB face to generate the point at. The valid range is [0, 5].
This index corresponds to the planes in the order (-X, +X, -Y, +Y, -Z, +Z).
@see FacePoint(), FacePlane(). */
vec FaceNormal(int faceIndex) const;
/// Computes the plane equation of the given face of this AABB.
/** @param faceIndex The index of the AABB face. The valid range is [0, 5].
This index corresponds to the planes in the order (-X, +X, -Y, +Y, -Z, +Z).
@return The plane equation the specified face lies on. The normal of this plane points outwards from this AABB.
@see FacePoint(), FaceNormal(), GetFacePlanes(). */
Plane FacePlane(int faceIndex) const;
/// Fills an array with all the eight corner points of this AABB.
/** @param outPointArray [out] The array to write the points to. Must have space for 8 elements.
@see CornerPoint(). */
void GetCornerPoints(vec *outPointArray) const;
/// Fills an array with all the six planes of this AABB.
/** @param outPlaneArray [out] The array to write the planes to. Must have space for 6 elements.
@see FacePlane(). */
void GetFacePlanes(Plane *outPlaneArray) const;
/// Generates an AABB that encloses the given point set.
/** This function finds the smallest AABB that contains the given set of points.
@param pointArray A pointer to an array of points to enclose inside an AABB.
@param numPoints The number of elements in the pointArray list.
@see SetFrom(). */
static AABB MinimalEnclosingAABB(const vec *pointArray, int numPoints);
/// Finds the most extremal points along the three world axes simultaneously.
/** @param pointArray A pointer to an array of points to process.
@param numPoints The number of elements in the pointArray list.
@param minx [out] Receives the point that has the smallest x coordinate.
@param maxx [out] Receives the point that has the largest x coordinate.
@param miny [out] Receives the point that has the smallest y coordinate.
@param maxy [out] Receives the point that has the largest y coordinate.
@param minz [out] Receives the point that has the smallest z coordinate.
@param maxz [out] Receives the point that has the largest z coordinate. */
static void ExtremePointsAlongAABB(const vec *pointArray, int numPoints, int &minx, int &maxx, int &miny, int &maxy, int &minz, int &maxz);
/// Creates a new AABB given is center position and size along the X, Y and Z axes.
/** @see SetCenter(). */
static AABB FromCenterAndSize(const vec &aabbCenterPos, const vec &aabbSize);
/// Returns the side lengths of this AABB in x, y and z directions.
/** The returned vector is equal to the diagonal vector of this AABB, i.e. it spans from the
minimum corner of the AABB to the maximum corner of the AABB.
@see HalfSize(), Diagonal(). */
vec Size() const;
/// [similarOverload: Size]
/** Returns Size()/2.
@see Size(), HalfDiagonal(). */
vec HalfSize() const;
/// Returns the diameter vector of this AABB.
/** @note For AABB, Diagonal() and Size() are the same concept. These functions are provided for symmetry
with the OBB class.
@see Size(), HalfDiagonal(). */
vec Diagonal() const { return Size(); }
/// [similarOverload: Diagonal]
/** Returns Diagonal()/2.
@see Diagonal(), HalfSize(). */
vec HalfDiagonal() const { return HalfSize(); }
/// Computes the volume of this AABB.
/** @see SurfaceArea(), IsDegenerate(). */
float Volume() const;
/// Computes the surface area of the faces of this AABB.
/** @see Volume(). */
float SurfaceArea() const;
/// Generates a random point inside this AABB.
/** The points are distributed uniformly.
@see RandomPointOnSurface(), RandomPointOnEdge(), RandomCornerPoint(). */
vec RandomPointInside(LCG &rng) const;
/// Generates a random point on a random face of this AABB.
/** The points are distributed uniformly.
@see RandomPointInside(), RandomPointOnEdge(), RandomCornerPoint(). */
vec RandomPointOnSurface(LCG &rng) const;
/// Generates a random point on a random edge of this AABB.
/** The points are distributed uniformly.
@see RandomPointInside(), RandomPointOnSurface(), RandomCornerPoint(). */
vec RandomPointOnEdge(LCG &rng) const;
/// Picks a random corner point of this AABB.
/** The points are distributed uniformly.
@see RandomPointInside(), RandomPointOnSurface(), RandomPointOnEdge(). */
vec RandomCornerPoint(LCG &rng) const;
/// Translates this AABB in world space.
/** @param offset The amount of displacement to apply to this AABB, in world space coordinates.
@see Scale(), Transform(). */
void Translate(const vec &offset);
/// Applies a uniform scale to this AABB.
/** This function scales this AABB structure in-place, using the given center point as the origin
for the scaling operation.
@param centerPoint Specifies the center of the scaling operation, in world space.
@param scaleFactor The uniform scale factor to apply to each world space axis.
@see Translate(), Transform(). */
void Scale(const vec ¢erPoint, float scaleFactor);
/// Applies a non-uniform scale to this AABB.
/** This function scales this AABB structure in-place, using the given center point as the origin
for the scaling operation.
@param centerPoint Specifies the center of the scaling operation, in world space.
@param scaleFactor The non-uniform scale factors to apply to each world space axis.
@see Translate(), Transform(). */
void Scale(const vec ¢erPoint, const vec &scaleFactor);
/// Applies a transformation to this AABB.
/** This function transforms this AABB with the given transformation, and then recomputes this AABB
to enclose the resulting oriented bounding box. This transformation is not exact and in general, calling
this function results in the loosening of the AABB bounds.
@param transform The transformation to apply to this AABB. This function assumes that this
transformation does not contain shear, nonuniform scaling or perspective properties, i.e. that the fourth
row of the float4x4 is [0 0 0 1].
@see Translate(), Scale(), Transform(), classes float3x3, float3x4, float4x4, Quat. */
void TransformAsAABB(const float3x3 &transform);
void TransformAsAABB(const float3x4 &transform);
void TransformAsAABB(const float4x4 &transform);
void TransformAsAABB(const Quat &transform);
/// Applies a transformation to this AABB and returns the resulting OBB.
/** Transforming an AABB produces an oriented bounding box. This set of functions does not apply the transformation
to this object itself, but instead returns the OBB that results in the transformation.
@param transform The transformation to apply to this AABB. This function assumes that this
transformation does not contain shear, nonuniform scaling or perspective properties, i.e. that the fourth
row of the float4x4 is [0 0 0 1].
@see Translate(), Scale(), TransformAsAABB(), classes float3x3, float3x4, float4x4, Quat. */
OBB Transform(const float3x3 &transform) const;
OBB Transform(const float3x4 &transform) const;
OBB Transform(const float4x4 &transform) const;
OBB Transform(const Quat &transform) const;
/// Computes the closest point inside this AABB to the given point.
/** If the target point lies inside this AABB, then that point is returned.
@see Distance(), Contains(), Intersects().
@todo Add ClosestPoint(Line/Ray/LineSegment/Plane/Triangle/Polygon/Circle/Disc/AABB/OBB/Sphere/Capsule/Frustum/Polyhedron). */
vec ClosestPoint(const vec &targetPoint) const;
/// Computes the distance between this AABB and the given object.
/** This function finds the nearest pair of points on this and the given object, and computes their distance.
If the two objects intersect, or one object is contained inside the other, the returned distance is zero.
@todo Add AABB::Distance(Line/Ray/LineSegment/Plane/Triangle/Polygon/Circle/Disc/AABB/OBB/Capsule/Frustum/Polyhedron).
@see Contains(), Intersects(), ClosestPoint(). */
float Distance(const vec &point) const;
float Distance(const Sphere &sphere) const;
/// Tests if the given object is fully contained inside this AABB.
/** This function returns true if the given object lies inside this AABB, and false otherwise.
@note The comparison is performed using less-or-equal, so the faces of this AABB count as being inside, but
due to float inaccuracies, this cannot generally be relied upon.
@todo Add Contains(Circle/Disc/Sphere/Capsule).
@see Distance(), Intersects(), ClosestPoint(). */
bool Contains(const vec &point) const;
bool Contains(const LineSegment &lineSegment) const;
bool Contains(const AABB &aabb) const;
bool Contains(const OBB &obb) const;
bool Contains(const Sphere &sphere) const;
bool Contains(const Triangle &triangle) const;
bool Contains(const Polygon &polygon) const;
bool Contains(const Frustum &frustum) const;
bool Contains(const Polyhedron &polyhedron) const;
bool Contains(const Capsule &capsule) const;
/// Tests whether this AABB and the given object intersect.
/** Both objects are treated as "solid", meaning that if one of the objects is fully contained inside
another, this function still returns true. (e.g. in case a line segment is contained inside this AABB,
or this AABB is contained inside a Sphere, etc.)
@param ray The first parameter of this function specifies the other object to test against.
@param dNear [out] If specified, receives the parametric distance along the line denoting where the
line entered this AABB.
@param dFar [out] If specified, receives the parametric distance along the line denoting where the
line exited this AABB.
@see Contains(), Distance(), ClosestPoint().
@note If you do not need the intersection intervals, you should call the functions without these
parameters in the function signature for optimal performance.
@todo Add Intersects(Circle/Disc). */
bool Intersects(const Ray &ray, float &dNear, float &dFar) const;
bool Intersects(const Ray &ray) const;
bool Intersects(const Line &line, float &dNear, float &dFar) const;
bool Intersects(const Line &line) const;
bool Intersects(const LineSegment &lineSegment, float &dNear, float &dFar) const;
bool Intersects(const LineSegment &lineSegment) const;
bool Intersects(const Plane &plane) const;
bool Intersects(const AABB &aabb) const;
bool Intersects(const OBB &obb) const;
/** For reference documentation on the Sphere-AABB intersection test, see Christer Ericson's Real-Time Collision Detection, p. 165. [groupSyntax]
@param sphere The first parameter of this function specifies the other object to test against.
@param closestPointOnAABB [out] Returns the closest point on this AABB to the given sphere. This pointer
may be null. */
bool Intersects(const Sphere &sphere, vec *closestPointOnAABB = 0) const;
bool Intersects(const Capsule &capsule) const;
bool Intersects(const Triangle &triangle) const;
bool Intersects(const Polygon &polygon) const;
bool Intersects(const Frustum &frustum) const;
bool Intersects(const Polyhedron &polyhedron) const;
/// Projects this AABB onto the given axis.
/** @param axis The axis to project onto. This vector can be unnormalized.
@param dMin [out] Returns the minimum extent of this AABB on the given axis.
@param dMax [out] Returns the maximum extent of this AABB on the given axis. */
void ProjectToAxis(const vec &axis, float &dMin, float &dMax) const;
int UniqueFaceNormals(vec *out) const;
int UniqueEdgeDirections(vec *out) const;
/// Expands this AABB to enclose the given object.
/** This function computes an AABB that encloses both this AABB and the specified object, and stores the resulting
AABB into this.
@note The generated AABB is not necessarily the optimal enclosing AABB for this AABB and the given object. */
void Enclose(const vec &point);
void Enclose(const LineSegment &lineSegment);
void Enclose(const AABB &aabb);
void Enclose(const OBB &obb);
void Enclose(const Sphere &sphere);
void Enclose(const Triangle &triangle);
void Enclose(const Capsule &capsule);
void Enclose(const Frustum &frustum);
void Enclose(const Polygon &polygon);
void Enclose(const Polyhedron &polyhedron);
void Enclose(const vec *pointArray, int numPoints);
/// Generates an unindexed triangle mesh representation of this AABB.
/** @param numFacesX The number of faces to generate along the X axis. This value must be >= 1.
@param numFacesY The number of faces to generate along the Y axis. This value must be >= 1.
@param numFacesZ The number of faces to generate along the Z axis. This value must be >= 1.
@param outPos [out] An array of size numVertices which will receive a triangle list
of vertex positions. Cannot be null.
@param outNormal [out] An array of size numVertices which will receive vertex normals.
If this parameter is null, vertex normals are not returned.
@param outUV [out] An array of size numVertices which will receive vertex UV coordinates.
If this parameter is null, a UV mapping is not generated.
@param ccwIsFrontFacing If true, then the front-facing direction of the faces will be the sides
with counterclockwise winding order. Otherwise, the faces are generated in clockwise winding order.
The number of vertices that outPos, outNormal and outUV must be able to contain is
(x*y + x*z + y*z)*2*6. If x==y==z==1, then a total of 36 vertices are required. Call
NumVerticesInTriangulation to obtain this value.
@see ToPolyhedron(), ToEdgeList(), NumVerticesInTriangulation(). */
void Triangulate(int numFacesX, int numFacesY, int numFacesZ,
vec *outPos, vec *outNormal, float2 *outUV,
bool ccwIsFrontFacing) const;
/// Returns the number of vertices that the Triangulate() function will output with the given subdivision parameters.
/** @see Triangulate(). */
static int NumVerticesInTriangulation(int numFacesX, int numFacesY, int numFacesZ)
{
return (numFacesX*numFacesY + numFacesX*numFacesZ + numFacesY*numFacesZ)*2*6;
}
/// Generates an edge list representation of the edges of this AABB.
/** @param outPos [out] An array that contains space for at least 24 vertices (NumVerticesInEdgeList()).
@see Triangulate(), Edge(), NumVerticesInEdgeList(). */
void ToEdgeList(vec *outPos) const;
/// Returns the number of vertices that the ToEdgeList() function will output.
/** @see ToEdgeList(). */
static int NumVerticesInEdgeList()
{
return 4*3*2;
}
#ifdef MATH_ENABLE_STL_SUPPORT
/// Returns a human-readable representation of this AABB. Most useful for debugging purposes.
/** The returned string specifies the center point and the half-axes of this AABB. */
std::string ToString() const;
std::string SerializeToString() const;
/// Returns a string of C++ code that can be used to construct this object. Useful for generating test cases from badly behaving objects.
std::string SerializeToCodeString() const;
#endif
static AABB FromString(const char *str, const char **outEndStr = 0);
#ifdef MATH_ENABLE_STL_SUPPORT
static AABB FromString(const std::string &str) { return FromString(str.c_str()); }
#endif
#ifdef MATH_QT_INTEROP
operator QString() const { return toString(); }
QString toString() const { return QString::fromStdString(ToString()); }
#endif
/// Finds the set intersection of this and the given AABB.
/** @return This function returns the AABB that is contained in both this and the given AABB.
@todo Add Intersection(OBB/Polyhedron). */
AABB Intersection(const AABB &aabb) const;
// Finds the set intersection of this AABB and the given OBB.
/* @return This function returns a Polyhedron that represents the set of points that are contained in this AABB
and the given OBB. */
// Polyhedron Intersection(const OBB &obb) const;
// Finds the set intersection of this AABB and the given Polyhedron.
/* @return This function returns a Polyhedron that represents the set of points that are contained in this AABB
and the given Polyhedron. */
// Polyhedron Intersection(const Polyhedron &polyhedron) const;
/// Computes the intersection of a line, ray or line segment and an AABB.
/** Based on "T. Kay, J. Kajiya. Ray Tracing Complex Scenes. SIGGRAPH 1986 vol 20, number 4. pp. 269-"
http://www.siggraph.org/education/materials/HyperGraph/raytrace/rtinter3.htm
@param linePos The starting position of the line.
@param lineDir The direction of the line. This direction vector must be normalized!
@param tNear [in, out] For the test, the input line is treated as a line segment. Pass in the signed distance
from the line origin to the start of the line. For a Line-AABB test, -FLOAT_INF is typically passed here.
For a Ray-AABB test, 0.0f should be inputted. If intersection occurs, the signed distance from line origin
to the line entry point in the AABB is returned here.
@param tFar [in, out] Pass in the signed distance from the line origin to the end of the line. For Line-AABB and
Ray-AABB tests, pass in FLOAT_INF. For a LineSegment-AABB test, pass in the length of the line segment here.
If intersection occurs, the signed distance from line origin to the line exit point in the AABB
is returned here.
@return True if an intersection occurs, false otherwise.
@note This is a low level utility function. It may be more convenient to use one of the AABB::Intersects()
functions instead.
@see Intersects(). */
bool IntersectLineAABB(const vec &linePos, const vec &lineDir, float &tNear, float &tFar) const;
bool IntersectLineAABB_CPP(const vec &linePos, const vec &lineDir, float &tNear, float &tFar) const;
#ifdef MATH_SSE
bool IntersectLineAABB_SSE(const float4 &linePos, const float4 &lineDir, float tNear, float tFar) const;
#endif
#ifdef MATH_OGRE_INTEROP
AABB(const Ogre::AxisAlignedBox &other):minPoint(other.getMinimum()), maxPoint(other.getMaximum()) {}
operator Ogre::AxisAlignedBox() const { return Ogre::AxisAlignedBox(minPoint, maxPoint); }
#endif
#ifdef MATH_GRAPHICSENGINE_INTEROP
void Triangulate(VertexBuffer &vb, int numFacesX, int numFacesY, int numFacesZ, bool ccwIsFrontFacing) const;
void ToLineList(VertexBuffer &vb) const;
#endif
bool Equals(const AABB &rhs, float epsilon = 1e-3f) const { return minPoint.Equals(rhs.minPoint, epsilon) && maxPoint.Equals(rhs.maxPoint, epsilon); }
/// Compares whether this AABB and the given AABB are identical bit-by-bit in the underlying representation.
/** @note Prefer using this over e.g. memcmp, since there can be SSE-related padding in the structures. */
bool BitEquals(const AABB &other) const { return minPoint.BitEquals(other.minPoint) && maxPoint.BitEquals(other.maxPoint); }
};
OBB operator *(const float3x3 &transform, const AABB &aabb);
OBB operator *(const float3x4 &transform, const AABB &aabb);
OBB operator *(const float4x4 &transform, const AABB &aabb);
OBB operator *(const Quat &transform, const AABB &aabb);
#ifdef MATH_QT_INTEROP
Q_DECLARE_METATYPE(AABB)
Q_DECLARE_METATYPE(AABB*)
#endif
#ifdef MATH_ENABLE_STL_SUPPORT
std::ostream &operator <<(std::ostream &o, const AABB &aabb);
#endif
#ifdef MATH_SIMD
void AABBTransformAsAABB_SIMD(AABB &aabb, const float4x4 &m);
#endif
MATH_END_NAMESPACE
| [
"5459489@qq.com"
] | 5459489@qq.com |
cc78fcf05ee09d4d012b79b21aa0e4bb4df0569a | 6fb56590f4680748d19f09860e864e65859d9361 | /include/gts/dsmcc/biop/parsers/bind.hpp | 6d2c37b9726f2009b62c929baa8971f48261423f | [
"BSL-1.0"
] | permissive | expertisesolutions/gts | 41eda5b8765fbbb9407dd6c4a1c4d07c7997802f | 86cf40c38add39cf168380387dee0f0f815b0757 | refs/heads/master | 2021-01-10T12:08:11.277506 | 2019-07-31T16:35:07 | 2019-07-31T16:41:02 | 36,961,572 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,256 | hpp | ///////////////////////////////////////////////////////////////////////////////
//
// Copyright 2011-2014 Felipe Magno de Almeida.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/foreach for documentation
//
#ifndef GTS_DSMCC_BIOP_PARSERS_BIND_HPP
#define GTS_DSMCC_BIOP_PARSERS_BIND_HPP
#include <gts/dsmcc/biop/parsers/prefixed_string.hpp>
#include <gts/dsmcc/biop/parsers/iop_ior.hpp>
#include <gts/dsmcc/biop/bind.hpp>
namespace gts { namespace dsmcc { namespace biop { namespace parsers {
template <typename BaseIterator>
biop::bind<BaseIterator> bind(BaseIterator& first, BaseIterator last)
{
biop::bind<BaseIterator> r;
typedef boost::mpl::int_<8u> names_count_bits_size;
typedef boost::mpl::int_<8u> id_length_bits_size;
typedef boost::mpl::int_<8u> kind_length_bits_size;
typedef boost::mpl::int_<8u> binding_type_bits_size;
typedef boost::mpl::int_<16u> object_info_size_bits_size;
boost::uint_t<8u>::least names = algorithm::parse_data
<boost::uint_t<8u>::least, 0u, names_count_bits_size::value>(first);
if(std::distance(first, last) >= names_count_bits_size::value/CHAR_BIT)
{
first = algorithm::position<names_count_bits_size::value>(first);
while(names-- && first != last)
{
boost::iterator_range<BaseIterator> id
= parsers::prefixed_string<id_length_bits_size::value>
(first, last);
boost::iterator_range<BaseIterator> kind
= parsers::prefixed_string<kind_length_bits_size::value>
(first, last);
r.names.push_back(biop::bind_name<BaseIterator>(id, kind));
}
}
if(std::distance(first, last) >= binding_type_bits_size::value/CHAR_BIT)
{
r.binding_type = algorithm::parse_data
<boost::uint_t<binding_type_bits_size::value>::least, 0u, binding_type_bits_size::value>
(first);
first = algorithm::position<binding_type_bits_size::value>(first);
r.ior = parsers::iop_ior(first, last);
boost::iterator_range<BaseIterator> object_info = parsers::prefixed_string
<object_info_size_bits_size::value>(first, last);
}
else
first = last;
return r;
}
} } } }
#endif
| [
"felipe@expertisesolutions.com.br"
] | felipe@expertisesolutions.com.br |
5a558ba2ddf6a6beb5e8f84df24b22f6d873ba8d | ffd9d30c97ffc69131eda7bb5b277a0ca3bc7b52 | /Node.hpp | b8070fdaa46f3e1d17796f283b16cb86f8eac499 | [] | no_license | cielcr/queuesystem | 9c44386f022500beb2d5f4f0a5c6c0ab7b5b5bf4 | 80158073d9730321d827db9175edf9554dccc514 | refs/heads/master | 2021-06-27T03:21:03.223351 | 2017-09-17T14:54:17 | 2017-09-17T14:54:17 | 103,531,385 | 4 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 588 | hpp | //
// Node.h
// QueueSystem
//
// Created by Changkun on 16/7/6.
// Copyright © 2016 Shiyanlou.com. All rights reserved.
//
#ifndef Node_h
#define Node_h
#include "Random.hpp"
struct Node {
int arrive_time;
int duration;
struct Node *next;
// 默认到达事件为0,需要服务的事件是随机的
Node(int arrive_time = 0,
int duration = Random::getRandom(EXPONENTAIL, 0.1)):
arrive_time(arrive_time),
duration(duration),
next(NULL) {}
};
typedef struct Node Node;
typedef struct Node Customer;
#endif /* Node_h */
| [
"zwj_xuan@163.com"
] | zwj_xuan@163.com |
237579c5944f55cbffafa58ab02d941048013ac3 | 07dab9c6aa6dec5c24cb9c652a186bf8f11e9ddc | /funct.cpp | 8926cb047da09f0f190e34b664789a8b109fc157 | [] | no_license | greysoftcrazy/cpp_samples | 5cf6b05360a73f95a17bc137cdd0a06e1e37dbd4 | 3d3ac9050976fc2593cce3fb4a2fb2248dd63e73 | refs/heads/master | 2021-05-09T11:28:35.308753 | 2018-01-26T01:29:28 | 2018-01-26T01:29:28 | 118,989,792 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 336 | cpp | #include <iostream>
using namespace std;
void line(), message();
int main()
{
cout << "The program starts in main()." << endl;
line();
message();
line();
cout << "At the end of main()." << endl;
return 0;
}
void line()
{
cout << "line();" << endl;
}
void message()
{
cout << "In function message()." << endl;
}
| [
"greysoftcrazy@gmail.com"
] | greysoftcrazy@gmail.com |
590344ce0c8bfdda1dce6bd7e8aec21f3a47f95f | e9fee45f5588ac7424a379413f6d4125be671b1b | /decoders/cpp/MapSchemaTypes.hpp | 0ce8c171f2e1cc2f7ee9ab6d46459eb1e5fd2380 | [
"MIT"
] | permissive | charlesmcclendon/schema | 8529aaf21063725a573acf253d4b11cbd0b07777 | 475c4471d16df60349cd6d9bd3c8d4f8ddaf776b | refs/heads/master | 2020-05-28T11:36:08.001368 | 2019-05-29T00:03:26 | 2019-05-29T00:03:26 | 188,987,790 | 0 | 0 | MIT | 2019-05-28T08:32:29 | 2019-05-28T08:32:29 | null | UTF-8 | C++ | false | false | 2,150 | hpp | //
// THIS FILE HAS BEEN GENERATED AUTOMATICALLY
// DO NOT CHANGE IT MANUALLY UNLESS YOU KNOW WHAT YOU'RE DOING
//
// GENERATED USING @colyseus/schema 0.4.34
//
#ifndef __SCHEMA_CODEGEN_MAPSCHEMATYPES_H__
#define __SCHEMA_CODEGEN_MAPSCHEMATYPES_H__ 1
#include "schema.h"
#include <typeinfo>
#include <typeindex>
#include "IAmAChild.hpp"
using namespace colyseus::schema;
class MapSchemaTypes : public Schema {
public:
MapSchema<IAmAChild*> mapOfSchemas = MapSchema<IAmAChild*>();
MapSchema<varint_t> mapOfNumbers = MapSchema<varint_t>();
MapSchema<string> mapOfStrings = MapSchema<string>();
MapSchema<int32_t> mapOfInt32 = MapSchema<int32_t>();
MapSchemaTypes() {
this->_indexes = {{0, "mapOfSchemas"}, {1, "mapOfNumbers"}, {2, "mapOfStrings"}, {3, "mapOfInt32"}};
this->_types = {{0, "map"}, {1, "map"}, {2, "map"}, {3, "map"}};
this->_childPrimitiveTypes = {{1, "number"}, {2, "string"}, {3, "int32"}};
this->_childSchemaTypes = {{0, typeid(IAmAChild)}};
}
protected:
MapSchema<char*> getMap(string field)
{
if (field == "mapOfSchemas")
{
return *(MapSchema<char*> *)&this->mapOfSchemas;
} else if (field == "mapOfNumbers")
{
return *(MapSchema<char*> *)&this->mapOfNumbers;
} else if (field == "mapOfStrings")
{
return *(MapSchema<char*> *)&this->mapOfStrings;
} else if (field == "mapOfInt32")
{
return *(MapSchema<char*> *)&this->mapOfInt32;
}
return Schema::getMap(field);
}
void setMap(string field, MapSchema<char*> value)
{
if (field == "mapOfSchemas")
{
this->mapOfSchemas = *(MapSchema<IAmAChild*> *)&value;
return;
} else if (field == "mapOfNumbers")
{
this->mapOfNumbers = *(MapSchema<varint_t> *)&value;
return;
} else if (field == "mapOfStrings")
{
this->mapOfStrings = *(MapSchema<string> *)&value;
return;
} else if (field == "mapOfInt32")
{
this->mapOfInt32 = *(MapSchema<int32_t> *)&value;
return;
}
return Schema::setMap(field, value);
}
Schema* createInstance(std::type_index type) {
if (type == typeid(IAmAChild))
{
return new IAmAChild();
}
return Schema::createInstance(type);
}
};
#endif
| [
"endel.dreyer@gmail.com"
] | endel.dreyer@gmail.com |
e17f6f9deffc959133f3bc0d53b686929d059f6e | 95458eb3399399b3d647f5e52d9e6a8990cf738e | /ProcessLib/HeatTransportBHE/BHE/BoreholeGeometry.cpp | 7a35a7f644dfade9a644214da09b3ee29dc2a853 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | joergbuchwald/ogs | 9078417a3c68996fa003dd2560e804cb448c8b21 | f5ee59fdb5af21ab98323b96a777f90b140fa925 | refs/heads/master | 2023-06-18T18:46:09.931769 | 2022-02-18T18:23:49 | 2022-02-18T18:23:49 | 174,160,100 | 0 | 0 | NOASSERTION | 2019-03-15T08:14:20 | 2019-03-06T14:26:03 | C++ | UTF-8 | C++ | false | false | 1,081 | cpp | /**
* \file
*
* \copyright
* Copyright (c) 2012-2022, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*/
#include "BoreholeGeometry.h"
#include "BaseLib/ConfigTree.h"
namespace ProcessLib
{
namespace HeatTransportBHE
{
namespace BHE
{
BoreholeGeometry createBoreholeGeometry(BaseLib::ConfigTree const& config)
{
const auto borehole_length =
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__borehole__length}
config.getConfigParameter<double>("length");
const auto borehole_diameter =
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__borehole__diameter}
config.getConfigParameter<double>("diameter");
return {borehole_length, borehole_diameter};
}
} // namespace BHE
} // namespace HeatTransportBHE
} // namespace ProcessLib
| [
"github@naumov.de"
] | github@naumov.de |
e736f38d9bf61359678ea82d2a875195233075c1 | 823def708475d4e77ee1cf3f44142e9746470a1e | /Src/Motor.cpp | 33864710ef2730b1bc719ea277046b07da9ec758 | [] | no_license | Xeenych/Robocar | 6753b181464d0b1fa53b25bed4c7571e4096b567 | ad4e6efe5612255a89c422115d5ba2b7569828eb | refs/heads/master | 2020-06-10T02:50:53.852104 | 2019-06-24T19:11:33 | 2019-06-24T19:11:33 | 193,560,382 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 533 | cpp | #include "motor.hpp"
Motor::Motor(TIM_TypeDef* _TIMx, uint32_t _Channel, uint16_t _top, uint16_t _center, uint16_t _offset) {
TIM=_TIMx;
Channel=_Channel;
top=_top;
center=_center;
offset=_offset;
LL_TIM_SetAutoReload(TIM, top);
LL_TIM_CC_EnableChannel(TIM, Channel);
LL_TIM_EnableCounter(TIM);
SetSpeed(0);
}
void Motor::SetSpeed(int16_t off) {
if (off>offset)
off = offset;
if (off<-offset)
off = -offset;
//uint16_t abs = (off>=0)? off : -off;
LL_TIM_OC_SetCompareCH1(TIM, center+off);
} | [
"Xeenych@gmail.com"
] | Xeenych@gmail.com |
9a98ee84dc5914d155d147236f3653d41ca7f940 | 42c351d7d61c78fca536913ca7d367d9a8ed85d6 | /orca3denginelibrarymodule/src/main/jni/Orca3dEngine/Orca3dRenderer.cpp | 8f0ed96644823eb5d99d5c26ec6f1dcea94fb573 | [] | no_license | ex3n/Orca3dEngine-Android | 4cd6db6ffa0f010bdea59e7cd5f117f3137969d0 | c7b7231c0c43e1f56e93cff735118b46c8cc4e52 | refs/heads/master | 2016-09-10T22:49:48.366419 | 2015-03-06T17:26:17 | 2015-03-06T17:26:17 | 31,780,540 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,686 | cpp | //
// Orca3dRenderer.cpp
// Orca3D
//
// Created by Gary Robinson on 12/3/13.
// Copyright (c) 2013 Chad Zeluff. All rights reserved.
//
#include "Orca3dRenderer.h"
#include "logger.h"
#define LOG_TAG "layer"
Orca3dRenderer::Orca3dRenderer(Orca3dScene *pScene)
{
m_pScene = pScene;
m_pEffects = new Orca3dEffects();
m_pVbo = NULL;
m_pIndexVbo = NULL;
m_nNumMesh = 0;
m_nNumDrawPasses = 1;
m_bAlphaBlending = false;
m_bTransparentSkinMode = false;
m_fAnimationProgress = 0.f;
}
Orca3dRenderer::~Orca3dRenderer()
{
if(m_pEffects)
{
delete m_pEffects;
m_pEffects = NULL;
}
if(m_pVbo)
{
glDeleteBuffers(m_nNumMesh, m_pVbo);
glDeleteBuffers(m_nNumMesh, m_pIndexVbo);
delete []m_pVbo;
delete []m_pIndexVbo;
}
}
void Orca3dRenderer::setEffectsFile(const char *filename)
{
m_pEffects->setEffectsFile(filename);
}
void Orca3dRenderer::initMeshData()
{
m_nNumMesh = m_pScene->getModelPOD()->nNumMesh;
if (!m_pVbo)
m_pVbo = new GLuint[m_nNumMesh];
if (!m_pIndexVbo)
m_pIndexVbo = new GLuint[m_nNumMesh];
glGenBuffers(m_nNumMesh, m_pVbo);
for (unsigned int i = 0; i < m_nNumMesh; ++i)
{
// Load vertex data into buffer object
SPODMesh &Mesh = m_pScene->getModelPOD()->pMesh[i];
unsigned int uiSize = Mesh.nNumVertex * Mesh.sVertex.nStride;
glBindBuffer(GL_ARRAY_BUFFER, m_pVbo[i]);
glBufferData(GL_ARRAY_BUFFER, uiSize, Mesh.pInterleaved, GL_STATIC_DRAW);
// Load index data into buffer object if available
m_pIndexVbo[i] = 0;
if (Mesh.sFaces.pData)
{
glGenBuffers(1, &m_pIndexVbo[i]);
uiSize = PVRTModelPODCountIndices(Mesh) * sizeof(GLshort);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_pIndexVbo[i]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, uiSize, Mesh.sFaces.pData, GL_STATIC_DRAW);
}
}
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
void Orca3dRenderer::enableAlphaBlend(bool enabled, bool transparentSkinMode)
{
m_bAlphaBlending = enabled;
m_bTransparentSkinMode = transparentSkinMode;
if(!m_bAlphaBlending)
m_nNumDrawPasses = 1;
else if(!m_bTransparentSkinMode)
m_nNumDrawPasses = 2;
else
m_nNumDrawPasses = 3;
}
void Orca3dRenderer::renderFrame(float timeSinceLastFrame)
{
//LOG_INFO("started Render Frame");
updateFrameRate();
m_pScene->processTimeAnimations(timeSinceLastFrame);
m_fAnimationProgress = m_pScene->getActiveAnimationProgress();
m_pScene->setMatricesForCurrentFrame();
m_pScene->updateLabelsForCurrentFrame();
for(int drawPass = 0; drawPass < m_nNumDrawPasses; drawPass++)
{
if(initDrawPass(drawPass))
drawVisibleLayers(drawPass);
}
}
void Orca3dRenderer::updateFrameRate()
{
// do this later
}
float Orca3dRenderer::getFrameRate()
{
return m_fFrameRate;
}
bool Orca3dRenderer::initDrawPass(int passIndex)
{
if(passIndex == 0)
{
glDepthMask(true);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
//LOG_INFO("glclear after gldepth mask");
}
else
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
}
return true;
}
void Orca3dRenderer::drawVisibleLayers(int passIndex)
{
for(int i=0; i<m_pScene->getNumLayers(); i++)
{
Orca3dLayer *layer = m_pScene->getLayerAt(i);
if(layer->getVisible())
{
//LOG_INFO("LayerName %s " , layer->getName().c_str() );
if(passIndex == 0)
{
//regular nodes
for(int j=0; j<layer->getNumNodeIndices(); j++)
{
int nodeIndex = layer->getNodeIndexAt(j);
drawNode(nodeIndex, passIndex, layer->getHighlighted());
}
//labels
if(layer->getLabelsVisible())
{
for(int k=0; k<layer->getNumLabelIndices(); k++)
{
int labelNodeIndex = layer->getLabelIndexAt(k);
drawNode(labelNodeIndex, passIndex, layer->getHighlighted());
}
}
}
else
{
//alpha blended nodes
for(int k=0; k<layer->getNumAlphaIndices(); k++)
{
int alphaNodeIndex = layer->getAlphaIndexAt(k);
drawNode(alphaNodeIndex, passIndex, layer->getHighlighted());
}
}
}
}
}
void Orca3dRenderer::drawNode(int nodeIndex, int drawPassIndex, bool bIsHighlighted)
{
SPODNode &node = m_pScene->getModelPOD()->pNode[nodeIndex];
setCullingForNode(nodeIndex, drawPassIndex);
bool bIsLabel = false;
if(drawPassIndex == 0)
{
string nodeName(node.pszName);
if(nodeName.find("annotation") != string::npos)
bIsLabel = true;
//LOG_INFO("drawing %s\n", nodeName.c_str());
}
// bind the VBO for the mesh
GLuint vbo = m_pVbo[node.nIdx];
glBindBuffer(GL_ARRAY_BUFFER, vbo);
// bind the index buffer, won't hurt if the handle is 0
GLuint vboIndex = m_pIndexVbo[node.nIdx];
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboIndex);
//LOG_INFO("processing Effects");
//set up the shaders for the node
m_pEffects->processEffects(m_pScene, nodeIndex, drawPassIndex, bIsHighlighted, m_fAnimationProgress, bIsLabel);
//LOG_INFO("done processing Effects");
SPODMesh &mesh = m_pScene->getModelPOD()->pMesh[node.nIdx];
int boneCount = mesh.sBoneIdx.n;
if(boneCount > 0)
drawBones(nodeIndex, drawPassIndex, bIsLabel);
else
glDrawElements(GL_TRIANGLES, mesh.nNumFaces * 3, GL_UNSIGNED_SHORT, &((unsigned short*)0)[0]);
//LOG_INFO("glDrawElements worked");
// Unbind the previous buffers by binding to 0
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
m_pEffects->disableVertexAttribArray();
}
void Orca3dRenderer::setCullingForNode(int nodeIndex, int passIndex)
{
glEnable(GL_CULL_FACE);
if(m_bTransparentSkinMode && (passIndex == 1))
{
SPODNode &node = m_pScene->getModelPOD()->pNode[nodeIndex];
string nodeName(node.pszName);
if((nodeName.find("skin") != string::npos) || (nodeName.find("Skin") != string::npos))
{
glCullFace(GL_FRONT);
return;
}
}
glCullFace(GL_BACK);
}
void Orca3dRenderer::drawBones(int nodeIndex, int drawPassIndex, bool bIsLabel)
{
SPODNode &node = m_pScene->getModelPOD()->pNode[nodeIndex];
SPODMesh &mesh = m_pScene->getModelPOD()->pMesh[node.nIdx];
for(int i32Batch = 0; i32Batch < mesh.sBoneBatches.nBatchCnt; ++i32Batch)
{
/*
If the current mesh has bone index and weight data then we need to
set up some additional variables in the shaders.
*/
// Go through the bones for the current bone batch
PVRTMat4 amBoneWorld[16];
PVRTMat3 afBoneWorldIT[16], mBoneIT;
int i32Count = mesh.sBoneBatches.pnBatchBoneCnt[i32Batch];
if(i32Count > 16){
printf("ERROR: Hard code matrix aray is too short!!!!!");
}
for(int i = 0; i < i32Count; ++i)
{
// Get the Node of the bone
int i32NodeID = mesh.sBoneBatches.pnBatches[i32Batch * mesh.sBoneBatches.nBatchBoneMax + i];
// Get the World transformation matrix for this bone and combine it with our app defined
// transformation matrix
amBoneWorld[i] = m_pScene->getModelPOD()->GetBoneWorldMatrix(node, m_pScene->getModelPOD()->pNode[i32NodeID]);
//on the pin annotations with bones in them, use boneWorldMatrix, not curNodeWorldMatrix
if(bIsLabel)
{
amBoneWorld[i] *= m_pScene->getLabelScaleMatrix();
glUniformMatrix4fv(m_pEffects->getCurNodeWorldMatrixLoc(), 1, GL_FALSE, m_pScene->getProjectionViewRot().ptr());
}
// Calculate the inverse transpose of the 3x3 rotation/scale part for correct lighting
afBoneWorldIT[i] = PVRTMat3(amBoneWorld[i]).inverse().transpose();
}
if(m_pEffects->curNodeHasBoneMatLoc())
glUniformMatrix4fv(m_pEffects->getCurNodeBoneMatLoc(), i32Count, GL_FALSE, amBoneWorld[0].ptr());
if(m_pEffects->curNodeHasBoneMatITLoc())
glUniformMatrix3fv(m_pEffects->getCurNodeBoneMatITLoc(), i32Count, GL_FALSE, afBoneWorldIT[0].ptr());
/*
As we are using bone batching we don't want to draw all the faces contained within pMesh, we only want
to draw the ones that are in the current batch. To do this we pass to the drawMesh function the offset
to the start of the current batch of triangles (Mesh.sBoneBatches.pnBatchOffset[i32Batch]) and the
total number of triangles to draw (i32Tris)
*/
int i32Tris;
if(i32Batch+1 < mesh.sBoneBatches.nBatchCnt)
i32Tris = mesh.sBoneBatches.pnBatchOffset[i32Batch+1] - mesh.sBoneBatches.pnBatchOffset[i32Batch];
else
i32Tris = mesh.nNumFaces - mesh.sBoneBatches.pnBatchOffset[i32Batch];
// Draw the mesh one bone batch at a time
glDrawElements(GL_TRIANGLES, i32Tris * 3, GL_UNSIGNED_SHORT, &((unsigned short*)0)[3 * mesh.sBoneBatches.pnBatchOffset[i32Batch]]);
}
}
void Orca3dRenderer::pickLabelAtViewPosition(float viewX, float viewY)
{
//render a frame offscreen with picking flag set for the effects
m_pEffects->setPicking(true);
//turn off the transparent skin layer from any renderings so labels can be picked through it
bool bTurnOffSkin = false;
const char *skinLayerName = "Skin";
if(m_bTransparentSkinMode && m_pScene->isLayerVisible(skinLayerName))
{
m_pScene->setLayerVisible(skinLayerName, false);
bTurnOffSkin = true;
}
//?? scale the pins bigger so they are easier to touch
GLuint viewFrameBuffer, viewRenderBuffer, depthRenderbuffer;
glGenFramebuffers(1, &viewFrameBuffer);
glBindFramebuffer(GL_FRAMEBUFFER, viewFrameBuffer);
int bufferWidth = (int)(m_pScene->getWidth());
int bufferHeight = (int)(m_pScene->getHeight());
glGenRenderbuffers(1, &viewRenderBuffer);
glBindRenderbuffer(GL_RENDERBUFFER, viewRenderBuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8_OES, bufferWidth, bufferHeight);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, viewRenderBuffer);
glGenRenderbuffers(1, &depthRenderbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, depthRenderbuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, bufferWidth, bufferHeight);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthRenderbuffer);
glBindFramebuffer(GL_FRAMEBUFFER, viewFrameBuffer);
glViewport(0, 0, bufferWidth, bufferHeight);
renderFrame(0.f);
// get the color at the pixel touched, use that to determine where the model was picked
unsigned char pixels[4] = {0,0,0,0};
glBindFramebuffer(GL_FRAMEBUFFER, viewFrameBuffer);
int readPixelsX = (int)(viewX);
int readPixelsY = (int)(m_pScene->getHeight() - viewY);
glReadPixels(readPixelsX, readPixelsY, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
//if the pixel touched is not the clear color, then a node was picked
int nodeIndex = -1;
float clearColor[4] = {-1,-1,-1,-1};
glGetFloatv(GL_COLOR_CLEAR_VALUE, clearColor);
for(int i=0; i<4; i++)
{
if(clearColor[i] != pixels[i])
{
nodeIndex = (int)(pixels[0]);
break;
}
}
m_pScene->pickedNode(nodeIndex);
//cleanup
glDeleteFramebuffers(1, &viewFrameBuffer);
glDeleteRenderbuffers(1, &viewRenderBuffer);
glDeleteRenderbuffers(1, &depthRenderbuffer);
m_pEffects->setPicking(false);
if(bTurnOffSkin)
m_pScene->setLayerVisible(skinLayerName, true);
}
GLubyte *Orca3dRenderer::renderToImageData(int bufferWidth, int bufferHeight, int dataLength)
{
GLuint viewFrameBuffer, viewRenderBuffer, depthRenderbuffer;
glGenFramebuffers(1, &viewFrameBuffer);
glBindFramebuffer(GL_FRAMEBUFFER, viewFrameBuffer);
glGenRenderbuffers(1, &viewRenderBuffer);
glBindRenderbuffer(GL_RENDERBUFFER, viewRenderBuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8_OES, bufferWidth, bufferHeight);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, viewRenderBuffer);
glGenRenderbuffers(1, &depthRenderbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, depthRenderbuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, bufferWidth, bufferHeight);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthRenderbuffer);
glBindFramebuffer(GL_FRAMEBUFFER, viewFrameBuffer);
glViewport(0, 0, bufferWidth, bufferHeight);
renderFrame(0);
GLubyte *data = (GLubyte *)malloc(dataLength * sizeof(GLubyte));
glBindFramebuffer(GL_FRAMEBUFFER, viewFrameBuffer);
glReadPixels(0, 0, bufferWidth, bufferHeight, GL_RGBA, GL_UNSIGNED_BYTE, data);
return data;
}
| [
"j.hansen.1994@gmail.com"
] | j.hansen.1994@gmail.com |
1038fba978909aab04ea7167babb2fe2d974d9f6 | 3d7f958a7003914f0d4f11f324a460dd7c03b84f | /OverloadingEx1.cpp | f200d31f6b116b525df4960bf7f4619d2f37533a | [] | no_license | blankspace-dev/C- | fca199efe83824ff19218883cedba1d0c47efa23 | 3e46f97b2d11f6534efc9efacd09630e11baea2c | refs/heads/master | 2020-12-30T15:43:08.128647 | 2017-06-17T12:13:58 | 2017-06-17T12:13:58 | 91,173,712 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 260 | cpp | #include <iostream>
void ExFunc(int a)
{
std::cout << "ExFunc(int a) called : " << a << std::endl;
}
void ExFunc(char a)
{
std::cout << "ExFunc(char a) called : " << a << std::endl;
}
int main(void)
{
ExFunc(5);
ExFunc('B');
return 0;
}
| [
"blankspace-dev@naver.com"
] | blankspace-dev@naver.com |
ce2d9336e19aad95baedbfa9ddcca63576e67c4d | 5ac4af1856032d41cedcd83b481b247c9cd2ede0 | /include/scout/Runtime/old/volren/hpgv/hpgv_utiltiming.h | c472dab25c2aec87f35ee2394f62a1b76e07fa01 | [
"BSD-3-Clause",
"LicenseRef-scancode-other-permissive"
] | permissive | lineCode/scout | 884bf2a6bf5c0e9963ef6af36f8559ec635929f3 | a7b66c9bb6940625005c05bc350491a443a23866 | refs/heads/master | 2021-05-30T14:55:14.591760 | 2016-02-18T22:45:02 | 2016-02-18T22:45:02 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,584 | h | /**
* hpgv_utiltiming.h
*
* Copyright (c) Hongfeng Yu
*
* Contact:
* Hongfeng Yu
* hfstudio@gmail.com
*
*
* All rights reserved. May not be used, modified, or copied
* without permission.
*
*/
#ifndef HPGV_UTILTIMING_H
#define HPGV_UTILTIMING_H
#include <mpi.h>
namespace scout {
extern "C" {
#define HPGV_MAX_TIMING_UNIT 170
#define HPGV_TIMING_UNIT_0 0
#define HPGV_TIMING_UNIT_1 1
#define HPGV_TIMING_UNIT_2 2
#define HPGV_TIMING_UNIT_3 3
#define HPGV_TIMING_UNIT_4 4
#define HPGV_TIMING_UNIT_5 5
#define HPGV_TIMING_UNIT_6 6
#define HPGV_TIMING_UNIT_7 7
#define HPGV_TIMING_UNIT_8 8
#define HPGV_TIMING_UNIT_9 9
#define HPGV_TIMING_UNIT_10 10
#define HPGV_TIMING_UNIT_11 11
#define HPGV_TIMING_UNIT_12 12
#define HPGV_TIMING_UNIT_13 13
#define HPGV_TIMING_UNIT_14 14
#define HPGV_TIMING_UNIT_15 15
#define HPGV_TIMING_UNIT_16 16
#define HPGV_TIMING_UNIT_17 17
#define HPGV_TIMING_UNIT_18 18
#define HPGV_TIMING_UNIT_19 19
#define HPGV_TIMING_UNIT_20 20
#define HPGV_TIMING_UNIT_21 21
#define HPGV_TIMING_UNIT_22 22
#define HPGV_TIMING_UNIT_23 23
#define HPGV_TIMING_UNIT_24 24
#define HPGV_TIMING_UNIT_25 25
#define HPGV_TIMING_UNIT_26 26
#define HPGV_TIMING_UNIT_27 27
#define HPGV_TIMING_UNIT_28 28
#define HPGV_TIMING_UNIT_29 29
#define HPGV_TIMING_UNIT_30 30
#define HPGV_TIMING_UNIT_31 31
#define HPGV_TIMING_UNIT_32 32
#define HPGV_TIMING_UNIT_33 33
#define HPGV_TIMING_UNIT_34 34
#define HPGV_TIMING_UNIT_35 35
#define HPGV_TIMING_UNIT_36 36
#define HPGV_TIMING_UNIT_37 37
#define HPGV_TIMING_UNIT_38 38
#define HPGV_TIMING_UNIT_39 39
#define HPGV_TIMING_UNIT_40 40
#define HPGV_TIMING_UNIT_41 41
#define HPGV_TIMING_UNIT_42 42
#define HPGV_TIMING_UNIT_43 43
#define HPGV_TIMING_UNIT_44 44
#define HPGV_TIMING_UNIT_45 45
#define HPGV_TIMING_UNIT_46 46
#define HPGV_TIMING_UNIT_47 47
#define HPGV_TIMING_UNIT_48 48
#define HPGV_TIMING_UNIT_49 49
#define HPGV_TIMING_UNIT_50 50
#define HPGV_TIMING_UNIT_51 51
#define HPGV_TIMING_UNIT_52 52
#define HPGV_TIMING_UNIT_53 53
#define HPGV_TIMING_UNIT_54 54
#define HPGV_TIMING_UNIT_55 55
#define HPGV_TIMING_UNIT_56 56
#define HPGV_TIMING_UNIT_57 57
#define HPGV_TIMING_UNIT_58 58
#define HPGV_TIMING_UNIT_59 59
#define HPGV_TIMING_UNIT_60 60
#define HPGV_TIMING_UNIT_61 61
#define HPGV_TIMING_UNIT_62 62
#define HPGV_TIMING_UNIT_63 63
#define HPGV_TIMING_UNIT_64 64
#define HPGV_TIMING_UNIT_65 65
#define HPGV_TIMING_UNIT_66 66
#define HPGV_TIMING_UNIT_67 67
#define HPGV_TIMING_UNIT_68 68
#define HPGV_TIMING_UNIT_69 69
#define HPGV_TIMING_UNIT_70 70
#define HPGV_TIMING_UNIT_71 71
#define HPGV_TIMING_UNIT_72 72
#define HPGV_TIMING_UNIT_73 73
#define HPGV_TIMING_UNIT_74 74
#define HPGV_TIMING_UNIT_75 75
#define HPGV_TIMING_UNIT_76 76
#define HPGV_TIMING_UNIT_77 77
#define HPGV_TIMING_UNIT_78 78
#define HPGV_TIMING_UNIT_79 79
#define HPGV_TIMING_UNIT_80 80
#define HPGV_TIMING_UNIT_81 81
#define HPGV_TIMING_UNIT_82 82
#define HPGV_TIMING_UNIT_83 83
#define HPGV_TIMING_UNIT_84 84
#define HPGV_TIMING_UNIT_85 85
#define HPGV_TIMING_UNIT_86 86
#define HPGV_TIMING_UNIT_87 87
#define HPGV_TIMING_UNIT_88 88
#define HPGV_TIMING_UNIT_89 89
#define HPGV_TIMING_UNIT_90 90
#define HPGV_TIMING_UNIT_91 91
#define HPGV_TIMING_UNIT_92 92
#define HPGV_TIMING_UNIT_93 93
#define HPGV_TIMING_UNIT_94 94
#define HPGV_TIMING_UNIT_95 95
#define HPGV_TIMING_UNIT_96 96
#define HPGV_TIMING_UNIT_97 97
#define HPGV_TIMING_UNIT_98 98
#define HPGV_TIMING_UNIT_99 99
#define HPGV_TIMING_UNIT_100 100
#define HPGV_TIMING_UNIT_101 101
#define HPGV_TIMING_UNIT_102 102
#define HPGV_TIMING_UNIT_103 103
#define HPGV_TIMING_UNIT_104 104
#define HPGV_TIMING_UNIT_105 105
#define HPGV_TIMING_UNIT_106 106
#define HPGV_TIMING_UNIT_107 107
#define HPGV_TIMING_UNIT_108 108
#define HPGV_TIMING_UNIT_109 109
#define HPGV_TIMING_UNIT_110 110
#define HPGV_TIMING_UNIT_111 111
#define HPGV_TIMING_UNIT_112 112
#define HPGV_TIMING_UNIT_113 113
#define HPGV_TIMING_UNIT_114 114
#define HPGV_TIMING_UNIT_115 115
#define HPGV_TIMING_UNIT_116 116
#define HPGV_TIMING_UNIT_117 117
#define HPGV_TIMING_UNIT_118 118
#define HPGV_TIMING_UNIT_119 119
#define HPGV_TIMING_UNIT_120 120
#define HPGV_TIMING_UNIT_121 121
#define HPGV_TIMING_UNIT_122 122
#define HPGV_TIMING_UNIT_123 123
#define HPGV_TIMING_UNIT_124 124
#define HPGV_TIMING_UNIT_125 125
#define HPGV_TIMING_UNIT_126 126
#define HPGV_TIMING_UNIT_127 127
#define HPGV_TIMING_UNIT_128 128
#define HPGV_TIMING_UNIT_129 129
#define HPGV_TIMING_UNIT_130 130
#define HPGV_TIMING_UNIT_131 131
#define HPGV_TIMING_UNIT_132 132
#define HPGV_TIMING_UNIT_133 133
#define HPGV_TIMING_UNIT_134 134
#define HPGV_TIMING_UNIT_135 135
#define HPGV_TIMING_UNIT_136 136
#define HPGV_TIMING_UNIT_137 137
#define HPGV_TIMING_UNIT_138 138
#define HPGV_TIMING_UNIT_139 139
#define HPGV_TIMING_UNIT_140 140
#define HPGV_TIMING_UNIT_141 141
#define HPGV_TIMING_UNIT_142 142
#define HPGV_TIMING_UNIT_143 143
#define HPGV_TIMING_UNIT_144 144
#define HPGV_TIMING_UNIT_145 145
#define HPGV_TIMING_UNIT_146 146
#define HPGV_TIMING_UNIT_147 147
#define HPGV_TIMING_UNIT_148 148
#define HPGV_TIMING_UNIT_149 149
#define HPGV_TIMING_UNIT_150 150
#define HPGV_TIMING_UNIT_151 151
#define HPGV_TIMING_UNIT_152 152
#define HPGV_TIMING_UNIT_153 153
#define HPGV_TIMING_UNIT_154 154
#define HPGV_TIMING_UNIT_155 155
#define HPGV_TIMING_UNIT_156 156
#define HPGV_TIMING_UNIT_157 157
#define HPGV_TIMING_UNIT_158 158
#define HPGV_TIMING_UNIT_159 159
#define HPGV_TIMING_UNIT_160 160
#define HPGV_TIMING_UNIT_161 161
#define HPGV_TIMING_UNIT_162 162
#define HPGV_TIMING_UNIT_163 163
#define HPGV_TIMING_UNIT_164 164
#define HPGV_TIMING_UNIT_165 165
#define HPGV_TIMING_UNIT_166 166
#define HPGV_TIMING_UNIT_167 167
#define HPGV_TIMING_UNIT_168 168
#define HPGV_TIMING_UNIT_169 169
void
hpgv_timing_contextglobal(char *context);
void
hpgv_timing_contextlocal(char *context);
void
hpgv_timing_showlocal(int local);
void
hpgv_timing_showglobal(int global);
void
hpgv_timing_savelocal(int local);
void
hpgv_timing_saveglobal(int global);
void
hpgv_timing_showbreakdown();
void
hpgv_timing_countroot(int countroot);
int
hpgv_timing_valid();
void
hpgv_timing_finalize();
void
hpgv_timing_init(int root, MPI_Comm mpicomm);
void
hpgv_timing_name(int unit, char *name);
void
hpgv_timing_decrease(int unit, double value);
void
hpgv_timing_increase(int unit, double value);
double
hpgv_timing_get(int unit);
double
hpgv_timing_getgather(int proc, int unit);
void
hpgv_timing_set(int unit, double value);
void
hpgv_timing_begin(int unit);
void
hpgv_timing_end(int unit);
void
hpgv_timing_count(int unit);
void
hpgv_timing_statistics();
#define HPGV_TIMING_SAVE_LOCAL 0
#define HPGV_TIMING_SHOW_LOCAL 1
#define HPGV_TIMING_SAVE_GLOBAL 2
#define HPGV_TIMING_SHOW_GLOBAL 3
#ifdef HPGV_TIMING
#define HPGV_TIMING_CONTEXTLOCAL(context) \
hpgv_timing_contextlocal(context)
#define HPGV_TIMING_CONTEXTGLOBAL(context) \
hpgv_timing_contextglobal(context)
#define HPGV_TIMING_SHOWGLOBAL(global) \
hpgv_timing_showglobal(global)
#define HPGV_TIMING_SHOWLOCAL(local) \
hpgv_timing_showlocal(local)
#define HPGV_TIMING_SAVEGLOBAL(global) \
hpgv_timing_saveglobal(global)
#define HPGV_TIMING_SAVELOCAL(local) \
hpgv_timing_savelocal(local)
#define HPGV_TIMING_SHOWBREAKDOWN() \
hpgv_timing_showbreakdown()
#define HPGV_TIMING_COUNTROOT(countroot) \
hpgv_timing_countroot(countroot)
#define HPGV_TIMING_VALID() \
hpgv_timing_valid()
#define HPGV_TIMING_FINALIZE() {\
hpgv_timing_finalize();\
}
#define HPGV_TIMING_INIT(root, mpicomm) {\
hpgv_timing_init(root, mpicomm);\
}
#define HPGV_TIMING_NAME(unit, name) {\
hpgv_timing_name(unit, name);\
}
#define HPGV_TIMING_DECREASE(unit, value) {\
hpgv_timing_decrease(unit, value);\
}
#define HPGV_TIMING_INCREASE(unit, value) {\
hpgv_timing_increase(unit, value);\
}
#define HPGV_TIMING_SET(unit, value) {\
hpgv_timing_set(unit, value);\
}
#define HPGV_TIMING_GET(unit) hpgv_timing_get(unit)
#define HPGV_TIMING_GETGATHER(proc, unit) hpgv_timing_getgather(proc, unit)
#define HPGV_TIMING_BEGIN(unit) {\
hpgv_timing_begin(unit);\
}
#define HPGV_TIMING_END(unit) {\
hpgv_timing_end(unit);\
}
#define HPGV_TIMING_COUNT(unit) {\
hpgv_timing_count(unit);\
}
#define HPGV_TIMING_STATISTICS() {\
hpgv_timing_statistics();\
}
#define HPGV_TIMING_BARRIER(mpicomm) {\
MPI_Barrier(mpicomm);\
}
#else
#define HPGV_TIMING_CONTEXTLOCAL(context)
#define HPGV_TIMING_CONTEXTGLOBAL(context)
#define HPGV_TIMING_SHOWGLOBAL(global)
#define HPGV_TIMING_SHOWLOCAL(local)
#define HPGV_TIMING_SAVEGLOBAL(global)
#define HPGV_TIMING_SAVELOCAL(local)
#define HPGV_TIMING_SHOWBREAKDOWN()
#define HPGV_TIMING_COUNTROOT(countroot)
#define HPGV_TIMING_VALID() HPGV_FALSE
#define HPGV_TIMING_FINALIZE()
#define HPGV_TIMING_INIT(root, mpicomm)
#define HPGV_TIMING_NAME(unit, name)
#define HPGV_TIMING_DECREASE(unit, value)
#define HPGV_TIMING_INCREASE(unit, value)
#define HPGV_TIMING_GET(unit)
#define HPGV_TIMING_GETGATHER(proc, unit)
#define HPGV_TIMING_SET(unit, value)
#define HPGV_TIMING_BEGIN(unit)
#define HPGV_TIMING_END(unit)
#define HPGV_TIMING_COUNT(unit)
#define HPGV_TIMING_STATISTICS()
#define HPGV_TIMING_BARRIER(mpicomm)
#endif
}
} // end namespace scout
#endif
| [
"cahrens@lanl.gov"
] | cahrens@lanl.gov |
3df041647ac8b2d0e3c83d8b774bb94acf81a898 | e7ced2ae6b2039d4eb68590249ea206c96bc0f0b | /Classes/TowerMenu.cpp | 106faf410ce3d78dae06c07cdbb2cc310e4f2be9 | [] | no_license | wangpeng20150703/tower | 8cfa8e05a9ebe060336d7fa08928feb09a9c5601 | 36fcf6584abc75984853547d7ab5dd25a1ee2554 | refs/heads/master | 2020-05-18T17:13:25.288748 | 2015-08-25T06:15:54 | 2015-08-25T06:15:54 | 39,827,816 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,656 | cpp | //
// TowerMenu.cpp
// tower
//
// Created by wangpeng on 15/7/31.
//
//
#include "TowerMenu.h"
#include "TowerMenuManager.h"
bool TowerMenu::init()
{
return true;
}
void TowerMenu::onEnter()
{
Node::onEnter();
NotificationCenter::getInstance()->addObserver(
this, CC_CALLFUNCO_SELECTOR(TowerMenu::addTower), "select tower", nullptr);
}
void TowerMenu::onExit()
{
Node::onExit();
NotificationCenter::getInstance()->removeAllObservers(this);
}
void TowerMenu::setPos(Vec2 v, cocos2d::experimental::TMXTiledMap* pMap, Vec2 mapOffset)
{
// tile正中坐标
int x = (v.x - mapOffset.x) / pMap->getTileSize().width;
int y = pMap->getMapSize().height - (v.y - mapOffset.y) / pMap->getTileSize().height;
auto layer = pMap->getLayer("layer0");
if (layer->getTileGIDAt(Vec2(x, y)) != 3) {
return;
}
v.x = ((int)((v.x - mapOffset.x) / pMap->getTileSize().width) + 0.5) * pMap->getTileSize().width;
v.y = ((int)((v.y - mapOffset.y) / pMap->getTileSize().height) + 0.5) * pMap->getTileSize().height;
m_vTileCenter.x = v.x + mapOffset.x;
m_vTileCenter.y = v.y + mapOffset.y;
//添加菜单中种类
auto towerRed = Tower::create();
towerRed->setTowerType(RED);
towerRed->load("tower1.png");
towerRed->setIsMenuTower(true);
m_vTower.push_back(towerRed);
auto towerYellow = Tower::create();
towerYellow->setTowerType(YELLOW);
towerYellow->load("tower2.png");
towerYellow->setIsMenuTower(true);
m_vTower.push_back(towerYellow);
//设置子类在菜单中坐标
m_vTower[0]->setPos(
Vec2(v.x + mapOffset.x - m_vTower[0]->getTowerSprite()->getTextureRect().size.width, v.y + mapOffset.y));
m_vTower[1]->setPos(
Vec2(v.x + mapOffset.x + m_vTower[1]->getTowerSprite()->getTextureRect().size.width, v.y + mapOffset.y));
for (int i = 0; i < m_vTower.size(); i++) {
addChild(m_vTower[i]);
}
//监听
listen();
}
void TowerMenu::addTower(Ref* obj)
{
if (obj == NULL) {
return;
}
if (!TowerManager::getInstance()->addNewTowerToGame(((Tower*)obj)->getTowerType(), getParent(), 1, m_vTileCenter)) {
log("TowerMenu::addTower ERROR");
return;
}
TowerMenuManager::getInstance()->release();
}
void TowerMenu::release()
{
this->removeFromParentAndCleanup(true);
}
void TowerMenu::listen()
{
//设置监听
auto listener1 = EventListenerTouchOneByOne::create();
listener1->setSwallowTouches(true);
listener1->onTouchBegan = [](Touch* touch, Event* event) {
auto target = static_cast<Tower*>(event->getCurrentTarget());
Vec2 locationInNode = target->getTowerSprite()->convertToNodeSpace(touch->getLocation());
Rect r = target->getTowerSprite()->getTextureRect();
if (r.containsPoint(locationInNode)) {
switch (target->getTowerType()) {
case RED: {
auto temp = Tower::create();
temp->setTowerType(RED);
NotificationCenter::getInstance()->postNotification("select tower", temp);
} break;
case YELLOW: {
auto temp = Tower::create();
temp->setTowerType(YELLOW);
NotificationCenter::getInstance()->postNotification("select tower", temp);
} break;
}
return true;
}
return false;
};
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener1, m_vTower[0]);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener1->clone(), m_vTower[1]);
} | [
"wp20150703@163.com"
] | wp20150703@163.com |
5585c2e4132295a6e1f9a0d22ecb139745954fba | bb9e83dc11eaa59ff26642fd879eee091bae3952 | /src/unrolled_strings.cpp | fa850cd17076fb86c021234db206f4cd91b76840 | [] | no_license | svatasoiu/strings-ops | ea03ee65f29c0fc93f0ba87e4d49851295f98711 | f208cad29580af4fb09f90cac8e33ef1ddfb0fac | refs/heads/master | 2021-05-06T02:34:22.410748 | 2017-12-18T02:28:42 | 2017-12-18T02:28:42 | 114,570,467 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 770 | cpp | #include <cstdint>
#include "strings.hpp"
namespace strings
{
size_t strlen(const char *s) {
size_t len = 0;
while (!((((*(uint64_t *)s) - 0x0101010101010101ULL)
& ~(*(uint64_t *)s) & 0x8080808080808080ULL)))
{
s += 8;
len += 8;
}
while (*s++ && ++len)
;
return len;
}
// from https://codereview.stackexchange.com/questions/30337/x86-strcpy-implementation
char * strcpy(char * dst, const char * src)
{
char * origin = dst;
while (!((((*(uint64_t *)src) - 0x0101010101010101ULL)
& ~(*(uint64_t *)src) & 0x8080808080808080ULL)))
{
*(uint64_t *)dst = *(uint64_t *)src;
src += 8;
dst += 8;
}
while (*dst++ = *src++)
;
return origin;
}
} | [
"sorin.vatasoiu@gmail.com"
] | sorin.vatasoiu@gmail.com |
d0a773f10fb6642a10da425beb16786a55b15604 | c06fbce9c1a339a00728e58ec87fea3e02a4a89a | /projects/fs_project/include/master.hpp | faa339ad6696cdc1824b581e41429859e1f56070 | [] | no_license | RotemKadosh/DistributedDisk | 191c67dc894347f8ecb18429d72180a98d688df5 | 7ddadf93fd6a8015179942dd50090761bfda69c9 | refs/heads/main | 2023-03-26T11:02:37.537243 | 2021-03-30T09:03:03 | 2021-03-30T09:03:03 | 352,929,363 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 61 | hpp | /home/rotemkadosh27/git/projects/fs_project/master/master.hpp | [
"rotemkadosh27@gmail.com"
] | rotemkadosh27@gmail.com |
9bff766c62e403befccb103f277c7ddcda5ed0f6 | d401edfa1fc9ef27a16fc29ad19458dd043d762f | /src/examples/iqinetics_underactuated_propeller/complex_motor_control_client.hpp | f4918045022b90b65c6d896b822d61e1fe5fb180 | [
"BSD-3-Clause"
] | permissive | dskart/Firmware | 09ba3d479bf8353962c5b67630dab7680a743676 | 96776c12dd962a588fe76fc54cbde1eccbdf42c2 | refs/heads/master | 2020-04-17T10:00:26.329326 | 2019-01-19T00:23:41 | 2019-01-19T00:23:41 | 144,616,176 | 0 | 0 | BSD-3-Clause | 2018-08-13T18:06:28 | 2018-08-13T18:06:28 | null | UTF-8 | C++ | false | false | 11,981 | hpp | #ifndef COMPLEX_MOTOR_CONTROL_CLIENT_H
#define COMPLEX_MOTOR_CONTROL_CLIENT_H
#include "communication_interface.h"
#include "client_communication.hpp"
//TODO::Cleanup then include common_message_types and delete the below line
const uint8_t kTypeComplexMotorControl = 51;
class ComplexMotorControlClient: public ClientAbstract{
public:
ComplexMotorControlClient(uint8_t obj_idn):
ClientAbstract( kTypeComplexMotorControl, obj_idn),
cmd_mode_( kTypeComplexMotorControl, obj_idn, kSubCmdMode),
cmd_phase_pwm_( kTypeComplexMotorControl, obj_idn, kSubCmdPhasePwm),
cmd_phase_volts_( kTypeComplexMotorControl, obj_idn, kSubCmdPhaseVolts),
cmd_spin_pwm_( kTypeComplexMotorControl, obj_idn, kSubCmdSpinPwm),
cmd_spin_volts_( kTypeComplexMotorControl, obj_idn, kSubCmdSpinVolts),
cmd_brake_( kTypeComplexMotorControl, obj_idn, kSubCmdBrake),
cmd_coast_( kTypeComplexMotorControl, obj_idn, kSubCmdCoast),
cmd_calibrate_( kTypeComplexMotorControl, obj_idn, kSubCmdCalibrate),
cmd_velocity_( kTypeComplexMotorControl, obj_idn, kSubCmdVelocity),
cmd_angle_( kTypeComplexMotorControl, obj_idn, kSubCmdAngle),
drive_pwm_( kTypeComplexMotorControl, obj_idn, kSubDrivePwm),
drive_volts_( kTypeComplexMotorControl, obj_idn, kSubDriveVolts),
mech_lead_angle_( kTypeComplexMotorControl, obj_idn, kSubMechLeadAngle),
obs_supply_volts_( kTypeComplexMotorControl, obj_idn, kSubObsSupplyVolts),
obs_supply_amps_( kTypeComplexMotorControl, obj_idn, kSubObsSupplyAmps),
obs_angle_( kTypeComplexMotorControl, obj_idn, kSubObsAngle),
obs_absolute_angle_( kTypeComplexMotorControl, obj_idn, kSubObsAbsoluteAngle),
obs_velocity_( kTypeComplexMotorControl, obj_idn, kSubObsVelocity),
motor_pole_pairs_( kTypeComplexMotorControl, obj_idn, kSubMotorPolePairs),
motor_emf_shape_( kTypeComplexMotorControl, obj_idn, kSubMotorEmfShape),
motor_kv_( kTypeComplexMotorControl, obj_idn, kSubMotorKv),
motor_r_ohm_( kTypeComplexMotorControl, obj_idn, kSubMotorROhm),
motor_i_max_( kTypeComplexMotorControl, obj_idn, kSubMotorIMax),
permute_wires_( kTypeComplexMotorControl, obj_idn, kSubPermuteWires),
calibration_angle_( kTypeComplexMotorControl, obj_idn, kSubCalibrationAngle),
lead_time_( kTypeComplexMotorControl, obj_idn, kSubLeadTime),
commutation_hz_( kTypeComplexMotorControl, obj_idn, kSubCommutationHz),
control_hz_( kTypeComplexMotorControl, obj_idn, kSubControlHz),
phase_angle_( kTypeComplexMotorControl, obj_idn, kSubPhaseAngle),
calibration_time_( kTypeComplexMotorControl, obj_idn, kSubCalibrationTime),
velocity_filter_fc_( kTypeComplexMotorControl, obj_idn, kSubVelocityFilterFc),
velocity_filter_value_( kTypeComplexMotorControl, obj_idn, kSubVelocityFilterValue),
velocity_kp_( kTypeComplexMotorControl, obj_idn, kSubVelocityKp),
velocity_ki_( kTypeComplexMotorControl, obj_idn, kSubVelocityKi),
velocity_kd_( kTypeComplexMotorControl, obj_idn, kSubVelocityKd),
velocity_ff0_( kTypeComplexMotorControl, obj_idn, kSubVelocityFF0),
velocity_ff1_( kTypeComplexMotorControl, obj_idn, kSubVelocityFF1),
velocity_ff2_( kTypeComplexMotorControl, obj_idn, kSubVelocityFF2),
angle_kp_( kTypeComplexMotorControl, obj_idn, kSubAngleKp),
angle_ki_( kTypeComplexMotorControl, obj_idn, kSubAngleKi),
angle_kd_( kTypeComplexMotorControl, obj_idn, kSubAngleKd),
est_motor_amps_( kTypeComplexMotorControl, obj_idn, kSubEstMotorAmps),
est_motor_torque_( kTypeComplexMotorControl, obj_idn, kSubEstMotorTorque),
obs_motor_amps_( kTypeComplexMotorControl, obj_idn, kSubObsMotorAmps),
ctrl_spin_amps_( kTypeComplexMotorControl, obj_idn, kSubCtrlSpinAmps),
ctrl_spin_torque_( kTypeComplexMotorControl, obj_idn, kSubCtrlSpinTorque),
amps_kp_( kTypeComplexMotorControl, obj_idn, kSubAmpsKp),
amps_ki_( kTypeComplexMotorControl, obj_idn, kSubAmpsKi),
amps_kd_( kTypeComplexMotorControl, obj_idn, kSubAmpsKd),
volts_limit_( kTypeComplexMotorControl, obj_idn, kSubVoltsLimit)
{};
// Client Entries
ClientEntry<uint8_t> cmd_mode_;
ClientEntry<float> cmd_phase_pwm_;
ClientEntry<float> cmd_phase_volts_;
ClientEntry<float> cmd_spin_pwm_;
ClientEntry<float> cmd_spin_volts_;
ClientEntryVoid cmd_brake_;
ClientEntryVoid cmd_coast_;
ClientEntry<float> cmd_calibrate_;
ClientEntry<float> cmd_velocity_;
ClientEntry<float> cmd_angle_;
ClientEntry<float> drive_pwm_;
ClientEntry<float> drive_volts_;
ClientEntry<float> mech_lead_angle_;
ClientEntry<float> obs_supply_volts_;
ClientEntry<float> obs_supply_amps_;
ClientEntry<float> obs_angle_;
ClientEntry<float> obs_absolute_angle_;
ClientEntry<float> obs_velocity_;
ClientEntry<uint16_t> motor_pole_pairs_;
ClientEntry<uint8_t> motor_emf_shape_;
ClientEntry<float> motor_kv_;
ClientEntry<float> motor_r_ohm_;
ClientEntry<float> motor_i_max_;
ClientEntry<uint8_t> permute_wires_;
ClientEntry<float> calibration_angle_;
ClientEntry<float> lead_time_;
ClientEntry<uint32_t> commutation_hz_;
ClientEntry<uint32_t> control_hz_;
ClientEntry<float> phase_angle_;
ClientEntry<float> calibration_time_;
ClientEntry<uint32_t> velocity_filter_fc_;
ClientEntry<float> velocity_filter_value_;
ClientEntry<float> velocity_kp_;
ClientEntry<float> velocity_ki_;
ClientEntry<float> velocity_kd_;
ClientEntry<float> velocity_ff0_;
ClientEntry<float> velocity_ff1_;
ClientEntry<float> velocity_ff2_;
ClientEntry<float> angle_kp_;
ClientEntry<float> angle_ki_;
ClientEntry<float> angle_kd_;
ClientEntry<float> est_motor_amps_;
ClientEntry<float> est_motor_torque_;
ClientEntry<float> obs_motor_amps_;
ClientEntry<float> ctrl_spin_amps_;
ClientEntry<float> ctrl_spin_torque_;
ClientEntry<float> amps_kp_;
ClientEntry<float> amps_ki_;
ClientEntry<float> amps_kd_;
ClientEntry<float> volts_limit_;
void ReadMsg(CommunicationInterface& com,
uint8_t* rx_data, uint8_t rx_length)
{
static const uint8_t kEntryLength = kSubVoltsLimit+1;
ClientEntryAbstract* entry_array[kEntryLength] = {
&cmd_mode_, // 0
&cmd_phase_pwm_, // 1
&cmd_phase_volts_, // 2
&cmd_spin_pwm_, // 3
&cmd_spin_volts_, // 4
&cmd_brake_, // 5
&cmd_coast_, // 6
&cmd_calibrate_, // 7
&cmd_velocity_, // 8
&cmd_angle_, // 9
&drive_pwm_, // 10
&drive_volts_, // 11
&mech_lead_angle_, // 12
&obs_supply_volts_, // 13
&obs_supply_amps_, // 14
&obs_angle_, // 15
&obs_absolute_angle_, // 16
&obs_velocity_, // 17
&motor_pole_pairs_, // 18
&motor_emf_shape_, // 19
&motor_kv_, // 20
&motor_r_ohm_, // 21
&motor_i_max_, // 22
&permute_wires_, // 23
&calibration_angle_, // 24
&lead_time_, // 25
&commutation_hz_, // 26
&control_hz_, // 27
&phase_angle_, // 28
&calibration_time_, // 29
&velocity_filter_fc_, // 30
&velocity_filter_value_,// 31
&velocity_kp_, // 32
&velocity_ki_, // 33
&velocity_kd_, // 34
&velocity_ff0_, // 35
&velocity_ff1_, // 36
&velocity_ff2_, // 37
&angle_kp_, // 38
&angle_ki_, // 39
&angle_kd_, // 40
nullptr, // 41
&est_motor_amps_, // 42
&est_motor_torque_, // 43
&obs_motor_amps_, // 44
&ctrl_spin_amps_, // 45
&ctrl_spin_torque_, // 46
&s_kp_, // 47
&s_ki_, // 48
&s_kd_, // 49
&volts_limit_ // 50
};
ParseMsg(rx_data, rx_length, entry_array, kEntryLength);
}
private:
static const uint8_t kSubCmdMode = 0;
static const uint8_t kSubCmdPhasePwm = 1;
static const uint8_t kSubCmdPhaseVolts = 2;
static const uint8_t kSubCmdSpinPwm = 3;
static const uint8_t kSubCmdSpinVolts = 4;
static const uint8_t kSubCmdBrake = 5;
static const uint8_t kSubCmdCoast = 6;
static const uint8_t kSubCmdCalibrate = 7;
static const uint8_t kSubCmdVelocity = 8;
static const uint8_t kSubCmdAngle = 9;
static const uint8_t kSubDrivePwm = 10;
static const uint8_t kSubDriveVolts = 11;
static const uint8_t kSubMechLeadAngle = 12;
static const uint8_t kSubObsSupplyVolts = 13;
static const uint8_t kSubObsSupplyAmps = 14;
static const uint8_t kSubObsAngle = 15;
static const uint8_t kSubObsAbsoluteAngle = 16;
static const uint8_t kSubObsVelocity = 17;
static const uint8_t kSubMotorPolePairs = 18;
static const uint8_t kSubMotorEmfShape = 19;
static const uint8_t kSubMotorKv = 20;
static const uint8_t kSubMotorROhm = 21;
static const uint8_t kSubMotorIMax = 22;
static const uint8_t kSubPermuteWires = 23;
static const uint8_t kSubCalibrationAngle = 24;
static const uint8_t kSubLeadTime = 25;
static const uint8_t kSubCommutationHz = 26;
static const uint8_t kSubControlHz = 27;
static const uint8_t kSubPhaseAngle = 28;
static const uint8_t kSubCalibrationTime = 29;
static const uint8_t kSubVelocityFilterFc = 30;
static const uint8_t kSubVelocityFilterValue = 31;
static const uint8_t kSubVelocityKp = 32;
static const uint8_t kSubVelocityKi = 33;
static const uint8_t kSubVelocityKd = 34;
static const uint8_t kSubVelocityFF0 = 35;
static const uint8_t kSubVelocityFF1 = 36;
static const uint8_t kSubVelocityFF2 = 37;
static const uint8_t kSubAngleKp = 38;
static const uint8_t kSubAngleKi = 39;
static const uint8_t kSubAngleKd = 40;
// State deprecated = 41
static const uint8_t kSubEstMotorAmps = 42;
static const uint8_t kSubEstMotorTorque = 43;
static const uint8_t kSubObsMotorAmps = 44;
static const uint8_t kSubCtrlSpinAmps = 45;
static const uint8_t kSubCtrlSpinTorque = 46;
static const uint8_t kSubAmpsKp = 47;
static const uint8_t kSubAmpsKi = 48;
static const uint8_t kSubAmpsKd = 49;
static const uint8_t kSubVoltsLimit = 50;
};
#endif // COMPLEX_MOTOR_CONTROL_CLIENT_H
| [
"dskart11@gmail.com"
] | dskart11@gmail.com |
8f15b9f7befc95fd9fb1aca1d89424e0052dd870 | aec0ec186c4d633a39325ca5d3fb0b82814ddd94 | /OpenAnalysis-rcc/src/OpenAnalysis/IRInterface/ReachConstsIRInterface.hpp | 1bddb4db81894e5270cc0f310f7db3005685e66e | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | Vladimir84/rcc | 6c9e2188dacc7ae2d88c7e1bffce4b081106c704 | 74df17f897e1e35ffd310697bbdaabd189c01b69 | refs/heads/master | 2020-12-25T01:05:51.889319 | 2011-05-04T04:17:53 | 2011-05-04T04:17:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,156 | hpp | /*! \file
\brief Abstract IR interface for Reaching Constants analysis.
\authors Michelle Strout, Barbara Kreaseck
\version $Id: ReachConstsIRInterface.hpp,v 1.7 2005/03/17 21:47:46 mstrout Exp $
Copyright (c) 2002-2005, Rice University <br>
Copyright (c) 2004-2005, University of Chicago <br>
Copyright (c) 2006, Contributors <br>
All rights reserved. <br>
See ../../../Copyright.txt for details. <br>
The source IR will be responsible for ...
Preliminary version of this interface so that Nathan can implement
some of the stuff we need.
*/
#ifndef ReachConstsIRInterface_h
#define ReachConstsIRInterface_h
#include <OpenAnalysis/IRInterface/IRHandles.hpp>
#include <OpenAnalysis/Utils/OA_ptr.hpp>
#include <OpenAnalysis/ExprTree/ExprTree.hpp>
#include <OpenAnalysis/IRInterface/ConstValBasicInterface.hpp>
#include <OpenAnalysis/IRInterface/EvalToConstVisitorIRInterface.hpp>
//#include <OpenAnalysis/IRInterface/ExprStmtPairIterator.hpp>
#include <OpenAnalysis/IRInterface/AssignPairIterator.hpp>
#include <OpenAnalysis/IRInterface/OpBasicInterface.hpp>
namespace OA {
namespace ReachConsts {
//! The ReachConstsIRInterface abstract base class gives a set of methods
//! for querying the source IR for information relevant to constant propagation
//! Analysis.
//! This is the primary interface for ReachConsts to the underlying
//! intermediate representation.
class ReachConstsIRInterface : public virtual IRHandlesIRInterface,
public virtual EvalToConstVisitorIRInterface
{
public:
ReachConstsIRInterface() { }
virtual ~ReachConstsIRInterface() { }
//! Given a subprogram return an IRStmtIterator* for the entire
//! subprogram
virtual OA_ptr<IRStmtIterator> getStmtIterator(ProcHandle h) = 0;
//! Given a statement handle, get a string expressing its value
//virtual std::string toString(const StmtHandle h) = 0;
//! Given a memory reference handle, get a succinct string representation
//virtual std::string toString(const MemRefHandle h) = 0;
//! Return a list of all the memory reference handles that appear
//! in the given statement.
virtual OA_ptr<MemRefHandleIterator> getAllMemRefs(StmtHandle stmt) = 0;
//! Return a list of all the target memory reference handles that appear
//! in the given statement.
virtual OA_ptr<MemRefHandleIterator> getDefMemRefs(StmtHandle stmt) = 0;
//! Return a list of all the use memory reference handles that appear
//! in the given statement
virtual OA_ptr<MemRefHandleIterator> getUseMemRefs(StmtHandle stmt) = 0;
//! Given a statement return a list to the pairs of
//! target MemRefHandle, ExprHandle where
//! target = expr
virtual OA_ptr<AssignPairIterator>
getAssignPairIterator(StmtHandle h) = 0;
//! Given an OpHandle and two operands (unary ops will just
//! use the first operand and the second operand should be NULL)
//! return a ConstValBasicInterface
virtual OA_ptr<ConstValBasicInterface>
evalOp(OA_ptr<OpBasicInterface> opH,
OA_ptr<ConstValBasicInterface> operand1,
OA_ptr<ConstValBasicInterface> operand2) = 0;
//! Given a ConstSymHandle return an abstraction representing the
//! constant value
virtual OA_ptr<ConstValBasicInterface> getConstValBasic(ConstSymHandle c) = 0;
//! Given a ConstValHandle return an abstraction representing the
//! constant value
virtual OA_ptr<ConstValBasicInterface> getConstValBasic(ConstValHandle c) = 0;
//! Temporary routine for testing MPICFG
// given a ConstValBasicInterface, print out value if any
virtual std::string toString(OA_ptr<ConstValBasicInterface> cvPtr) = 0;
// need all for full override
virtual std::string toString(const ProcHandle h) const = 0;
virtual std::string toString(const StmtHandle h) const = 0;
virtual std::string toString(const ExprHandle h) const = 0;
virtual std::string toString(const OpHandle h) const = 0;
virtual std::string toString(const MemRefHandle h) const = 0;
virtual std::string toString(const SymHandle h) const = 0;
virtual std::string toString(const ConstSymHandle h) const = 0;
virtual std::string toString(const ConstValHandle h) const = 0;
//! Temporary routine for testing ReachConsts
// Given an unsigned int, return a ConstValBAsicInterface for it
virtual OA_ptr<ConstValBasicInterface> getConstValBasic (unsigned int val) = 0;
//! Given an ExprHandle, return an ExprTree
virtual OA_ptr<ExprTree> getExprTree(ExprHandle h) = 0;
//! Return an iterator over all of the callsites in a given stmt
virtual OA_ptr<IRCallsiteIterator> getCallsites(StmtHandle h) = 0;
//! temporary routine to find things out
// should be removed after testing
virtual int returnOpEnumValInt(OA::OpHandle op) = 0;
virtual OA_ptr<MemRefExprIterator>
getMemRefExprIterator(MemRefHandle memref) = 0;
virtual OA::OA_ptr<OA::MemRefExprIterator>
getDefMREs(OA::StmtHandle stmt) = 0;
virtual OA_ptr<AssignPairIterator>
getAssignPairIterator(CallHandle h) = 0;
};
} // end of namespace ReachConsts
} // end of namespace OA
#endif
| [
"john@jollyroger.(none)"
] | john@jollyroger.(none) |
9b9d3d80b2db936854f5354339f1017c54398026 | 40aee99c2674f121c15ac23cde6bd736d1e418e6 | /assembly/assemblyCommon/LStepExpressMotion.h | 0da33474f9ebd0aad8f0b863ea02eec7cc2a287c | [] | no_license | ksbeerna/cmstkmodlab | 1510e56a965bee9b6f42baaa1d863c5d0a2f311b | 90ce9c3867b856e85b66e4e73994e79fce49b351 | refs/heads/master | 2020-12-06T17:22:11.349564 | 2016-09-27T15:01:08 | 2016-09-27T15:01:08 | 45,681,511 | 0 | 0 | null | 2015-11-06T12:45:23 | 2015-11-06T12:45:22 | null | UTF-8 | C++ | false | false | 645 | h | #ifndef LSTEPEXPRESSMOTION_H
#define LSTEPEXPRESSMOTION_H
#include <vector>
#include "LStepExpressModel.h"
class LStepExpressMotion
{
public:
LStepExpressMotion(std::vector<double> & values, bool mode);
LStepExpressMotion(double x, double y, double z, double a, bool mode);
LStepExpressMotion(unsigned int axis, double value, bool mode);
bool getMode() const { return mode_; }
double getX() const { return x_; }
double getY() const { return y_; }
double getZ() const { return z_; }
double getA() const { return a_; }
protected:
bool mode_;
double x_, y_, z_, a_;
};
#endif // LSTEPEXPRESSMOTION_H
| [
"andreas@mussgiller.de"
] | andreas@mussgiller.de |
b83d6911a988d8dbb0c28cf50813ef9c184a8b2e | 97b6097c02a01adbe3926606c54e606b90665735 | /lib/Core/ExecutorUtil.cpp | 1e1329bc2db6b3ce599417624c89cc7ffac2dc75 | [
"NCSA"
] | permissive | xdzhang-xdu/kleem | ffe63b324c56b37eb25a09c014f60d7cbcdd5da7 | 8e0267cd0a4de0bc0c8cade1972582b235b7a7c1 | refs/heads/master | 2023-09-05T04:31:56.703562 | 2021-11-09T11:23:03 | 2021-11-09T11:23:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,277 | cpp | //===-- ExecutorUtil.cpp --------------------------------------------------===//
//
// The KLEE Symbolic Virtual Machine
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "Context.h"
#include "Executor.h"
#include "klee/Config/Version.h"
#include "klee/Core/Interpreter.h"
#include "klee/Expr/Expr.h"
#include "klee/Module/KModule.h"
#include "klee/Solver/Solver.h"
#include "klee/Support/ErrorHandling.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Operator.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
using namespace llvm;
namespace klee {
ref<klee::ConstantExpr> Executor::evalConstant(const Constant *c,
const KInstruction *ki) {
if (!ki) {
KConstant* kc = kmodule->getKConstant(c);
if (kc)
ki = kc->ki;
}
if (const llvm::ConstantExpr *ce = dyn_cast<llvm::ConstantExpr>(c)) {
return evalConstantExpr(ce, ki);
} else {
if (const ConstantInt *ci = dyn_cast<ConstantInt>(c)) {
return ConstantExpr::alloc(ci->getValue());
} else if (const ConstantFP *cf = dyn_cast<ConstantFP>(c)) {
ref<Expr> result = ConstantExpr::alloc(cf->getValueAPF().bitcastToAPInt());
result->isFloat = true;
return cast<ConstantExpr>(result);
} else if (const GlobalValue *gv = dyn_cast<GlobalValue>(c)) {
auto it = globalAddresses.find(gv);
assert(it != globalAddresses.end());
return it->second;
} else if (isa<ConstantPointerNull>(c)) {
return Expr::createPointer(0);
} else if (isa<UndefValue>(c) || isa<ConstantAggregateZero>(c)) {
if (getWidthForLLVMType(c->getType()) == 0) {
if (isa<llvm::LandingPadInst>(ki->inst)) {
klee_warning_once(0, "Using zero size array fix for landingpad instruction filter");
return ConstantExpr::create(0, 1);
}
}
return ConstantExpr::create(0, getWidthForLLVMType(c->getType()));
} else if (const ConstantDataSequential *cds =
dyn_cast<ConstantDataSequential>(c)) {
// Handle a vector or array: first element has the smallest address,
// the last element the highest
std::vector<ref<Expr> > kids;
for (unsigned i = cds->getNumElements(); i != 0; --i) {
ref<Expr> kid = evalConstant(cds->getElementAsConstant(i - 1), ki);
kids.push_back(kid);
}
assert(Context::get().isLittleEndian() &&
"FIXME:Broken for big endian");
ref<Expr> res = ConcatExpr::createN(kids.size(), kids.data());
return cast<ConstantExpr>(res);
} else if (const ConstantStruct *cs = dyn_cast<ConstantStruct>(c)) {
const StructLayout *sl = kmodule->targetData->getStructLayout(cs->getType());
llvm::SmallVector<ref<Expr>, 4> kids;
for (unsigned i = cs->getNumOperands(); i != 0; --i) {
unsigned op = i-1;
ref<Expr> kid = evalConstant(cs->getOperand(op), ki);
uint64_t thisOffset = sl->getElementOffsetInBits(op),
nextOffset = (op == cs->getNumOperands() - 1)
? sl->getSizeInBits()
: sl->getElementOffsetInBits(op+1);
if (nextOffset-thisOffset > kid->getWidth()) {
uint64_t paddingWidth = nextOffset-thisOffset-kid->getWidth();
kids.push_back(ConstantExpr::create(0, paddingWidth));
}
kids.push_back(kid);
}
assert(Context::get().isLittleEndian() &&
"FIXME:Broken for big endian");
ref<Expr> res = ConcatExpr::createN(kids.size(), kids.data());
return cast<ConstantExpr>(res);
} else if (const ConstantArray *ca = dyn_cast<ConstantArray>(c)){
llvm::SmallVector<ref<Expr>, 4> kids;
for (unsigned i = ca->getNumOperands(); i != 0; --i) {
unsigned op = i-1;
ref<Expr> kid = evalConstant(ca->getOperand(op), ki);
kids.push_back(kid);
}
assert(Context::get().isLittleEndian() &&
"FIXME:Broken for big endian");
ref<Expr> res = ConcatExpr::createN(kids.size(), kids.data());
return cast<ConstantExpr>(res);
} else if (const ConstantVector *cv = dyn_cast<ConstantVector>(c)) {
llvm::SmallVector<ref<Expr>, 8> kids;
const size_t numOperands = cv->getNumOperands();
kids.reserve(numOperands);
for (unsigned i = numOperands; i != 0; --i) {
kids.push_back(evalConstant(cv->getOperand(i - 1), ki));
}
assert(Context::get().isLittleEndian() &&
"FIXME:Broken for big endian");
ref<Expr> res = ConcatExpr::createN(numOperands, kids.data());
assert(isa<ConstantExpr>(res) &&
"result of constant vector built is not a constant");
return cast<ConstantExpr>(res);
} else if (const BlockAddress * ba = dyn_cast<BlockAddress>(c)) {
// return the address of the specified basic block in the specified function
const auto arg_bb = (BasicBlock *) ba->getOperand(1);
const auto res = Expr::createPointer(reinterpret_cast<std::uint64_t>(arg_bb));
return cast<ConstantExpr>(res);
} else {
std::string msg("Cannot handle constant ");
llvm::raw_string_ostream os(msg);
os << "'" << *c << "' at location "
<< (ki ? ki->getSourceLocation() : "[unknown]");
klee_error("%s", os.str().c_str());
}
}
}
ref<ConstantExpr> Executor::evalConstantExpr(const llvm::ConstantExpr *ce,
const KInstruction *ki) {
llvm::Type *type = ce->getType();
ref<ConstantExpr> op1(0), op2(0), op3(0);
int numOperands = ce->getNumOperands();
if (numOperands > 0) op1 = evalConstant(ce->getOperand(0), ki);
if (numOperands > 1) op2 = evalConstant(ce->getOperand(1), ki);
if (numOperands > 2) op3 = evalConstant(ce->getOperand(2), ki);
/* Checking for possible errors during constant folding */
switch (ce->getOpcode()) {
case Instruction::SDiv:
case Instruction::UDiv:
case Instruction::SRem:
case Instruction::URem:
if (op2->getLimitedValue() == 0) {
std::string msg("Division/modulo by zero during constant folding at location ");
llvm::raw_string_ostream os(msg);
os << (ki ? ki->getSourceLocation() : "[unknown]");
klee_error("%s", os.str().c_str());
}
break;
case Instruction::Shl:
case Instruction::LShr:
case Instruction::AShr:
if (op2->getLimitedValue() >= op1->getWidth()) {
std::string msg("Overshift during constant folding at location ");
llvm::raw_string_ostream os(msg);
os << (ki ? ki->getSourceLocation() : "[unknown]");
klee_error("%s", os.str().c_str());
}
}
std::string msg("Unknown ConstantExpr type");
llvm::raw_string_ostream os(msg);
switch (ce->getOpcode()) {
default :
os << "'" << *ce << "' at location "
<< (ki ? ki->getSourceLocation() : "[unknown]");
klee_error("%s", os.str().c_str());
case Instruction::Trunc:
return op1->Extract(0, getWidthForLLVMType(type));
case Instruction::ZExt: return op1->ZExt(getWidthForLLVMType(type));
case Instruction::SExt: return op1->SExt(getWidthForLLVMType(type));
case Instruction::Add: return op1->Add(op2);
case Instruction::Sub: return op1->Sub(op2);
case Instruction::Mul: return op1->Mul(op2);
case Instruction::SDiv: return op1->SDiv(op2);
case Instruction::UDiv: return op1->UDiv(op2);
case Instruction::SRem: return op1->SRem(op2);
case Instruction::URem: return op1->URem(op2);
case Instruction::And: return op1->And(op2);
case Instruction::Or: return op1->Or(op2);
case Instruction::Xor: return op1->Xor(op2);
case Instruction::Shl: return op1->Shl(op2);
case Instruction::LShr: return op1->LShr(op2);
case Instruction::AShr: return op1->AShr(op2);
case Instruction::BitCast: return op1;
case Instruction::IntToPtr:
return op1->ZExt(getWidthForLLVMType(type));
case Instruction::PtrToInt:
return op1->ZExt(getWidthForLLVMType(type));
case Instruction::GetElementPtr: {
ref<ConstantExpr> base = op1->ZExt(Context::get().getPointerWidth());
for (gep_type_iterator ii = gep_type_begin(ce), ie = gep_type_end(ce);
ii != ie; ++ii) {
ref<ConstantExpr> indexOp =
evalConstant(cast<Constant>(ii.getOperand()), ki);
if (indexOp->isZero())
continue;
// Handle a struct index, which adds its field offset to the pointer.
#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0)
if (auto STy = ii.getStructTypeOrNull()) {
#else
if (StructType *STy = dyn_cast<StructType>(*ii)) {
#endif
unsigned ElementIdx = indexOp->getZExtValue();
const StructLayout *SL = kmodule->targetData->getStructLayout(STy);
base = base->Add(
ConstantExpr::alloc(APInt(Context::get().getPointerWidth(),
SL->getElementOffset(ElementIdx))));
continue;
}
// For array or vector indices, scale the index by the size of the type.
// Indices can be negative
base = base->Add(indexOp->SExt(Context::get().getPointerWidth())
->Mul(ConstantExpr::alloc(
APInt(Context::get().getPointerWidth(),
kmodule->targetData->getTypeAllocSize(
ii.getIndexedType())))));
}
return base;
}
case Instruction::ICmp: {
switch(ce->getPredicate()) {
default: assert(0 && "unhandled ICmp predicate");
case ICmpInst::ICMP_EQ: return op1->Eq(op2);
case ICmpInst::ICMP_NE: return op1->Ne(op2);
case ICmpInst::ICMP_UGT: return op1->Ugt(op2);
case ICmpInst::ICMP_UGE: return op1->Uge(op2);
case ICmpInst::ICMP_ULT: return op1->Ult(op2);
case ICmpInst::ICMP_ULE: return op1->Ule(op2);
case ICmpInst::ICMP_SGT: return op1->Sgt(op2);
case ICmpInst::ICMP_SGE: return op1->Sge(op2);
case ICmpInst::ICMP_SLT: return op1->Slt(op2);
case ICmpInst::ICMP_SLE: return op1->Sle(op2);
}
}
case Instruction::Select:
return op1->isTrue() ? op2 : op3;
case Instruction::FAdd:
case Instruction::FSub:
case Instruction::FMul:
case Instruction::FDiv:
case Instruction::FRem:
case Instruction::FPTrunc:
case Instruction::FPExt:
case Instruction::UIToFP:
case Instruction::SIToFP:
case Instruction::FPToUI:
case Instruction::FPToSI:
case Instruction::FCmp:
assert(0 && "floating point ConstantExprs unsupported");
}
llvm_unreachable("Unsupported expression in evalConstantExpr");
return op1;
}
}
| [
"zhangxiaodong@xidian.edu.cn"
] | zhangxiaodong@xidian.edu.cn |
0fdcc524bf8d05911c80b53062e29f5ab8df5aa2 | 410e45283cf691f932b07c5fdf18d8d8ac9b57c3 | /third_party/blink/renderer/core/layout/layout_block_test.cc | 33cac11a4a64b32ecc389d294d0b71a58f28c723 | [
"BSD-2-Clause",
"LGPL-2.1-only",
"LGPL-2.0-only",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-2.0-only",
"LicenseRef-scancode-other-copyleft",
"BSD-3-Clause"
] | permissive | yanhuashengdian/chrome_browser | f52a7f533a6b8417e19b85f765f43ea63307a1fb | 972d284a9ffa4b794f659f5acc4116087704394c | refs/heads/master | 2022-12-21T03:43:07.108853 | 2019-04-29T14:20:05 | 2019-04-29T14:20:05 | 184,068,841 | 0 | 2 | BSD-3-Clause | 2022-12-17T17:35:55 | 2019-04-29T12:40:27 | null | UTF-8 | C++ | false | false | 4,974 | cc | // Copyright 2014 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 "build/build_config.h"
#include "third_party/blink/renderer/core/dom/element_traversal.h"
#include "third_party/blink/renderer/core/layout/layout_block.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/layout/layout_block_flow.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
using ::testing::MatchesRegex;
namespace blink {
class LayoutBlockTest : public RenderingTest {};
TEST_F(LayoutBlockTest, LayoutNameCalledWithNullStyle) {
scoped_refptr<ComputedStyle> style = ComputedStyle::Create();
LayoutObject* obj = LayoutBlockFlow::CreateAnonymous(&GetDocument(), style,
LegacyLayout::kAuto);
obj->SetModifiedStyleOutsideStyleRecalc(nullptr,
LayoutObject::ApplyStyleChanges::kNo);
EXPECT_FALSE(obj->Style());
EXPECT_THAT(obj->DecoratedName().Ascii().data(),
MatchesRegex("LayoutN?G?BlockFlow \\(anonymous\\)"));
obj->Destroy();
}
TEST_F(LayoutBlockTest, WidthAvailableToChildrenChanged) {
ScopedOverlayScrollbarsForTest overlay_scrollbars(false);
SetBodyInnerHTML(R"HTML(
<!DOCTYPE html>
<div id='list' style='overflow-y:auto; width:150px; height:100px'>
<div style='height:20px'>Item</div>
<div style='height:20px'>Item</div>
<div style='height:20px'>Item</div>
<div style='height:20px'>Item</div>
<div style='height:20px'>Item</div>
<div style='height:20px'>Item</div>
</div>
)HTML");
Element* list_element = GetDocument().getElementById("list");
ASSERT_TRUE(list_element);
LayoutBox* list_box = ToLayoutBox(list_element->GetLayoutObject());
Element* item_element = ElementTraversal::FirstChild(*list_element);
ASSERT_TRUE(item_element);
ASSERT_GT(list_box->VerticalScrollbarWidth(), 0);
ASSERT_EQ(item_element->OffsetWidth(),
150 - list_box->VerticalScrollbarWidth());
DummyExceptionStateForTesting exception_state;
list_element->style()->setCSSText(&GetDocument(), "width:150px;height:100px;",
exception_state);
ASSERT_FALSE(exception_state.HadException());
UpdateAllLifecyclePhasesForTest();
ASSERT_EQ(list_box->VerticalScrollbarWidth(), 0);
ASSERT_EQ(item_element->OffsetWidth(), 150);
}
TEST_F(LayoutBlockTest, OverflowWithTransformAndPerspective) {
SetBodyInnerHTML(R"HTML(
<div id='target' style='width: 100px; height: 100px; overflow: scroll;
perspective: 200px;'>
<div style='transform: rotateY(-45deg); width: 140px; height: 100px'>
</div>
</div>
)HTML");
LayoutBox* scroller =
ToLayoutBox(GetDocument().getElementById("target")->GetLayoutObject());
EXPECT_EQ(119.5, scroller->LayoutOverflowRect().Width().ToFloat());
}
TEST_F(LayoutBlockTest, NestedInlineVisualOverflow) {
// Only exercises legacy code.
if (RuntimeEnabledFeatures::LayoutNGEnabled())
return;
SetBodyInnerHTML(R"HTML(
<label style="font-size: 0px">
<input type="radio" style="margin-left: -15px">
</label>
)HTML");
auto* body = To<LayoutBlockFlow>(GetDocument().body()->GetLayoutObject());
RootInlineBox* box = body->FirstRootBox();
#if defined(OS_MACOSX)
EXPECT_EQ(LayoutRect(-17, 0, 16, 19),
box->VisualOverflowRect(box->LineTop(), box->LineBottom()));
#elif defined(OS_ANDROID)
EXPECT_EQ(LayoutRect(-15, 3, 19, 16),
box->VisualOverflowRect(box->LineTop(), box->LineBottom()));
#else
EXPECT_EQ(LayoutRect(-15, 3, 16, 13),
box->VisualOverflowRect(box->LineTop(), box->LineBottom()));
#endif
}
TEST_F(LayoutBlockTest, ContainmentStyleChange) {
SetBodyInnerHTML(R"HTML(
<style>
* { display: block }
</style>
<div id=target style="contain:strict">
<div>
<div>
<div id=contained style="position: fixed"></div>
<div></div>
<div>
</div>
</div>
)HTML");
Element* target_element = GetDocument().getElementById("target");
auto* target = To<LayoutBlockFlow>(target_element->GetLayoutObject());
LayoutBox* contained = ToLayoutBox(GetLayoutObjectByElementId("contained"));
EXPECT_TRUE(target->PositionedObjects()->Contains(contained));
// Remove layout containment. This should cause |contained| to now be
// in the positioned objects set for the LayoutView, not |target|.
target_element->setAttribute(html_names::kStyleAttr, "contain:style");
UpdateAllLifecyclePhasesForTest();
EXPECT_FALSE(target->PositionedObjects());
EXPECT_TRUE(
GetDocument().GetLayoutView()->PositionedObjects()->Contains(contained));
}
} // namespace blink
| [
"279687673@qq.com"
] | 279687673@qq.com |
2f8d88680aae03da8e31c9f03221b67adea2c50d | 0d28adfee39f1ce3dbb4d960184946693d6e0b7c | /tcpClient/Main.cpp | 4e8bdd5d285af28742a8c3624356ad707c812fd4 | [] | no_license | kew10/NetworkProgramming | ca95b2154a1aceaeb063bac47ff77b6741852d67 | 2bc4e9e405aa845dabd4994ce8334b7ad425d9cc | refs/heads/master | 2022-12-06T06:27:54.663255 | 2020-08-25T00:54:38 | 2020-08-25T00:54:38 | 277,942,992 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,802 | cpp | #include <iostream>
#include <string>
#include <WS2tcpip.h>
#pragma comment(lib, "ws2_32.lib")
using namespace std;
void main()
{
string ipAddress = "127.0.0.1"; // IP Address of the server
int port = 54000; // Listening port # on the server
// Initialize WinSock
WSAData data;
WORD ver = MAKEWORD(2, 2);
int wsResult = WSAStartup(ver, &data);
if (wsResult != 0)
{
cerr << "Can't start Winsock, Err #" << wsResult << endl;
return;
}
// Create socket
SOCKET sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock == INVALID_SOCKET)
{
cerr << "Can't create socket, Err #" << WSAGetLastError() << endl;
WSACleanup();
return;
}
// Fill in a hint structure
sockaddr_in hint;
hint.sin_family = AF_INET;
hint.sin_port = htons(port);
inet_pton(AF_INET, ipAddress.c_str(), &hint.sin_addr);
// Connect to server
int connResult = connect(sock, (sockaddr*)&hint, sizeof(hint));
if (connResult == SOCKET_ERROR)
{
cerr << "Can't connect to server, Err #" << WSAGetLastError() << endl;
closesocket(sock);
WSACleanup();
return;
}
// Do-while loop to send and receive data
char buf[4096];
string userInput;
do
{
// Prompt the user for some text
cout << "> ";
getline(cin, userInput);
if (userInput.size() > 0) // Make sure the user has typed in something
{
// Send the text
int sendResult = send(sock, userInput.c_str(), userInput.size() + 1, 0);
if (sendResult != SOCKET_ERROR)
{
// Wait for response
ZeroMemory(buf, 4096);
int bytesReceived = recv(sock, buf, 4096, 0);
if (bytesReceived > 0)
{
// Echo response to console
cout << "SERVER> " << string(buf, 0, bytesReceived) << endl;
}
}
}
} while (userInput.size() > 0);
// Gracefully close down everything
closesocket(sock);
WSACleanup();
}
| [
"kazim.bozca@hotmail.com"
] | kazim.bozca@hotmail.com |
4b1acd65c18b921a6e6922e39896848ff17e5de9 | 254779c04eb07fbd3a6e79deab7e19b186ad2744 | /hw1/code/bilateral.cpp | 413e6380f61a21997f7c20f93dec57e763a64273 | [] | no_license | Maud1023/Digital_Image_Processing | 8951544fc6a4f046006628be0d68fb0c384b1592 | abde6d464bfb985ecc4aff4725ddb37470adc2f8 | refs/heads/master | 2020-07-08T13:41:30.073043 | 2019-08-22T01:38:36 | 2019-08-22T01:38:36 | 203,691,685 | 0 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 5,696 | cpp | //(1) Name: Yifei Liu
//(2) USC ID Number: 3852294243
//(3) USC Email: liu534@usc.edu
//(4) Submission Date: 1/22/2019
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <cmath>
using namespace std;
int convert(float num){
if(num > 255){
num = 255;
}
if(num < 0){
num = 0;
}
return num;
}
int main(int argc, char *argv[])
{
// Define file pointer and variables
FILE *file;
int BytesPerPixel;
//int Size = 256;
int Row;
int Column;
// Check for proper syntax
if (argc < 4){
cout << "Syntax Error - Incorrect Parameter Usage:" << endl;
cout << "program_name input_image.raw ori_image.raw output_image.raw [BytesPerPixel = 1] [Row = 256] [Column = 256]" << endl;
//cout << "program_name 1.input_image.raw 2.ori_image.raw 3.output_image.raw 4.[BytesPerPixel = 1] 5.[Row = 256] 6.[Column = 256]" << endl;
return 0;
}
// Check if image is grayscale or color
if (argc < 5){
BytesPerPixel = 1; // default is grey image
}
else {
BytesPerPixel = atoi(argv[4]);
// Check if size is specified
if (argc >= 6){
// Size = atoi(argv[4]);
//BytesPerPixel = atoi(argv[3]);
Row = atoi(argv[5]);
Column = atoi(argv[6]);
}
}
cout << "Row and Column: " << Row << " and" << Column <<endl;
// Allocate image data array
unsigned char Imagedata[Row][Column][BytesPerPixel];
unsigned char Imagedata_ori[Row][Column][BytesPerPixel];
// Read image (filename specified by first argument) into image data matrix
if (!(file=fopen(argv[1],"rb"))) {
cout << "Cannot open file: " << argv[1] <<endl;
exit(1);
}
fread(Imagedata, sizeof(unsigned char), Row*Column*BytesPerPixel, file);
fclose(file);
cout << "Image read succeed!" <<endl;
if (!(file=fopen(argv[2],"rb"))) {
cout << "Cannot open file: " << argv[1] <<endl;
exit(1);
}
fread(Imagedata_ori, sizeof(unsigned char), Row*Column*BytesPerPixel, file);
fclose(file);
cout << "BytesPerPixel: " << BytesPerPixel <<endl;
///////////////////////// INSERT YOUR PROCESSING CODE HERE /////////////////////////
//1. Expand the image matrix.
cout << "1. Expand the image matrix." <<endl;
int N = 5; //Window size
int i = 0;
int j = 0;
int l = 0;
int k = 0;
int ch = 0;
unsigned char Imagedata_Expassion[Row + N - 1][Column + N - 1][BytesPerPixel];
//fill inside
for (k = 0; k < BytesPerPixel; k++){
for (i = (N - 1)/2; i < Row + (N - 1)/2; i++){
for (j = (N - 1)/2; j < Column + (N - 1)/2; j++){
Imagedata_Expassion[i][j][k] = Imagedata[i - (N - 1)/2][j - (N - 1)/2][k];
}
}
}
cout << "Fill inside succeed!" <<endl;
//fill the expended column.
for (k = 0; k < BytesPerPixel; k++){
for (i = (N - 1)/2; i < Row + (N - 1)/2; i++){
for (j = 0; j < (N - 1)/2 ; j++){
Imagedata_Expassion[i][j][k] = Imagedata_Expassion[i][N - 1 - j][k];
}
for (j = (N - 1)/2 + Column; j < N - 1 + Column; j++){
Imagedata_Expassion[i][j][k] = Imagedata_Expassion[i][N - 3 + 2 * Column - j][k];
}
}
}
cout << "Fill the expended column succeed!" <<endl;
//fill the expeneded row.
for(k = 0; k < BytesPerPixel; k++){
for (i = 0; i < (N - 1)/2 ; i++){
for(j = 0; j < Column + N - 1; j++){
Imagedata_Expassion[i][j][k] = Imagedata_Expassion[N - 1 -i][j][k];
}
}
for (i = (N - 1)/2 + Row; i < N - 1 + Row; i++){
for(j = 0; j < Column + N - 1; j++){
Imagedata_Expassion[i][j][k] = Imagedata_Expassion[N - 3 + 2 * Row - i][j][k];
}
}
}
cout << "Fill the expended row succeed!" <<endl;
//2.Filtering by Bilateral Filter
cout << "2.Filtering by Bilateral Filter" <<endl;
unsigned char Imagedata_compute_bilateral[Row][Column][BytesPerPixel];
double middle = 0.0;
double sigma_c = 10;
double sigma_s = 100;
double w;
double w_sum = 0.0;
double temp = 0.0;
for(ch = 0; ch < BytesPerPixel; ch++){
for (i = (N - 1)/2; i < Row + (N - 1)/2; i++){
for(j = (N - 1)/2; j < Column + (N - 1)/2; j++){
w_sum = 0.0;
temp = 0.0;
for(k = i - (N - 1)/2; k < i + (N + 1) / 2; k++){
for(l = j -(N - 1)/2; l < j + (N - 1) / 2; l++){
int distance = (i - k) * (i - k) + (j - l) * (j - l);
int luminance = abs(Imagedata_Expassion[i][j][ch] - Imagedata_Expassion[k][l][ch]);
w = exp( - distance / (2 * sigma_c * sigma_c) - luminance * luminance /(2 * sigma_s * sigma_s));
w_sum += w;
temp += Imagedata_Expassion[k][l][ch] * w;
}
}
Imagedata_compute_bilateral[i - (N - 1)/2][j - (N - 1)/2][ch] = (int)convert(temp / w_sum);
}
}
}
//3. Caculate PSNR
// compute mse
double temp1 = 0;
double mse1 = 0;
double psnr1 = 0;
double temp2 = 0;
double mse2 = 0;
double psnr2 = 0;
for(ch = 0; ch < BytesPerPixel; ch++){
for(i = 0; i < Row; i++){
for (j = 0; j < Column; j++){
temp1 = Imagedata[i][j][ch] - Imagedata_ori[i][j][ch];
mse1 = mse1 + (temp1 * temp1);
temp2 = Imagedata_compute_bilateral[i][j][ch] - Imagedata_ori[i][j][ch];
mse2 = mse2 + (temp2 * temp2);
}
}
}
mse1 = mse1 / (Row * Column * BytesPerPixel);
mse2 = mse2 / (Row * Column * BytesPerPixel);
psnr1 = 10 * log10(255.0 * 255.0 / mse1);
psnr2 = 10 * log10(255.0 * 255.0 / mse2);
cout << "psnr of noise image is :" << psnr1 <<endl;
cout << "psnr of Imagedata_compute_bilateral is :" << psnr2 <<endl;
////////////////////////// END CODE ////////////////////////////////////////////////
// Write image data (filename specified by second argument) from image data matrix
if (!(file=fopen(argv[3],"wb"))) {
cout << "Cannot open file: " << argv[3] << endl;
exit(1);
}
fwrite(Imagedata_compute_bilateral, sizeof(unsigned char), Row*Column*BytesPerPixel, file);
fclose(file);
return 0;
}
| [
"yifei_l1023@163.com"
] | yifei_l1023@163.com |
a5086908dbef208a7add8be23cf15a58c993bcf7 | d15f50029eff79d775780e85b6abdc22d522029b | /podbeuter.cpp | 2f351f9db54d48996aadf0d924f5373e4c23ed8a | [
"MIT"
] | permissive | danieldc/newsbeuter | 703eaac3a76d8d53984571a6f2606d5630868b6d | 4c20084be10fb077c5ec5459fcdb5755bf7ad8a4 | refs/heads/master | 2021-06-18T04:25:03.774130 | 2016-11-17T21:25:51 | 2016-11-17T21:25:51 | 74,135,551 | 0 | 1 | null | 2016-11-18T14:13:51 | 2016-11-18T14:13:51 | null | UTF-8 | C++ | false | false | 558 | cpp | #include <iostream>
#include <config.h>
#include <pb_controller.h>
#include <cstring>
#include <pb_view.h>
#include <errno.h>
#include <utils.h>
using namespace podbeuter;
int main(int argc, char * argv[]) {
utils::initialize_ssl_implementation();
if (!setlocale(LC_CTYPE,"") || !setlocale(LC_MESSAGES,"")) {
std::cerr << "setlocale failed: " << strerror(errno) << std::endl;
return 1;
}
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
pb_controller c;
podbeuter::pb_view v(&c);
c.set_view(&v);
c.run(argc, argv);
return 0;
}
| [
"ak@synflood.at"
] | ak@synflood.at |
e5d2e9ec47a7c176548510d29927799abf759316 | 6b4ccb663382274fb6f96c3af3a0e5b98bded94b | /step6/ar.cpp | 7d922736f824dc14d4b21395c6a77c2425778579 | [] | no_license | jeromeetienne/ar-challenge | 82d29817821e08f55bdec148cd92be9f95e5f0e6 | f15678c7ed2c67bf59496ed883eb4fb196363871 | refs/heads/master | 2023-08-31T23:25:34.682582 | 2017-12-02T15:26:38 | 2017-12-02T15:26:38 | 112,845,641 | 0 | 0 | null | 2017-12-02T13:48:40 | 2017-12-02T13:48:40 | null | UTF-8 | C++ | false | false | 3,359 | cpp | #include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <iostream>
using namespace std;
using namespace cv;
void drawQuad(Mat image, Mat points, Scalar color) {
// cout << points.at<Point2f>(0,0) << " " << points.at<Point2f>(0,1) << " " << points.at<Point2f>(0,2) << " " << points.at<Point2f>(0,3) << endl;
line(image, points.at<Point2f>(0,0), points.at<Point2f>(0,1), color);
line(image, points.at<Point2f>(0,1), points.at<Point2f>(0,2), color);
line(image, points.at<Point2f>(0,2), points.at<Point2f>(0,3), color);
line(image, points.at<Point2f>(0,3), points.at<Point2f>(0,0), color);
}
int main(int argc, char** argv) {
Scalar red(255, 0, 0);
Scalar green(0, 255, 0);
Scalar blue(0, 0, 255);
FileStorage fs("../calibrate/out_camera_data.xml", FileStorage::READ);
Mat intrinsics, distortion;
fs["Camera_Matrix"] >> intrinsics;
fs["Distortion_Coefficients"] >> distortion;
if (intrinsics.rows != 3 || intrinsics.cols != 3 || distortion.rows != 5 || distortion.cols != 1) {
cout << "Run calibration (in ../calibrate/) first!" << endl;
return 1;
}
VideoCapture cap(0);
if(!cap.isOpened()) // check if we succeeded
return -1;
Mat image;
for (;;) {
cap >> image;
Mat grayImage;
cvtColor(image, grayImage, CV_RGB2GRAY);
Mat blurredImage;
blur(grayImage, blurredImage, Size(5, 5));
Mat threshImage;
threshold(blurredImage, threshImage, 128.0, 255.0, THRESH_OTSU);
vector<vector<Point> > contours;
findContours(threshImage, contours, CV_RETR_LIST, CV_CHAIN_APPROX_NONE);
// drawContours(image, contours, -1, color);
vector<Mat> squares;
for (auto contour : contours) {
vector<Point> approx;
approxPolyDP(contour, approx, arcLength(Mat(contour), true)*0.02, true);
if( approx.size() == 4 &&
fabs(contourArea(Mat(approx))) > 1000 &&
isContourConvex(Mat(approx)) )
{
Mat squareMat;
Mat(approx).convertTo(squareMat, CV_32FC3);
squares.push_back(squareMat);
}
}
if (squares.size() > 0) {
vector<Point3f> objectPoints = {Point3f(-1, -1, 0), Point3f(-1, 1, 0), Point3f(1, 1, 0), Point3f(1, -1, 0)};
Mat objectPointsMat(objectPoints);
cout << "objectPointsMat: " << objectPointsMat.rows << ", " << objectPointsMat.cols << endl;
cout << "squares[0]: " << squares[0] << endl;
Mat rvec;
Mat tvec;
solvePnP(objectPointsMat, squares[0], intrinsics, distortion, rvec, tvec);
cout << "rvec = " << rvec << endl;
cout << "tvec = " << tvec << endl;
drawQuad(image, squares[0], green);
vector<Point3f> line3d = {{0, 0, 0}, {0, 0, 1}};
vector<Point2f> line2d;
projectPoints(line3d, rvec, tvec, intrinsics, distortion, line2d);
cout << "line2d = " << line2d << endl;
line(image, line2d[0], line2d[1], red);
}
cv::imshow("image", image);
cv::waitKey(1);
}
return 0;
}
| [
"jbrewer@jera.com"
] | jbrewer@jera.com |
e0d24de3d8cdd36a1869c3b3b8cdad9825dac08f | 430cf3bb0270c4f2d46e25c3cd6d6827e9c7dd19 | /Source/Quiver/Quiver/Entity/PhysicsComponent/PhysicsComponentDef.cpp | 1ff5bafa8eeca2ca27110150acb603411bef0d10 | [
"MIT"
] | permissive | WeyrSDev/Quiver | e59d68a83b0df36019487d49299b95ddc923c454 | 1c9ed98f48ed5f8a98b272f85636182d8523ba33 | refs/heads/master | 2021-08-19T02:16:28.026961 | 2017-11-24T13:20:16 | 2017-11-24T13:20:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,151 | cpp | #include "PhysicsComponentDef.h"
#include <Box2D/Collision/Shapes/b2CircleShape.h>
#include <Box2D/Collision/Shapes/b2ChainShape.h>
#include <Box2D/Collision/Shapes/b2EdgeShape.h>
#include <Box2D/Collision/Shapes/b2PolygonShape.h>
#include <spdlog/spdlog.h>
#include "Quiver/Physics/PhysicsShape.h"
namespace qvr {
std::unique_ptr<b2Shape> DynamicCopy(const b2Shape& shape)
{
switch (shape.GetType())
{
case b2Shape::Type::e_circle:
{
auto circleShape = std::make_unique<b2CircleShape>();
*(circleShape.get()) = (b2CircleShape&)shape;
return circleShape;
}
case b2Shape::Type::e_polygon:
{
auto polyShape = std::make_unique<b2PolygonShape>();
*(polyShape.get()) = (b2PolygonShape&)shape;
return polyShape;
}
case b2Shape::Type::e_chain:
{
auto chainShape = std::make_unique<b2ChainShape>();
*(chainShape.get()) = (b2ChainShape&)shape;
return chainShape;
}
case b2Shape::Type::e_edge:
{
auto edgeShape = std::make_unique<b2EdgeShape>();
*(edgeShape.get()) = (b2EdgeShape&)shape;
return edgeShape;
}
}
return nullptr;
}
PhysicsComponentDef::PhysicsComponentDef(const b2Shape & shape, const b2Vec2 & position, const float angle)
: m_Shape(DynamicCopy(shape))
{
fixtureDef = b2FixtureDef{};
bodyDef = b2BodyDef{};
fixtureDef.density = 1.0f;
fixtureDef.shape = m_Shape.get();
bodyDef.position = position;
bodyDef.type = b2_staticBody;
bodyDef.angle = angle;
}
PhysicsComponentDef::PhysicsComponentDef(const nlohmann::json & j)
{
fixtureDef = b2FixtureDef{};
bodyDef = b2BodyDef{};
using json = nlohmann::json;
if (j.find("Shape") == j.end()) return;
{
m_Shape = PhysicsShape::FromJson(j["Shape"]);
if (!m_Shape) {
return;
}
}
if (j.find("Position") == j.end()) return;
const b2Vec2 position = b2Vec2(j["Position"][0], j["Position"][1]);
if (j.find("Angle") == j.end()) return;
const float angle = j["Angle"];
b2BodyType bodyType = b2_staticBody;
// BodyType is soft. If it's not there we'll just use the default.
if (j.find("BodyType") != j.end()) {
if (j["BodyType"].is_string()) {
const std::string bodyTypeStr = j["BodyType"];
if (bodyTypeStr == "Static") {
bodyType = b2_staticBody;
}
else if (bodyTypeStr == "Dynamic") {
bodyType = b2_dynamicBody;
}
else if (bodyTypeStr == "Kinematic") {
bodyType = b2_kinematicBody;
}
}
}
// Also soft: fixed rotation-ness
bool fixedRotation = false;
if (j.find("FixedRotation") != j.end() &&
j["FixedRotation"].is_boolean())
{
fixedRotation = j["FixedRotation"];
}
float linearDamping = 0.0f;
if (j.find("LinearDamping") != j.end() &&
j["LinearDamping"].is_number())
{
linearDamping = j["LinearDamping"];
}
bool isBullet = false;
if (j.find("IsBullet") != j.end() &&
j["IsBullet"].is_boolean())
{
isBullet = j["IsBullet"];
}
fixtureDef.shape = m_Shape.get();
fixtureDef.density = 1.0f;
if (j.find("Friction") != j.end() &&
j["Friction"].is_number())
{
fixtureDef.friction = j["Friction"];
}
if (j.find("Restitution") != j.end() &&
j["Restitution"].is_number())
{
fixtureDef.restitution = j["Restitution"];
}
bodyDef.type = bodyType;
bodyDef.position = position;
bodyDef.angle = angle;
bodyDef.fixedRotation = fixedRotation;
bodyDef.linearDamping = linearDamping;
bodyDef.bullet = isBullet;
if (j.find("AngularDamping") != j.end() &&
j["AngularDamping"].is_number())
{
bodyDef.angularDamping = j["AngularDamping"];
}
}
bool PhysicsComponentDef::VerifyJson(const nlohmann::json & j) {
auto log = spdlog::get("console");
assert(log);
const char* logCtx = "PhysicsComponentDef::VerifyJson: ";
if (!j.is_object()) {
return false;
}
if (j.find("Position") == j.end()) return false;
if (!j["Position"].is_array()) return false;
if (j["Position"].size() != 2) return false;
if (!j["Position"][0].is_number()) return false;
if (!j["Position"][1].is_number()) return false;
if (j.find("Angle") == j.end()) return false;
if (!j["Angle"].is_number()) return false;
if (j.find("Shape") == j.end()) return false;
if (!PhysicsShape::VerifyJson(j["Shape"])) return false;
// Warn if there's something off about BodyType.
if (j.find("BodyType") == j.end()) {
log->warn("{} Could not find 'BodyType' field.", logCtx);
}
else {
if (!j["BodyType"].is_string()) {
log->warn("{} 'BodyType' is not a string.", logCtx);
}
else {
std::string bodyType = j["BodyType"];
std::string validBodyTypes[3] = { "Static", "Dynamic", "Kinematic" };
bool bodyTypeIsValid = false;
for (auto valid : validBodyTypes) {
if (bodyType == valid) {
bodyTypeIsValid = true;
break; // Success, BodyType is valid.
}
}
if (!bodyTypeIsValid) {
log->warn(
"{} 'BodyType' is not '{}', '{}' or '{}'",
logCtx,
validBodyTypes[0],
validBodyTypes[1],
validBodyTypes[2]);
}
}
}
// TODO: Add warnings for missing/bogus FixedRotation.
// TODO: Add warnings for missing/bogus LinearDamping.
// TODO: Add warnings for missing/bogus AngularDamping.
// TODO: Add warnings for missing/bogus Friction.
// TODO: Add warnings for missing/bogus Restitution.
return true;
}
} | [
"nershly@gmail.com"
] | nershly@gmail.com |
cabc4e3d68be0850a223a95ca54c30e5e26a1d01 | 650720c3d1d38bef00c871937376127bb7a53313 | /4_2_first_window_QQuickView/main.cpp | 4da956d9d41c462d485445971aa4a58bf9476f5f | [] | no_license | shin1/Qt3D_TechBookFest7 | 865458a19ba7a61554ca8c205e893abba5ca0663 | 47aaf3edecf7a8b9551a874943ea1f965c8b6335 | refs/heads/master | 2020-07-11T08:46:40.944034 | 2019-09-26T14:10:02 | 2019-09-26T14:10:02 | 204,494,697 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 329 | cpp | #include <QGuiApplication>
#include <QQuickView>
int main(int argc, char* argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQuickView view;
view.setTitle("QQuickView");
view.setSource(QUrl("qrc:/main.qml"));
view.show();
return app.exec();
}
| [
"shinichi.okada@qt.io"
] | shinichi.okada@qt.io |
9d79cedddd6d8d566fc5d84417effee6ed9711cb | 629edf8faa13214abed5c193cd957286d6b539af | /Chapter_18/DynamicCube/DynamicCube/DynamicCubeMapApp.h | 8e1fde794e785543b9df7debbdb7aab22a447733 | [] | no_license | NiHan1997/DirectX12Exercise | d435c2215544ccbc0702551a734878efd0435617 | a4a562da9a1d1575d6df62e5e8a107ab40fe0345 | refs/heads/master | 2023-03-30T00:47:38.454646 | 2021-03-29T03:48:52 | 2021-03-29T03:48:52 | 226,768,377 | 17 | 5 | null | null | null | null | GB18030 | C++ | false | false | 4,195 | h | #pragma once
#include "..\..\..\Common\d3dApp.h"
#include "..\..\..\Common\Camera.h"
#include "..\..\..\Common\d3dUtil.h"
#include "..\..\..\Common\MathHelper.h"
#include "..\..\..\Common\UploadBuffer.h"
#include "..\..\..\Common\GeometryGenerator.h"
#include "FrameResource.h"
#include "CubeRenderTarget.h"
using Microsoft::WRL::ComPtr;
using namespace DirectX;
using namespace DirectX::PackedVector;
const int gNumFrameResources = 3;
/// 立方体纹理的大小.
const UINT CubeMapSize = 512;
struct RenderItem
{
RenderItem() = default;
RenderItem(const RenderItem& rhs) = delete;
~RenderItem() = default;
int ObjectCBIndex = -1;
int NumFramesDirty = gNumFrameResources;
XMFLOAT4X4 World = MathHelper::Identity4x4();
XMFLOAT4X4 TexTransform = MathHelper::Identity4x4();
Material* Mat = nullptr;
MeshGeometry* Geo = nullptr;
D3D12_PRIMITIVE_TOPOLOGY PrimitiveType = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
UINT IndexCount = 0;
UINT StartIndexLocation = 0;
UINT BaseVertexLocation = 0;
};
enum class RenderLayer : int
{
Opaque = 0,
OpaqueDynamicReflectors,
Sky,
Count
};
class DynamicCubeMapApp : public D3DApp
{
public:
DynamicCubeMapApp(HINSTANCE hInstance);
DynamicCubeMapApp(const DynamicCubeMapApp& rhs) = delete;
DynamicCubeMapApp& operator=(const DynamicCubeMapApp& rhs) = delete;
~DynamicCubeMapApp();
virtual bool Initialize() override;
private:
virtual void CreateRtvAndDsvDescriptorHeaps() override;
virtual void OnResize()override;
virtual void Update(const GameTimer& gt) override;
virtual void Draw(const GameTimer& gt) override;
virtual void OnMouseDown(WPARAM btnState, int x, int y) override;
virtual void OnMouseUp(WPARAM btnState, int x, int y) override;
virtual void OnMouseMove(WPARAM btnState, int x, int y) override;
void OnKeyboardInput(const GameTimer& gt);
void AnimateMaterials(const GameTimer& gt);
void UpdateObjectCBs(const GameTimer& gt);
void UpdateMaterialBuffer(const GameTimer& gt);
void UpdateMainPassCB(const GameTimer& gt);
void UpdateCubeMapFacePassCBs();
void LoadTextures();
void BuildRootSignature();
void BuildDescriptorHeaps();
void BuildCubeDepthStencil();
void BuildShadersAndInputLayout();
void BuildSkullGeometry();
void BuildShapeGeometry();
void BuildMaterials();
void BuildRenderItems();
void BuildFrameResources();
void BuildPSOs();
void DrawRenderItems(ID3D12GraphicsCommandList* cmdList, const std::vector<RenderItem*>& ritems);
void DrawSceneToCubeMap();
std::array<const CD3DX12_STATIC_SAMPLER_DESC, 6> GetStaticSamplers();
void BuildCubeFaceCamera(float x, float y, float z);
private:
std::vector<std::unique_ptr<FrameResource>> mFrameResources;
FrameResource* mCurrFrameResource = nullptr;
int mCurrFrameResourceIndex = 0;
ComPtr<ID3D12RootSignature> mRootSignature = nullptr;
ComPtr<ID3D12DescriptorHeap> mSrvDescriptorHeap = nullptr;
ComPtr<ID3D12Resource> mCubeDepthStencilBuffer;
std::unordered_map<std::string, std::unique_ptr<MeshGeometry>> mGeometries;
std::unordered_map<std::string, std::unique_ptr<Material>> mMaterials;
std::unordered_map<std::string, std::unique_ptr<Texture>> mTextures;
std::unordered_map<std::string, ComPtr<ID3DBlob>> mShaders;
std::unordered_map<std::string, ComPtr<ID3D12PipelineState>> mPSOs;
std::vector<D3D12_INPUT_ELEMENT_DESC> mInputLayout;
std::vector<std::unique_ptr<RenderItem>> mAllRitems;
std::vector<RenderItem*> mRitemLayer[(int)RenderLayer::Count];
RenderItem* mSkullRitem = nullptr;
UINT mSkyTexHeapIndex = 0;
UINT mDynamicTexHeapIndex = 0;
std::unique_ptr<CubeRenderTarget> mDynamicCubeMap = nullptr;
CD3DX12_CPU_DESCRIPTOR_HANDLE mCubeDSV;
PassConstants mMainPassCB;
Camera mCamera;
Camera mCubeMapCamera[6];
POINT mLastMousePos;
};
int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nShowCmd)
{
#if defined(DEBUG) | defined(_DEBUG)
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
try
{
DynamicCubeMapApp theApp(hInstance);
if (!theApp.Initialize())
return 0;
return theApp.Run();
}
catch (DxException& e)
{
MessageBox(nullptr, e.ToString().c_str(), L"HR Failed", MB_OK);
return 0;
}
} | [
"371429357@qq.com"
] | 371429357@qq.com |
a8951efd40d759a18c9a53f2d9742ac19cf40961 | fef8a3f1973a1de5c28d900a190c53aa32272d4c | /src/include/lem/solarix/LexiconStorage_MySQL.h | 78ee55b13bd929ecb1df96a59e87f8cb4af33d86 | [] | no_license | hackerlank/GrammarEngine | b9b6f6f2efa55c445c28a66ae1bdd9c6e4e82f61 | 12b29a9e95fe065d795dc7df32e35ef387cdde77 | refs/heads/master | 2020-06-12T18:27:21.219704 | 2016-05-21T12:09:31 | 2016-05-21T12:09:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 21,330 | h | #if !defined LexiconStorage_MySQL__h && defined SOL_MYSQL_DICTIONARY_STORAGE
#define LexiconStorage_MySQL__h
#include <lem/mysql_helpers.h>
#include <lem/process.h>
#include <lem/containers.h>
#include <lem/solarix/LexiconStorage.h>
namespace Solarix
{
class LS_ResultSet_MySQL;
class StorageConnection_MySQL;
class TreeScorerPredicate;
class TreeScorerResult;
class LexiconStorage_MySQL : public LexiconStorage
{
private:
StorageConnection_MySQL* cnx;
void Connect(void);
void Disconnect(void);
LexiconStorage_MySQL(void);
lem::UFString EncodeString( const lem::UFString &str ) const;
void StoreClassInternals( int id, const SG_Class &cls );
void StoreCoordStates( int id_coord, const Solarix::GramCoord &coord );
void StoreLanguageInternals( const SG_Language &lang );
#if defined LEM_THREADS
lem::Process::CriticalSection cs_partofspeech;
#endif
std::map< lem::UCString, int > partofspeech_map;
#if defined LEM_THREADS
lem::Process::CriticalSection cs_languages;
#endif
lem::MCollect<int> language_ids;
void LoadAllLanguages(void);
LS_ResultSet* ListByQuery( const lem::FString &Select );
LS_ResultSet* ListByQuery( const lem::UFString &Select );
int QueryInt( const lem::FString & sql );
int QueryInt( const lem::UFString & sql );
void Execute( const lem::FString & sql );
void Execute( const lem::UFString & sql );
int ExecuteAndReturnId( const lem::UFString & sql );
int ExecuteAndReturnId( const lem::FString & sql );
TreeScorerPoint* LoadTreeScorerPoint( const lem::UFString & sql );
public:
LexiconStorage_MySQL( StorageConnection_MySQL *_cnx );
virtual ~LexiconStorage_MySQL(void);
virtual void CreateSchema(void);
virtual void CopyDatabase( const lem::Path & lexicon_db_path );
virtual void BeginTx(void);
virtual void CommitTx(void);
virtual void RollBackTx(void);
virtual TransactionGuard* GetTxGuard(void);
virtual void CommitCompilation(void);
virtual void AddAuxFormType( int id, const lem::UCString &name );
virtual LS_ResultSet* ListAuxFormTypes(void);
virtual int AddAuxForm( int ekey, int iform, int aux_type, const lem::UFString &aux_data );
virtual int GetAuxForm( int ekey, int iform, int aux_type, lem::UFString &aux_data );
virtual LS_ResultSet* ListAuxForms(void);
virtual LS_ResultSet* ListAuxForms( int ekey, int iform );
virtual int AddAuxEntryData( int ekey, int aux_type, const lem::UFString &aux_data );
virtual int GetAuxEntryData( int ekey, int aux_type, lem::UFString &aux_data );
virtual LS_ResultSet* ListAuxEntryData(void);
virtual LS_ResultSet* ListAuxEntryData( int ekey );
virtual int AddAuxWord( const lem::UCString & src, int aux_type, const lem::UFString &aux_data );
virtual int GetAuxWord( const lem::UCString & src, int aux_type, lem::UFString &aux_data );
virtual LS_ResultSet* ListAuxWords(void);
virtual LS_ResultSet* ListAuxWords( const lem::UCString & src );
virtual void ReplaceEntryKey( int old_ekey, int new_ekey );
virtual int CountPhrases(void);
virtual LS_ResultSet* ListPhrases(void);
virtual int FindPhrase( const lem::UFString &text, bool ignore_case );
virtual LS_ResultSet* ListPhrasesWithPrefix( const lem::UFString &mask, bool ignore_case );
virtual bool GetPhrase( int id, SG_Phrase &phrase );
virtual int AddPhrase( SG_Phrase &info );
virtual void UpdatePhrase( const SG_Phrase &te );
virtual void DeletePhrase( int id );
virtual LS_ResultSet* ListPhraseNotes( int id_phrase );
virtual bool GetPhraseNote( int id_note, SG_PhraseNote ¬e );
virtual int GetPhraseNote( int id_entry, int note_type, SG_PhraseNote ¬e );
virtual int FindPhraseNote( const lem::UFString &text, int type, int &te_id );
virtual int AddPhraseNote( int id_phrase, int type, const lem::UFString &data );
virtual void DeletePhraseNotes( int id_phrase );
virtual void DeletePhraseNote( int id_note );
virtual LS_ResultSet* ListCplxLeft(void);
virtual int GetCplxLeft( const lem::UCString &headword, CplxLeft &info );
virtual int StoreCplxLeft( const lem::UCString &headword, int minlen, int maxlen );
virtual void ClearCplxLeft( const lem::UCString &headword );
virtual bool GetPartOfSpeech( int id, SG_Class &cls );
virtual LS_ResultSet* ListPartsOfSpeech(void);
virtual int FindPartOfSpeech( const lem::UCString &name );
virtual int CountPartsOfSpeech(void);
virtual int AddPartOfSpeech( const lem::UCString &name );
virtual int AddPartOfSpeech( const Solarix::SG_Class &cls );
virtual void StorePartOfSpeech( int id, const SG_Class &cls );
virtual bool GetCoord( int id, Solarix::GramCoord &coord );
virtual LS_ResultSet* ListCoords(void);
virtual int FindCoord( const lem::UCString &name );
virtual int CountCoords(void);
virtual int AddCoord( const lem::UCString &coord );
virtual int AddCoord( Solarix::GramCoord &coord );
virtual void StoreCoord( int id, Solarix::GramCoord &coord );
virtual int CountLanguages(void);
virtual int FindLanguage( const lem::UCString &name );
virtual LS_ResultSet* ListLanguages(void);
virtual bool GetLanguage( int id, SG_Language &lang );
virtual int AddLanguage( SG_Language &lang );
virtual void StoreLanguage( const SG_Language &lang );
virtual int FindCriterion( const lem::UCString & name );
virtual int StoreCriterion( const Criterion &x );
virtual Criterion* GetCriterion( int id );
virtual LS_ResultSet* EnumerateCriteria(void);
// Preprocessor rules
virtual LS_ResultSet* ListCropRules( int id_language );
virtual LA_CropRule* GetPreprocessorCropRule( int id );
virtual void DeletePreprocessorRules(void);
virtual int FindCropRule( const lem::UCString &rule_name );
// Recognition rules
virtual LS_ResultSet* ListRecognitionRules( int id_language, bool including_word_matchers );
virtual LA_RecognitionRule* GetRecognitionRule( int id );
virtual void StoreRecognitionRule( LA_RecognitionRule *rule );
virtual void DeleteRecognitionRules(void);
virtual int FindRecognitionRule( const lem::UCString &rule_name );
virtual LS_ResultSet* ListRecognitionRulesForWord( int id_language, const lem::UCString & word );
virtual LS_ResultSet* ListPhoneticRules( int id_language );
virtual LA_PhoneticRule* GetPhoneticRule( int id );
virtual void StorePhoneticRule( LA_PhoneticRule *rule );
virtual void DeletePhoneticRules(void);
virtual int FindPhoneticRule( const lem::UCString &rule_name );
virtual LS_ResultSet* ListWordEntrySet(void);
virtual int FindWordEntrySet( const lem::UCString &rule_name );
virtual void DeleteWordEntrySets(void);
virtual WordEntrySetItem* GetWordEntrySet( int id );
virtual void StoreWordEntrySet( WordEntrySetItem &ies );
virtual LS_ResultSet* ListWordSet(void);
virtual int FindWordSet( const lem::UCString &rule_name );
virtual void DeleteWordSets(void);
virtual WordSetItem* GetWordSet( int id );
virtual void StoreWordSet( WordSetItem &words );
virtual LS_ResultSet* ListUnbreakableRules( int id_language );
virtual LA_UnbreakableRule* GetUnbreakableRule( int id );
virtual void StoreUnbreakableRule( LA_UnbreakableRule *rule );
virtual void DeleteUnbreakableRules(void);
virtual int FindUnbreakableRule( const lem::UCString &rule_name );
virtual LS_ResultSet* ListSynPatternTrees(void);
virtual void DeleteSynPatternTrees(void);
virtual void StoreSynPatternTree( int id_language, const lem::UCString &name, int id, const SynPatternTreeNode *tree, int pattern_type );
virtual std::pair<SynPatternTreeNode*,lem::UCString> GetSynPatternTree( int id );
virtual int FindSynPatternTree( int id_language, const lem::UCString &name, int pattern_type );
virtual lem::UCString GetSynPatternTreeName( int id );
virtual void DeleteProductionRules( const wchar_t *Marker );
virtual int RegisterRuleGroup( const lem::UCString &name, const wchar_t *Marker );
virtual int CountRuleGroups( const wchar_t *Marker );
virtual int FindRuleGroup( const wchar_t *Marker, const lem::UCString &name );
virtual LS_ResultSet* ListProductionRuleCategories( const wchar_t *Marker );
virtual int RegisterProcedure( const lem::UCString &name, const wchar_t *Marker );
virtual int FindProcedure( const lem::UCString &name, const wchar_t *Marker );
virtual void DeleteProcedures( const wchar_t *Marker );
virtual void DeletePatternMatchers( const wchar_t *Marker );
virtual LS_ResultSet* ListPatternMatchers( const wchar_t *Marker );
virtual LS_ResultSet* ListProcedures( const wchar_t *Marker );
virtual TrPatternMatcher * GetPatternMatcher( int id );
virtual TrProcedure * GetProcedure( int id );
virtual void StoreProcedure( const wchar_t *Marker, const TrProcedure *p );
virtual void StorePatternMatcher( const wchar_t *Marker, int type, const lem::UCString &name, TrPatternMatcher *m );
virtual int FindPatternMatcher( const lem::UCString &name, const wchar_t *Marker );
virtual void DeleteFunctions( const wchar_t *Marker );
virtual TrFunctions* GetFunctions( const wchar_t *Marker );
virtual void StoreFunctions( TrFunctions *functions, const wchar_t *Marker );
virtual LS_ResultSet* ListLanguageUsage(void);
virtual void StoreLanguageUsage( int id_language, bool is_input, bool is_output, bool is_default );
virtual void DeleteSourceLocations(void);
virtual int RegisterSourceFilename( const lem::Path &filepath );
virtual int RegisterSourceLocation( int id_filename, int iline, int icolumn );
virtual bool GetSourceFilename( int id_filename, lem::Path &filepath );
virtual bool GetSourceLocation( int id_location, int &id_file, int &line, int &column );
virtual int FindSourceLineBeginning( int id_filename, int line );
virtual int FindClosestSourceLocation( int id_filename, int line );
virtual LS_ResultSet* ListSourceFilenames(void);
virtual LS_ResultSet* ListSourceLocations(void);
virtual LS_ResultSet* ListParadigmaMatchers(void);
virtual LS_ResultSet* ListParadigmas(void);
virtual int StoreParadigma( const SG_DeclensionTable &p );
virtual SG_DeclensionTable* GetParadigma( int id );
virtual void AddEnding( const lem::UCString &ending, int id_language, int efreq );
virtual bool GetEndingStat( int id_language, EndingStat &res );
virtual bool FindEnding( int id_language, const lem::UCString &ending, int &nform, int &sumfreq );
virtual LS_ResultSet* ListEndings(void);
virtual LS_ResultSet* ListEndingStat(void);
virtual void SetWordformFrequency( int id_entry, int iform, int frequency );
virtual std::pair<bool,int> GetWordformFrequency( int id_entry, int iform );
virtual LS_ResultSet* ListWordformFrequency(void);
virtual void DeleteWordformFrequency(void);
virtual bool FindMisspelling( int id_language, const lem::UCString &word, lem::MCollect<lem::UCString> &new_words );
virtual void AddMisspelling( int id_language, const lem::UCString &word, const lem::UCString &new_word );
virtual LS_ResultSet* ListMisspelling(void);
virtual void DeleteMisspelling(void);
virtual int RegisterCollocationSet( const lem::UCString &name, bool case_sensitive );
virtual int FindCollocationSet( const lem::UCString &name );
virtual void AddCollocationToSet( int id_set, const lem::MCollect<lem::UCString> &words );
virtual void DeleteCollocationSets(void);
virtual int FindCollocationInSet( int id_set, const lem::MCollect<lem::UCString> &words );
virtual int FindCollocationSetHeadword( const lem::UCString &headword, int &min_len, int &max_len );
virtual LS_ResultSet* ListCollocationSets(void);
virtual LS_ResultSet* ListCollocationSetItems(void);
virtual LS_ResultSet* ListCollocationSetHeadwords(void);
virtual int StoreFacts( const KB_Facts * facts );
virtual void UpdateFactsQueryMode( const KB_Facts * facts );
virtual int StoreFact( const KB_Facts &facts, const KB_Fact * fact );
virtual int StoreFactArgument(
int id_fact,
int arg_index,
const KB_Argument & arg
);
virtual KB_Facts* LoadFacts( int id_facts );
virtual LS_ResultSet* ListFactsInGroup( int id_facts );
virtual KB_Fact* LoadFact( int id );
virtual KB_Argument* LoadFactArgument( int id );
virtual LS_ResultSet* ListFactIndex1();
virtual LS_ResultSet* ListFactIndex2();
virtual LS_ResultSet* ListFactGroups();
virtual LS_ResultSet* ListFacts();
virtual LS_ResultSet* ListFactArguments();
virtual int FindFactByEntries(
int id_facts,
int n_arg,
int return_type,
int id_entry1,
int id_entry2,
int id_entry3,
int id_entry4,
int id_entry5,
KB_CheckingResult &result
);
virtual void FindFactsByEntries(
int id_facts,
int n_arg,
int id_entry1,
int id_entry2,
int id_entry3,
int id_entry4,
int id_entry5,
lem::MCollect<int> & id_fact
);
virtual int FindFactByWords(
int id_facts,
int n_arg,
int return_type,
const lem::UCString &word1,
const lem::UCString &word2,
const lem::UCString &word3,
const lem::UCString &word4,
const lem::UCString &word5,
KB_CheckingResult &result
);
virtual int RegisterWordformSet( const lem::UCString & set_name );
virtual int FindWordformSet( const lem::UCString & set_name );
virtual int StoreWordformSetCoords( const CP_Array & coords );
virtual void StoreWordformSetItem( int id_set, const lem::UCString & lexeme, int ekey, int id_coords );
virtual LS_ResultSet* ListWordformSets();
virtual LS_ResultSet* ListWordformSetCoords();
virtual LS_ResultSet* ListWordformSetItems();
virtual int FindWordformSetItem( int id_set, const lem::UCString & word, int id_entry, int * id_coords );
virtual void LoadWordformSetCoords( int id_coords, Solarix::CP_Array & pairs );
virtual void DeleteWordformSets();
virtual int StoreTreeScorerGroup( const lem::UCString & name, const TreeScorerGroupParams & params );
virtual int FindTreeScorerGroup( const lem::UCString & name );
virtual void LoadTreeScorerGroupParams( int id, TreeScorerGroupParams & params );
virtual LS_ResultSet* ListTreeScorerGroups();
virtual void StoreTreeScoreGroupMember( int id_group, int id_root );
virtual LS_ResultSet* ListTreeScoreGroupMembers();
virtual LS_ResultSet* ListGenericTreeScorers();
virtual void ListTreeScoreGroupMembers( int id_group, lem::MCollect<int> & roots );
virtual int RegisterTreeScorer_Word( const lem::UCString & word, int id_root_point, const lem::UFString & scoring_expression, int scoring_type, bool root_node, int id_group );
virtual int RegisterTreeScorer_Wordentry( int EntryKey, int id_root_point, const lem::UFString & scoring_expression, int scoring_type, bool root_node, int id_group );
virtual int RegisterTreeScorer_Generic( int id_root_point, const lem::UFString & scoring_expression, int scoring_type, int id_group );
virtual int StoreTreeScorerPoint(
int id_parent_point,
int id_group,
const lem::UCString & word, int id_entry, int id_metaentry, int id_class,
const lem::UCString & wordset_name, const lem::UCString & wordentryset_name, const lem::UCString & wordformset_name,
const CPE_Array & coords,
int ThesaurusCheck_Link, int ThesaurusCheck_Entry,
const lem::MCollect<CollocFilterSetChecker> & set_checkers,
bool is_positive,
int link_type,
int relative_position,
int id_src,
int quantification_min_count,
int quantification_max_count,
int children_quantification_min_count,
int children_quantification_max_count,
const lem::UCString & marker,
const lem::MCollect<BackRefCorrel> & back_correls
);
virtual void ListTreeScorers(
int id_group,
const Solarix::Word_Form & root,
lem::MCollect<int> & headpoint_ids,
lem::MCollect<TreeScorerResult*> & scores,
lem::MCollect<int> & anchor_is_root
);
virtual void ListGenericTreeScorers(
int id_group,
lem::MCollect<int> & headpoint_ids,
lem::MCollect<TreeScorerResult*> & scores
);
virtual TreeScorerPoint* LoadTreeScorerPoint( int id_point );
virtual void LoadTreeScorerChildNodes( int id_point, lem::MCollect<TreeScorerPoint*> & scorer_leafs );
virtual int GetTreeScorerHeadpointSrc( int id_point );
virtual void StoreTreeScorerPredicate(
int id_host_point,
const lem::UCString & func_name,
const lem::Collect<TreeScorerPredicateArg> & args
);
virtual void LoadTreeScorerPredicates( TreeScorerPoint * p );
virtual TreeScorerPredicate* LoadTreeScorerPredicate( int id );
virtual LS_ResultSet* ListTreeScorerPredicates();
virtual LS_ResultSet* ListTreeScorerLemmas();
virtual LS_ResultSet* ListTreeScorerWords();
virtual LS_ResultSet* ListTreeScorerPoints();
virtual int StoreMetaEntry( const lem::UCString & name, int id_class, const lem::MCollect<int> & entries );
virtual int FindMetaEntry( const lem::UCString & name, int id_class );
virtual void GetMetaEntryItems( int id_metaentry, lem::MCollect<int> & entries );
virtual LS_ResultSet* ListMetaEntries();
virtual bool DoesMetaEntryContains( int id_metaentry, int id_entry );
virtual MetaEntry* LoadMetaEntry( int id );
virtual int StoreWordAssoc_ByLemma( int src_location, int id_entry, int id_entry1, int score );
virtual int StoreWordAssoc_ByMetaentry( int src_location, int id_entry, int id_metaentry1, int score );
virtual int StoreWordAssoc_ByLexem( int src_location, int id_entry, const lem::UCString & word1, int score );
virtual int StoreWordAssoc_ByThesaurusLink( int src_location, int id_entry, int link_type, int link_entry, int score );
virtual int StoreWordAssoc_BySet( int src_location, int id_entry, const lem::UCString & set_name, int set_type, int score );
virtual LS_ResultSet* ListAssociationsForEntry( int id_entry );
virtual LS_ResultSet* ListAssociatedEntries();
virtual WordAssociation* LoadAssocitation( int id );
virtual LS_ResultSet* ListSkipTokenRules( int id_language );
virtual SkipTokenRule* LoadSkipTokenRule( int id );
virtual void StoreSkipTokenRule( int id_language, int src_location, int id_pattern, int score );
virtual int StorePredicateTemplate( const lem::UFString & src, const lem::MCollect<lem::UCString> & params );
virtual PredicateTemplate* LoadPredicateTemplate( int id );
virtual LS_ResultSet* ListPredicateTemplate();
virtual void StoreOmonym( const lem::UCString & entry_name, int id_class );
virtual bool IsOmonym( const lem::UCString & entry_name, int id_class );
virtual LS_ResultSet* ListOmonyms();
};
}
#endif
| [
"mentalcomputing@gmail.com"
] | mentalcomputing@gmail.com |
be253cc03d6cceae5040f3a9047cec82603ce3c4 | 00d23d72b12d9f5ef5aa4fb34a82e74c98a44d4c | /sources/FieldDoctor.cpp | 3b2015b27d1baffd789885bd3a05e53ac5585cf3 | [] | no_license | tehilabk/pandemic-game-cpp | 792f7361660907c5bcafcfe0c1ca497d65ff62d3 | 8dde7af9428fe32c46774bf200c95155171d9809 | refs/heads/master | 2023-05-13T06:58:42.618723 | 2021-05-24T00:01:42 | 2021-05-24T00:01:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,002 | cpp | #include "FieldDoctor.hpp"
#include "Player.hpp"
#include "string"
#include <typeinfo>
using namespace std;
using namespace pandemic;
namespace pandemic{
string FieldDoctor::role(){
return my_role;
}
Player& FieldDoctor::treat(City city){
if (currCity == city){
Player::treat(city);
return *this;
}
if (!(is_neighbors(this->gameBoard,currCity, city)))
{
throw invalid_argument("can't treat, this cities not neighbors");
}
int disease_level = get_disease_level(this->gameBoard,city);
if (disease_level == 0)
{
throw invalid_argument("can't treat, disease level=0");
}
if (is_discovered(this->gameBoard,get_color(this->gameBoard,city)))
{
set_disease_level(this->gameBoard,city, disease_level);
}
else
{
set_disease_level(this->gameBoard,city, 1);
}
return *this;
}
} | [
"tehilabk123@gmail.com"
] | tehilabk123@gmail.com |
60a131d6ab21b765e72a48e424ce48860a2261ce | f08e4be57512d0555b24d13b38978f2d2c593fd1 | /leetcode/InsertionSortList.h | 328a461927866c0cb5cdf4425a820f009a8b4af5 | [] | no_license | FLOWERCLOUD/LeetcodePracticeByHuayun | 6f07ed86b9f4c0af1c58f4c212df826f63dd6e8e | da31b3473f6f4e02bbf69872fb4c4edfcc6bd687 | refs/heads/master | 2021-01-10T17:14:21.817412 | 2016-03-17T04:39:30 | 2016-03-17T04:39:30 | 43,479,625 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,619 | h |
#include "structuredef.h"
#include <iostream>
typedef struct ListNode Node;
struct ListNode* insertionSortList(struct ListNode* head) {
Node dumnode;
dumnode.next = head;
dumnode.val = -1000000;
Node* pNode = head;
for( ; pNode != NULL ; pNode= pNode->next){
Node* preNodeB = pNode;
for( ;preNodeB != &dumnode ; ){
Node* preNodeA = &dumnode;
while( preNodeA->next != preNodeB )preNodeA = preNodeA->next;
if(preNodeA->val > preNodeB->val ){
int tmp = preNodeB->val;
preNodeB->val = preNodeA->val;
preNodeA->val = tmp;
}
preNodeB = preNodeA; // NOT --preNode
}
}
return dumnode.next;
}
struct ListNode* insertionSortList2(struct ListNode* head) {
Node dumnode;
dumnode.next = head;
dumnode.val = -1000000;
Node* pNode = head;
for( ; pNode != NULL ; pNode= pNode->next){
Node* preNodeA = dumnode.next; // preNode point to head
for( ; preNodeA != pNode ;preNodeA = preNodeA->next){
if( preNodeA->val > pNode->val){
int tmp = pNode->val;
pNode->val = preNodeA->val ;
preNodeA->val = tmp;
}
}
}
return dumnode.next;
}
struct ListNode* insertionSortList3(struct ListNode* head) {
Node dumnode;
dumnode.next = head;
dumnode.val = -2147483648;
Node* pNode = head;
Node* preNode = &dumnode;
for( ; pNode != NULL ;pNode = preNode->next ){
if( pNode->val > preNode->val){
//do nothing
preNode = pNode;
}else{
Node* preNodeA = &dumnode;
while( preNodeA->next->val < pNode->val)preNodeA = preNodeA->next;
preNode->next = pNode->next; //point tp next node;
pNode->next = preNodeA->next;
preNodeA->next = pNode;
}
}
return dumnode.next;
}
struct ListNode* insertionSortList4(struct ListNode* head) {
Node dumnode;
dumnode.next = head;
dumnode.val = 0; // min 32 bit value
Node* pNode = head;
Node* preNode = &dumnode;
if( head && head->next){
for( ; pNode->next != NULL ;pNode = preNode->next ){
if( pNode->next->val > pNode->val){
//do nothing
preNode = pNode;
}else{
Node* preNodeA = &dumnode;
while( preNodeA->next->val < pNode->next->val)preNodeA = preNodeA->next;
preNode->next = pNode->next->next; //point tp next node;
pNode->next->next = preNodeA->next;
preNodeA->next = pNode->next;
}
}
}
return dumnode.next;
}
class insertionSortListWrap
{
public:
ListNode *head ;
static const int iarray[3] ;
insertionSortListWrap(){
head = getListFromArray( (int*)iarray);
}
ListNode* getListFromArray( int* iarray){
ListNode *pNode;
int arraynum = sizeof( iarray)/sizeof(int);
ListNode dummy;
pNode = &dummy;
for( int i = 0 ;i< arraynum ;++i ){
pNode->next =(ListNode*)malloc(sizeof(int));
pNode->next->val = iarray[i];
pNode = pNode->next;
pNode->next = NULL;
}
return dummy.next;
}
void coutList(ListNode* phead)
{
while( NULL != phead){
std::cout<< phead->val<<std::endl;
phead = phead->next;
}
}
void run()
{
insertionSortList4(head);
coutList(head);
}
};
//const int insertionSortListWrap::iarray[] = {-2147483647,-2147483648};
const int insertionSortListWrap::iarray[] = {3,4,1};
//const int insertionSortListWrap::iarray[] = {3911,1546,3370,1944,3306,1150,-1343,3573,-1393,675,
// 2107,-1094,2272,425,-1599,-1140,503,-1730,-1728,3420,
// 365,608,-72,2528,3907,1932,-411,-1460,3241,-278,
// 1624,3653,-1795,3241,-1755,3896,3385,1404,1063,3973,
// -970,2976,3639,1723,-582,2490,-893,2223,969,2599,
// 945,-1950,1242,-588,935,-1075,1451,-498,3801,-1652,
// 1907,2368,-45,2191,3105,1499,-1983,3836,1600,439,
// 2963,655,1354,724,2420,2325,-1458,1777,2376,1114,
// 341,-1565,1204,-46,-1927,-255,1908,-1935,-37,-1039,
// -342,2918,572,-706,1665,2978,-1670,1645,-1082,1116,
// 2330,3754,912,2625,3802,-1759,208,3869,-1668,3153,
// 641,-1996,2360,-687,-788,-1652,3452,1856,232,3510,
// 3469,589,210,2962,69,-617,-1886,-296,-1945,3306,
// 3329,-31,-131,1267,-1857,2644,-404,1546,-1505,2424,
// -1723,3777,-1941,7,2887,2730,2221,1337,3738,-1846,
// 2002,858,75,3190,-1316,2733,1438,269,1539,1014,
// -323,2306,912,3986,38,3526,-1553,1306,-775,2913,
// -1312,3133,364,-1664,-1802,1474,-584,-1541,-82,2548,
// -1999,-1945,1424,353,2934,-49,2553,-1548,-163,2842,
// -1270,-408,1675,1374,543,-1904,3338,-284,985,-1069,
// 3633,1918,1615,510,3849,3613,1275,3133,2691,1173,
// 3796,-1757,-1775,658,1257,3688,1160,3696,1397,1653,
// 1822,-251,1557,-1493,-714,192,2038,77,-172,-1935,
// 569,2107,-1580,102,-1990,-1619,2252,2780,2913,-1762,
// -1132,3126,2003,3077,2152,781,150,-1330,893,-1325,
// 1175,1697,2043,1331,827,3510,-534,1598,2347,680,
// -1649,1194,-1192,-1836,1618,2920,688,-1234,-138,3214,
// 1492,1706,-739,-1647,-1785,-283,-1930,-444,1860,1467,
// -1839,3854,-297,-1988,3193,1204,3905,-624,716,-1777,
// 1077,2154,-1360,2612,3714,-969,-1328,-1905,1010,-435,
// 48,2953,351,1596,947,440,-212,3912,3670,1270,
// 2997,-803,3491,1020,1911,529,1394,-1864,-112,-721,
// 1865,3441,-1362,-1953,-82,-1878,2897,3871,653,3559,
// -395,2480,2948,1090,609,3193,-1298,3386,3296,3869,
// 1228,1258,3392,746,-1846,2827,-1804,345,2740,1432,
// -1388,3104,3721,2682,372,1065,2279,70,282,-1541,
// -1624,-538,-333,3901,750,-525,2913,-795,3447,-1160,
// 2182,215,-1395,-763,1460,-1910,772,-829,1827,1665,
// 1469,4,3608,-1689,1235,-774,3157,-1671,2497,2168,
// -1476,1486,2690,1117,1829,-1314,677,1838,1008,-182,
// -1211,848,-293,-329,-1901,-785,587,2602,-1043,3280,
// 2406,1913,1067,-1531,-36,285,1073,958,719,3667,
// 2001,622,-1885,2856,-539,249,2441,2237,2201,-667,
// -1344,1663,1227,3933,1150,28,1066,3736,1275,326,
// 254,3247,-1695,3562,-174,30,25,3723,-1232,3565,
// -1434,3404,-861,-1057,1794,1410,-650,231,3798,-100,
// 869,1690,812,750,-858,1054,1137,3174,3114,3844,
// -819,2987,-871,922,3089,-1794,-1481,2628,2150,-629,
// -1112,2289,-455,3977,2411,3511,3424,329,1242,3787,
// 3728,2589,2292,3393,1941,-1265,2338,1981,97,-1935,
// 2556,-1997,2508,-106,802,-729,-265,648,1042,-1241,
// -1151,-1987,2746,3485,1542,461,-1588,3789,184,-1656,
// -1731,-651,2857,1665,2745,357,1154,-1058,276,543,
// -1946,1944,3270,2632,2131,-849,3849,-42,830,-1281,
// 2624,3736,3628,3138,3970,1596,3072,940,1176,3151,
// -1874,-1798,-770,-981,2660,-737,3552,432,2344,289,
// -669,-1737,-979,-615,-1214,3365,2806,1497,2556,-1888,
// -1751,1349,-44,3553,-150,1080,3113,3015,2999,-1398,
// 445,2604,2763,3403,965,-1985,311,-521,-1392,-735,
// 1909,3068,-91,-122,-691,1482,3881,2010,3490,1253,
// -42,-1338,-1242,-1824,-287,-919,3925,1257,1643,-829,
// -289,3059,2891,3290,-1803,-598,1066,-726,3647,2845,
// 3326,2471,1388,3683,3140,-339,-69,3099,2194,3639,
// 736,-266,2513,-456,3945,2231,-560,2230,361,-1211,
// 3735,1475,1536,66,-1542,-1525,350,3638,2046,2272,
// -863,770,1915,-891,3105,2687,3875,2915,2277,3049,
// 2342,-500,2573,-518,1287,1253,2778,3250,1379,2829,
// 3824,3554,-441,2765,1547,1789,777,-1354,534,950,
// 1914,-768,3187,2551,1928,1308,2314,-1308,2345,785,
// 12,3196,-443,-1576,2903,144,-614,2242,1378,638,
// 2556,3914,1420,610,-1294,3357,1701,-988,831,2983,
// 1911,1041,3836,-421,-834,1301,1143,1865,831,-1926,
// -210,-889,-355,853,-695,-280,693,309,3434,1028,-175,
// 2877,-1060,1660,3116,1745,3862,3629,-680,3387,1356,1037,
// -1523,338,876,-1167,1665,2334,-1763,1199,2377,2549,-1962,
// -415,-590,-1819,-91,2639,3093,3100,3967,275,-1689,1188,1068,
// 3734,411,204,904,3769,-1998,2147,-1347,-887,1369,3660,3088,
// 1625,1759,-813,1439,2129,-137,3103,-921,1039,556,3865,3956,
// 1969,-666,1558,-234,744,-198,-1349,43,2913,3979,651,2799,
// 577,95,-1378,2486,2640,397,-631,2410,3879,3018,-60,3438,-455,
// -769,-1097,1810,113,-1627,-801,-1964,603,2764,210,1857,-1657,
// 3693,2302,-1800,-48,2547,-1529,2444,3652,294,-754,275,2257,
// -1814,-1838,2187,1169,-215,-319,3051,-1024,698,-272,3079,3536,
// 3887,106,1034,-1803,1253,1826,840,317,-127,-584,1611,644,881,
// 1672,1002,-326,507,-900,2997,1632,-1856,834,2786,2822,457,-1593,
// 1671,1272,2969,3095,286,971,3395,2002,-1996,3048,1152,3238,-1723,
// 466,3855,2209,-52,274,-1037,2496,-892,-895,516,1300,3704,-1663,3451,
// 1240,1908,456,3790,3663,835,-1728,-1830,763,3915,1899,-1042,771,
// 3269,2538,-1779,704,264,1414,2849,1069,-1906,3453,320,1763,62,1618,
// -1883,3020,-157,-1428,68,-378,-665,551,670,440,2745,718,2587,1541,
// 3271,243,1773,-187,-1575,3469,-583,50,2491,606,580,2152,1249,2189,
// -679,81,3974,2402,2674,865,3212,2359,1001,2145,2768,397,-1349,-232,
// -616,3205,3944,1376,865,3245,-686,2943,356,1416,-798,-1009,875,3667,
// 3320,-1666,-897,2198,286,-1498,1325,2749,125,3831,-704,-589,553,1415,
// -490,3348,-1183,-426,1512,1340,-5,220,-91,2422,3409,-561,220,2818,1316,
// 3445,-455,2298,2804,494,-114,-247,-1456,2578,3331,2981,2739,684,-874,
// 357,2074,480,-1987,1704,1929,-1049,-240,65,-1739,3251,1874,-449,2532,
// 1467,2838,946,-108,-683,2116,3094,1924,3184,1004,-909,3053,1857,591,
// 3687,-1770,2042,2948,-1576,1285,2391,1315,-1187,272,3666,-1439,-836,880,2849,3981,2567,1723,2975,2422,-1970,3943,3820,432,3882,201,3616,-863,-509,1347,-949,3154,-678,-1776,-1146,671,2411,928,-403,793,1559,1354,-1630,-1424,2801,990,3225,1625,3272,1828,763,2420,-569,3928,380,3995,-1955,-1542,1320,-478,1445,-1365,2979,2545,-1561,1824,2672,-1921,3979,-252,3306,2814,309,2406,2612,-324,890,-67,-1354,1424,-1133,2332,2186,879,2598,-798,671,1599,1952,2186,3401,-293,2414,-1123,1951,-1740,923,17,1926,3538,3952,3162,-858,3736,3869,3623,3414,-412,-1139,2754,3934,2155,1489,-1587,1013,1807,1958,613,336,2629,-974,100,3071,2517,1092,3738,3209,2628,2357,1719,3663,-9,738,-1145,3202,-1413,3917,-279,-754,-1526,1807,3516,3737,1471,-1268,-610,-532,1542,3589,-1008,218,3413,-785,-148,201,2364,-90,-1464,3153,1070,1197,-1032,826,3098,885,-999,1728,1773,47,611,1740,-310,3878,3657,-1167,2349,-170,1431,2930,2432,1015,839,-1967,1591,1317,2672,2296,3250,927,455,3620,-353,-1652,3367,-875,-1588,166,-1420,112,1142,-869,2083,321,2119,-1437,3143,-221,1317,-246,3511,3577,984,1220,-1248,1697,3373,2586,3710,-894,2672,2476,1226,1899,-1818,-1964,-770,-1468,255,647,3515,788,-1699,2711,1773,2190,-1685,122,3047,-685,522,-143,-630,1482,-688,-1390,-522,-1739,2517,-1003,543,3054,-1814,2622,160,-853,-398,1897,2142,-207,-347,843,3058,293,3929,3348,-161,-1672,1168,-1577,235,2710,2326,3853,2103,-699,2879,3404,-1366,3840,-1054,2498,-758,3803,834,-626,1895,-728,-427,2399,-526,159,3014,571,-1698,1337,-1453,-12,-1516,1510,1275,1586,-576,3354,-427,2964,1023,-784,443,-461,-953,3208,3061,-1858,-16,78,248,982,2075,-537,2934,-798,1843,-1366,-459,3230,-1161,-1066,1778,-844,1004,-641,2806,731,2417,-733,-1993,-962,-1022,469,2047,3138,-1776,1819,3345,-211,-1081,-1059,-345,2033,3252,2071,3292,-843,-990,2893,3593,-263,2910,2967,2510,-834,-922,-1340,-107,3639,2,-942,-432,2465,1390,1917,348,970,3663,-763,-563,-363,1226,2583,1334,305,-610,1500,3322,3477,415,-1752,201,3646,2117,-84,305,2691,3986,1158,921,2092,-1167,2872,-1151,1420,3374,1564,249,703,2471,1181,-866,1949,-87,-1988,2319,-644,3078,3226,-678,1855,-1083,1939,-1374,-914,-85,-104,3029,1481,1160,1892,3136,3968,1953,-1434,2989,3507,-1921,2466,3969,695,2813,947,2506,-1445,-1138,197,3147,3315,-676,-184,1555,-167,1686,3142,116,2560,117,1747,1270,-1694,1892,-723,-1579,-24,-1665,-1924,-1604,2247,-541,-1985,3082,-754,2424,2380,2205,299,954,55,2643,1852,-813,3059,3133,-1707,-1880,535,-13,1760,2996,102,1224,-694,3917,3116,456,3738,1799,3546,3026,-1172,-466,-1873,462,3418,2866,2996,522,3461,2908,-521,2309,1474,3306,3705,-1138,924,-1235,-1428,3377,3442,3325,-1336,3275,3834,3731,1178,1291,923,2571,2777,2577,3409,-1765,2228,2444,3058,2415,849,3994,919,-927,3376,-612,898,3909,-1527,719,2476,2484,2112,1242,-947,3696,-895,1449,-1402,338,781,2975,-836,510,3439,-223,2706,-970,3805,-1208,-1064,3497,1985,2030,1025,1104,-414,219,-1482,-14,364,-1044,-1191,3486,2800,3965,2060,-96,484,3269,3112,1023,30,1322,-1116,-511,1624,399,2365,1901,-1275,538,-1003,3816,-1867,-409,3494,3740,1570,1529,2890,3111,714,531,-1158,-1781,3512,1053,107,2284,1673,642,-905,1013,-531,3016,1268,101,731,-264,2770,112,-892,623,1109,-1499,1504,512,533,3443,2536,3767,-1709,-1376,2852,2248,2255,-992,-1305,3333,-669,206,-42,-400,1011,-50,3697,668,-1165,3464,2123,1513,-249,746,631,3530,2843,1339,-1134,-1776,1139,2557,3639,2888,3112,466,-1999,-658,1653,1685,824,3730,1600,1174,2875,-1356,3429,1325,-497,2895,1309,855,-1510,-935,1065,2395,-837,384,-730,1354,-1233,-776,3557,3625,417,1460,2742,-929,-31,3631,2931,3605,-361,2256,2244,1263,-1545,1433,607,-1107,-574,-162,1806,1937,1053,-504,3279,283,534,-1909,766,797,-1323,2812,-1506,-1545,-1857,-618,829,3075,1223,236,3718,1372,558,-336,1638,1011,2041,1526,2727,733,-465,3112,3902,-1850,1612,-1444,747,2456,2798,2238,-1872,1350,140,-1201,2502,-1757,2651,3836,1514,18,2636,558,2536,1228,3502,2003,-1227,1504,-1442,338,1407,265,3809,-1885,-454,256,451,-1228,200,1081,1855,3157,3388,3540,-1428,-75,-1694,1416,2672,2853,208,1989,1831,157,-944,1424,1231,-1640,324,3859,3907,2971,1670,3958,197,354,-144,3,661,2431,-1848,3571,3172,3184,-795,1053,1383,-1228,2645,926,-191,3263,-1306,1420,2066,23,3645,1220,3435,-1012,-40,1246,-769,1904,1329,1137,-1944,-1213,202,2700,1024,-1031,3917,-739,1213,3661,1392,-1351,989,-794,-285,2288,-243,-339,2110,2422,-1770,512,3522,565,1697,2356,1614,2658,2694,1274,1883,681,3477,3123,-72,3713,-362,1557,3059,1221,-1804,2110,3565,-1970,1433,-1459,2968,3433,-1394,2845,3649,0,3676,-1338,-294,-246,1339,2544,1752,3637,1955,2913,3397,-1090,-1553,297,2641,2422,499,329,-841,1721,2561,-1650,2942,1498,353,-1351,3864,293,-1847,421,61,1028,3859,-1332,898,3534,923,-1058,-534,-1498,-1084,-1270,2306,3375,3642,-1730,-1250,2781,2564}; | [
"528450012@qq.com"
] | 528450012@qq.com |
e801795a70aed86a4849926fbc81422f4eb6557c | 6bd34b9b8071e3656e25863660c4241f83f2b1c4 | /Algorithms/BinaryTree.cpp | 02f7600750c6f90cf34f74a0bb993bcd407bd27e | [] | no_license | James-Morley/Algorithms | 0194f6387606d72951b127c1ca9fb02c43435890 | 99417d8458b26ec8160140ca61e2bd1c87cbbbf7 | refs/heads/master | 2020-12-15T11:50:31.780891 | 2020-01-23T13:36:33 | 2020-01-23T13:36:33 | 235,093,307 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,641 | cpp | #include "pch.h"
#include "BinaryTree.h"
#include <iostream>
#include <queue>
BinaryTree::BinaryTree() {
root = nullptr;
}
BinaryTree::~BinaryTree() {
deleteTree(root);
}
void BinaryTree::deleteTree(Node* node) {
if (node != NULL) {
deleteTree(node->left);
deleteTree(node->right);
delete node;
}
}
void BinaryTree::insert(const int& key) {
if (this->root == NULL) {
this->root = new Node;
this->root->value = key;
this->root->left = nullptr;
this->root->right = nullptr;
}
else {
insert(root, key);
}
}
void BinaryTree::insert(Node* node, const int& key) {
if (key <= node->value) {
if (node->left == nullptr) {
node->left = new Node;
node->left->value = key;
node->left->left = nullptr;
node->left->right = nullptr;
}
else {
insert(node->left, key);
}
}
else if (key > node->value) {
if (node->right == nullptr) {
node->right = new Node;
node->right->value = key;
node->right->left = nullptr;
node->right->right = nullptr;
}
else {
insert(node->right, key);
}
}
}
bool BinaryTree::contains(const int& key) const {
return contains(root, key);
}
bool BinaryTree::contains(Node* node, const int& key) const {
if (node == nullptr) {
return false;
}
else if (node->value == key) {
return true;
}
if (key <= node->value) {
if (node->left == nullptr) {
return false;
}
else if (node->left->value == key) {
return true;
}
else {
return contains(node->left, key);
}
}
else if (key > node->value) {
if (node->right == nullptr) {
return false;
}
else if (node->right->value == key) {
return true;
}
else {
return contains(node->right, key);
}
}
std::cout << "THIS MEANS SOMETHING WENT WRONG" << std::endl;
return false;
}
bool BinaryTree::bfs(const int& key) const {
return bfs(root, key);
}
bool BinaryTree::bfs(Node* node, const int& key) const {
std::cout << "BFS KEY: " << key << std::endl;
std::queue<Node> q;
node->visited = true;
q.push(*node);
while (!q.empty()) {
Node* n = &q.front();
if (n->value == key) {
std::cout << "SUCCESSFUL BFS!" << std::endl;
return true;
}
if (n->left != nullptr) {
q.push(*n->left);
}
if (n->right != nullptr) {
q.push(*n->right);
}
q.pop();
}
std::cout << "BFS DOESN'T CONTAIN: " << key << std::endl;
return false;
}
//POST ORDER TRAVERSAL
void BinaryTree::post_order_traversal() const {
std::cout << "POST ORDER TRAVERSAL" << std::endl;
post_order_traversal(root);
}
void BinaryTree::post_order_traversal(Node* node) const {
if (node == nullptr) {
return;
}
if (node->right != nullptr) {
post_order_traversal(node->right);
}
std::cout << node->value << std::endl;
if (node->left != nullptr) {
post_order_traversal(node->left);
}
}
//PRE ORDER TRAVERSAL
void BinaryTree::pre_order_traversal() const {
std::cout << "PRE ORDER TRAVERSAL" << std::endl;
pre_order_traversal(root);
}
void BinaryTree::pre_order_traversal(Node* node) const {
if (node == nullptr) {
return;
}
std::cout << node->value << std::endl;
if (node->left != nullptr) {
pre_order_traversal(node->left);
}
if (node->right != nullptr) {
pre_order_traversal(node->right);
}
}
//IN ORDER TRAVERSAL
void BinaryTree::in_order_traversal() const {
std::cout << "IN ORDER TRAVERSAL" << std::endl;
in_order_traversal(root);
}
void BinaryTree::in_order_traversal(Node* node) const {
if (node == nullptr) {
return;
}
if (node->left != nullptr) {
in_order_traversal(node->left);
}
std::cout << node->value << std::endl;
if (node->right != nullptr) {
in_order_traversal(node->right);
}
}
| [
"james.morley@hagueprint.com"
] | james.morley@hagueprint.com |
019be2a594b9b2971cc884b5841642bf9a46bb7b | 3c2d747b5968b39ea93d03c03afd84df0c906a49 | /C++ Aufbaukurs 2019-06-19 07-48 Uhr/06-C++_Aubaukurs_E229-UE.6/06.06.02-Capacity_und_Size+clear.cpp | 8440ae1e9b41a68bf92cb4cf42244318e56b6748 | [] | no_license | Opehline/CPP_V2 | 87b8f914f938dcab5882101a177beac393da41e1 | 8e1475fc05f1fb03652dd72d2fefdffc48a77247 | refs/heads/master | 2022-01-12T00:06:27.356025 | 2019-06-26T13:04:33 | 2019-06-26T13:04:33 | 189,986,628 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,414 | cpp | // Gisela Neira
// C++ Aufbaukurs E229
// * Programm 06.06.02 der C++ Programmierung
// * Unterscheidung zwischen size() und capacity()
#include <iostream>
#include <iomanip>
#include <vector>
#define Capacity
//#define atFunk
int main()
{
// * Ein Vector mit 6 Plaetzen initialisiert mit allen Werten gleich Null:
std::vector<int> mein_vector(5,5); // * int mein_array[6]={5,5,5,5,5,5};
// * auch: std::vector<int> mein_vector(6);
// * garantier mit NULL intitialisert
for(int i=0; i<=20; i++)
{
mein_vector.push_back(26);
}
mein_vector.clear();
std::cout << "mein_vector.size() "
<< mein_vector.size() << std::endl;
#ifdef atFunk
std::cout << "mein_vector.at(0)"
<< mein_vector.at(0) << std::endl;
#endif
#ifdef Capacity
std::cout << "mein_vector.capacity() "
<< mein_vector.capacity() << std::endl;
for(int i=0; i<=50; i++)
{
std::cout << mein_vector[i] << std::endl;
std::cout << &mein_vector[i] << std::endl;
}
std::cout << "\n";
for(int i=0; i<=3; i++)
{
mein_vector.push_back(2);
std::cout << mein_vector[i] << std::endl;
std::cout << &mein_vector[i] << std::endl;
}
std::cout << "mein_vector.capacity() "
<< mein_vector.capacity() << std::endl;
#endif // Capacity
return 0;
}
| [
"TTreffler@han.ibb.com"
] | TTreffler@han.ibb.com |
eec43e6049af09c177029b409f97cc4999a68de3 | 8fdab174252614c3d0eea09a4bd7aa262c087fd1 | /cpp/acceleratedcpp/chapter5/grade.cpp | c00a5d4b92a1db41c7e4116e1bc4876390d35871 | [] | no_license | idreesdb/Tutorials | a5190c72ad9ad25d9e8302c01357939bd62b75d8 | 754cd20250b7f826caf76a1d3c188826a4babbd3 | refs/heads/master | 2021-01-17T07:37:01.623156 | 2016-05-27T14:03:28 | 2016-05-27T14:03:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 793 | cpp | #include <stdexcept>
#include <vector>
#include "grade.h"
#include "median.h"
#include "Student_info.h"
using std::domain_error; using std::vector;
// compute a student's overall grade from miderm, final exam and homework grades
double grade(double midterm, double final, double homework)
{
return 0.2 * midterm + 0.4 * final + 0.4 * homework;
}
// compute a student's overall grade from final, exam and a vector of homework grades.
// this function does not copy its argument, because 'median' does so for us.
double grade(double midterm, double final, const vector<double>& hw)
{
if (hw.size() == 0)
throw domain_error("Student has done no homework");
return grade(midterm, final, median(hw));
}
double grade(const Student_info& s)
{
return grade(s.midterm, s.final, s.homework);
} | [
"slxecas@gmail.com"
] | slxecas@gmail.com |
d49f25f8aa4b3c4edd6a5f56d4303a12e132331f | b5b1c179010814ff28797199371c56ab04351e03 | /src/rendering/sprite_renderer.cpp | d93e42d27b587f2615f6edc9ef2a2dc8d0840f1c | [] | no_license | maximmalashev/gl-framework | 5d99f34731147558394ba39c171e73f8b315bfbc | d35cf856f59457e2f9250c71f3f86ec67fa536eb | refs/heads/master | 2023-07-07T03:51:52.009331 | 2021-08-04T18:38:21 | 2021-08-04T18:38:21 | 372,079,326 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,529 | cpp | #include "pch.h"
#include "sprite_renderer.h"
#include "buffer.h"
#include "shader.h"
#include "vertex_array.h"
#include "render_commands.h"
#include "../scene/orthographic_camera.h"
namespace gl
{
struct Vertex
{
glm::vec3 position;
glm::vec4 color;
};
namespace RendererSettings
{
const u32 MAX_SPRITES = 50000;
const u32 MAX_VERTICES = MAX_SPRITES * 4;
const u32 MAX_INDICES = MAX_SPRITES * 6;
constexpr u32 SPRITE_SIZE = sizeof(Vertex) * 4;
Vertex* verticesHead;
Vertex* verticesTail;
u32 spriteCount = 0;
std::shared_ptr<VertexArray> vao;
std::shared_ptr<Shader> shader;
glm::vec4 spriteVertices[] = {
glm::vec4( 0.5f, 0.5f, 0.0f, 1.0f),
glm::vec4( 0.5f, -0.5f, 0.0f, 1.0f),
glm::vec4(-0.5f, -0.5f, 0.0f, 1.0f),
glm::vec4(-0.5f, 0.5f, 0.0f, 1.0f)
};
}
SpriteRenderer::SpriteRenderer()
{
RendererSettings::verticesHead = new Vertex[RendererSettings::MAX_VERTICES];
RendererSettings::verticesTail = RendererSettings::verticesHead;
std::vector<i32> vboLayout;
vboLayout.push_back(3);
vboLayout.push_back(4);
u32 vboCount = RendererSettings::MAX_VERTICES * (3 + 4);
std::shared_ptr<VertexBuffer> vbo = std::make_shared<VertexBuffer>(vboCount, vboCount * sizeof(float), vboLayout);
u32* indices = new u32[RendererSettings::MAX_INDICES];
u32 offset = 0;
for (u32 index = 0; index < RendererSettings::MAX_INDICES; )
{
indices[index++] = 0 + offset;
indices[index++] = 1 + offset;
indices[index++] = 3 + offset;
indices[index++] = 1 + offset;
indices[index++] = 2 + offset;
indices[index++] = 3 + offset;
offset += 4;
}
std::shared_ptr<IndexBuffer> ibo = std::make_shared<IndexBuffer>(RendererSettings::MAX_INDICES, indices);
delete[] indices;
RendererSettings::vao = std::make_shared<VertexArray>(vbo, ibo);
RendererSettings::shader = Shader::FromFile("../OpenGL-Engine/res/shaders/sprite.shader");
}
SpriteRenderer::~SpriteRenderer()
{
delete[] RendererSettings::verticesHead;
}
void SpriteRenderer::Setup(const OrthographicCamera& camera)
{
RendererSettings::shader->SetUniformMat4("uProjectionView", camera.GetTransformationMatrix() * camera.GetProjectionMatrix());
}
void SpriteRenderer::Flush()
{
RendererSettings::vao->GetVertexBuffer()->SetData(reinterpret_cast<f32*>(RendererSettings::verticesHead), RendererSettings::SPRITE_SIZE * RendererSettings::spriteCount);
RenderCommands::DrawTriangles(RendererSettings::vao, RendererSettings::shader);
RendererSettings::verticesTail = RendererSettings::verticesHead;
RendererSettings::spriteCount = 0;
}
void SpriteRenderer::Finish()
{
RendererSettings::vao->GetVertexBuffer()->SetData(reinterpret_cast<f32*>(RendererSettings::verticesHead), RendererSettings::SPRITE_SIZE * RendererSettings::spriteCount);
RenderCommands::DrawTriangles(RendererSettings::vao, RendererSettings::shader, RendererSettings::spriteCount * 6);
RendererSettings::verticesTail = RendererSettings::verticesHead;
RendererSettings::spriteCount = 0;
}
void SpriteRenderer::Draw(const Sprite& sprite)
{
if (RendererSettings::spriteCount >= RendererSettings::MAX_SPRITES)
Flush();
for (i32 vertex = 0; vertex < 4; vertex++)
{
RendererSettings::verticesTail->position = static_cast<glm::vec3>(sprite.GetTransformationMatrix() * RendererSettings::spriteVertices[vertex]);
RendererSettings::verticesTail->color = sprite.GetColor();
RendererSettings::verticesTail++;
}
RendererSettings::spriteCount++;
}
} | [
"maxim.malashev@gmail.com"
] | maxim.malashev@gmail.com |
8396246c706595e2456727f9ac04d1b723956c98 | 690b60a57f85bdce71e614676c305e2492fb7608 | /KernelSDK/src/coredrivers/KernelFileLogDriver/isoTime.h | 8029bd5b60635df03b9fa8f81d9e1a0fc3796547 | [
"Apache-2.0"
] | permissive | rodrigomr/VFS | b07886c0a97bf08c2853fa3182e90eba6ff6ff4e | 6b68b00df8cb668106c2d0841cbcd46138298717 | refs/heads/master | 2020-03-30T13:54:59.627030 | 2018-10-02T12:06:43 | 2018-10-02T12:06:43 | 151,293,022 | 0 | 0 | NOASSERTION | 2018-10-02T17:12:38 | 2018-10-02T17:12:46 | null | UTF-8 | C++ | false | false | 1,175 | h | // Copyright 2018 Grass Valley, A Belden Brand
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
namespace vfs
{
//{{{
inline const std::string isoTime(const UInt32 y, const UInt32 m, const UInt32 d, const UInt32 h, const UInt32 n, const UInt32 s)
{
char buf[32];
sprintf(buf, "%04dy%02dm%02dd - %02dh%02dm%02ds", y, m, d, h, n, s);
return std::string(buf);
}
//}}}
//{{{
inline const String isoTimeW(const UInt32 y, const UInt32 m, const UInt32 d, const UInt32 h, const UInt32 n, const UInt32 s)
{
Char buf[32];
swprintf(buf, L"%04dy%02dm%02dd - %02dh%02dm%02ds", y, m, d, h, n, s);
return String(buf);
}
//}}}
}
| [
"drjwcain@gmail.com"
] | drjwcain@gmail.com |
6fbad9d27259ef1a9d9046956858fb3285e801bc | ad6fc07dd66c13ec4965c685682a137c3c9c6325 | /Lab4_Better/FirstExample/objParser.cpp | bcf3d461f71d309a547542ded1dd68cabc1d2d0d | [] | no_license | EMaude/GAM531 | 635f5a0f441abeb697968cafb09ece6712c9a7c4 | bef55de67cffb33c4daefebd175e4a430c0771b9 | refs/heads/master | 2021-10-08T02:39:41.397441 | 2018-12-04T14:01:00 | 2018-12-04T14:01:00 | 146,930,211 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,499 | cpp | #include "objParser.h"
int objParser::sizesFromFile()
{
///TODO: Make read vertex and faces sizes from file
return 0;
}
objParser::objParser(std::string filename, GLuint NumVertices, GLuint NumFaces, GLuint NumTexVert)
{
this->filename = filename;
this->NumVertices = NumVertices;
this->NumFaces = NumFaces;
this->NumTexVert = NumTexVert;
this->file.open(this->filename);
}
objParser::objParser(std::string filename)
{
this->filename = filename;
this->file.open(this->filename);
//sizesFromFile();
std::cout << "This constructor is not done, and will cause stupid things to happen" << std::endl;
}
objParser::~objParser()
{
this->file.close();
}
int objParser::read(GLfloat vertexArray[][3], GLuint faces[][3])
{
if (file.is_open())
{
std::cout << "Reading File" << std::endl;
std::string line;
int ln = 0;
int vertNum = 1; //starts at one as faces starts looking at index 1
int faceNum = 0;
while (getline(this->file, line))
{
ln++;
if (!line.empty())
{
if (line.at(0) == 'v')
{
float temp;
float temparr[3];
std::stringstream ss;
ss << line;
int i = 0;
std::string t;
while (!ss.eof()) {
ss >> t;
if (std::stringstream(t) >> temp && i <= 3) {
temparr[i] = temp;
i++;
}
t = "";
}
if (vertNum <= this->NumVertices)
{
for (int i = 0; i < 3; i++)
{
vertexArray[vertNum][i] = temparr[i];
}
}
else
{
std::cout << "ERROR: Could not add vertex to vertexArray" << std::endl;
return 0;
}
vertNum++;
}
if (line.at(0) == 'f')
{
int temp;
int temparr[3];
std::stringstream ss;
ss << line;
int i = 0;
std::string t;
while (!ss.eof()) {
ss >> t;
//std::cout << "Token: " << t << std::endl;
if (std::stringstream(t) >> temp && i <= 3) {
temparr[i] = temp;
i++;
}
t = "";
}
if (faceNum <= this->NumFaces)
{
for (int i = 0; i < 3; i++)
{
faces[faceNum][i] = temparr[i];
}
}
else
{
std::cout << "ERROR: Could not add face to faces" << std::endl;
return 0;
}
faceNum++;
}
}
}
std::cout << "Done Reading File" << std::endl;
return 1;
}
return -1;
}
int objParser::read(GLfloat vertexArray[][3], GLuint faces[][3], GLfloat textureArray[][2], GLuint faces_texture[][3])
{
if (file.is_open())
{
std::cout << "Reading File" << std::endl;
std::string line;
int ln = 0;
int vertNum = 1; //starts at one as faces starts looking at index 1
int faceNum = 0;
int vtextNum = 1; //starts at one as faces starts looking at index 1
while (getline(this->file, line))
{
ln++;
if (!line.empty())
{
if (line.at(0) == 'v' && line.at(1) == 't')
{
float temp;
float temparr[3];
//create a string stream from line
std::stringstream ss;
ss << line;
int i = 0;
std::string t;
//look through tokens of ss
while (!ss.eof()) {
ss >> t;
if (std::stringstream(t) >> temp && i <= 2) {
temparr[i] = temp;
i++;
}
t = "";
}
if (vtextNum <= this->NumTexVert)
{
for (int i = 0; i < 2; i++)
{
textureArray[vtextNum][i] = temparr[i];
}
}
else
{
std::cout << "ERROR: Could not add texture vertex to texture vertex Array" << std::endl;
return 0;
}
vtextNum++;
}
else if (line.at(0) == 'v')
{
float temp;
float temparr[3];
std::stringstream ss;
ss << line;
int i = 0;
std::string t;
while (!ss.eof()) {
ss >> t;
if (std::stringstream(t) >> temp && i <= 3) {
temparr[i] = temp;
i++;
}
t = "";
}
if (vertNum <= this->NumVertices)
{
for (int i = 0; i < 3; i++)
{
vertexArray[vertNum][i] = temparr[i];
}
}
else
{
std::cout << "ERROR: Could not add vertex to vertexArray" << std::endl;
return 0;
}
vertNum++;
}
else if (line.at(0) == 'f')
{
int temp;
int temparr[3];
int temparr2[3];
std::stringstream ss;
ss << line;
int i = 0;
std::string t;
while (!ss.eof()) {
ss >> t;
//std::cout << "Token: " << t << std::endl;
if (std::stringstream(t) >> temp && i <= 3) {
temparr[i] = temp;
t = t.substr(t.find_first_of('/') + 1);
if (std::stringstream(t) >> temp) {
temparr2[i] = temp;
}
i++;
}
t = "";
}
if (faceNum <= this->NumFaces)
{
for (int i = 0; i < 3; i++)
{
faces[faceNum][i] = temparr[i];
}
for (int i = 0; i < 2; i++)
{
faces_texture[faceNum][i] = temparr2[i];
}
}
else
{
std::cout << "ERROR: Could not add face to faces" << std::endl;
return 0;
}
faceNum++;
}
}
}
std::cout << "Done Reading File" << std::endl;
return 1;
}
return -1;
}
int objParser::read(GLfloat * vertexArray, GLuint * faces, GLuint * textureArray, GLuint * faces_texture)
{
///TODO: Create Arrays and read file
std::cout << "This read is not done, use the other one" << std::endl;
return 0;
}
int objParser::read(GLfloat *vertexArray, GLuint *faces)
{
///TODO: Create Arrays and read file
std::cout << "This read is not done, use the other one" << std::endl;
return 0;
}
| [
"maude.elliot@gmail.com"
] | maude.elliot@gmail.com |
ce9222837cf35d2723cc6e8d556b4ac287a86cab | dacb2c51361616d2181cfdb86fcaf49405d7ad41 | /Krispy/src/Krispy/Materials/Material.cpp | cc270caaecd5f3d55632c5ad5c58be1d30bd9f97 | [
"MIT"
] | permissive | Dallin343/GameEngine | e93df60dc61bf3be59d555a5ffdb62ae61c36d68 | 029de5127edb29f3372b354cf8902a29ee80d768 | refs/heads/master | 2022-12-19T07:49:01.181947 | 2020-09-18T06:42:58 | 2020-09-18T06:42:58 | 286,892,101 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 662 | cpp | //
// Created by dallin on 9/15/20.
//
#include "Material.h"
#include "Krispy/Renderer/Renderer.h"
#include "Platform/OpenGL/OpenGLMaterial.h"
namespace Krispy {
Ref<Material> Material::Create(float ambientStrength, const Ref <Texture2D> &diffuse, const Ref <Texture2D> &specular) {
switch (Renderer::GetAPI()) {
case RendererAPI::API::None: KRISPY_CORE_ASSERT(false, "RenderAPI::None not implemented!"); return nullptr;
case RendererAPI::API::OpenGL: return CreateRef<OpenGLMaterial>(ambientStrength, diffuse, specular);
}
KRISPY_CORE_ASSERT(false, "Unknown RenderAPI!");
return nullptr;
}
}
| [
"dallinhagman@gmail.com"
] | dallinhagman@gmail.com |
5a07f7fcecbaeb8623a677848029092ab9c38299 | c112242db176c5a6750bb771d75a0a0711ad9ba4 | /archivosPractica/parteSuperioTiovivo.cc | 84a1eff588619a37136d79e9c59c0985a422be24 | [] | no_license | bartozambrana/IG_UGR | 06921ceb416111e7b48f4e987b49138e5957c259 | 0f779b33c63acfbbca72dced9942e786b784f19f | refs/heads/main | 2023-01-01T20:12:31.752760 | 2020-10-28T18:47:14 | 2020-10-28T18:47:14 | 308,106,216 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,619 | cc | #include "parteSuperiorTiovivo.h"
ParteSuperiorTiovivo::ParteSuperiorTiovivo(ObjPLY * ply, string imagenCono, string imagenBase, string imagenBarra){
this->cilindro = new Cilindro(50,1,1,imagenBarra);
this->cono = new Cono(50,1,1,imagenCono);
this->barraConPLY = new BarraConPLY(ply,imagenBarra);
this->base = new BaseSecundariaTiovivo(imagenBase);
}
void ParteSuperiorTiovivo::setMaterial(const Material & material, const Material & material2,const Material & material3){
cilindro->setMaterial(material);
cono ->setMaterial(material);
barraConPLY->setMaterial(material3,material2);
base->setMaterial(material);
}
void ParteSuperiorTiovivo::setColor(Tupla3f color){
cilindro->setColor(color);
cono->setColor(color);
barraConPLY->setColor(color);
base->setColor(color);
}
void ParteSuperiorTiovivo::draw(int modo, bool ajedrez, bool tapas, float translacionPLY, float giroZPLY, float giroParteSuperior){
glPushMatrix();
//TERCER GRADO DE LIBERTAD
glRotatef(giroParteSuperior,0.0,1.0,0.0); //Rotamos todos los elementos
//Techo del Tiovivo
glPushMatrix();
glTranslatef(0.0 , 21.0 , 0.0);//Situación en la parte superior del tiovivo
glScalef( 20.0 ,15.0 ,20.0 ); //Cono de radio 10, altura 15 -> Diametro 20 altura 15
cono->draw(modo,ajedrez,tapas);
glPopMatrix();
//Pilar Central
glPushMatrix();
glTranslatef(0.0 , 1.0, 0.0); //Situamos el pilar central a 1 del suelo
glScalef(5 , 20.5, 5); //Establecemos de altura 20 para enlazar con el techo y dándole más anchura para parecerse a un pilar
cilindro->draw(modo,ajedrez,tapas);
glPopMatrix();
//Base
glPushMatrix(); //Enlaza con el pilar
base->draw(modo,ajedrez,tapas);
glPopMatrix();
//Barras con objetos ply: Rotaremos el archivo ply siempre para que mira siempre a la derecha
//Partiendo de la hipótesis de que inicialmente está mirando hacia la derecha
//Barra frente teniendo el ejeZ hacia nosotros
glPushMatrix();
glTranslatef(0.0,1.0,15.0); //Situamos la barra y objeto ply bajo el techo y entre la base secundaria en el frente
glRotatef(180 ,0.0 ,1.0 ,0.0);
barraConPLY->draw(modo,ajedrez,tapas,translacionPLY,giroZPLY);
glPopMatrix();
//Barra izquierda, con eje Z hacia nosotros
glPushMatrix();
glTranslatef(-15.0,1.0,0.0);
glRotatef(90 ,0.0 ,1.0 ,0.0);
barraConPLY->draw(modo,ajedrez,tapas,translacionPLY,giroZPLY);
glPopMatrix();
//Barra derecha, con eje Z hacia nosotros
glPushMatrix();
glTranslatef(15.0,1.0,0.0);
glRotatef(270.0 ,0.0 ,1.0 ,0.0);
barraConPLY->draw(modo,ajedrez,tapas,translacionPLY,giroZPLY);
glPopMatrix();
//Barra detrás, con eje Z hacia nosotros
glPushMatrix();
glTranslatef(0.0,1.0,-15.0);
barraConPLY->draw(modo,ajedrez,tapas,translacionPLY,giroZPLY);
glPopMatrix();
glPopMatrix();
}
void ParteSuperiorTiovivo::setColorSeleccionado(int color){
cilindro->setColorSeleccionado(color);
cono->setColorSeleccionado(color);
base->setColorSeleccionado(color);
barraConPLY->setColorSeleccionado(color);
}
void ParteSuperiorTiovivo::setColoresAFalse(){
cilindro->setAFalseColores();
cono->setAFalseColores();
base->setAFalseColores();
barraConPLY->setAFalseColores();
} | [
"bartolomezambranaperez99@gmail.com"
] | bartolomezambranaperez99@gmail.com |
9c734f09c40c57c7d4e4292267197ad3f2ada038 | 01f93a80c10ef00e590232a6a33695810fe65e21 | /231power-of-two.cc | 539f3e89be6621f1c1e264ebbb8bc3e4f4d7974f | [] | no_license | ej2xu/LeetCode | b75b7c96a6456e5d413d4131f3c7da32a602a4ab | 7833ce128ee0a5206e52c804d0f908daf6fda688 | refs/heads/master | 2021-08-04T11:06:50.445969 | 2016-11-06T02:49:40 | 2016-11-06T02:49:40 | 66,995,130 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 97 | cc | class Solution {
public:
bool isPowerOfTwo(int n) {
return n>0 && !(n&(n-1));
}
};
| [
"yxu@willamette.edu"
] | yxu@willamette.edu |
4089524de512933772bec0296b8e11d563561198 | ba3f97837848483edaa6f4ed599b59e3dedf5246 | /6/problem_6.cpp | 40ca7a29a9ba763d36d601d952516f35f284d5fd | [] | no_license | wodniak/project_euler | 7c1a687123a4c32d7158437db1b593f079e4400c | 030e7aa41712dc0d8398302a2197074cb93da45a | refs/heads/master | 2020-06-01T04:38:46.799197 | 2019-01-14T16:55:02 | 2019-01-14T21:44:27 | 190,639,838 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 598 | cpp | #include <iostream>
using namespace std;
//brute force implementation
unsigned long sum_square_diff(int n)
{
unsigned long sum = 0, sum1 = 0;
for (int i = 1; i <= n; ++i)
{
sum += i * i;
sum1 += i;
}
return sum1 * sum1 - sum;
}
//special formula implementation
unsigned long sum_square_diff2(int n)
{
unsigned long sum1 = n * (n + 1) / 2;
unsigned long sum = n * (2*n + 1)*(n + 1) / 6;
return sum1 * sum1 - sum;
}
int main()
{
int N = 100;
cout << sum_square_diff(N) << "\n";
cout << sum_square_diff2(N) << "\n";
return 0;
} | [
"wozgrz96@gmail.com"
] | wozgrz96@gmail.com |
19405c42eed8928dd1b3c29c6989a5aeca9eb9f3 | e5091c3a8477fa12e1adfdb1f3d826eb6e9bb2be | /Codeforces/binary_string_reconstruction.cpp | fcb742c1826345139c13b8cf5bb3b9afbcc06280 | [] | no_license | leonardoAnjos16/Competitive-Programming | 1db3793bfaa7b16fc9a2854c502b788a47f1bbe1 | 4c9390da44b2fa3c9ec4298783bfb3258b34574d | refs/heads/master | 2023-08-14T02:25:31.178582 | 2023-08-06T06:54:52 | 2023-08-06T06:54:52 | 230,381,501 | 7 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 665 | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t; scanf("%d", &t);
while (t--) {
int n[3];
for (int i = 0; i < 3; i++)
scanf("%d", &n[i]);
string ans = "";
if (!n[1]) {
int size = (n[0] > 0) ? n[0] : n[2];
char bit = (n[0] > 0) ? '0' : '1';
for (int i = 0; i <= size; i++) ans += bit;
} else {
for (int i = 0; i <= n[0]; i++) ans += '0';
for (int i = 0; i < n[2]; i++) ans += '1';
for (int i = 1; i <= n[1]; i++) ans += i % 2 + '0';
}
printf("%s\n", ans.c_str());
}
} | [
"las4@cin.ufpe.br"
] | las4@cin.ufpe.br |
1011a7bd62d7f059cb1477e827aa771924b59636 | b470753cd4c7e6d600e9d5f8fad3221b152c4c11 | /src/Ingame/Details/TerrainObject.cpp | 26bb23663d79056e469304ed7c7a4f3675df70c9 | [] | no_license | schlenkibus/Wurms | aaa872be1674d3065403ef479e3a51be4790a1ab | 755d7d25379ee85e91ffd9e0c912936219227d0b | refs/heads/master | 2021-06-21T21:08:58.338460 | 2019-07-18T05:02:13 | 2019-07-18T05:02:13 | 145,979,667 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,497 | cpp | #include <memory>
#include <Box2D/Dynamics/b2Fixture.h>
#include <iostream>
#include "TerrainObject.h"
#include "../../UI/Overlay/PhysicsDebugger.h"
#include "../../Application.h"
#include "../../Tools/MathTools.h"
TerrainObject::TerrainObject(b2World* world, const std::vector<b2Vec2>& polygons) :
m_world(world), m_shape(), m_polys(convertToBox2DCoords(polygons)), m_drawObject(convertToSFMLCoords(polygons))
{
sanitizePoints();
calcObject();
}
void TerrainObject::draw(sf::RenderWindow &window) {
m_drawObject.draw(window);
}
bool TerrainObject::onEvent(sf::Event &e) {
return GameObject::onEvent(e);
}
void TerrainObject::update(float delta) {
auto pos = m_body->GetTransform().p;
m_drawObject.m_shape.setPosition(sf::Vector2f(pos.x, pos.y));
m_drawObject.setRotation((int)(m_body->GetAngle()*180/M_1_PI) % 360);
}
void TerrainObject::onResize(sf::Event &resizeEvent) {
GameObject::onResize(resizeEvent);
}
std::vector<sf::Vector2f> TerrainObject::convertToSFMLCoords(const std::vector<b2Vec2>& vector) {
std::vector<sf::Vector2f> ret;
ret.reserve(vector.size());
for(auto& pos: vector) {
ret.emplace_back(sf::Vector2f(pos.x, pos.y));
}
return ret;
}
std::vector<b2Vec2> TerrainObject::convertToBox2DCoords(const std::vector<b2Vec2> &vector) {
std::vector<b2Vec2> ret;
ret.reserve(vector.size());
for(auto p: vector)
ret.emplace_back(p);
return ret;
}
bool contains(const sf::CircleShape* shape, float x, float y) {
return shape->getRadius() >= MathTools::distance(shape->getPosition().x, shape->getPosition().y, x, y);
}
void TerrainObject::applyExplosion(Explosion *pExplosion) {
sf::CircleShape clippingObject;
clippingObject.setPosition(pExplosion->getPosition());
clippingObject.setRadius(pExplosion->getRadius());
clippingObject.setOrigin(clippingObject.getRadius() / 2, clippingObject.getRadius() / 2);
auto affectedPoints = calculateAffectedPoints(clippingObject);
bool willBreakCircle = doesExplosionBreakCircle(affectedPoints);
if(willBreakCircle) {
std::cerr << "making terrain kaputt!\n";
//doSplit(clippingObject, affectedPoints);
} else {
moveToOutsideOfCircle(&clippingObject, affectedPoints);
}
sanitizePoints();
calcObject();
m_drawObject.calcObject(convertToSFMLCoords(m_polys));
}
std::vector<b2Vec2*> TerrainObject::calculateAffectedPoints(sf::CircleShape& shape) {
std::vector<b2Vec2*> ret{};
for(auto& p: m_polys) {
if(contains(&shape, p.x, p.y)) {
ret.emplace_back(&p);
}
}
return ret;
}
void TerrainObject::doSplit(sf::CircleShape& shape, std::vector<b2Vec2*> affectedPoints) {
}
void TerrainObject::calcObject() {
if(m_fixture)
m_body->DestroyFixture(m_fixture);
if(m_body)
m_world->DestroyBody(m_body);
m_shape = std::make_unique<b2ChainShape>();
m_bodyDef.type = b2_staticBody;
m_body = m_world->CreateBody(&m_bodyDef);
m_shape->CreateLoop(&*m_polys.begin(), static_cast<int32>(m_polys.size()));
m_fixtureDef.shape = m_shape.get();
m_fixture = m_body->CreateFixture(&m_fixtureDef);
auto po = m_body->GetTransform().p;
m_drawObject.setPosition(sf::Vector2f(po.x, po.y));
}
void TerrainObject::moveToOutsideOfCircle(sf::CircleShape *pShape, std::vector<b2Vec2 *> vector) {
for(auto* p: vector) {
movePointToClosestCircleEdge(pShape->getPosition(), pShape->getRadius(), p);
}
}
void TerrainObject::movePointToClosestCircleEdge(const sf::Vector2f &circleCenter, float radius, b2Vec2* pointToMove) {
const auto A = circleCenter;
const auto B = sf::Vector2f(pointToMove->x, pointToMove->y);
const auto div = std::sqrt(std::pow(B.x - A.x, 2.f) + std::pow(B.y - A.y, 2.f));
const auto cX = A.x + radius * (B.x - A.x) / div;
const auto cY = A.y + radius * (B.y - A.y) / div;
const auto closestPoint = sf::Vector2f(cX, cY);
if(const auto* debugger = PhysicsDebugger::getDebugger()) {
debugger->addExpiringPoint(B, sf::seconds(5));
debugger->addExpiringPoint(circleCenter, sf::seconds(5));
debugger->addExpiringPoint(closestPoint, sf::seconds(5));
}
pointToMove->x = closestPoint.x;
pointToMove->y = closestPoint.y;
}
void TerrainObject::sanitizePoints() {
std::vector<int> indiciesToDelete;
for(int index = 0; index < m_polys.size(); index++) {
if(index != 0 || index + 1 != m_polys.size()) {
auto pre = m_polys[index - 1];
auto curr = m_polys[index];
auto post = m_polys[index + 1];
if(b2DistanceSquared(pre, curr) <= 0.005f * 0.005f ||
b2DistanceSquared(post, curr) <= 0.005f * 0.005f) {
indiciesToDelete.emplace_back(index);
}
}
}
for(auto index: indiciesToDelete)
m_polys.erase(m_polys.begin() + index);
}
const size_t TerrainObject::getPolyCount() const {
return m_polys.size();
}
bool TerrainObject::doesExplosionBreakCircle(std::vector<b2Vec2 *> &affectedPoints) {
bool entryExplosion = false;
bool exitExplosion = false;
for(auto& p: m_polys) {
if(std::find(affectedPoints.begin(), affectedPoints.end(), &p) != affectedPoints.end()) {
entryExplosion = true;
if(exitExplosion)
return true;
} else if(entryExplosion) {
exitExplosion = true;
}
}
return false;
}
| [
"justus.scheil@parteimail.de"
] | justus.scheil@parteimail.de |
8a3237cdc76630fa4dd7dbd2e37478b14ccfbd2f | 2b80b8338ecf91e4221e26580fe489dceec231b9 | /src/qt/bitcoin.cpp | 647f0ac83104e8b0a40d70934d9ba5d9b6765b76 | [
"MIT"
] | permissive | globalcoindev/globalcoin | 00db11f8b3fc51d96a0213f195b55da2097bd621 | 77a1e64a53f61042f1e0459dd1c3168ef1e190ad | refs/heads/master | 2016-09-06T12:41:02.402799 | 2014-01-28T19:55:06 | 2014-01-28T19:55:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,987 | cpp | /*
* W.J. van der Laan 2011-2012
*/
#include "bitcoingui.h"
#include "clientmodel.h"
#include "walletmodel.h"
#include "optionsmodel.h"
#include "guiutil.h"
#include "guiconstants.h"
#include "init.h"
#include "ui_interface.h"
#include "qtipcserver.h"
#include <QApplication>
#include <QMessageBox>
#include <QTextCodec>
#include <QLocale>
#include <QTranslator>
#include <QSplashScreen>
#include <QLibraryInfo>
#include <boost/interprocess/ipc/message_queue.hpp>
#include <boost/algorithm/string/predicate.hpp>
#if defined(BITCOIN_NEED_QT_PLUGINS) && !defined(_BITCOIN_QT_PLUGINS_INCLUDED)
#define _BITCOIN_QT_PLUGINS_INCLUDED
#define __INSURE__
#include <QtPlugin>
Q_IMPORT_PLUGIN(qcncodecs)
Q_IMPORT_PLUGIN(qjpcodecs)
Q_IMPORT_PLUGIN(qtwcodecs)
Q_IMPORT_PLUGIN(qkrcodecs)
Q_IMPORT_PLUGIN(qtaccessiblewidgets)
#endif
// Need a global reference for the notifications to find the GUI
static BitcoinGUI *guiref;
static QSplashScreen *splashref;
static void ThreadSafeMessageBox(const std::string& message, const std::string& caption, int style)
{
// Message from network thread
if(guiref)
{
bool modal = (style & CClientUIInterface::MODAL);
// in case of modal message, use blocking connection to wait for user to click OK
QMetaObject::invokeMethod(guiref, "error",
modal ? GUIUtil::blockingGUIThreadConnection() : Qt::QueuedConnection,
Q_ARG(QString, QString::fromStdString(caption)),
Q_ARG(QString, QString::fromStdString(message)),
Q_ARG(bool, modal));
}
else
{
printf("%s: %s\n", caption.c_str(), message.c_str());
fprintf(stderr, "%s: %s\n", caption.c_str(), message.c_str());
}
}
static bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption)
{
if(!guiref)
return false;
if(nFeeRequired < MIN_TX_FEE || nFeeRequired <= nTransactionFee || fDaemon)
return true;
bool payFee = false;
QMetaObject::invokeMethod(guiref, "askFee", GUIUtil::blockingGUIThreadConnection(),
Q_ARG(qint64, nFeeRequired),
Q_ARG(bool*, &payFee));
return payFee;
}
static void ThreadSafeHandleURI(const std::string& strURI)
{
if(!guiref)
return;
QMetaObject::invokeMethod(guiref, "handleURI", GUIUtil::blockingGUIThreadConnection(),
Q_ARG(QString, QString::fromStdString(strURI)));
}
static void InitMessage(const std::string &message)
{
if(splashref)
{
splashref->showMessage(QString::fromStdString(message), Qt::AlignBottom|Qt::AlignHCenter, QColor(255,255,200));
QApplication::instance()->processEvents();
}
}
static void QueueShutdown()
{
QMetaObject::invokeMethod(QCoreApplication::instance(), "quit", Qt::QueuedConnection);
}
/*
Translate string to current locale using Qt.
*/
static std::string Translate(const char* psz)
{
return QCoreApplication::translate("bitcoin-core", psz).toStdString();
}
/* Handle runaway exceptions. Shows a message box with the problem and quits the program.
*/
static void handleRunawayException(std::exception *e)
{
PrintExceptionContinue(e, "Runaway exception");
QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occured. GLOBALCOIN can no longer continue safely and will quit.") + QString("\n\n") + QString::fromStdString(strMiscWarning));
exit(1);
}
#ifndef BITCOIN_QT_TEST
int main(int argc, char *argv[])
{
// TODO: implement URI support on the Mac.
#if !defined(MAC_OSX)
// Do this early as we don't want to bother initializing if we are just calling IPC
for (int i = 1; i < argc; i++)
{
if (boost::algorithm::istarts_with(argv[i], "globalcoin:"))
{
const char *strURI = argv[i];
try {
boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME);
if (mq.try_send(strURI, strlen(strURI), 0))
// if URI could be sent to the message queue exit here
exit(0);
else
// if URI could not be sent to the message queue do a normal Bitcoin-Qt startup
break;
}
catch (boost::interprocess::interprocess_exception &ex) {
// don't log the "file not found" exception, because that's normal for
// the first start of the first instance
if (ex.get_error_code() != boost::interprocess::not_found_error)
{
printf("main() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what());
break;
}
}
}
}
#endif
// Internal string conversion is all UTF-8
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForTr());
Q_INIT_RESOURCE(bitcoin);
QApplication app(argc, argv);
// Install global event filter that makes sure that long tooltips can be word-wrapped
app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));
// Command-line options take precedence:
ParseParameters(argc, argv);
// ... then bitcoin.conf:
if (!boost::filesystem::is_directory(GetDataDir(false)))
{
fprintf(stderr, "Error: Specified directory does not exist\n");
return 1;
}
ReadConfigFile(mapArgs, mapMultiArgs);
// Application identification (must be set before OptionsModel is initialized,
// as it is used to locate QSettings)
app.setOrganizationName("GLOBALCOIN");
app.setOrganizationDomain("globalcoin.org");
if(GetBoolArg("-testnet")) // Separate UI settings for testnet
app.setApplicationName("GLOBALCOIN-Qt-testnet");
else
app.setApplicationName("GLOBALCOIN-Qt");
// ... then GUI settings:
OptionsModel optionsModel;
// Get desired locale (e.g. "de_DE") from command line or use system locale
QString lang_territory = QString::fromStdString(GetArg("-lang", QLocale::system().name().toStdString()));
QString lang = lang_territory;
// Convert to "de" only by truncating "_DE"
lang.truncate(lang_territory.lastIndexOf('_'));
QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator;
// Load language files for configured locale:
// - First load the translator for the base language, without territory
// - Then load the more specific locale translator
// Load e.g. qt_de.qm
if (qtTranslatorBase.load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
app.installTranslator(&qtTranslatorBase);
// Load e.g. qt_de_DE.qm
if (qtTranslator.load("qt_" + lang_territory, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
app.installTranslator(&qtTranslator);
// Load e.g. bitcoin_de.qm (shortcut "de" needs to be defined in bitcoin.qrc)
if (translatorBase.load(lang, ":/translations/"))
app.installTranslator(&translatorBase);
// Load e.g. bitcoin_de_DE.qm (shortcut "de_DE" needs to be defined in bitcoin.qrc)
if (translator.load(lang_territory, ":/translations/"))
app.installTranslator(&translator);
// Subscribe to global signals from core
uiInterface.ThreadSafeMessageBox.connect(ThreadSafeMessageBox);
uiInterface.ThreadSafeAskFee.connect(ThreadSafeAskFee);
uiInterface.ThreadSafeHandleURI.connect(ThreadSafeHandleURI);
uiInterface.InitMessage.connect(InitMessage);
uiInterface.QueueShutdown.connect(QueueShutdown);
uiInterface.Translate.connect(Translate);
// Show help message immediately after parsing command-line options (for "-lang") and setting locale,
// but before showing splash screen.
if (mapArgs.count("-?") || mapArgs.count("--help"))
{
GUIUtil::HelpMessageBox help;
help.showOrPrint();
return 1;
}
QSplashScreen splash(QPixmap(":/images/splash"), 0);
if (GetBoolArg("-splash", true) && !GetBoolArg("-min"))
{
splash.show();
splash.setAutoFillBackground(true);
splashref = &splash;
}
app.processEvents();
app.setQuitOnLastWindowClosed(false);
try
{
// Regenerate startup link, to fix links to old versions
if (GUIUtil::GetStartOnSystemStartup())
GUIUtil::SetStartOnSystemStartup(true);
BitcoinGUI window;
guiref = &window;
if(AppInit2())
{
{
// Put this in a block, so that the Model objects are cleaned up before
// calling Shutdown().
optionsModel.Upgrade(); // Must be done after AppInit2
if (splashref)
splash.finish(&window);
ClientModel clientModel(&optionsModel);
WalletModel walletModel(pwalletMain, &optionsModel);
window.setClientModel(&clientModel);
window.setWalletModel(&walletModel);
// If -min option passed, start window minimized.
if(GetBoolArg("-min"))
{
window.showMinimized();
}
else
{
window.show();
}
// TODO: implement URI support on the Mac.
#if !defined(MAC_OSX)
// Place this here as guiref has to be defined if we dont want to lose URIs
ipcInit();
// Check for URI in argv
for (int i = 1; i < argc; i++)
{
if (boost::algorithm::istarts_with(argv[i], "globalcoin:"))
{
const char *strURI = argv[i];
try {
boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME);
mq.try_send(strURI, strlen(strURI), 0);
}
catch (boost::interprocess::interprocess_exception &ex) {
printf("main() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what());
break;
}
}
}
#endif
app.exec();
window.hide();
window.setClientModel(0);
window.setWalletModel(0);
guiref = 0;
}
// Shutdown the core and it's threads, but don't exit Bitcoin-Qt here
Shutdown(NULL);
}
else
{
return 1;
}
} catch (std::exception& e) {
handleRunawayException(&e);
} catch (...) {
handleRunawayException(NULL);
}
return 0;
}
#endif // BITCOIN_QT_TEST
| [
"benfordcapitalpumps@gmail.com"
] | benfordcapitalpumps@gmail.com |
350dc401c3a008473161de6ebb829a22e3eee1c3 | fb7efe44f4d9f30d623f880d0eb620f3a81f0fbd | /chrome/browser/feature_engagement/session_duration_updater.cc | 46468acfe213542f4e20f70af1e8e01165005273 | [
"BSD-3-Clause"
] | permissive | wzyy2/chromium-browser | 2644b0daf58f8b3caee8a6c09a2b448b2dfe059c | eb905f00a0f7e141e8d6c89be8fb26192a88c4b7 | refs/heads/master | 2022-11-23T20:25:08.120045 | 2018-01-16T06:41:26 | 2018-01-16T06:41:26 | 117,618,467 | 3 | 2 | BSD-3-Clause | 2022-11-20T22:03:57 | 2018-01-16T02:09:10 | null | UTF-8 | C++ | false | false | 3,063 | 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 "chrome/browser/feature_engagement/session_duration_updater.h"
#include "base/observer_list.h"
#include "base/time/time.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
#include "chrome/common/pref_names.h"
#include "components/feature_engagement/public/event_constants.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
namespace feature_engagement {
SessionDurationUpdater::SessionDurationUpdater(PrefService* pref_service)
: duration_tracker_observer_(this), pref_service_(pref_service) {
AddDurationTrackerObserver();
}
SessionDurationUpdater::~SessionDurationUpdater() = default;
// static
void SessionDurationUpdater::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterIntegerPref(prefs::kObservedSessionTime, 0);
}
void SessionDurationUpdater::AddObserver(Observer* observer) {
observer_list_.AddObserver(observer);
// Re-adds SessionDurationUpdater as an observer of
// DesktopSessionDurationTracker if another feature is added after
// SessionDurationUpdater was removed.
if (!duration_tracker_observer_.IsObserving(
metrics::DesktopSessionDurationTracker::Get()))
AddDurationTrackerObserver();
}
void SessionDurationUpdater::RemoveObserver(Observer* observer) {
observer_list_.RemoveObserver(observer);
// If all the observer Features have removed themselves due to their active
// time limits have been reached, the SessionDurationUpdater removes itself
// as an observer of DesktopSessionDurationTracker.
if (!observer_list_.might_have_observers())
RemoveDurationTrackerObserver();
}
void SessionDurationUpdater::OnSessionEnded(base::TimeDelta elapsed) {
// This case is only used during testing as that is the only case that
// DesktopSessionDurationTracker isn't calling this on its observer.
if (!duration_tracker_observer_.IsObserving(
metrics::DesktopSessionDurationTracker::Get())) {
return;
}
base::TimeDelta elapsed_session_time;
elapsed_session_time +=
base::TimeDelta::FromMinutes(
pref_service_->GetInteger(prefs::kObservedSessionTime)) +
elapsed;
pref_service_->SetInteger(prefs::kObservedSessionTime,
elapsed_session_time.InMinutes());
for (Observer& observer : observer_list_)
observer.OnSessionEnded(elapsed_session_time);
}
void SessionDurationUpdater::AddDurationTrackerObserver() {
duration_tracker_observer_.Add(metrics::DesktopSessionDurationTracker::Get());
}
void SessionDurationUpdater::RemoveDurationTrackerObserver() {
duration_tracker_observer_.Remove(
metrics::DesktopSessionDurationTracker::Get());
}
PrefService* SessionDurationUpdater::GetPrefs() {
return pref_service_;
}
} // namespace feature_engagement
| [
"jacob-chen@iotwrt.com"
] | jacob-chen@iotwrt.com |
d58225b9f27c87f31d43853bf0315a24ef85efa7 | 8d6401e52bae5362bd7c149c381823a909f5a61f | /src/kernel_impl.hpp | c25bf465634f607f0c3869f9d422178e0f4b91f4 | [
"MIT"
] | permissive | vinit-n/fluctus | f095467d64d17643c197ad5b075a7f1bed6935bb | 2208605fa4a87f6d0b11530a26542a4c88817488 | refs/heads/master | 2022-04-09T05:04:40.755593 | 2020-03-27T20:48:07 | 2020-03-27T20:48:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 19,674 | hpp | #pragma once
#include <clt.hpp>
#include "tracer.hpp"
#include "clcontext.hpp"
inline CLContext* getCtxPtr(void* userPtr)
{
Tracer* tracer = static_cast<Tracer*>(userPtr);
CLContext *ctx = static_cast<CLContext*>(tracer->getClContext());
return ctx;
}
class WFLogicKernel : public clt::Kernel
{
public:
WFLogicKernel(void) : Kernel("src/wf_logic.cl", "logic") {}
void setArgs() override {
const CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("pixels", ctx->deviceBuffers.pixelBuffer);
err |= setArg("denoiserNormal", ctx->deviceBuffers.denoiserNormalBuffer);
err |= setArg("denoiserAlbedo", ctx->deviceBuffers.denoiserAlbedoBuffer);
err |= setArg("queueLens", ctx->deviceBuffers.queueCounters);
err |= setArg("extensionQueue", ctx->deviceBuffers.extensionQueue);
err |= setArg("shadowQueue", ctx->deviceBuffers.shadowQueue);
err |= setArg("raygenQueue", ctx->deviceBuffers.raygenQueue);
err |= setArg("diffuseQueue", ctx->deviceBuffers.diffuseMatQueue);
err |= setArg("glossyQueue", ctx->deviceBuffers.glossyMatQueue);
err |= setArg("ggxReflQueue", ctx->deviceBuffers.ggxReflMatQueue);
err |= setArg("ggxRefrQueue", ctx->deviceBuffers.ggxRefrMatQueue);
err |= setArg("deltaQueue", ctx->deviceBuffers.deltaMatQueue);
err |= setArg("tris", ctx->deviceBuffers.triangleBuffer);
err |= setArg("nodes", ctx->deviceBuffers.nodeBuffer);
err |= setArg("indices", ctx->deviceBuffers.indexBuffer);
err |= setArg("envMap", ctx->deviceBuffers.environmentMap);
err |= setArg("probTable", ctx->deviceBuffers.probTable);
err |= setArg("aliasTable", ctx->deviceBuffers.aliasTable);
err |= setArg("pdfTable", ctx->deviceBuffers.pdfTable);
err |= setArg("materials", ctx->deviceBuffers.materialBuffer);
err |= setArg("texData", ctx->deviceBuffers.texDataBuffer);
err |= setArg("textures", ctx->deviceBuffers.texDescriptorBuffer);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("numTasks", ctx->getNumTasks());
err |= setArg("firstIteration", (cl_uint)false);
clt::check(err, "Failed to set wf_logic arguments");
}
std::string getAdditionalBuildOptions() override {
Tracer* tracer = static_cast<Tracer*>(userPtr);
const RenderParams& params = tracer->getParams();
std::string opts;
if (tracer->useDenoiser) opts.append(" -DUSE_OPTIX_DENOISER");
if (params.useAreaLight) opts.append(" -DUSE_AREA_LIGHT");
if (params.useEnvMap) opts.append(" -DUSE_ENV_MAP");
if (params.sampleExpl) opts.append(" -DSAMPLE_EXPLICIT");
if (params.sampleImpl) opts.append(" -DSAMPLE_IMPLICIT");
if (!params.wfSeparateQueues) opts.append(" -DWF_SINGLE_MAT_QUEUE");
return opts;
}
};
class PickKernel : public clt::Kernel
{
public:
PickKernel(void) : Kernel("src/kernel_pick.cl", "pick") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("tris", ctx->deviceBuffers.triangleBuffer);
err |= setArg("nodes", ctx->deviceBuffers.nodeBuffer);
err |= setArg("indices", ctx->deviceBuffers.indexBuffer);
err |= setArg("pickResult", ctx->deviceBuffers.pickResult);
clt::check(err, "Failed to set kernel_pick arguments!");
}
};
class WFExtensionKernel : public clt::Kernel
{
public:
WFExtensionKernel(void) : Kernel("src/wf_extrays.cl", "traceExtension") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("queueLens", ctx->deviceBuffers.queueCounters);
err |= setArg("extensionQueue", ctx->deviceBuffers.extensionQueue);
err |= setArg("tris", ctx->deviceBuffers.triangleBuffer);
err |= setArg("nodes", ctx->deviceBuffers.nodeBuffer);
err |= setArg("indices", ctx->deviceBuffers.indexBuffer);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set wf_extension arguments!");
}
};
class WFShadowKernel : public clt::Kernel
{
public:
WFShadowKernel(void) : Kernel("src/wf_shadowrays.cl", "traceShadow") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("queueLens", ctx->deviceBuffers.queueCounters);
err |= setArg("shadowQueue", ctx->deviceBuffers.shadowQueue);
err |= setArg("tris", ctx->deviceBuffers.triangleBuffer);
err |= setArg("nodes", ctx->deviceBuffers.nodeBuffer);
err |= setArg("indices", ctx->deviceBuffers.indexBuffer);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set wf_shadow arguments!");
}
};
class WFRaygenKernel : public clt::Kernel
{
public:
WFRaygenKernel(void) : Kernel("src/wf_raygen.cl", "genRays") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("queueLens", ctx->deviceBuffers.queueCounters);
err |= setArg("raygenQueue", ctx->deviceBuffers.raygenQueue);
err |= setArg("extensionQueue", ctx->deviceBuffers.extensionQueue);
err |= setArg("currPixelIdx", ctx->deviceBuffers.currentPixelIdx);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set wf_raygen arguments!");
}
};
class WFDiffuseKernel : public clt::Kernel
{
public:
WFDiffuseKernel(void) : Kernel("src/wf_mat_diffuse.cl", "wavefrontDiffuse") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("queueLens", ctx->deviceBuffers.queueCounters);
err |= setArg("diffuseQueue", ctx->deviceBuffers.diffuseMatQueue);
err |= setArg("extensionQueue", ctx->deviceBuffers.extensionQueue);
err |= setArg("materials", ctx->deviceBuffers.materialBuffer);
err |= setArg("texData", ctx->deviceBuffers.texDataBuffer);
err |= setArg("textures", ctx->deviceBuffers.texDescriptorBuffer);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set wf_diffuse arguments!");
}
};
class WFGlossyKernel : public clt::Kernel
{
public:
WFGlossyKernel(void) : Kernel("src/wf_mat_glossy.cl", "wavefrontGlossy") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("queueLens", ctx->deviceBuffers.queueCounters);
err |= setArg("glossyQueue", ctx->deviceBuffers.glossyMatQueue);
err |= setArg("extensionQueue", ctx->deviceBuffers.extensionQueue);
err |= setArg("materials", ctx->deviceBuffers.materialBuffer);
err |= setArg("texData", ctx->deviceBuffers.texDataBuffer);
err |= setArg("textures", ctx->deviceBuffers.texDescriptorBuffer);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set wf_glossy arguments!");
}
};
class WFGGXReflKernel : public clt::Kernel
{
public:
WFGGXReflKernel(void) : Kernel("src/wf_mat_ggx_reflection.cl", "wavefrontGGXReflection") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("queueLens", ctx->deviceBuffers.queueCounters);
err |= setArg("ggxReflQueue", ctx->deviceBuffers.ggxReflMatQueue);
err |= setArg("extensionQueue", ctx->deviceBuffers.extensionQueue);
err |= setArg("materials", ctx->deviceBuffers.materialBuffer);
err |= setArg("texData", ctx->deviceBuffers.texDataBuffer);
err |= setArg("textures", ctx->deviceBuffers.texDescriptorBuffer);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set wf_ggx_refl arguments!");
}
};
class WFGGXRefrKernel : public clt::Kernel
{
public:
WFGGXRefrKernel(void) : Kernel("src/wf_mat_ggx_refraction.cl", "wavefrontGGXRefraction") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("queueLens", ctx->deviceBuffers.queueCounters);
err |= setArg("ggxRefrQueue", ctx->deviceBuffers.ggxRefrMatQueue);
err |= setArg("extensionQueue", ctx->deviceBuffers.extensionQueue);
err |= setArg("materials", ctx->deviceBuffers.materialBuffer);
err |= setArg("texData", ctx->deviceBuffers.texDataBuffer);
err |= setArg("textures", ctx->deviceBuffers.texDescriptorBuffer);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set wf_ggx_refr arguments!");
}
};
class WFDeltaKernel : public clt::Kernel
{
public:
WFDeltaKernel(void) : Kernel("src/wf_mat_delta.cl", "wavefrontDelta") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("queueLens", ctx->deviceBuffers.queueCounters);
err |= setArg("deltaQueue", ctx->deviceBuffers.deltaMatQueue);
err |= setArg("extensionQueue", ctx->deviceBuffers.extensionQueue);
err |= setArg("materials", ctx->deviceBuffers.materialBuffer);
err |= setArg("texData", ctx->deviceBuffers.texDataBuffer);
err |= setArg("textures", ctx->deviceBuffers.texDescriptorBuffer);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set wf_delta arguments!");
}
};
class WFAllMaterialsKernel : public clt::Kernel
{
public:
WFAllMaterialsKernel(void) : Kernel("src/wf_mat_all.cl", "wavefrontAllMaterials") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("queueLens", ctx->deviceBuffers.queueCounters);
err |= setArg("materialQueue", ctx->deviceBuffers.diffuseMatQueue);
err |= setArg("extensionQueue", ctx->deviceBuffers.extensionQueue);
err |= setArg("materials", ctx->deviceBuffers.materialBuffer);
err |= setArg("texData", ctx->deviceBuffers.texDataBuffer);
err |= setArg("textures", ctx->deviceBuffers.texDescriptorBuffer);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set wf_all_mats arguments!");
}
std::string getAdditionalBuildOptions() override {
// Only handle material types that exist in scene
Tracer* tracer = static_cast<Tracer*>(userPtr);
unsigned int typeBits = tracer->getScene()->getMaterialTypes();
return getBxdfDefines(typeBits);
}
};
class WFResetKernel : public clt::Kernel
{
public:
WFResetKernel(void) : Kernel("src/wf_reset.cl", "reset") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("pixels", ctx->deviceBuffers.pixelBuffer);
err |= setArg("denoiserAlbedo", ctx->deviceBuffers.denoiserAlbedoBuffer);
err |= setArg("denoiserNormal", ctx->deviceBuffers.denoiserNormalBuffer);
err |= setArg("queueLens", ctx->deviceBuffers.queueCounters);
err |= setArg("raygenQueue", ctx->deviceBuffers.raygenQueue);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set wf_reset arguments!");
}
};
class MKResetKernel : public clt::Kernel
{
public:
MKResetKernel(void) : Kernel("src/mk_reset.cl", "reset") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("pixels", ctx->deviceBuffers.pixelBuffer);
err |= setArg("denoiserAlbedo", ctx->deviceBuffers.denoiserAlbedoBuffer);
err |= setArg("denoiserNormal", ctx->deviceBuffers.denoiserNormalBuffer);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set mk_reset arguments!");
}
};
class MKRaygenKernel : public clt::Kernel
{
public:
MKRaygenKernel(void) : Kernel("src/mk_raygen.cl", "genCameraRays") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set mk_raygen arguments!");
}
};
class MKNextVertexKernel : public clt::Kernel
{
public:
MKNextVertexKernel(void) : Kernel("src/mk_next_vertex.cl", "nextVertex") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("materials", ctx->deviceBuffers.materialBuffer);
err |= setArg("texData", ctx->deviceBuffers.texDataBuffer);
err |= setArg("textures", ctx->deviceBuffers.texDescriptorBuffer);
err |= setArg("denoiserNormal", ctx->deviceBuffers.denoiserNormalBuffer);
err |= setArg("tris", ctx->deviceBuffers.triangleBuffer);
err |= setArg("nodes", ctx->deviceBuffers.nodeBuffer);
err |= setArg("indices", ctx->deviceBuffers.indexBuffer);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("stats", ctx->deviceBuffers.renderStats);
err |= setArg("envMap", ctx->deviceBuffers.environmentMap);
err |= setArg("pdfTable", ctx->deviceBuffers.pdfTable);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set mk_next_vertex arguments!");
}
std::string getAdditionalBuildOptions() override {
Tracer* tracer = static_cast<Tracer*>(userPtr);
const RenderParams& params = tracer->getParams();
std::string opts;
if (tracer->useDenoiser) opts.append(" -DUSE_OPTIX_DENOISER");
return opts;
}
};
class MKSampleBSDFKernel : public clt::Kernel
{
public:
MKSampleBSDFKernel(void) : Kernel("src/mk_sample_bsdf.cl", "sampleBsdf") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("denoiserAlbedo", ctx->deviceBuffers.denoiserAlbedoBuffer);
err |= setArg("materials", ctx->deviceBuffers.materialBuffer);
err |= setArg("texData", ctx->deviceBuffers.texDataBuffer);
err |= setArg("textures", ctx->deviceBuffers.texDescriptorBuffer);
err |= setArg("envMap", ctx->deviceBuffers.environmentMap);
err |= setArg("probTable", ctx->deviceBuffers.probTable);
err |= setArg("aliasTable", ctx->deviceBuffers.aliasTable);
err |= setArg("pdfTable", ctx->deviceBuffers.pdfTable);
err |= setArg("tris", ctx->deviceBuffers.triangleBuffer);
err |= setArg("nodes", ctx->deviceBuffers.nodeBuffer);
err |= setArg("indices", ctx->deviceBuffers.indexBuffer);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("stats", ctx->deviceBuffers.renderStats);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set mk_sample_bsdf arguments!");
}
std::string getAdditionalBuildOptions() override {
Tracer* tracer = static_cast<Tracer*>(userPtr);
const RenderParams& params = tracer->getParams();
std::string opts;
if (tracer->useDenoiser) opts.append(" -DUSE_OPTIX_DENOISER");
// Only check for material types that exist
unsigned int typeBits = tracer->getScene()->getMaterialTypes();
opts.append(getBxdfDefines(typeBits));
return opts;
}
};
class MKSplatKernel : public clt::Kernel
{
public:
MKSplatKernel(void) : Kernel("src/mk_splat.cl", "splat") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("pixels", ctx->deviceBuffers.pixelBuffer);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("stats", ctx->deviceBuffers.renderStats);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set mk_splat arguments!");
}
};
class MKSplatPreviewKernel : public clt::Kernel
{
public:
MKSplatPreviewKernel(void) : Kernel("src/mk_splat_preview.cl", "splatPreview") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("tasks", ctx->deviceBuffers.tasksBuffer);
err |= setArg("pixels", ctx->deviceBuffers.pixelBuffer);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set mk_splat_preview arguments!");
}
};
class MKPostprocessKernel : public clt::Kernel
{
public:
MKPostprocessKernel(void) : Kernel("src/mk_postprocess.cl", "process") {}
void setArgs() override {
CLContext *ctx = getCtxPtr(userPtr);
int err = 0;
err |= setArg("pixelsRaw", ctx->deviceBuffers.pixelBuffer); // raw pixels
err |= setArg("denoiserAlbedo", ctx->deviceBuffers.denoiserAlbedoBuffer);
err |= setArg("denoiserNormal", ctx->deviceBuffers.denoiserNormalBuffer);
err |= setArg("pixelsPreview", ctx->deviceBuffers.previewBuffer); // tonemapped output
err |= setArg("denoiserAlbedoGL", ctx->deviceBuffers.denoiserAlbedoBufferGL);
err |= setArg("denoiserNormalGL", ctx->deviceBuffers.denoiserNormalBufferGL);
err |= setArg("params", ctx->deviceBuffers.renderParams);
err |= setArg("numTasks", ctx->getNumTasks());
clt::check(err, "Failed to set mk_postprocess arguments!");
}
std::string getAdditionalBuildOptions() override {
Tracer* tracer = static_cast<Tracer*>(userPtr);
const RenderParams& params = tracer->getParams();
std::string opts;
if (tracer->useDenoiser) opts.append(" -DUSE_OPTIX_DENOISER");
return opts;
}
};
| [
"erik.harkonen@hotmail.com"
] | erik.harkonen@hotmail.com |
55c0fe181206832e068aa4416f2c387a44608e54 | d69b2bd336453f39c3b270a51cf89854dc6c7746 | /Lab/Lab 06:22:17/PaycheckCalculator_Ver2/main.cpp | 37447a05424608a5d443e13773e8ad4d9a32a81e | [] | no_license | aldavidramos/RamosAllan_CSC5_45549 | 2f66030a7f3c04d38ab940cabb58e132e9cc0497 | 31766d5ca95a4f11fa2eecd9a0eeaadc41988dda | refs/heads/master | 2021-01-01T06:51:57.327532 | 2017-07-29T06:24:01 | 2017-07-29T06:24:01 | 97,530,089 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,380 | cpp | /*
* File: main.cpp
* Author: Allan Ramos
* Created on June 20, 2017, 6:51 PM
* Purpose: Template
*/
//System Libraries
#include <iostream> //Input/Output Library
#include <iomanip>
using namespace std; //Namespace of the System Libraries
//User Libraries
//Global Constants
//Function Prototypes
//Execution Begins Here!
int main(int argc, char** argv) {
//Declare and Initialize Variables
float payRte = 10; //Dollars per hour
float hrsWkd; //Hours worked
float payChk; //Total paycheck
float ovrFact = 1.5f; //Overtime factor
float ovrTmPy;
//Input Data
cout<<"Enter the amount of hours worked"<<endl;
cin>>hrsWkd; //Input the amount of hours worked
//Process the Data
//Output the processed Data
if (hrsWkd <=40){
payChk = payRte * hrsWkd; //Calculate paycheck
cout<<"Your paycheck amounts to $"<<setprecision(2)<<fixed<<payChk<<endl; //Display paycheck amount
}
else {
ovrTmPy = (hrsWkd - 40) * payRte * ovrFact;
payChk = 40 * payRte + ovrTmPy;
cout<<"You worked "<<hrsWkd-40<<" hours overtime"<<endl;
cout<<"Your overtime pay amounts to $"<<setprecision(2)<<fixed<<ovrTmPy<<endl;
cout<<"Your total paycheck amounts to $"<<setprecision(2)<<fixed<<payChk<<endl;
}
//Exit Stage Right!
return 0;
} | [
"al.david.ramos@gmail.com"
] | al.david.ramos@gmail.com |
1f9b230ac14b3caca4376e3faec3c2a32cc39e89 | e02a75042ee1f0da2d32996b7cd7269a80c8502e | /AtCoder/abc180/a.cpp | a46fc38ace48c0b105aa1b4ed0448f8add4e0e45 | [] | no_license | KL-Lru/Competitive-Programming | 35131245d630e7b8728e2707066dc871e6363230 | d9395043ea439c68bcbdd1ed52fe080444dcc140 | refs/heads/master | 2021-06-18T03:17:16.583231 | 2021-04-05T14:09:00 | 2021-04-05T14:09:00 | 193,652,887 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 123 | cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,b;
cin >> n >> a >> b;
cout << n - a + b << endl;
} | [
"kilattoeruru@outlook.jp"
] | kilattoeruru@outlook.jp |
4f5114d356fbb38ccf5b5776041f39dea9785ae4 | db54c07d92e507a66ecac37c442e45330350c4f3 | /PROItheGame/PROItheGame/Player.cpp | 639b763b2b314fdd7bd4372250e822ade79fbeb5 | [] | no_license | psatala/PROItheGame | 248644dd27d6650ce31d42ba66a3aeb16853cedd | 67b94ceb4448e8d1b9ab56bf151c68c35bbed918 | refs/heads/master | 2020-05-07T18:56:15.948439 | 2020-01-31T10:58:04 | 2020-01-31T10:58:04 | 180,789,170 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,807 | cpp | ///Name: Player.h
///Purpose: definition of functions responsible for handling the actions of the player
///Author: Piotr Satala
#include "Player.h"
//private methods
bool Player::checkIfInsideAny(std::vector <GameObject*> myVector)
{
bool result = false;
for (std::vector <GameObject*>::iterator it = myVector.begin(); it != myVector.end(); ++it)
result |= checkIfInsideOneObject(*it);
return result;
}
bool Player::checkIfInsideOneObject(GameObject* someObject)
{
if (this == someObject) return false; //not checking if the player is inside himself
return xCoordinate + objectWidth > someObject->getXCoordinate() && xCoordinate < someObject->getXCoordinate() + someObject->getObjectWidth()
&& yCoordinate + objectHeight > someObject->getYCoordinate() && yCoordinate < someObject->getYCoordinate() + someObject->getObjectHeight();
}
//protected methods
void Player::jump()
{
if(gravityConstant >= 0 && contact[DOWN] || gravityConstant < 0 && contact[UP])
playerMomentum.setYVelocity(yConstant);
}
void Player::moveRight()
{
playerMomentum.setXVelocity(xConstant);
}
void Player::moveLeft()
{
playerMomentum.setXVelocity(-xConstant);
}
void Player::stopX()
{
playerMomentum.setXVelocity(0);
}
void Player::teleport(Direction dir, std::vector<GameObject*> myVector)
{
Uint32 now = SDL_GetTicks();
if (now - lastTeleportTime >= timeBetweenTeleports || 0 == lastTeleportTime)
{
//auxiliary arrays
int x[] = { 0, 0, -1, 1 };
int y[] = { -1, 1, 0, 0 };
//teleporting
xCoordinate += x[(int)dir] * teleportDistance;
yCoordinate += y[(int)dir] * teleportDistance;
if (checkIfInsideAny(myVector)) //reversing teleport in case player is inside an object
{
xCoordinate -= x[(int)dir] * teleportDistance;
yCoordinate -= y[(int)dir] * teleportDistance;
}
else //updating timer
lastTeleportTime = now;
}
}
//public methods
void Player::calculateNextPosition(const double timeDifference)
{
//updating vertical velocity
if((playerMomentum.getGForce() > 0 && !contact[DOWN]) || (playerMomentum.getGForce() < 0 && !contact[UP]))
playerMomentum.setYVelocity(playerMomentum.getYVelocity() + playerMomentum.getGForce() * timeDifference);
//updating vertical position
yCoordinate += playerMomentum.getYVelocity() * timeDifference;
//updating horizontal position
xCoordinate += playerMomentum.getXVelocity() * timeDifference;
//reseting contact
for (int i = 0; i < 4; i++)
contact[i] = false;
}
void Player::checkCollision(Obstacle* obstacle)
{
if (!isAlive)
return;
bool contactWithThisObject[4] = { 0 };
//check contact up
if (contactWithThisObject[UP] = checkCollisionSide(obstacle, UP))
{
getPlayerMomentum()->setYVelocity(0);
yCoordinate = round(obstacle->getYCoordinate() + obstacle->getObjectHeight());
}
//check contact down
if (contactWithThisObject[DOWN] = checkCollisionSide(obstacle, DOWN))
{
getPlayerMomentum()->setYVelocity(0);
yCoordinate = round(obstacle->getYCoordinate() - objectHeight);
}
//check contact left
if (contactWithThisObject[LEFT] = checkCollisionSide(obstacle, LEFT))
{
getPlayerMomentum()->setXVelocity(0);
xCoordinate = round(obstacle->getXCoordinate() + obstacle->getObjectWidth());
}
//check contact right
if (contactWithThisObject[RIGHT] = checkCollisionSide(obstacle, RIGHT))
{
getPlayerMomentum()->setXVelocity(0);
xCoordinate = round(obstacle->getXCoordinate() - objectWidth);
}
//update overall contact
for (int i = 0; i < 4; i++)
contact[i] |= contactWithThisObject[i];
//check if contact with the obstacle killed the player
for (int i = 0; i < 4; i++)
{
if (contactWithThisObject[i])
{
if (obstacle->getIsItFinish())
hasFinished = true;
else if (obstacle->getCanItKill())
isAlive = false;
}
}
}
| [
"piotr.satala@wp.pl"
] | piotr.satala@wp.pl |
5bf5313acd11e67ca3d8599274fba296501db0cc | 8475de6e798a10e43aea149c55b254435a7ffcd0 | /sys_utils.cpp | 953c8d92e1874f038372d95ac40b1fd7b85e7206 | [] | no_license | dimorlus/TC66 | f493a9545dfc4bfec88ae91dfac2b1cae84451e1 | 8493e9146447f4e2d2bb0f1405d8f838348ff724 | refs/heads/main | 2023-07-09T10:51:56.177721 | 2021-08-23T08:00:58 | 2021-08-23T08:00:58 | 391,590,792 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,497 | cpp | //---------------------------------------------------------------------------
#include <windows.h>
#pragma hdrstop
#include "sys_utils.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
int GetMainMenuHeight(void)
{
NONCLIENTMETRICS Rec;
Rec.cbSize = sizeof(Rec);
if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, Rec.cbSize, &Rec.cbSize, 0))
return Rec.iMenuHeight;
else return -1;
}
//---------------------------------------------------------------------------
int GetScroolBarHeight(void)
{
NONCLIENTMETRICS Rec;
Rec.cbSize = sizeof(Rec);
if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, Rec.cbSize, &Rec.cbSize, 0))
return Rec.iScrollHeight;
else return -1;
}
//---------------------------------------------------------------------------
int GetScroolBarWidth(void)
{
NONCLIENTMETRICS Rec;
Rec.cbSize = sizeof(Rec);
if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, Rec.cbSize, &Rec.cbSize, 0))
return Rec.iCaptionWidth;
else return -1;
}
//---------------------------------------------------------------------------
int GetCaptionHeight(void)
{
NONCLIENTMETRICS Rec;
Rec.cbSize = sizeof(Rec);
if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, Rec.cbSize, &Rec.cbSize, 0))
return Rec.iCaptionHeight;
else return -1;
}
//---------------------------------------------------------------------------
/*
- In TcxGridDBTableView you can set the scrollbars property to say what
scrollbars you want
- How do you determine if a scrollbar is actually visible? I cannot
seem to find a property/method that will tell me this. I also tried:
function ScrollBar_Exists(const AWindowHandle : HWnd) : TScrollStyle;
var
dwStyleFlags : DWORD;
begin
dwStyleFlags := GetWindowLong(AWindowHandle, GWL_STYLE) and
(WS_VSCROLL or WS_HSCROLL);
case dwStyleFlags of
0 : result := ssNone;
WS_VSCROLL : result := ssVertical;
WS_HSCROLL : result := ssHorizontal;
else
result := ssBoth;
end;
end;
passing the handle of the grid, but even when the scrollbar was visible
the above function returned ssNone.
*/
//TScrollStyle ScrollBar_Exists(HWnd AWindowHandle)
bool VScrollBar_Exists(HWND AWindowHandle)
{
return GetWindowLong(AWindowHandle, GWL_STYLE) & WS_VSCROLL;
}
bool HScrollBar_Exists(HWND AWindowHandle)
{
return GetWindowLong(AWindowHandle, GWL_STYLE) & WS_HSCROLL;
}
| [
"dimorlus@gmail.com"
] | dimorlus@gmail.com |
1a20a22f06ded9a9cc7b39403401df6e4a416fcc | 5cbb7a94f5470f5107ed5dfb386c4bd59050200c | /code/sln/LiangZhu/src/common/file_pool.cpp | f8e74545fc4da13de8111f61fd01e10c6ff4f025 | [] | no_license | hill9932/OpenTaker | d339e03029b28e907eb3351e82071d09cc31715a | 3b497a4fbf86248cf8bb717c6a4e495172e5e287 | refs/heads/master | 2021-01-25T07:18:45.690675 | 2015-06-15T14:51:12 | 2015-06-15T14:51:12 | 27,569,793 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,576 | cpp | #include "file_pool.h"
#define ADD_TASK(task) m_filePool->m_threadPool.addTask(task);
/*
CFilePool::WriteCompleteCallback CFilePool::s_write_callback;
CFilePool::ReadCompleteCallback CFilePool::s_read_callback;
CFilePool::ErrorCallback CFilePool::s_error_callback;
*/
namespace LiangZhu
{
CFilePool::CFilePool(int _blockNum, int _threadNum, void* _context)
: m_threadPool(MyMin(_threadNum, 20))
, m_IOContextPool(MyMax(_blockNum, 1024))
{
m_readCallback = boost::bind(&CFilePool::onDataRead, this, _1, _2, _3);
m_writeCallback = boost::bind(&CFilePool::onDataWritten, this, _1, _2, _3);
m_errorCallback = boost::bind(&CFilePool::onError, this, _1, _2, _3);
m_context = _context;
m_isStop = false;
m_aioCallback = NULL;
}
CFilePool::~CFilePool()
{
stop();
}
int CFilePool::start(ICallable* _handler)
{
ICallable* task = NULL;
for (int i = 0; i < m_threadPool.getThreadNum(); i++)
{
task = _handler ? _handler : new IoHandler(this);
m_threadPool.addTask(task);
}
return 0;
}
int CFilePool::stop()
{
m_isStop = true;
m_threadPool.stop();
for (int i = 0; i < MyMax(m_threadPool.getThreadNum() * 2, 2); i++)
{
#ifdef WIN32
PostQueuedCompletionStatus(m_IOService.m_aioHandler, 0, NULL, NULL);
#else
//raise(SIGUSR1);
#endif
}
return 0;
}
void CFilePool::wait()
{
m_threadPool.join_all();
}
int CFilePool::attach(handle_t _fileHandle, void* _context, u_int32 _flag)
{
Aio_t h = m_IOService.assoicateObject(_fileHandle, _context, _flag);
int rv = -1;
if (h == NULL)
{
rv = GetLastSysError();
LOG_ERROR_MSG(0);
}
else
{
rv = 0;
}
return rv;
}
int CFilePool::attach(CHFile& _file, void* _context, u_int32 _flag)
{
return attach((handle_t)_file, _context, _flag);
}
int CFilePool::onDataRead(void* _handler, PPER_FILEIO_INFO_t _io_context, u_int32 _bytes_count)
{
return 0;
}
int CFilePool::onDataWritten(void* _handler, PPER_FILEIO_INFO_t _io_context, u_int32 _bytes_count)
{
return 0;
}
int CFilePool::onError(void* _handler, PPER_FILEIO_INFO_t _io_context, int _error_code)
{
return 0;
}
#ifdef WIN32
#include "file_pool_win32.hxx"
#else
#include "file_pool_linux.hxx"
#endif
}
| [
"hill9932@gmail.com"
] | hill9932@gmail.com |
e9e814a0d0fb46b88096a75b6978d94a9d959c1a | e90bb6a20665f2b875e047f12bd05839c2396c5d | /blasius_laminar_github/9.7/uniform/functionObjects/functionObjectProperties | 1a203a875a972a7f47babcfb9e094a1cce7e4743 | [] | no_license | fluidko/laminar_BL_OpenFOAM | 5dabd283090720211ef819367bd92109df068105 | c3e0bf11355d723ed47a3712e121d48edb4e8c92 | refs/heads/master | 2023-03-16T14:30:33.059718 | 2020-06-16T01:59:58 | 2020-06-16T01:59:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 897 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "9.7/uniform/functionObjects";
object functionObjectProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //
| [
"tong011@e.ntu.edu.sg"
] | tong011@e.ntu.edu.sg | |
c96fdac6cc49eb2258053133d21ce0a89abc925c | 7890e727f391539ae5f8bf0219bc06841d83443a | /include/lxgui/gui_text.hpp | ca5188bee4026de28449754875253ee2f74e811c | [
"MIT"
] | permissive | dreamplayer-zhang/lxgui | 9424d7e65a2208294d8157ff5a886e24961a667d | 3128a25482ea189a5513c36f6261044d63f7bd4c | refs/heads/master | 2022-11-01T06:51:34.974005 | 2020-06-17T19:19:39 | 2020-06-17T19:19:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,416 | hpp | #ifndef GUI_TEXT_HPP
#define GUI_TEXT_HPP
#include <lxgui/utils.hpp>
#include "lxgui/gui_color.hpp"
#include "lxgui/gui_quad2.hpp"
#include "lxgui/gui_font.hpp"
#include "lxgui/gui_sprite.hpp"
#include <lxgui/utils_string.hpp>
#include <lxgui/utils_refptr.hpp>
#include <map>
#include <array>
namespace lxgui {
namespace gui
{
class manager;
class sprite;
struct vertex;
/// Used to draw some text on the screen
/**
*/
class text
{
public :
/// Contains a string that will be drawn on a line
struct line
{
utils::ustring sCaption;
float fWidth = 0.0f;
};
enum class color_action
{
NONE,
SET,
RESET
};
/// Contains information about the text at a given position
struct format
{
color mColor = color::WHITE;
color_action mColorAction = color_action::NONE;
};
enum class alignment
{
LEFT,
CENTER,
RIGHT
};
enum class vertical_alignment
{
TOP,
MIDDLE,
BOTTOM
};
/// Holds the position, tex. coordinates and color of a character.
struct letter
{
quad2f mQuad;
quad2f mUVs;
color mColor = color::WHITE;
bool bNoRender = false;
};
/// Constructor.
/** \param sFileName The path to the .ttf file to use
* \param fSize The size of the font (in point)
*/
text(manager* pManager, const std::string& sFileName, float fSize);
/// Returns the path to the .ttf file.
/** \return The path to the .ttf file
*/
const std::string& get_font_name() const;
/// Returns the size of the font.
/** \return The size of the font
*/
float get_font_size() const;
/// Returns the height of one line (constant).
/** \return The height of one line (constant)
*/
float get_line_height() const;
/// Sets the text to render.
/** \param sText The text to render
* \note This text can be formated :<br>
* - "|cAARRGGBB" : sets text color (hexadecimal).<br>
* - "|r" : sets text color to default.<br>
* - "||" : writes "|".
*/
void set_text(const std::string& sText);
/// Returns the text that will be rendered.
/** \return The text that will be rendered
* \note This string contains format tags.
*/
const std::string& get_text() const;
/// Returns the text that will be rendered (unicode character set).
/** \return The text that will be rendered (unicode character set)
* \note This string contains format tags.
*/
const utils::ustring& get_unicode_text() const;
/// Sets this text's default color.
/** \param mColor The default color
* \param bForceColor 'true' to ignore color tags
*/
void set_color(const color& mColor, bool bForceColor = false);
/// Returns this text's default color.
/** \return This text's default color
*/
const color& get_color() const;
/// Sets the dimensions of the text box.
/** \param fW The new witdh
* \param fH The new height
* \note To remove the text box, use 0.0f.
*/
void set_dimensions(float fW, float fH);
/// Sets the width of the text box.
/** \param fBoxW The new witdh
* \note To remove it, use 0.0f.
*/
void set_box_width(float fBoxW);
/// Sets the height of the text box.
/** \param fBoxH The new height
* \note To remove it, use 0.0f.
*/
void set_box_height(float fBoxH);
/// Returns the width of the rendered text.
/** \return The width of the rendered text
* \note Takes the text box into account if any.
*/
float get_width();
/// Returns the height of the rendered text.
/** \return The height of the rendered text
* \note Takes the text box into account if any.
*/
float get_height();
/// Returns the width of the text box.
/** \return The width of the text box
*/
float get_box_width() const;
/// Returns the height of the text box.
/** \return The height of the text box
*/
float get_box_height() const;
/// Returns the length of the text.
/** \return The length of the text
* \note Ignores the text box, but not manual line jumps.
*/
float get_text_width() const;
/// Returns the number of text lines.
/** \return The number of text lines
*/
uint get_num_lines() const;
/// Returns the lenght of a provided string.
/** \param sString The string to measure
* \return The lenght of the provided string
*/
float get_string_width(const std::string& sString) const;
/// Returns the lenght of a provided string.
/** \param sString The string to measure
* \return The lenght of the provided string
*/
float get_string_width(const utils::ustring& sString) const;
/// Returns the length of a single character.
/** \param uiChar The character to measure
* \return The lenght of this character
*/
float get_character_width(char32_t uiChar) const;
/// Returns the kerning between two characters.
/** \param uiChar1 The first character
* \param uiChar2 The second character
* \return The kerning between two characters
* \note Kerning is a letter spacing adjustment that makes the
* text look more condensed : is you stick an A near a V,
* you can reduce the space between the two letters, but not
* if you put two Vs side to side.
*/
float get_character_kerning(char32_t uiChar1, char32_t uiChar2) const;
/// Returns the height of the text.
/** \return The height of one text
* \note Ignores the text box, but not manual line jumps.
*/
float get_text_height() const;
/// Sets text alignment.
/** \param mAlign The new alignment
*/
void set_alignment(const alignment& mAlign);
/// Sets text vertical alignment.
/** \param mVertAlign The new vertical alignment
*/
void set_vertical_alignment(const vertical_alignment& mVertAlign);
/// Returns the text aligment.
/** \return The text alignment
*/
const alignment& get_alignment() const;
/// Returns the text aligment.
/** \return The text alignment
*/
const vertical_alignment& get_vertical_alignment() const;
/// Sets this text's tracking.
/** \param fTracking The new tracking
* \note Tracking is the space between each character. Default
* is 0.
*/
void set_tracking(float fTracking);
/// Returns this text's tracking.
/** \return This text's tracking
*/
float get_tracking() const;
/// Sets this text's line spacing.
/** \param fLineSpacing The new line spacing
* \note Line spacing is a coefficient that, multiplied by the
* height of a line, gives the space between two lines.
* Default is 1.5f.
*/
void set_line_spacing(float fLineSpacing);
/// Returns this text's line spacing.
/** \return This text's line spacing
*/
float get_line_spacing() const;
/// Allows removal of a line's starting spaces.
/** \param bRemoveStartingSpaces 'true' to remove them
* \note The text box does word wrapping : it cuts too long
* lines only between words. But sometimes, the rendered
* text must be cut between several spaces. By default,
* the algorithm puts cuted spaces at the beginning of
* the next line. You can change this behavior by setting
* this function to 'true'.
*/
void set_remove_starting_spaces(bool bRemoveStartingSpaces);
/// Checks if starting spaces removing is active.
/** \return 'true' if starting spaces removing is active
*/
bool get_remove_starting_spaces() const;
/// Allows word wrap when the line is too long for the text box.
/** \param bWrap 'true' to enable word wrap
* \param bAddEllipsis 'true' to put "..." at the end of a truncated line
* \note Enabled by default.
*/
void enable_word_wrap(bool bWrap, bool bAddEllipsis);
/// Checks if word wrap is enabled.
/** \return 'true' if word wrap is enabled
*/
bool is_word_wrap_enabled() const;
/// Enables color formatting.
/** \param bFormatting 'true' to enable color formatting
* \note Enabled by default.
* \note - "|cAARRGGBB" : sets text color (hexadecimal).<br>
* - "|r" : sets text color to default.<br>
* - "||" : writes "|".
*/
void enable_formatting(bool bFormatting);
/// Renders this text at the given position.
/** \param fX The horizontal position of the top left corner
* \param fY The vertical position of the top left corner
* \note Must be called between spriteManager::begin() and
* spriteManager::end().
*/
void render(float fX, float fY);
/// updates this text's cache.
/** \note Automatically done by render().<br>
* Only use this method if you need it to
* be Updated sooner.
*/
void update();
/// Returns the cached letters (position, size, texture coordinates)
/** \return The cached letters
* \note updates the letter cache if needed.
*/
const std::vector<letter>& get_letter_cache();
/// Creates a sprite that contains the provided character.
/** \param uiChar The character to draw
* \note Uses this text's font texture.
*/
sprite create_sprite(char32_t uiChar) const;
private :
void update_lines_();
void update_cache_();
manager* pManager_ = nullptr;
std::string sFileName_;
bool bReady_ = false;
float fSize_ = 0.0f;
float fTracking_ = 0.0f;
float fLineSpacing_ = 1.5f;
float fSpaceWidth_ = 0.0f;
bool bRemoveStartingSpaces_ = false;
bool bWordWrap_ = true;
bool bAddEllipsis_ = false;
color mColor_ = color::WHITE;
bool bForceColor_ = false;
bool bFormattingEnabled_ = false;
float fW_ = 0.0f, fH_ = 0.0f;
float fX_ = std::numeric_limits<float>::infinity();
float fY_ = std::numeric_limits<float>::infinity();
float fBoxW_ = std::numeric_limits<float>::infinity();
float fBoxH_ = std::numeric_limits<float>::infinity();
std::string sText_;
utils::ustring sUnicodeText_;
alignment mAlign_ = alignment::LEFT;
vertical_alignment mVertAlign_ = vertical_alignment::MIDDLE;
std::vector<line> lLineList_;
std::map<uint, format> lFormatList_;
bool bUpdateCache_ = false;
std::vector<letter> lLetterCache_;
bool bUpdateQuads_ = false;
std::vector<std::array<vertex,4>> lQuadList_;
sprite mSprite_;
utils::refptr<font> pFont_;
};
}
}
#endif
| [
"cschreib@orange.fr"
] | cschreib@orange.fr |
59960c8f96c13980c20b4758941d2a852a1a0838 | f338eb32c45d8d5d002a84798a7df7bb0403b3c4 | /PhysicsTools/PatAlgos/interface/KinResolutionsLoader.h | b1e628c5df9ae2d67ac880a041ccb47e4c18a8d0 | [] | permissive | wouf/cmssw | 0a8a8016e6bebc611f1277379e12bef130464afb | 60da16aec83a0fc016cca9e2a5ed0768ba3b161c | refs/heads/CMSSW_7_3_X | 2022-06-30T04:35:45.380754 | 2015-05-08T17:40:17 | 2015-05-08T17:40:17 | 463,028,972 | 0 | 0 | Apache-2.0 | 2022-02-24T06:05:30 | 2022-02-24T06:05:26 | null | UTF-8 | C++ | false | false | 2,062 | h | #ifndef PhysicsTools_PatAlgos_KinResolutionsLoader_h
#define PhysicsTools_PatAlgos_KinResolutionsLoader_h
#include "DataFormats/PatCandidates/interface/PATObject.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "PhysicsTools/PatAlgos/interface/KinematicResolutionProvider.h"
namespace pat { namespace helper {
class KinResolutionsLoader {
public:
/// Empty constructor
KinResolutionsLoader() {}
/// Constructor from a PSet
KinResolutionsLoader(const edm::ParameterSet &iConfig) ;
/// 'true' if this there is at least one efficiency configured
bool enabled() const { return !patlabels_.empty(); }
/// To be called for each new event, reads in the EventSetup object
void newEvent(const edm::Event &event, const edm::EventSetup &setup) const ;
/// Sets the efficiencies for this object, using the reference to the original objects
template<typename T>
void setResolutions( pat::PATObject<T> &obj ) const ;
/// Method for documentation and validation of PSet
static void fillDescription(edm::ParameterSetDescription & iDesc);
private:
/// Labels of the resolutions in PAT
std::vector<std::string> patlabels_;
/// Labels of the KinematicResolutionProvider in the EventSetup
std::vector<std::string> eslabels_;
/// Handles to the EventSetup
mutable std::vector<edm::ESHandle<KinematicResolutionProvider> > handles_;
}; // class
template<typename T>
void
KinResolutionsLoader::setResolutions( pat::PATObject<T> &obj ) const
{
for (size_t i = 0, n = patlabels_.size(); i < n; ++i) {
obj.setKinResolution( handles_[i]->getResolution(obj), patlabels_[i]);
}
}
} }
#endif
| [
"giulio.eulisse@gmail.com"
] | giulio.eulisse@gmail.com |
c8e34a7991cc26af7edf436c327ea829bc3b1d45 | 1de0c7d83d27cbc9af013c29605331bfdf1a363b | /src/ptIndexer.cc | 4afbbec336caf6f3ce783ac35b94d22fa1bbc5f3 | [] | no_license | dacongy/pestrie | 0a763d86b2c2985827c1449de92868f272426d01 | 8c1a05ba264c69e3428141bb8830d5e586a06e43 | refs/heads/master | 2021-01-22T09:47:36.613253 | 2014-03-29T12:28:09 | 2014-03-29T12:28:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,924 | cc | /*
* An implementation of William Weihl's algorithm presented in his POPL81 paper for equivalent sets detection.
* Alias matrix is computed by sets intersection, which is fairly fast in practice.
* Modified by richardxx, 2009.9
*/
#include "options.h"
#include "profile_helper.h"
struct hash_node
{
int idx;
struct hash_node *next;
};
struct hash_node **HT;
bitmap *ptm, *alm; // points-to matrix and alias matrix
int *es_map, *renum; // equivalent set mapping and renumbering for alias matrix
int n_es;
int hash_size;
int edge_num;
void input()
{
int i, k;
int t;
FILE *fp;
fp = fopen( input_file, "r" );
if ( fp == NULL ) return;
fscanf( fp, "%d %d", &n, &m );
ptm = new bitmap[n];
for ( i = 0; i < n; ++i )
ptm[i] = BITMAP_ALLOC(NULL);
if ( input_format == 0 ) {
for ( i = 0; i < n; ++i ) {
fscanf( fp, "%d", &k );
edge_num += k;
while ( k > 0 ) {
fscanf( fp, "%d", &t );
bitmap_set_bit( ptm[i], t );
k--;
}
}
}
else {
for ( i = 0; i < n; ++i ) {
while (1) {
fscanf( fp, "%d", &t );
if ( t == -1 ) break;
bitmap_set_bit( ptm[i], t );
edge_num++;
}
}
}
fclose( fp );
fprintf( stderr, "\n------------Input:%s---------\n", input_file );
show_res_use( "Input" );
}
void estimate_index_size()
{
double intsize;
double mem;
int labels;
//intsize = (sizeof(int)*8 - __builtin_clz(n)) * 1.0 / 8;
intsize = sizeof(int);
// The mapping vector
mem = n * intsize;
mem += bitmap_calculate_memory( ptm, n );
mem += bitmap_calculate_memory( alm, n_es );
labels = n;
labels += bitmap_calculate_labels( ptm, n );
labels += bitmap_calculate_labels( alm, n_es );
fprintf( stderr, "\n" );
fprintf( stderr, "Index labels: %d\n", labels );
fprintf( stderr, "The bitmap compressed index size is roughly : %.0lfKb\n", mem / 1024 );
fprintf( stderr, "The uncompressed index size is : %.0lfKb\n", labels * intsize / 1024 );
}
// Equivalent Sets Identification
void make_points_to_index()
{
int i;
hashval_t hv;
struct hash_node *p, *q;
int s;
es_map = new int[n];
// Determine the suitable hash size
for ( i = 0; i < N_PRIMES; ++i )
if ( primes[i] * 5 >= n ) break;
if ( i == N_PRIMES ) i--;
hash_size = primes[i];
HT = new hash_node*[hash_size];
memset( HT, 0, sizeof(void*) * hash_size );
for ( i = 0; i < n; ++i ) {
hv = bitmap_hash( ptm[i] ) % hash_size;
p = HT[hv];
while ( p ) {
if ( bitmap_equal_p( ptm[i], ptm[ p->idx ] ) ) break;
p = p -> next;
}
if ( p ) {
// Found identical set
es_map[i] = p -> idx;
BITMAP_FREE( ptm[i] );
continue;
}
es_map[i] = i;
p = new hash_node();
p -> idx = i;
p -> next = HT[hv];
HT[hv] = p;
++n_es;
}
fprintf( stderr, "\n--------------Indexing------------\n" );
show_res_use( "Indexing" );
fprintf( stderr, "\n" );
fprintf( stderr, "Nodes = %d, Edges = %d, Equivalent Sets = %d\n", n, edge_num, n_es );
}
void make_alias_matrix()
{
int i, j, k;
int s, t;
int *holder;
int alias_num;
renum = new int[n];
holder = new int[n];
for ( i = k = 0; i < n; ++i )
if ( es_map[i] == i ) {
renum[i] = k;
holder[k] = i;
++k;
}
alm = new bitmap[k];
alias_num = 0;
for ( i = 0; i < k; ++i )
alm[i] = BITMAP_ALLOC(NULL);
for ( i = 0; i < k; ++i ) {
s = holder[i];
for ( j = i + 1; j < k; ++j ) {
t = holder[j];
if ( bitmap_same_bit_p( ptm[s], ptm[t] ) ) {
bitmap_set_bit( alm[i], j );
//bitmap_set_bit( alm[j], i );
++alias_num;
}
}
}
fprintf( stderr, "\n---------------Make Alias Matrix-----------------\n" );
show_res_use( "Alias Matrix" );
//fprintf( stderr, "\n" );
fprintf( stderr, "Alias Pairs: %d\n", alias_num );
}
/*
* Output format:
* Points-to and Alias Matrix:
*
* N_p (pointers) N_o(objects)
* Pointer representative map (N_p)
*
* First the points-to matrix is given:
* k(points-to size) o1 o2 ... ok
*
* Then, the alias-to matrix:
* k(alias-to size) p1 p2 p3 ... pk
*/
void externalize_uncompressed_index()
{
int i, k;
unsigned j;
bitmap_iterator bi;
FILE *fp = NULL;
if ( output_file == NULL )
return;
fp = fopen( output_file, "wb" );
if ( fp == NULL ) {
fprintf( stderr, "Cannot write to the file: %s\n", output_file );
return;
}
// Write magic number
fwrite( "PTS1", sizeof(char), 4, fp );
// Write N_p
fwrite( &n, sizeof(int), 1, fp );
// Write N_o
fwrite( &m, sizeof(int), 1, fp );
// Write the pointer representatitives
fwrite( es_map, sizeof(int), n, fp );
// Write the points-to matrix
for ( i = 0; i < n; ++i ) {
if ( ptm[i] == NULL ) continue;
// output number of blocks for this bitmap
k = bitmap_count_bits( ptm[i] );
fwrite( &k, sizeof(int), 1, fp );
EXECUTE_IF_SET_IN_BITMAP( ptm[i], 0, j, bi ) {
fwrite( &j, sizeof(int), 1, fp );
}
}
// Write the alias-to matrix
for ( i = 0; i < n_es; ++i ) {
if ( alm[i] == NULL ) continue;
k = bitmap_count_bits( alm[i] );
fwrite( &k, sizeof(int), 1, fp );
EXECUTE_IF_SET_IN_BITMAP( alm[i], 0, j, bi ) {
fwrite( &j, sizeof(int), 1, fp );
}
}
fclose( fp );
}
/*
* Output format:
* Points-to and Alias Matrix:
*
* N_p (pointers) N_o(objects)
* Pointer representative map (N_p)
*
* First the points-to matrix is given:
* k(#blocks) b1(indx, data) b2 ... bk
*
* Then, the alias-to matrix:
* k(#blocks) b1 b2 ... bk
*/
void externalize_compressed_index()
{
int i, k;
unsigned j;
bitmap_iterator bi;
FILE *fp = NULL;
if ( output_file == NULL )
return;
fp = fopen( output_file, "wb" );
if ( fp == NULL ) {
fprintf( stderr, "Cannot write to the file: %s\n", output_file );
return;
}
// Write magic number
fwrite( "PTS2", sizeof(char), 4, fp );
// Write N_p
fwrite( &n, sizeof(int), 1, fp );
// Write N_o
fwrite( &m, sizeof(int), 1, fp );
// Write the pointer representatitives
fwrite( es_map, sizeof(int), n, fp );
// Write the points-to matrix
for ( i = 0; i < n; ++i ) {
if ( ptm[i] == NULL ) continue;
bitmap_write_out( ptm[i], fp );
}
// Write the alias-to matrix
for ( i = 0; i < n_es; ++i ) {
if ( alm[i] == NULL ) continue;
bitmap_write_out( alm[i], fp );
}
fclose( fp );
}
int answer_query( int x, int y )
{
x = es_map[x];
y = es_map[y];
return x != y ? bitmap_same_bit_p( ptm[x], ptm[y] ) : 1;
}
int main( int argc, char **argv )
{
//fprintf( stderr, "B = %d\n",BLOCK_SIZE );
if ( parse_options( argc, argv ) == 0 ) return -1;
bitmap_obstack_initialize(NULL);
input();
make_points_to_index();
make_alias_matrix();
estimate_index_size();
if ( output_format == 0 )
externalize_compressed_index();
else
externalize_uncompressed_index();
return 0;
}
| [
"frogxx@gmail.com"
] | frogxx@gmail.com |
5e7f8c14e060ad696e00ef5b185b528b18fb1343 | 3f35a65234956571dbc70b2afa0a7615d86080ef | /Hook/CreateAppWindow/stdafx.cpp | a8bb111291e54d75c80fcfb244dad869519c72f5 | [
"MIT"
] | permissive | edetoc/samples | 2843a7cbc1b2115d5d52e2ca0ce6a5effdff0389 | 5f24d304065c39e787c15d2ff6fcfae1d5ad2f83 | refs/heads/master | 2023-08-17T08:49:01.909947 | 2022-02-10T08:47:16 | 2022-02-10T08:47:16 | 196,325,112 | 2 | 0 | MIT | 2023-07-22T10:33:51 | 2019-07-11T05:24:47 | C# | UTF-8 | C++ | false | false | 294 | cpp | // stdafx.cpp : source file that includes just the standard includes
// CreateAppWindow.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
| [
"e_detoc@hotmail.com"
] | e_detoc@hotmail.com |
0616a810e6278395677de4fb0eeb99dfc1e5e42c | 6f28c1657ad31c5c615fb4a7539cb909f505fa57 | /trunk/Source/Managers/Component Managers/CLevelManager.h | 315600f72908461b0039a47d86b63b3fbafb65db | [] | no_license | BGCX067/falconfish-scd-svn-to-git | e094adcc2e9a922ba986ec367c101d489ab916ce | f4f9993dbbf4ac908f036e4bcd23b6710fe6b6bd | refs/heads/master | 2021-01-13T00:56:29.780363 | 2015-12-28T14:36:25 | 2015-12-28T14:36:25 | 48,872,900 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,484 | h | /*******************************************************************************
* Filename: CLevelManager.h
* Date: 04/09/2011
* Mod. Date: 04/16/2011
* Mod. Initials: JS
* Author: Jesse A. Stanciu
* Purpose: This manager will be used to
* spawn items on the level and
* cycle through them.
******************************************************************************/
#ifndef _CLEVELMANAGER_H_
#define _CLEVELMANAGER_H_
#include <D3dx9math.h>
#include <list>
using std::list;
extern "C"
{
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}
#include "..\Global Managers\Memory Manager\CAllocator.h"
class CEventManager;
class IEvent;
class IComponent;
class CObject;
class CRenderComponent;
class CLevelManager
{
public:
struct CNode
{
char szName[64];
D3DXMATRIX tLocalMatrix;
D3DXMATRIX tWorldMatrix;
};
private:
list<CRenderComponent*, CAllocator<CRenderComponent*>> m_cLevelRenderComps;
list<CRenderComponent*, CAllocator<CRenderComponent*>> m_cLevelCollisionRenderComps;
int m_objectcount;
bool m_bDrawCollision;
bool m_bDrawGeometry;
CNode* m_levelNodes;
CNode* m_shadowNodes;
CNode m_pCheckoutNode;
// Constructor
CLevelManager();
/////////////////////
// Trilogy of Evil //
/////////////////////
~CLevelManager();
CLevelManager(const CLevelManager&) {}
CLevelManager& operator=(const CLevelManager&) {}
void BuildLevel(char* szNodeMap);
void DrawCollision();
void DrawGeometry();
bool GetDrawCollision() { return m_bDrawCollision; }
bool GetDrawGeometry() { return m_bDrawGeometry; }
void FindAndCreateShadow(CObject* pParentObj, ERenderContext eObjRenContext);
void BuildShadows(char* szNodeMap);
public:
static CLevelManager* GetInstance()
{
static CLevelManager cLevelManager;
return &cLevelManager;
}
void Init();
static void Shutdown(IEvent*, IComponent*);
static void Update(IEvent*, IComponent*);
static void Level1SelectedCallback(IEvent*, IComponent*);
static int ToggleCollisionVision(lua_State* ptr);
static int ToggleGeometryVision(lua_State* ptr);
void AddRenderCollision(CRenderComponent* pRC);
inline CNode* GetLevelNodes()
{
return m_levelNodes;
}
inline int GetNumNodes()
{
return m_objectcount;
}
inline CNode* GetCheckoutNode()
{
return &m_pCheckoutNode;
}
void LoadLocations();
// Mutators
};
#endif | [
"you@example.com"
] | you@example.com |
a33a7b2b5f7cd5bd865f90ec9a2c1f0bd4318487 | aff4f6f1c5eb5c726e08b134885ba2b100156c99 | /RVAF-GUI/teechart/mappolygonlist.h | 6e5e45b9f6167da3d083c6d63c6deca6867b2891 | [
"BSD-2-Clause"
] | permissive | YangQun1/RVAF-GUI | 67fc46a4d1e64208072968a0122c81b8cb70ef1c | f187e2325fc8fdbac84a63515b7dd67c09e2fc72 | refs/heads/master | 2020-03-08T02:52:36.102203 | 2018-04-22T05:13:04 | 2018-04-22T05:13:04 | 127,873,180 | 0 | 0 | BSD-2-Clause | 2018-04-22T05:13:05 | 2018-04-03T08:05:51 | C++ | UTF-8 | C++ | false | false | 857 | h | // Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
// NOTE: Do not modify the contents of this file. If this class is regenerated by
// Microsoft Visual C++, your modifications will be overwritten.
// Dispatch interfaces referenced by this interface
class CMapPolygon;
/////////////////////////////////////////////////////////////////////////////
// CMapPolygonList wrapper class
class CMapPolygonList : public COleDispatchDriver
{
public:
CMapPolygonList() {} // Calls COleDispatchDriver default constructor
CMapPolygonList(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
CMapPolygonList(const CMapPolygonList& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
long Add();
CMapPolygon GetPolygon(long Index);
long GetCount();
};
| [
"1377318286@qq.com"
] | 1377318286@qq.com |
90a3eb78e2b24687327f41078483db6bbb3a9f28 | 279ebe8663cae0e1fe0e2248e8e89b660eab4ea0 | /src/version.h | 45958f8dce0d659c303e77662760e04097486c93 | [
"MIT"
] | permissive | sysmanalex/SaveCoin | 915c0f5136a51d8d574c0bcb306a16367f24fa71 | f50fb3052dbb8f3823c1443e29a51045ada80bc8 | refs/heads/master | 2021-01-21T00:56:54.004068 | 2014-06-28T16:14:05 | 2014-06-28T16:14:05 | 21,306,291 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,582 | h | // Copyright (c) 2012 The SaveCoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef SaveCoin_VERSION_H
#define SaveCoin_VERSION_H
#include "clientversion.h"
#include <string>
//
// client versioning
//
static const int CLIENT_VERSION =
1000000 * CLIENT_VERSION_MAJOR
+ 10000 * CLIENT_VERSION_MINOR
+ 100 * CLIENT_VERSION_REVISION
+ 1 * CLIENT_VERSION_BUILD;
extern const std::string CLIENT_NAME;
extern const std::string CLIENT_BUILD;
extern const std::string CLIENT_DATE;
//
// network protocol versioning
//
static const int PROTOCOL_VERSION = 70002;
// intial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
// disconnect from peers older than this proto version
static const int MIN_PEER_PROTO_VERSION = 209;
// nTime field added to CAddress, starting with this version;
// if possible, avoid requesting addresses nodes older than this
static const int CADDR_TIME_VERSION = 31402;
// only request blocks from nodes outside this range of versions
static const int NOBLKS_VERSION_START = 32000;
static const int NOBLKS_VERSION_END = 32400;
// BIP 0031, pong message, is enabled for all versions AFTER this one
static const int BIP0031_VERSION = 60000;
// "mempool" command, enhanced "getdata" behavior starts with this version:
static const int MEMPOOL_GD_VERSION = 60002;
#endif
| [
"sureshmatsui@gmail.com"
] | sureshmatsui@gmail.com |
139920045c78b95440a1c49ebcb0141c6d6df693 | a2eec93a6f3fc259c104102c358bc89751a23530 | /UVA/uva-1411(poj-3565).cpp | b458e2f1ea662cc4c8160a58d5611c8209452c7b | [] | no_license | scudrt/Virtual-Judge | 969b04e4bfe165e634165e4619e8eb5d50643ff1 | b2037cea1d54d5ca21637fccc95f9973194911a6 | refs/heads/master | 2020-06-01T23:57:53.360515 | 2020-03-20T08:32:06 | 2020-03-20T08:32:06 | 190,970,916 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,488 | cpp | #include <algorithm>
#include <stdio.h>
#include <cmath>
using namespace std;
#define maxn 101
#define INF (double)0x3f3f3f3f
double lx[maxn],ly[maxn],map[maxn][maxn],slack[maxn],x[2][maxn],y[2][maxn];
int n,m,match[maxn];
bool usedx[maxn],usedy[maxn];
int dfs(int now)
{
usedx[now]=1;
for (int i=1;i<=n;++i)
{
if (usedy[i])
continue;
double temp=lx[now]+ly[i]-map[now][i];
if (temp>=0.0000001)
slack[i]=min(slack[i],temp);
else
{
usedy[i]=1;
if (!match[i] || dfs(match[i]))
{
match[i]=now;
return 1;
}
}
}
return 0;
}
int main()
{
bool first=0;
while (~scanf("%d",&n))
{
if (first)
printf("\n");
else
first=1;
for (int j=1;j<=n;++j)
scanf("%lf%lf",&x[0][j],&y[0][j]);
for (int j=1;j<=n;++j)
{
match[j]=lx[j]=ly[j]=0.0;
scanf("%lf%lf",&x[1][j],&y[1][j]);
}
for (int i=1;i<=n;++i)
for (int j=1;j<=n;++j)
{
double xx=x[0][j]-x[1][i],yy=y[0][j]-y[1][i];
map[i][j]=INF-sqrt(xx*xx+yy*yy);
lx[i]=max(lx[i],map[i][j]);
}
for (int i=1;i<=n;++i)
{
for (int j=1;j<=n;++j)
slack[j]=INF;
while (1)
{
for (int j=1;j<=n;++j)
usedx[j]=usedy[j]=0;
if (dfs(i))
break;
double d=INF;
for (int j=1;j<=n;++j)
if (!usedy[j])
d=min(d,slack[j]);
for (int j=1;j<=n;++j)
{
if (usedx[j])
lx[j]-=d;
if (usedy[j])
ly[j]+=d;
else
slack[j]-=d;
}
}
}
for (int j=1;j<=n;++j)
printf("%d\n",match[j]);
}
return 0;
}
| [
"1208044562@qq.com"
] | 1208044562@qq.com |
95af73707d729932801600d3e94be13ecc3ef77e | 556ef6d02487dad80879d764943af738752cd3ae | /Projeto_1/Etapa_3/include/MainWindow.hpp | 4755ef90341fce2a7f688bbb29e47ca9a31f6045 | [] | no_license | nogenem/UFSC_CG-2015-2 | 94855ad30b16fd7e8fb86cd29f84734009829fe8 | 9f9b826737514f88113ada999fed905623c59884 | refs/heads/master | 2021-05-30T00:24:36.580259 | 2015-12-10T14:28:36 | 2015-12-10T14:28:36 | 41,050,380 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,322 | hpp | #ifndef MAINWINDOW_HPP
#define MAINWINDOW_HPP
#include <gtk/gtk.h>
#include <string>
#include "Viewport.hpp"
#include "Dialogs.hpp"
#include "Objects.hpp"
#include "World.hpp"
#include "FileHandlers.hpp"
#include "MyException.hpp"
#define UI_FILE "window.glade"
enum class Buttons { ZOOM_OUT, ZOOM_IN, UP, RIGHT, DOWN, LEFT, ROT_LEFT, ROT_RIGHT };
class MainWindow
{
public:
MainWindow(GtkBuilder* builder);
virtual ~MainWindow() { delete _world; delete _viewport; }
// Events
void openFile(GtkBuilder* builder);
void saveFile(GtkBuilder* builder);
void addPoint(GtkBuilder* builder);
void addLine(GtkBuilder* builder);
void addPolygon(GtkBuilder* builder);
void zoom(Buttons id);
void move(Buttons id);
void rotateWindow(Buttons id);
void onDraw(cairo_t* cr);
void showPopUp(GdkEvent *event);
void gotoSelectedObj();
void removeSelectedObj();
void translateSelectedObj(GtkBuilder* builder);
void scaleSelectedObj(GtkBuilder* builder);
void rotateSelectedObj(GtkBuilder* builder);
void showHelpDialog();
protected:
private:
GtkWidget* _mainWindow, *_step, *_log, *_popUp, *_logScroll;
GtkWidget *_helpDialog;
GtkTreeModel* _mainModel;
GtkTreeSelection* _treeSelection;
Viewport *_viewport;
World *_world;
// Altera o nome do obj passado como parametro para o
// nome do objeto selecionado e seta o inter para
// apontar para o obj selecionado;
// Retorna TRUE caso tenha algum obj selecionado
bool getSelectedObjName(std::string &name, GtkTreeIter *iter);
void showErrorDialog(const char* msg);
// Escreve no TextView de logs
void log(const char* msg);
// Adiciona os dados de um objeto na ListStore
void addObjOnListStore(const std::string name, const char* type);
};
MainWindow::MainWindow(GtkBuilder* builder) {
GError* error = NULL;
// (char*) usado para tirar warnings do compilador
char* ids[] = {(char*)"main_list_store",(char*)"adj_step",
(char*)"main_window",(char*)"main_pop_up_menu",(char*)"adj_log",
(char*)"dlog_help", NULL};
if(!gtk_builder_add_objects_from_file (GTK_BUILDER(builder), UI_FILE, ids, &error)){
g_warning( "%s", error->message );
g_free( error );
return;
}
_mainWindow = GTK_WIDGET( gtk_builder_get_object( GTK_BUILDER(builder), "main_window" ) );
// Pega o tamanho da area de desenho e manda para o Viewport
// Como a area eh fixa, pode-se pegar o tamanho requisitado
GtkWidget* area = GTK_WIDGET( gtk_builder_get_object( GTK_BUILDER(builder), "drawing_area" ) );
GtkRequisition min_size;
gtk_widget_get_preferred_size(area, &min_size, NULL);
_world = new World();
_viewport = new Viewport(min_size.width, min_size.height, _world);
//_viewport = new Viewport(1000, 1000, _world);
_step = GTK_WIDGET( gtk_builder_get_object( GTK_BUILDER(builder), "entry_step" ) );
// Pega o modelo e a classe de seleção da Treeview
// Eles serão usados para manipular os dados da ListStore (Add/Remove)
GtkTreeView* tree = GTK_TREE_VIEW( gtk_builder_get_object( GTK_BUILDER(builder), "main_treeview" ) );
_mainModel = gtk_tree_view_get_model(tree);
_treeSelection = gtk_tree_view_get_selection(tree);
_popUp = GTK_WIDGET( gtk_builder_get_object( GTK_BUILDER(builder), "main_pop_up_menu" ) );
_log = GTK_WIDGET( gtk_builder_get_object( GTK_BUILDER(builder), "tv_log" ) );
_logScroll = GTK_WIDGET( gtk_builder_get_object( GTK_BUILDER(builder), "log_scroll" ) );
_helpDialog = GTK_WIDGET( gtk_builder_get_object( GTK_BUILDER(builder), "dlog_help" ) );
// Salva o id do botao para poder ser usado depois apenas 1 função
// para manipula-los
g_object_set_data(G_OBJECT(gtk_builder_get_object(GTK_BUILDER(builder), "btn_zoom_out")),
"ID", GINT_TO_POINTER(Buttons::ZOOM_OUT));
g_object_set_data(G_OBJECT(gtk_builder_get_object(GTK_BUILDER(builder), "btn_zoom_in")),
"ID", GINT_TO_POINTER(Buttons::ZOOM_IN));
g_object_set_data(G_OBJECT(gtk_builder_get_object(GTK_BUILDER(builder), "btn_up")),
"ID", GINT_TO_POINTER(Buttons::UP));
g_object_set_data(G_OBJECT(gtk_builder_get_object(GTK_BUILDER(builder), "btn_right")),
"ID", GINT_TO_POINTER(Buttons::RIGHT));
g_object_set_data(G_OBJECT(gtk_builder_get_object(GTK_BUILDER(builder), "btn_down")),
"ID", GINT_TO_POINTER(Buttons::DOWN));
g_object_set_data(G_OBJECT(gtk_builder_get_object(GTK_BUILDER(builder), "btn_left")),
"ID", GINT_TO_POINTER(Buttons::LEFT));
g_object_set_data(G_OBJECT(gtk_builder_get_object(GTK_BUILDER(builder), "btn_rot_left")),
"ID", GINT_TO_POINTER(Buttons::ROT_LEFT));
g_object_set_data(G_OBJECT(gtk_builder_get_object(GTK_BUILDER(builder), "btn_rot_right")),
"ID", GINT_TO_POINTER(Buttons::ROT_RIGHT));
gtk_widget_show( _mainWindow );
}
void MainWindow::openFile(GtkBuilder* builder){
FileDialog dialog(GTK_BUILDER(builder));
if(dialog.run() == 1){
char* filename = dialog.getFileName();
if(filename == NULL)
return;
std::string file(filename);
delete filename;
try{
ObjReader r(file);
for(auto obj : r.getObjs()){
try{
_world->addObj(obj);
_viewport->transformObj(obj);
addObjOnListStore(obj->getName(), obj->getTypeName().c_str());
}catch(MyException& e){
log(e.what());
}
}
log("Arquivo carregado.\n");
}catch(MyException& e){
log(e.what());
showErrorDialog(e.what());
}
}
}
void MainWindow::saveFile(GtkBuilder* builder){
FileDialog dialog(GTK_BUILDER(builder), true);
if(dialog.run() == 1){
char* filename = dialog.getFileName();
if(filename == NULL)
return;
std::string file(filename);
delete filename;
try{
ObjWriter w(file);
w.writeObjs(_world);
log("Arquivo salvo.\n");
}catch(MyException& e){
log(e.what());
showErrorDialog(e.what());
}
}
}
void MainWindow::showErrorDialog(const char* msg){
GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW(_mainWindow),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
msg);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
void MainWindow::showHelpDialog(){
gtk_dialog_run (GTK_DIALOG (_helpDialog));
gtk_widget_hide(_helpDialog);
}
void MainWindow::log(const char* msg){
GtkTextBuffer *buffer;
GtkTextIter end;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(_log));
gtk_text_buffer_get_end_iter (buffer, &end);
gtk_text_buffer_insert (buffer, &end, msg, -1);
// Scroll para o final do Textview
GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW(_logScroll));
gtk_adjustment_set_value(adj, (gtk_adjustment_get_upper(adj) -
gtk_adjustment_get_page_size(adj)));
}
void MainWindow::addObjOnListStore(const std::string name, const char* type){
GtkListStore *liststore = GTK_LIST_STORE(_mainModel);
GtkTreeIter iter;
gtk_list_store_append(liststore, &iter);
gtk_list_store_set(liststore, &iter, 0, name.c_str(), 1, type, -1);
}
void MainWindow::showPopUp(GdkEvent *event){
gtk_menu_popup(GTK_MENU(_popUp), NULL, NULL, NULL, NULL,
event->button.button, event->button.time);
}
bool MainWindow::getSelectedObjName(std::string &name, GtkTreeIter *iter){
if(!gtk_tree_selection_get_selected(GTK_TREE_SELECTION(_treeSelection),
NULL, iter))
return false;
char *_name;
gtk_tree_model_get(_mainModel, iter, 0, &_name, -1);
name = _name;
delete _name;
return true;
}
void MainWindow::onDraw(cairo_t* cr){
_viewport->drawObjs(cr);
}
void MainWindow::gotoSelectedObj(){
GtkTreeIter iter;
std::string name;
if(!getSelectedObjName(name, &iter))
return;
_viewport->gotoObj(name);
gtk_widget_queue_draw(_mainWindow);
}
void MainWindow::removeSelectedObj(){
GtkTreeIter iter;
std::string name;
if(!getSelectedObjName(name, &iter))
return;
try{
_world->removeObj(name);
gtk_list_store_remove(GTK_LIST_STORE(_mainModel), &iter);
gtk_widget_queue_draw(_mainWindow);
log("Objeto removido.\n");
}catch(MyException& e){
log(e.what());
}
}
void MainWindow::zoom(Buttons id){
double value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(_step));
try{
switch(id){
case Buttons::ZOOM_OUT:
_viewport->zoomWindow(value);
break;
case Buttons::ZOOM_IN:
_viewport->zoomWindow(-value);
break;
default:
break;
}
gtk_widget_queue_draw(_mainWindow);
}catch(MyException& e){
log(e.what());
}
}
void MainWindow::move(Buttons id){
double value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(_step));
switch(id){
case Buttons::UP:
_viewport->moveWindow(0,value);
break;
case Buttons::RIGHT:
_viewport->moveWindow(value,0);
break;
case Buttons::DOWN:
_viewport->moveWindow(0,-value);
break;
case Buttons::LEFT:
_viewport->moveWindow(-value,0);
break;
default:
break;
}
gtk_widget_queue_draw(_mainWindow);
}
void MainWindow::rotateWindow(Buttons id){
double value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(_step));
switch(id){
case Buttons::ROT_LEFT:
_viewport->rotateWindow(value);
break;
case Buttons::ROT_RIGHT:
_viewport->rotateWindow(-value);
break;
default:
break;
}
gtk_widget_queue_draw(_mainWindow);
}
void MainWindow::addPoint(GtkBuilder* builder){
PointDialog dialog(GTK_BUILDER(builder));
bool finish = false;
while(!finish){
if(dialog.run() == 1){
try{
Coordinate c(dialog.getX(),dialog.getY());
Object* obj = _world->addPoint(
dialog.getName(), dialog.getColor(),c);
_viewport->transformObj(obj);
addObjOnListStore(dialog.getName(), "Point");
gtk_widget_queue_draw(_mainWindow);
log("Novo ponto adicionado.\n");
finish = true;
}catch(MyException& e){
log(e.what());
showErrorDialog(e.what());
}
}else
finish = true;
}
}
void MainWindow::addLine(GtkBuilder* builder){
LineDialog dialog(GTK_BUILDER(builder));
bool finish = false;
while(!finish){
if(dialog.run() == 1){
try{
Coordinates c;
c.emplace_back(dialog.getX1(), dialog.getY1());
c.emplace_back(dialog.getX2(), dialog.getY2());
Object* obj = _world->addLine(
dialog.getName(), dialog.getColor(), c);
_viewport->transformObj(obj);
addObjOnListStore(dialog.getName(), "Line");
gtk_widget_queue_draw(_mainWindow);
log("Nova reta adicionada.\n");
finish = true;
}catch(MyException& e){
log(e.what());
showErrorDialog(e.what());
}
}else
finish = true;
}
}
void MainWindow::addPolygon(GtkBuilder* builder){
PolygonDialog dialog(GTK_BUILDER(builder));
bool finish = false;
while(!finish){
if(dialog.run() == 1){
try{
Coordinates c;
dialog.getCoords(c);
Object* obj = _world->addPolygon(dialog.getName(), dialog.getColor(),
dialog.shouldBeFilled(), c);
_viewport->transformObj(obj);
addObjOnListStore(dialog.getName(), "Polygon");
gtk_widget_queue_draw(_mainWindow);
log("Novo poligono adicionado.\n");
finish = true;
}catch(MyException& e){
log(e.what());
showErrorDialog(e.what());
}
}else
finish = true;
}
}
void MainWindow::translateSelectedObj(GtkBuilder* builder){
TranslateDialog dialog(GTK_BUILDER(builder));
bool finish = false;
std::string name;
GtkTreeIter iter;
if(!getSelectedObjName(name, &iter))
return;
while(!finish){
if(dialog.run() == 1){
try{
Object* obj = _world->translateObj(name, dialog.getDX(), dialog.getDY());
_viewport->transformObj(obj);
gtk_widget_queue_draw(_mainWindow);
log("Objeto transladado.\n");
finish = true;
}catch(MyException& e){
log(e.what());
showErrorDialog(e.what());
}
}else
finish = true;
}
}
void MainWindow::scaleSelectedObj(GtkBuilder* builder){
ScaleDialog dialog(GTK_BUILDER(builder));
bool finish = false;
std::string name;
GtkTreeIter iter;
if(!getSelectedObjName(name, &iter))
return;
while(!finish){
if(dialog.run() == 1){
try{
Object* obj = _world->scaleObj(name, dialog.getSX(), dialog.getSY());
_viewport->transformObj(obj);
gtk_widget_queue_draw(_mainWindow);
log("Objeto escalonado.\n");
finish = true;
}catch(MyException& e){
log(e.what());
showErrorDialog(e.what());
}
}else
finish = true;
}
}
void MainWindow::rotateSelectedObj(GtkBuilder* builder){
RotateDialog dialog(GTK_BUILDER(builder));
bool finish = false;
std::string name;
GtkTreeIter iter;
if(!getSelectedObjName(name, &iter))
return;
while(!finish){
if(dialog.run() == 1){
try{
Object* obj = _world->rotateObj(name, dialog.getAngulo(),
Coordinate(dialog.getCX(), dialog.getCY()),
dialog.getRotateType());
_viewport->transformObj(obj);
gtk_widget_queue_draw(_mainWindow);
log("Objeto rotacionado.\n");
finish = true;
}catch(MyException& e){
log(e.what());
showErrorDialog(e.what());
}
}else
finish = true;
}
}
#endif // MAINWINDOW_HPP
| [
"gilney_salvo@hotmail.com"
] | gilney_salvo@hotmail.com |
f186b7885fe1595b7d867331d2fa485d155bdaf1 | 3e4f3a36bd030b931a676f9989c2786eca838418 | /InverseWayLiberation/src/Sounds/SoundManager.cpp | 3159de7012eb24a92d035f59d04275703f85c38d | [] | no_license | amjadtbssm/TGE | 0506491b449c98ace581e24692efcb3218820d06 | 31667d8268bb38a1efa50b617ee53b54dbdafe4b | refs/heads/master | 2020-08-12T03:28:46.718097 | 2018-11-25T16:33:44 | 2018-11-25T16:33:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12 | cpp |
// Vide... | [
"toto.rigolo@free.fr"
] | toto.rigolo@free.fr |
9f60af507d23ecbc718b607f1bd063ebbbd8f32d | 82afdf1a0de48235b75a9b6ca61c9dbcfefcfafa | /Package.cpp | 4eb9f21a9954bb8028a972e57c0309167313c0d1 | [] | no_license | shilrobot/shilscript_plus_plus | eec85d01074ec379da63abe00562d7663c664398 | 09dbdbdadc28d131fa3c8026b14015336a55ed62 | refs/heads/master | 2021-01-25T00:17:10.004698 | 2009-12-16T22:45:52 | 2009-12-16T22:45:52 | 2,589,159 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 348 | cpp | #include "Package.h"
#include "Name.h"
#include "CompileErrors.h"
#include "Class.h"
namespace SS {
Package::Package()
{
}
Package::~Package()
{
// Delete file objects this package used
for(size_t i = 0; i < m_files.size(); ++i)
delete m_files[i];
for(size_t i=0; i<m_classes.size(); ++i)
delete m_classes[i];
}
}
| [
"shilbert@6dcb506c-49f4-8c44-b148-53dce8eab73e"
] | shilbert@6dcb506c-49f4-8c44-b148-53dce8eab73e |
b94e4882ac85c8f4bced7f9b2bd738c46987aa8c | 211fcb30d2c0068d88074c646258b31e008fd32b | /AtCoder/etc/code-formula-2014-final/f.cpp | 4123dd345d986fb2d0f9d2de0e2fd2fa67e502cc | [] | no_license | makecir/competitive-programming | 2f9ae58284b37fab9aed872653518089951ff7fd | be6c7eff4baf07dd19b50eb756ec0d5dc5ec3ebf | refs/heads/master | 2021-06-11T08:10:17.375410 | 2021-04-13T11:59:17 | 2021-04-13T11:59:17 | 155,111,372 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,336 | cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
//#define MOD (998244353ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384
int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0 : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;}
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
vector<pll> ans(100);
ll x=0,y=0,mx=0;
rrep(i,100){
ll r=i+1;
if(x+2*r>1500){
y+=mx*2;
x=0;
mx=0;
}
chmax(mx,r);
ans[i].fs=x+r;
ans[i].sc=y+r;
x+=r*2;
}
rep(i,100)puta(ans[i].fs,ans[i].sc);
}
| [
"konpeist@yahoo.co.jp"
] | konpeist@yahoo.co.jp |
9c358f56a19dc08d4499407e187e2847505b1255 | 35b7acd22c0a880b269e533b44e61cbd5249f2e0 | /spritedetailpanel.cpp | 78af8542c53f678f4a910cf114cf9d3aa509c082 | [] | no_license | xscrat/ZebraForest | 35dbad74a234b67e9c1604ec79492d7d9df9624c | 612145f003e1477ddfbd01848cc9985d553af6ad | refs/heads/master | 2021-07-08T23:42:43.303629 | 2019-07-27T09:23:18 | 2019-07-27T09:23:18 | 188,523,133 | 0 | 0 | null | 2020-09-03T18:19:13 | 2019-05-25T05:07:11 | JavaScript | UTF-8 | C++ | false | false | 482 | cpp | #include "spritedetailpanel.h"
#include "ui_spritedetailpanel.h"
SpriteDetailPanel::SpriteDetailPanel(QWidget *parent) :
QWidget(parent),
ui(new Ui::SpriteDetailPanel)
{
ui->setupUi(this);
}
SpriteDetailPanel::~SpriteDetailPanel()
{
delete ui;
}
void SpriteDetailPanel::setSpriteInfo(int id, QString power_percent, QString identifier)
{
ui->label->setText(QString::number(id));
ui->label_2->setText(power_percent);
ui->label_3->setText(identifier);
}
| [
"xjfscrat@gmail.com"
] | xjfscrat@gmail.com |
a2b1d33f87c476c425d96011a91e864b48fd323f | 7e840c18856256a17a6691da86920025e0e91fda | /JD1018(AC).cpp | ad61e64822a4cd3bb1343c7dc13d0bbad46af63b | [] | no_license | stevencoding/jobduoj | 4cb981abf20b793f27fdd52ce1c7fe5907c31d2c | 097fe66ed1321767cf8f8eed5087deb126650e77 | refs/heads/master | 2020-02-26T14:21:40.874783 | 2015-04-27T18:45:57 | 2015-04-27T18:45:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 360 | cpp | #include <cstdio>
#include <cstring>
using namespace std;
int main()
{
int a[101];
int n, i, val;
while (scanf("%d", &n) == 1 && n) {
memset(a, 0, sizeof(a));
for (i = 0; i < n; ++i) {
scanf("%d", &val);
++a[val];
}
scanf("%d", &val);
if (val < 0 || val > 100) {
printf("0\n");
} else {
printf("%d\n", a[val]);
}
}
return 0;
} | [
"zhuli19901106@gmail.com"
] | zhuli19901106@gmail.com |
5eaba2c46da9df9dc533822545282b85e8152035 | ca30df828265ef61de17f8aa83da293eeb1c0766 | /src/ZStringLit.h | d92e09e0d231531eb005b66083a7e6d61a1fa9e7 | [] | no_license | pyanzin/z | 5ed55d2f06fa48bc02d645f2407ce212ffad9a31 | d12a63db6942762ccf226dc12389e627deae3023 | refs/heads/master | 2021-01-25T06:07:24.500592 | 2018-04-10T08:21:30 | 2018-04-10T08:21:30 | 93,531,737 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 508 | h | #pragma once
#include "ZExpr.h"
#include "ZBasicType.h"
class ZStringLit : public ZExpr {
public:
ZStringLit(std::string& value) : _value(value) {
setType(String);
}
virtual void accept(ZVisitor* visitor);
std::string& getValue() {
return _value;
}
void dump(std::ostream& stream, unsigned depth) override {
dumpTab(stream, depth);
stream << "string(\'" << _value << "\') : " << getType()->toString() << "\n";
}
std::string& _value;
};
| [
"igor.pyanzin@gmail.com"
] | igor.pyanzin@gmail.com |
31efd666895d1c9e2c46077d815a7d8e958a53f7 | 1a0de41b2fb843ae692ee7fc51f2206b0d7b715d | /lib/passes/invLoopCount.cpp | f160c114a2d1728444744a516c0554d6d93bbcdd | [] | no_license | amir9979/zoltar-hg-to-git | 7b22a1202a40073b91b74855ff37d4715c77b048 | 0cb9a640b295d77993688323b136dc7c1d551959 | refs/heads/master | 2020-03-21T19:04:49.385152 | 2011-08-25T09:36:55 | 2011-08-25T09:36:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,741 | cpp | #include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Streams.h"
#include "llvm/Transforms/Instrumentation.h"
#include "llvm/ValueSymbolTable.h"
#include "llvm/Value.h"
#include "llvm/Support/CallSite.h"
#include "llvm/IntrinsicInst.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Support/CFG.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Analysis/LoopInfo.h"
#include <time.h>
#include "indexManager.h"
#include "contextManager.h"
#include "registration.h"
using namespace llvm;
namespace {
class InvLoopCountInstrumenter : public ModulePass {
bool runOnModule(Module &M);
void getAnalysisUsage(AnalysisUsage &AU) const;
void instrumentLoop(Loop *loop, Constant *loopInitFn, Constant *loopIncrFn, unsigned int invariantTypeIndex, unsigned int *loopIndex);
public:
static char ID;
InvLoopCountInstrumenter() : ModulePass((intptr_t)&ID) {}
};
}
char InvLoopCountInstrumenter::ID = 0;
static RegisterPass<InvLoopCountInstrumenter>
RPinstrloops("invloopcount", "Instrument loops for invariant analysis");
void InvLoopCountInstrumenter::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequired<LoopInfo>();
}
bool InvLoopCountInstrumenter::runOnModule(Module &M) {
cerr << "instrument: --- Loop Count Invariant ---\n";
Function *Main = M.getFunction("main");
LLVMContext &C = M.getContext();
if (Main == 0) {
cerr << "WARNING: cannot insert loop count instrumentation into a module"
<< " with no main function!\n";
return false; // No main, no instrumentation!
}
// Add library function prototypes
Constant *loopInitFn = M.getOrInsertFunction("_handleInvariantChangeUInt",
Type::getVoidTy(C), // returns void
Type::getInt32Ty(C), // InvariantTypeIndex
Type::getInt32Ty(C), // LoopIndex
Type::getInt32Ty(C), // Value
NULL);
Constant *loopIncrFn = M.getOrInsertFunction("_handleInvariantIncrement",
Type::getVoidTy(C), // returns void
Type::getInt32Ty(C), // InvariantTypeIndex
Type::getInt32Ty(C), // LoopIndex
NULL);
unsigned int invariantTypeIndex = IndexManager::getInvariantTypeIndex();
unsigned int loopIndex = 0;
// Loop through all functions within module
for (Module::iterator F = M.begin(), ME = M.end(); F != ME; ++F) {
// skip function declarations
if(F->isDeclaration())
continue;
// skip the _registerAll function
if(F->getName()=="_registerAll")
continue;
// get loop info analysis from LLVM
LoopInfo &LI = getAnalysis<LoopInfo>(*F);
// process all loops in function
for (LoopInfo::iterator L = LI.begin(), LE = LI.end(); L != LE; ++L) {
Loop *loop = *L;
instrumentLoop(loop, loopInitFn, loopIncrFn, invariantTypeIndex, &loopIndex);
}
}
// add the registration of the instrumented invariants in the _registerAll() function
addInvariantTypeRegistration(M, invariantTypeIndex, loopIndex, "Loop Counter", 0);
llvm::cerr << "instrument: " << loopIndex << " loops instrumented\n";
// notify change of program
return true;
}
void InvLoopCountInstrumenter::instrumentLoop(Loop *loop, Constant *loopInitFn, Constant *loopIncrFn, unsigned int invariantTypeIndex, unsigned int *loopIndex) {
if(loop->getLoopPreheader() && loop->getHeader()) {
// init counter in header
BasicBlock::iterator initPos = loop->getLoopPreheader()->begin();
while (isa<AllocaInst>(initPos)) ++initPos;
std::vector<Value*> Args(3);
Args[0] = ConstantInt::get(Type::getInt32Ty(loop->getLoopPreheader()->getContext()), invariantTypeIndex);
Args[1] = ConstantInt::get(Type::getInt32Ty(loop->getLoopPreheader()->getContext()), *loopIndex);
Args[2] = ConstantInt::get(Type::getInt32Ty(loop->getLoopPreheader()->getContext()), 0);
CallInst::Create(loopInitFn, Args.begin(), Args.end(), "", initPos);
// increment counter in first loop block
BasicBlock *header = loop->getHeader();
BasicBlock::iterator incrPos = header->begin();
while (isa<AllocaInst>(incrPos)) ++incrPos;
std::vector<Value*> Args2(2);
Args2[0] = ConstantInt::get(Type::getInt32Ty(header->getContext()), invariantTypeIndex);
Args2[1] = ConstantInt::get(Type::getInt32Ty(header->getContext()), *loopIndex);
CallInst::Create(loopIncrFn, Args2.begin(), Args2.end(), "", incrPos);
(*loopIndex)++;
// try to get context information of loop
std::string dir="-", file="-", name="-";
int line = 0;
while (!isa<DbgStopPointInst>(incrPos)) ++incrPos;
if(isa<DbgStopPointInst>(*incrPos)) {
DbgStopPointInst &DSPI = cast<DbgStopPointInst>(*incrPos);
llvm::GetConstantStringInfo(DSPI.getDirectory(), dir);
llvm::GetConstantStringInfo(DSPI.getFileName(), file);
line = DSPI.getLine();
}
// add source context of this invariant to context file
ContextManager::addInvariantTypeContext(
invariantTypeIndex, // invariantTypeIndex
(*loopIndex)-1, // invariantIndex
dir, // path
file, // file
line, // line
name); // name
}
// process loops within this loop
for (Loop::iterator L = loop->begin(), LE = loop->end(); L != LE; ++L) {
instrumentLoop(*L, loopInitFn, loopIncrFn, invariantTypeIndex, loopIndex);
}
}
| [
"reydelamirienda@gmail.com"
] | reydelamirienda@gmail.com |
364598e6153281b12f141ddec48b3c38a7ca282a | e76ea38dbe5774fccaf14e1a0090d9275cdaee08 | /src/chrome/browser/chromeos/login/screens/network_screen.h | 0faa8ac2dcfeb0f33e44432adafb722feca5f8c1 | [
"BSD-3-Clause"
] | permissive | eurogiciel-oss/Tizen_Crosswalk | efc424807a5434df1d5c9e8ed51364974643707d | a68aed6e29bd157c95564e7af2e3a26191813e51 | refs/heads/master | 2021-01-18T19:19:04.527505 | 2014-02-06T13:43:21 | 2014-02-06T13:43:21 | 16,070,101 | 1 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 3,469 | h | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_NETWORK_SCREEN_H_
#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_NETWORK_SCREEN_H_
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string16.h"
#include "base/timer/timer.h"
#include "chrome/browser/chromeos/login/language_switch_menu.h"
#include "chrome/browser/chromeos/login/screens/network_screen_actor.h"
#include "chrome/browser/chromeos/login/screens/wizard_screen.h"
#include "chromeos/network/network_state_handler_observer.h"
namespace chromeos {
namespace login {
class NetworkStateHelper;
} // namespace login
class NetworkScreen : public WizardScreen,
public NetworkStateHandlerObserver,
public NetworkScreenActor::Delegate {
public:
NetworkScreen(ScreenObserver* screen_observer, NetworkScreenActor* actor);
virtual ~NetworkScreen();
// WizardScreen implementation:
virtual void PrepareToShow() OVERRIDE;
virtual void Show() OVERRIDE;
virtual void Hide() OVERRIDE;
virtual std::string GetName() const OVERRIDE;
// NetworkStateHandlerObserver implementation:
virtual void NetworkConnectionStateChanged(
const NetworkState* network) OVERRIDE;
virtual void DefaultNetworkChanged(const NetworkState* network) OVERRIDE;
// NetworkScreenActor::Delegate implementation:
virtual void OnActorDestroyed(NetworkScreenActor* actor) OVERRIDE;
virtual void OnContinuePressed() OVERRIDE;
NetworkScreenActor* actor() const { return actor_; }
protected:
// Subscribes NetworkScreen to the network change notification,
// forces refresh of current network state.
virtual void Refresh();
private:
friend class NetworkScreenTest;
FRIEND_TEST_ALL_PREFIXES(NetworkScreenTest, Timeout);
FRIEND_TEST_ALL_PREFIXES(NetworkScreenTest, CanConnect);
// Sets the NetworkStateHelper for use in tests. This
// class will take ownership of the pointed object.
void SetNetworkStateHelperForTest(login::NetworkStateHelper* helper);
// Subscribes to network change notifications.
void SubscribeNetworkNotification();
// Unsubscribes from network change notifications.
void UnsubscribeNetworkNotification();
// Notifies wizard on successful connection.
void NotifyOnConnection();
// Called by |connection_timer_| when connection to the network timed out.
void OnConnectionTimeout();
// Update UI based on current network status.
void UpdateStatus();
// Stops waiting for network to connect.
void StopWaitingForConnection(const string16& network_id);
// Starts waiting for network connection. Shows spinner.
void WaitForConnection(const string16& network_id);
// True if subscribed to network change notification.
bool is_network_subscribed_;
// ID of the the network that we are waiting for.
string16 network_id_;
// True if user pressed continue button so we should proceed with OOBE
// as soon as we are connected.
bool continue_pressed_;
// Timer for connection timeout.
base::OneShotTimer<NetworkScreen> connection_timer_;
NetworkScreenActor* actor_;
scoped_ptr<login::NetworkStateHelper> network_state_helper_;
DISALLOW_COPY_AND_ASSIGN(NetworkScreen);
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_NETWORK_SCREEN_H_
| [
"ronan@fridu.net"
] | ronan@fridu.net |
e18658eaaf70372ffffe9f54a55c73ec67db5d30 | 31b88f771255903c5b856e93efc0b97323eb5dc9 | /saiteki.cpp | a4618c76849eb3ca370ae36b45762e914a992543 | [] | no_license | elkurin/simulation_new | 2a9d6e0e3230c9bec21c89191dcf0b8779b2a29a | 8475d75ee611594ddb1f06f10181357382908a53 | refs/heads/master | 2021-01-21T04:40:46.594762 | 2016-06-28T18:30:08 | 2016-06-28T18:30:08 | 50,068,387 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,843 | cpp | #include <iostream>
#include <random>
#include <vector>
#include <utility>
#include <iomanip>
#include <cmath>
#include <array>
#include <ostream>
#include <fstream>
using namespace std;
namespace {
ofstream take_log_type("data_re_evolve_type_number10_test.log");
ofstream take_log_network("data_re_evolve_network10_test.log");
ofstream take_log_outside("data_re_evolve_outside10_test.log");
ofstream take_log_devdev("data_re_evolve_devdev10_test.log");
ofstream take_log_coef("data_re_evolve_coef10_test.log");
ofstream take_log_inside("data_re_evolve_inside10_test.log");
}
#define rep(i, n) for (int i = 0; i < n; i++)
double rd(void)
{
double get;
get = (double)(rand() % 1000) * 0.001 + 0.001;
return get;
}
double rand_normal(double mu, double sigma)
{
double z = sqrt(- 2.0 * log(rd())) * sin(2.0 * M_PI * rd());
return mu + sigma * z;
}
double get_rand_normal(double size)
{
double get;
get = rand_normal(size, size * 0.25);
return get;
}
const int cell_max = 100;
int cell_type = 1;
const int time_end = 100000;
const double time_bunkai = 0.1;
const int run_time = 1;
const int init_box_size = 1200;
const int max_cell_size = 10;
double box_con;
const int N = 10;
int cell_number;
double box_size;
double reversible[N][N];
double coef_decrease[N];
double nut_coef;
double nut_reversible;
double aver_nut;
typedef struct
{
int type;
double inside_nut;
int nut_cat;
double mol[N];
double nut_zero_coef;
double coef[N][N];
// double go[N];
int catalyst[N][N];
double size;
double init_last;
double init_last_con;
} Cell;
Cell cell[cell_max];
Cell def;
double outside_nut;
double outside[N];
double go[N];
int _count = 0;
int count_ = 0;
double decide_box_nut(int time)
{
return aver_nut;
}
double get_size(Cell p)
{
double sum = p.inside_nut;
rep(i, N) {
sum += p.mol[i];
}
return sum;
}
double get_box_size(void)
{
double sum = 0;
rep(i, cell_number) {
sum += cell[i].size;
}
return init_box_size - sum;
}
array<array<double, N>, 1000> begin_coef;
void sum_ten_init(void)
{
//coefの合計が一定でその中でrandomをつくる関数
double sum = 0;
array<double, N> keep;
for (int i = 0; i < cell_type; i++) {
rep(j, N) {
keep.at(j) = rand() % rand();
keep.at(j) *= rand();
sum += keep.at(j);
}
rep(j, N) {
begin_coef.at(i).at(j) = 10 * keep.at(j) / sum;
}
sum = 0;
}
}
void desig_init(void)
{
rep(i, cell_type) {
rep(j, N) {
cin >> begin_coef.at(i).at(j);
}
}
}
void all_init(void)
{
rep(i, N) {
if (i % 3 != 2) begin_coef.at(0).at(i) = 0.4;
else begin_coef.at(0).at(i) = 2.4;
}
}
void network(void)
{
rep(k, cell_type) {
rep(i, N) {
rep(j, N) {
if (i == j) continue;
cell[i].coef[i][j] = (double)(rand() % 100) * 0.01;
}
}
}
}
void init(void)
{
//defをいれておいて、typeカウントを防ぐ
def.type = - 1;
rep(i, N) cell[i] = def;
//coefの定め方
// sum_ten_init();
all_init();
cell_number = cell_type;
//outside系はloopの外
outside_nut = 20;
rep(i, N) {
outside[i] = 0;
go[i] = (i % 3 / 2) * 1;
coef_decrease[i] = 0;
}
nut_coef = 0.1;
nut_reversible = 0;
aver_nut = 0.01;
// aver_nut = 1.0;
//cellごとの詳細設定
rep(i, cell_type) {
cell[i].nut_zero_coef = begin_coef.at(i).at(0);
// cell[i].nut_zero_coef = 0;
cell[i].type = i;
rep(j, N) {
cell[i].mol[j] = 0.2;
cell[i].inside_nut = 0.2;
// cell[i].mol[j] = 0;
// cell[i].inside_nut = 0;
cell[i].nut_cat = N - 3;
if (j != N - 1) {
cell[i].coef[j][j + 1] = begin_coef.at(i).at(j + 1);
cell[i].catalyst[j][j + 1] = (j - 2 + N) % N;
reversible[j][j + 1] = 0;
}
}
cell[i].size = get_size(cell[i]);
cell[i].init_last = cell[i].mol[N - 1];
cell[i].init_last_con = cell[i].mol[N - 1] / cell[i].size;
}
rep(i, 10 * cell_type) {
cell[i] = cell[0];
}
box_size = get_box_size();
// network();
}
//outside分だけはglobalでここで宣言しておく
double prev_outside_nut_con;
double new_outside_nut_con;
double prev_outside_con[N];
double new_outside_con[N];
int a[1000];
int devdev = 0;
Cell internal(Cell p)
{
double new_con[N];
double prev_con[N];
//数から濃度へ変換
rep(i, N) {
prev_con[i] = p.mol[i] / p.size;
new_con[i] = prev_con[i];
}
double prev_nut_con = p.inside_nut / p.size;
double new_nut_con = prev_nut_con;
//細胞内外の栄養の流出入
// cout << pow(p.size, - 1.0 / 3.0) << endl;
new_nut_con += time_bunkai * nut_coef * pow(p.size, - 1.0 / 3.0) * (prev_outside_nut_con - prev_nut_con);
new_outside_nut_con -= time_bunkai * nut_coef * pow(p.size, - 1.0 / 3.0) * (prev_outside_nut_con - prev_nut_con) * p.size / box_size;
//ただのリアクション
new_con[0] += time_bunkai * p.nut_zero_coef * prev_nut_con * prev_con[p.nut_cat];
new_nut_con -= time_bunkai * p.nut_zero_coef * prev_nut_con * prev_con[p.nut_cat];
rep(i, N - 1) {
new_con[i + 1] += time_bunkai * p.coef[i][i + 1] * prev_con[i] * prev_con[p.catalyst[i][i + 1]];
prev_con[i] -= time_bunkai * p.coef[i][i + 1] * prev_con[i] * prev_con[p.catalyst[i][i + 1]];
}
//可逆反応
new_nut_con += time_bunkai * nut_reversible * prev_con[0];
new_con[0] -= time_bunkai * nut_reversible * prev_con[0];
rep(i, N - 1) {
new_con[i] += time_bunkai * reversible[i][i + 1] * prev_con[i + 1];
new_con[i + 1] -= time_bunkai * reversible[i][i + 1] * prev_con[i + 1];
}
//細胞内外の溶質の流出入
rep(i, N) {
new_con[i] += time_bunkai * go[i] * pow(p.size, - 1.0 / 3.0) * (prev_outside_con[i] - prev_con[i]);
new_outside_con[i] -= time_bunkai * go[i] * pow(p.size, - 1.0 / 3.0) * (prev_outside_con[i] - prev_con[i]) * p.size / box_size;
}
//濃度から数に戻して挿入
rep(i, N) {
p.mol[i] = new_con[i] * p.size;
}
p.inside_nut = new_nut_con * p.size;
//サイズを増やす
double sum = new_nut_con;
rep(i, N) {
sum += new_con[i];
}
p.size = sum * p.size;
return p;
}
void evolve(int get)
{
double sum = 0;
array<double, N> keep;
rep(j, N) {
keep.at(j) = rand();
sum += keep.at(j);
}
rep(j, N) {
begin_coef.at(cell_type).at(j) = pow(10, get) * keep.at(j) / sum;
}
if (cell_number + 1 == cell_max) {
int get;
// do {
get = rand() % cell_number;
// cout << "in while" << endl;
// } while(get == cell_number - 1);
cell_number--;
cell[get] = cell[cell_number];
}
cell[cell_number].nut_zero_coef = begin_coef.at(0).at(1);
cell[cell_number].type = cell_type;
rep(j, N) {
cell[cell_number].mol[j] = 0.2;
cell[cell_number].inside_nut = 0.2;
cell[cell_number].nut_cat = N - 3;
if (j != N - 1) {
cell[cell_number].coef[j][j + 1] = begin_coef.at(cell_type).at(j + 1);
cell[cell_number].catalyst[j][j + 1] = (j - 2 + N) % N;
reversible[cell_number][j + 1] = 0;
}
}
cell[cell_number].size = get_size(cell[cell_number]);
cell[cell_number].init_last = cell[cell_number].mol[N - 1];
cell[cell_number].init_last_con = cell[cell_number].mol[N - 1] / cell[cell_number].size;
cell_type++;
cell_number++;
}
pair<Cell, Cell> devide(Cell p)
{
Cell q, r;
q = p;
r = p;
//pが分裂するとき中身は6:4に分裂
while(1) {
// cout << "dev while" << endl;
q.inside_nut = get_rand_normal(0.5) * p.inside_nut;
if (q.inside_nut >= 0) break;
}
r.inside_nut = p.inside_nut - q.inside_nut;
rep(i, N) {
while(1) {
// cout << "dev whil " << i << " " << p.mol[i] << endl;
q.mol[i] = get_rand_normal(0.5) * p.mol[i];
if (q.mol[i] >= 0) break;
}
r.mol[i] = p.mol[i] - q.mol[i];
}
//sizeを入れておく
q.size = get_size(q);
r.size = get_size(r);
//pairで渡す
pair<Cell, Cell> s = {q, r};
return s;
}
double pop_sum = 0;
void process(int t)
{
box_con = decide_box_nut(t);
//outside系を濃度に変換
prev_outside_nut_con = outside_nut / box_size;
new_outside_nut_con = prev_outside_nut_con;
rep(i, N) {
prev_outside_con[i] = outside[i] / box_size;
new_outside_con[i] = prev_outside_con[i];
}
//loop回してreaction
rep(i, cell_number) {
if (cell[i].size == 0) {
cell[i] = cell[cell_number - 1];
cell_number--;
} else cell[i] = internal(cell[i]);
}
//sizeが2倍以上またはmaxを越えたら分裂、半分になったら消滅
rep(i, cell_number) {
if (/* cell[i].size > max_cell_size ||*/ cell[i].mol[N - 1] > 2 * cell[i].init_last) {
devdev++;
if (cell[i].mol[N - 1] > 2 * cell[i].init_last) _count++;
else count_++;
cell_number++;
pair<Cell, Cell> dev = devide(cell[i]);
cell[i] = dev.first;
if (cell_number == cell_max) {
int get;
do {
// cout << "while for dev" << endl;
get = rand() % cell_number;
} while(get == i);
cell_number--;
cell[get] = dev.second;
} else {
cell[cell_number - 1] = dev.second;
}
} else if (cell[i].mol[N] / cell[i].size < 0.5 * cell[i].init_last_con) {
cell[i] = cell[cell_number - 1];
cell_number--;
}
}
// cout << "out of dev" << endl;
//outsideの値を更新
outside_nut = new_outside_nut_con * box_size + time_bunkai * (box_con - prev_outside_nut_con) * box_size;
rep(i, N) outside[i] = new_outside_con[i] * box_size;
// cout << "out of outside" << endl;
//それぞれのcelltypeの数をカウント、表示
rep(i, cell_type) a[i] = 0;
rep(i, cell_number) a[cell[i].type]++;
// cout << "start counting a " << cell_number << endl;
cout << t << " ";
rep(i, cell_type) {
if (a[i] == 0) {
take_log_type << a[i] << " ";
continue;
}
cout << setw(4) << a[i] << " ";
take_log_type << a[i] << " ";
}
cout << endl;
take_log_type << endl;
//prevの変換が全て終わってからbox_sizeの値を更新
box_size = get_box_size();
double x = (double)a[0];
double y = (double)cell_number;
if (t >= time_end * 0.2) pop_sum += x / y;
vector<vector<double>> keep8(cell_type);
// cout << cell[0].mol[7] << endl;
rep(i, cell_number) {
if (cell[i].size != 0) keep8[cell[i].type].push_back(cell[i].mol[7] / cell[i].size);
}
rep(i, cell_type) {
vector<double> sum8(cell_type, 0);
rep(j, (int)keep8[i].size()) sum8[i] += keep8[i][j];
if (keep8[i].size() != 0) take_log_inside << sum8[i] / (double)keep8[i].size() << " ";
else take_log_inside << 0 << " ";
}
take_log_inside << endl;
}
int main(void)
{
//randomの種を与える
srand(10);
//run_time回だけ走らせる
rep(l, run_time) {
init();
//time_end秒だけ走らせる
rep(t, time_end) {
devdev = 0;
process(t);
rep(i, N) {
double sum0 = 0;
double sum2 = 0;
int num0 = 0;
int num2 = 0;
rep(j, cell_number) {
if (cell[j].type == 0) {
sum0 += cell[j].mol[i];
num0++;
}
if (cell[j].type == 16) {
sum2 += cell[j].mol[i];
num2++;
}
}
double get0, get2;
if (num0) get0 = sum0 / (double)num0;
else get0 = 0;
if (num2) get2 = sum2 / (double)num2;
else get2 = 0;
// cout << get0 << " " << get2 << endl;
// if (i == 8) take_log_network << (double)sum0 / (double)num0 << " " << (double)sum2 / (double)num2 << endl;
if (get0) take_log_network << (get0 - get2) / get0 << " ";
else take_log_network << 0 << " ";
}
take_log_network << endl;
// cout << cell[0].size << endl;
rep(i, N) {
take_log_outside << outside[i] << " ";
}
take_log_outside << endl;
take_log_devdev << devdev << endl;
if (t % 2000 == 1000) evolve(0);
if (t % 10000 == 0) evolve(1);
}
}
rep(i, cell_type) {
rep(j, N) {
cout << begin_coef.at(i).at(j) << " ";
take_log_coef << begin_coef.at(i).at(j) << " ";
}
cout << endl;
take_log_coef << endl;
}
rep(i, cell_type) {
if (a[i] == 0) {
continue;
}
cout << i << " " << setw(4) << a[i] << endl;
}
cout << endl;
cout << endl << _count << " " << count_ << endl << endl;
cout << "% = " << pop_sum / ((double)time_end * 0.8) << endl;
return 0;
}
| [
"eriko.kurimoto.729@gmail.com"
] | eriko.kurimoto.729@gmail.com |
3219c554fd368cb6f652e0ca76995bf801647114 | 94f30c7c49c19309afd7afac97a8d1d821080c5c | /UnityARKitScene/Classes/Native/Il2CppCompilerCalculateTypeValues_13Table.cpp | b7b133d6528e919f748a961a4fb6e07c917deda7 | [
"MIT"
] | permissive | snowxu17/NostalgiaCartoonUnityARKit_Test | 2407a197c9b513f4c89e532619393219a4eaf752 | a4304e72d014d04c2015242c6fc67b0ae6087373 | refs/heads/master | 2020-03-22T12:20:34.677975 | 2018-08-04T02:36:47 | 2018-08-04T02:36:47 | 140,034,208 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 189,723 | 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"
// UnityEngine.Gyroscope
struct Gyroscope_t3288342876;
// UnityEngine.ILogger
struct ILogger_t2607134790;
// UnityEngine.DisallowMultipleComponent[]
struct DisallowMultipleComponentU5BU5D_t3936143868;
// UnityEngine.ExecuteInEditMode[]
struct ExecuteInEditModeU5BU5D_t3239458680;
// UnityEngine.RequireComponent[]
struct RequireComponentU5BU5D_t2245623724;
// UnityEngine.U2D.SpriteAtlasManager/RequestAtlasCallback
struct RequestAtlasCallback_t3100554279;
// System.Action`1<UnityEngine.U2D.SpriteAtlas>
struct Action_1_t819399007;
// System.Collections.Generic.List`1<UnityEngine.BeforeRenderHelper/OrderBlock>
struct List_1_t3058052573;
// System.UnhandledExceptionEventHandler
struct UnhandledExceptionEventHandler_t3101989324;
// UnityEngine.Transform
struct Transform_t3600365921;
// UnityEngine.Events.UnityAction`2<UnityEngine.SceneManagement.Scene,UnityEngine.SceneManagement.LoadSceneMode>
struct UnityAction_2_t2165061829;
// UnityEngine.Events.UnityAction`1<UnityEngine.SceneManagement.Scene>
struct UnityAction_1_t2933211702;
// UnityEngine.Events.UnityAction`2<UnityEngine.SceneManagement.Scene,UnityEngine.SceneManagement.Scene>
struct UnityAction_2_t1262235195;
// System.String
struct String_t;
// UnityEngine.Events.UnityAction
struct UnityAction_t3245792599;
// System.Type
struct Type_t;
// System.Char[]
struct CharU5BU5D_t3528271667;
// System.Void
struct Void_t1185182177;
// UnityEngine.Texture
struct Texture_t3661962703;
// UnityEngine.Material
struct Material_t340375123;
// System.Action`1<UnityEngine.AsyncOperation>
struct Action_1_t1617499438;
// System.Reflection.MethodInfo
struct MethodInfo_t;
// System.DelegateData
struct DelegateData_t1677132599;
// UnityEngine.Display[]
struct DisplayU5BU5D_t103034768;
// UnityEngine.Display/DisplaysUpdatedDelegate
struct DisplaysUpdatedDelegate_t51287044;
// UnityEngine.CullingGroup/StateChanged
struct StateChanged_t2136737110;
// System.IAsyncResult
struct IAsyncResult_t767004451;
// System.AsyncCallback
struct AsyncCallback_t3962456242;
// UnityEngine.Camera
struct Camera_t4157153871;
// UnityEngine.RectTransform
struct RectTransform_t3704657025;
// UnityEngine.RectTransform/ReapplyDrivenProperties
struct ReapplyDrivenProperties_t1258266594;
// UnityEngine.Camera/CameraCallback
struct CameraCallback_t190067161;
#ifndef RUNTIMEOBJECT_H
#define RUNTIMEOBJECT_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Object
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEOBJECT_H
#ifndef INPUT_T1431474628_H
#define INPUT_T1431474628_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Input
struct Input_t1431474628 : public RuntimeObject
{
public:
public:
};
struct Input_t1431474628_StaticFields
{
public:
// UnityEngine.Gyroscope UnityEngine.Input::m_MainGyro
Gyroscope_t3288342876 * ___m_MainGyro_0;
public:
inline static int32_t get_offset_of_m_MainGyro_0() { return static_cast<int32_t>(offsetof(Input_t1431474628_StaticFields, ___m_MainGyro_0)); }
inline Gyroscope_t3288342876 * get_m_MainGyro_0() const { return ___m_MainGyro_0; }
inline Gyroscope_t3288342876 ** get_address_of_m_MainGyro_0() { return &___m_MainGyro_0; }
inline void set_m_MainGyro_0(Gyroscope_t3288342876 * value)
{
___m_MainGyro_0 = value;
Il2CppCodeGenWriteBarrier((&___m_MainGyro_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INPUT_T1431474628_H
#ifndef PLAYERCONNECTIONINTERNAL_T3892293164_H
#define PLAYERCONNECTIONINTERNAL_T3892293164_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.PlayerConnectionInternal
struct PlayerConnectionInternal_t3892293164 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // PLAYERCONNECTIONINTERNAL_T3892293164_H
#ifndef SETUPCOROUTINE_T2062820429_H
#define SETUPCOROUTINE_T2062820429_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.SetupCoroutine
struct SetupCoroutine_t2062820429 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SETUPCOROUTINE_T2062820429_H
#ifndef CLASSLIBRARYINITIALIZER_T2339504045_H
#define CLASSLIBRARYINITIALIZER_T2339504045_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.ClassLibraryInitializer
struct ClassLibraryInitializer_t2339504045 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CLASSLIBRARYINITIALIZER_T2339504045_H
#ifndef CUSTOMYIELDINSTRUCTION_T1895667560_H
#define CUSTOMYIELDINSTRUCTION_T1895667560_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.CustomYieldInstruction
struct CustomYieldInstruction_t1895667560 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CUSTOMYIELDINSTRUCTION_T1895667560_H
#ifndef GYROSCOPE_T3288342876_H
#define GYROSCOPE_T3288342876_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Gyroscope
struct Gyroscope_t3288342876 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // GYROSCOPE_T3288342876_H
#ifndef DEBUGLOGHANDLER_T826086171_H
#define DEBUGLOGHANDLER_T826086171_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.DebugLogHandler
struct DebugLogHandler_t826086171 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DEBUGLOGHANDLER_T826086171_H
#ifndef DEBUG_T3317548046_H
#define DEBUG_T3317548046_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Debug
struct Debug_t3317548046 : public RuntimeObject
{
public:
public:
};
struct Debug_t3317548046_StaticFields
{
public:
// UnityEngine.ILogger UnityEngine.Debug::s_Logger
RuntimeObject* ___s_Logger_0;
public:
inline static int32_t get_offset_of_s_Logger_0() { return static_cast<int32_t>(offsetof(Debug_t3317548046_StaticFields, ___s_Logger_0)); }
inline RuntimeObject* get_s_Logger_0() const { return ___s_Logger_0; }
inline RuntimeObject** get_address_of_s_Logger_0() { return &___s_Logger_0; }
inline void set_s_Logger_0(RuntimeObject* value)
{
___s_Logger_0 = value;
Il2CppCodeGenWriteBarrier((&___s_Logger_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DEBUG_T3317548046_H
#ifndef SCREEN_T3860757715_H
#define SCREEN_T3860757715_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Screen
struct Screen_t3860757715 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SCREEN_T3860757715_H
#ifndef DATAUTILITY_T2196215967_H
#define DATAUTILITY_T2196215967_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Sprites.DataUtility
struct DataUtility_t2196215967 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DATAUTILITY_T2196215967_H
#ifndef ATTRIBUTEHELPERENGINE_T2735742303_H
#define ATTRIBUTEHELPERENGINE_T2735742303_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AttributeHelperEngine
struct AttributeHelperEngine_t2735742303 : public RuntimeObject
{
public:
public:
};
struct AttributeHelperEngine_t2735742303_StaticFields
{
public:
// UnityEngine.DisallowMultipleComponent[] UnityEngine.AttributeHelperEngine::_disallowMultipleComponentArray
DisallowMultipleComponentU5BU5D_t3936143868* ____disallowMultipleComponentArray_0;
// UnityEngine.ExecuteInEditMode[] UnityEngine.AttributeHelperEngine::_executeInEditModeArray
ExecuteInEditModeU5BU5D_t3239458680* ____executeInEditModeArray_1;
// UnityEngine.RequireComponent[] UnityEngine.AttributeHelperEngine::_requireComponentArray
RequireComponentU5BU5D_t2245623724* ____requireComponentArray_2;
public:
inline static int32_t get_offset_of__disallowMultipleComponentArray_0() { return static_cast<int32_t>(offsetof(AttributeHelperEngine_t2735742303_StaticFields, ____disallowMultipleComponentArray_0)); }
inline DisallowMultipleComponentU5BU5D_t3936143868* get__disallowMultipleComponentArray_0() const { return ____disallowMultipleComponentArray_0; }
inline DisallowMultipleComponentU5BU5D_t3936143868** get_address_of__disallowMultipleComponentArray_0() { return &____disallowMultipleComponentArray_0; }
inline void set__disallowMultipleComponentArray_0(DisallowMultipleComponentU5BU5D_t3936143868* value)
{
____disallowMultipleComponentArray_0 = value;
Il2CppCodeGenWriteBarrier((&____disallowMultipleComponentArray_0), value);
}
inline static int32_t get_offset_of__executeInEditModeArray_1() { return static_cast<int32_t>(offsetof(AttributeHelperEngine_t2735742303_StaticFields, ____executeInEditModeArray_1)); }
inline ExecuteInEditModeU5BU5D_t3239458680* get__executeInEditModeArray_1() const { return ____executeInEditModeArray_1; }
inline ExecuteInEditModeU5BU5D_t3239458680** get_address_of__executeInEditModeArray_1() { return &____executeInEditModeArray_1; }
inline void set__executeInEditModeArray_1(ExecuteInEditModeU5BU5D_t3239458680* value)
{
____executeInEditModeArray_1 = value;
Il2CppCodeGenWriteBarrier((&____executeInEditModeArray_1), value);
}
inline static int32_t get_offset_of__requireComponentArray_2() { return static_cast<int32_t>(offsetof(AttributeHelperEngine_t2735742303_StaticFields, ____requireComponentArray_2)); }
inline RequireComponentU5BU5D_t2245623724* get__requireComponentArray_2() const { return ____requireComponentArray_2; }
inline RequireComponentU5BU5D_t2245623724** get_address_of__requireComponentArray_2() { return &____requireComponentArray_2; }
inline void set__requireComponentArray_2(RequireComponentU5BU5D_t2245623724* value)
{
____requireComponentArray_2 = value;
Il2CppCodeGenWriteBarrier((&____requireComponentArray_2), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ATTRIBUTEHELPERENGINE_T2735742303_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 SPRITEATLASMANAGER_T3158462485_H
#define SPRITEATLASMANAGER_T3158462485_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.U2D.SpriteAtlasManager
struct SpriteAtlasManager_t3158462485 : public RuntimeObject
{
public:
public:
};
struct SpriteAtlasManager_t3158462485_StaticFields
{
public:
// UnityEngine.U2D.SpriteAtlasManager/RequestAtlasCallback UnityEngine.U2D.SpriteAtlasManager::atlasRequested
RequestAtlasCallback_t3100554279 * ___atlasRequested_0;
// System.Action`1<UnityEngine.U2D.SpriteAtlas> UnityEngine.U2D.SpriteAtlasManager::<>f__mg$cache0
Action_1_t819399007 * ___U3CU3Ef__mgU24cache0_1;
public:
inline static int32_t get_offset_of_atlasRequested_0() { return static_cast<int32_t>(offsetof(SpriteAtlasManager_t3158462485_StaticFields, ___atlasRequested_0)); }
inline RequestAtlasCallback_t3100554279 * get_atlasRequested_0() const { return ___atlasRequested_0; }
inline RequestAtlasCallback_t3100554279 ** get_address_of_atlasRequested_0() { return &___atlasRequested_0; }
inline void set_atlasRequested_0(RequestAtlasCallback_t3100554279 * value)
{
___atlasRequested_0 = value;
Il2CppCodeGenWriteBarrier((&___atlasRequested_0), value);
}
inline static int32_t get_offset_of_U3CU3Ef__mgU24cache0_1() { return static_cast<int32_t>(offsetof(SpriteAtlasManager_t3158462485_StaticFields, ___U3CU3Ef__mgU24cache0_1)); }
inline Action_1_t819399007 * get_U3CU3Ef__mgU24cache0_1() const { return ___U3CU3Ef__mgU24cache0_1; }
inline Action_1_t819399007 ** get_address_of_U3CU3Ef__mgU24cache0_1() { return &___U3CU3Ef__mgU24cache0_1; }
inline void set_U3CU3Ef__mgU24cache0_1(Action_1_t819399007 * value)
{
___U3CU3Ef__mgU24cache0_1 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__mgU24cache0_1), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SPRITEATLASMANAGER_T3158462485_H
#ifndef BEFORERENDERHELPER_T1336903776_H
#define BEFORERENDERHELPER_T1336903776_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.BeforeRenderHelper
struct BeforeRenderHelper_t1336903776 : public RuntimeObject
{
public:
public:
};
struct BeforeRenderHelper_t1336903776_StaticFields
{
public:
// System.Collections.Generic.List`1<UnityEngine.BeforeRenderHelper/OrderBlock> UnityEngine.BeforeRenderHelper::s_OrderBlocks
List_1_t3058052573 * ___s_OrderBlocks_0;
public:
inline static int32_t get_offset_of_s_OrderBlocks_0() { return static_cast<int32_t>(offsetof(BeforeRenderHelper_t1336903776_StaticFields, ___s_OrderBlocks_0)); }
inline List_1_t3058052573 * get_s_OrderBlocks_0() const { return ___s_OrderBlocks_0; }
inline List_1_t3058052573 ** get_address_of_s_OrderBlocks_0() { return &___s_OrderBlocks_0; }
inline void set_s_OrderBlocks_0(List_1_t3058052573 * value)
{
___s_OrderBlocks_0 = value;
Il2CppCodeGenWriteBarrier((&___s_OrderBlocks_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BEFORERENDERHELPER_T1336903776_H
#ifndef NOALLOCHELPERS_T1437076930_H
#define NOALLOCHELPERS_T1437076930_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.NoAllocHelpers
struct NoAllocHelpers_t1437076930 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // NOALLOCHELPERS_T1437076930_H
#ifndef UNHANDLEDEXCEPTIONHANDLER_T1162846485_H
#define UNHANDLEDEXCEPTIONHANDLER_T1162846485_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UnhandledExceptionHandler
struct UnhandledExceptionHandler_t1162846485 : public RuntimeObject
{
public:
public:
};
struct UnhandledExceptionHandler_t1162846485_StaticFields
{
public:
// System.UnhandledExceptionEventHandler UnityEngine.UnhandledExceptionHandler::<>f__mg$cache0
UnhandledExceptionEventHandler_t3101989324 * ___U3CU3Ef__mgU24cache0_0;
public:
inline static int32_t get_offset_of_U3CU3Ef__mgU24cache0_0() { return static_cast<int32_t>(offsetof(UnhandledExceptionHandler_t1162846485_StaticFields, ___U3CU3Ef__mgU24cache0_0)); }
inline UnhandledExceptionEventHandler_t3101989324 * get_U3CU3Ef__mgU24cache0_0() const { return ___U3CU3Ef__mgU24cache0_0; }
inline UnhandledExceptionEventHandler_t3101989324 ** get_address_of_U3CU3Ef__mgU24cache0_0() { return &___U3CU3Ef__mgU24cache0_0; }
inline void set_U3CU3Ef__mgU24cache0_0(UnhandledExceptionEventHandler_t3101989324 * value)
{
___U3CU3Ef__mgU24cache0_0 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__mgU24cache0_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // UNHANDLEDEXCEPTIONHANDLER_T1162846485_H
#ifndef ENUMERATOR_T3442430665_H
#define ENUMERATOR_T3442430665_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Transform/Enumerator
struct Enumerator_t3442430665 : public RuntimeObject
{
public:
// UnityEngine.Transform UnityEngine.Transform/Enumerator::outer
Transform_t3600365921 * ___outer_0;
// System.Int32 UnityEngine.Transform/Enumerator::currentIndex
int32_t ___currentIndex_1;
public:
inline static int32_t get_offset_of_outer_0() { return static_cast<int32_t>(offsetof(Enumerator_t3442430665, ___outer_0)); }
inline Transform_t3600365921 * get_outer_0() const { return ___outer_0; }
inline Transform_t3600365921 ** get_address_of_outer_0() { return &___outer_0; }
inline void set_outer_0(Transform_t3600365921 * value)
{
___outer_0 = value;
Il2CppCodeGenWriteBarrier((&___outer_0), value);
}
inline static int32_t get_offset_of_currentIndex_1() { return static_cast<int32_t>(offsetof(Enumerator_t3442430665, ___currentIndex_1)); }
inline int32_t get_currentIndex_1() const { return ___currentIndex_1; }
inline int32_t* get_address_of_currentIndex_1() { return &___currentIndex_1; }
inline void set_currentIndex_1(int32_t value)
{
___currentIndex_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ENUMERATOR_T3442430665_H
#ifndef YIELDINSTRUCTION_T403091072_H
#define YIELDINSTRUCTION_T403091072_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.YieldInstruction
struct YieldInstruction_t403091072 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.YieldInstruction
struct YieldInstruction_t403091072_marshaled_pinvoke
{
};
// Native definition for COM marshalling of UnityEngine.YieldInstruction
struct YieldInstruction_t403091072_marshaled_com
{
};
#endif // YIELDINSTRUCTION_T403091072_H
#ifndef ATTRIBUTE_T861562559_H
#define ATTRIBUTE_T861562559_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Attribute
struct Attribute_t861562559 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ATTRIBUTE_T861562559_H
#ifndef GRAPHICS_T783367614_H
#define GRAPHICS_T783367614_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Graphics
struct Graphics_t783367614 : public RuntimeObject
{
public:
public:
};
struct Graphics_t783367614_StaticFields
{
public:
// System.Int32 UnityEngine.Graphics::kMaxDrawMeshInstanceCount
int32_t ___kMaxDrawMeshInstanceCount_0;
public:
inline static int32_t get_offset_of_kMaxDrawMeshInstanceCount_0() { return static_cast<int32_t>(offsetof(Graphics_t783367614_StaticFields, ___kMaxDrawMeshInstanceCount_0)); }
inline int32_t get_kMaxDrawMeshInstanceCount_0() const { return ___kMaxDrawMeshInstanceCount_0; }
inline int32_t* get_address_of_kMaxDrawMeshInstanceCount_0() { return &___kMaxDrawMeshInstanceCount_0; }
inline void set_kMaxDrawMeshInstanceCount_0(int32_t value)
{
___kMaxDrawMeshInstanceCount_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // GRAPHICS_T783367614_H
#ifndef CURSOR_T1422555833_H
#define CURSOR_T1422555833_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Cursor
struct Cursor_t1422555833 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CURSOR_T1422555833_H
#ifndef SCENEMANAGER_T2787271929_H
#define SCENEMANAGER_T2787271929_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.SceneManagement.SceneManager
struct SceneManager_t2787271929 : public RuntimeObject
{
public:
public:
};
struct SceneManager_t2787271929_StaticFields
{
public:
// UnityEngine.Events.UnityAction`2<UnityEngine.SceneManagement.Scene,UnityEngine.SceneManagement.LoadSceneMode> UnityEngine.SceneManagement.SceneManager::sceneLoaded
UnityAction_2_t2165061829 * ___sceneLoaded_0;
// UnityEngine.Events.UnityAction`1<UnityEngine.SceneManagement.Scene> UnityEngine.SceneManagement.SceneManager::sceneUnloaded
UnityAction_1_t2933211702 * ___sceneUnloaded_1;
// UnityEngine.Events.UnityAction`2<UnityEngine.SceneManagement.Scene,UnityEngine.SceneManagement.Scene> UnityEngine.SceneManagement.SceneManager::activeSceneChanged
UnityAction_2_t1262235195 * ___activeSceneChanged_2;
public:
inline static int32_t get_offset_of_sceneLoaded_0() { return static_cast<int32_t>(offsetof(SceneManager_t2787271929_StaticFields, ___sceneLoaded_0)); }
inline UnityAction_2_t2165061829 * get_sceneLoaded_0() const { return ___sceneLoaded_0; }
inline UnityAction_2_t2165061829 ** get_address_of_sceneLoaded_0() { return &___sceneLoaded_0; }
inline void set_sceneLoaded_0(UnityAction_2_t2165061829 * value)
{
___sceneLoaded_0 = value;
Il2CppCodeGenWriteBarrier((&___sceneLoaded_0), value);
}
inline static int32_t get_offset_of_sceneUnloaded_1() { return static_cast<int32_t>(offsetof(SceneManager_t2787271929_StaticFields, ___sceneUnloaded_1)); }
inline UnityAction_1_t2933211702 * get_sceneUnloaded_1() const { return ___sceneUnloaded_1; }
inline UnityAction_1_t2933211702 ** get_address_of_sceneUnloaded_1() { return &___sceneUnloaded_1; }
inline void set_sceneUnloaded_1(UnityAction_1_t2933211702 * value)
{
___sceneUnloaded_1 = value;
Il2CppCodeGenWriteBarrier((&___sceneUnloaded_1), value);
}
inline static int32_t get_offset_of_activeSceneChanged_2() { return static_cast<int32_t>(offsetof(SceneManager_t2787271929_StaticFields, ___activeSceneChanged_2)); }
inline UnityAction_2_t1262235195 * get_activeSceneChanged_2() const { return ___activeSceneChanged_2; }
inline UnityAction_2_t1262235195 ** get_address_of_activeSceneChanged_2() { return &___activeSceneChanged_2; }
inline void set_activeSceneChanged_2(UnityAction_2_t1262235195 * value)
{
___activeSceneChanged_2 = value;
Il2CppCodeGenWriteBarrier((&___activeSceneChanged_2), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SCENEMANAGER_T2787271929_H
#ifndef RESOURCES_T2942265397_H
#define RESOURCES_T2942265397_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Resources
struct Resources_t2942265397 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RESOURCES_T2942265397_H
#ifndef VECTOR4_T3319028937_H
#define VECTOR4_T3319028937_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Vector4
struct Vector4_t3319028937
{
public:
// System.Single UnityEngine.Vector4::x
float ___x_1;
// System.Single UnityEngine.Vector4::y
float ___y_2;
// System.Single UnityEngine.Vector4::z
float ___z_3;
// System.Single UnityEngine.Vector4::w
float ___w_4;
public:
inline static int32_t get_offset_of_x_1() { return static_cast<int32_t>(offsetof(Vector4_t3319028937, ___x_1)); }
inline float get_x_1() const { return ___x_1; }
inline float* get_address_of_x_1() { return &___x_1; }
inline void set_x_1(float value)
{
___x_1 = value;
}
inline static int32_t get_offset_of_y_2() { return static_cast<int32_t>(offsetof(Vector4_t3319028937, ___y_2)); }
inline float get_y_2() const { return ___y_2; }
inline float* get_address_of_y_2() { return &___y_2; }
inline void set_y_2(float value)
{
___y_2 = value;
}
inline static int32_t get_offset_of_z_3() { return static_cast<int32_t>(offsetof(Vector4_t3319028937, ___z_3)); }
inline float get_z_3() const { return ___z_3; }
inline float* get_address_of_z_3() { return &___z_3; }
inline void set_z_3(float value)
{
___z_3 = value;
}
inline static int32_t get_offset_of_w_4() { return static_cast<int32_t>(offsetof(Vector4_t3319028937, ___w_4)); }
inline float get_w_4() const { return ___w_4; }
inline float* get_address_of_w_4() { return &___w_4; }
inline void set_w_4(float value)
{
___w_4 = value;
}
};
struct Vector4_t3319028937_StaticFields
{
public:
// UnityEngine.Vector4 UnityEngine.Vector4::zeroVector
Vector4_t3319028937 ___zeroVector_5;
// UnityEngine.Vector4 UnityEngine.Vector4::oneVector
Vector4_t3319028937 ___oneVector_6;
// UnityEngine.Vector4 UnityEngine.Vector4::positiveInfinityVector
Vector4_t3319028937 ___positiveInfinityVector_7;
// UnityEngine.Vector4 UnityEngine.Vector4::negativeInfinityVector
Vector4_t3319028937 ___negativeInfinityVector_8;
public:
inline static int32_t get_offset_of_zeroVector_5() { return static_cast<int32_t>(offsetof(Vector4_t3319028937_StaticFields, ___zeroVector_5)); }
inline Vector4_t3319028937 get_zeroVector_5() const { return ___zeroVector_5; }
inline Vector4_t3319028937 * get_address_of_zeroVector_5() { return &___zeroVector_5; }
inline void set_zeroVector_5(Vector4_t3319028937 value)
{
___zeroVector_5 = value;
}
inline static int32_t get_offset_of_oneVector_6() { return static_cast<int32_t>(offsetof(Vector4_t3319028937_StaticFields, ___oneVector_6)); }
inline Vector4_t3319028937 get_oneVector_6() const { return ___oneVector_6; }
inline Vector4_t3319028937 * get_address_of_oneVector_6() { return &___oneVector_6; }
inline void set_oneVector_6(Vector4_t3319028937 value)
{
___oneVector_6 = value;
}
inline static int32_t get_offset_of_positiveInfinityVector_7() { return static_cast<int32_t>(offsetof(Vector4_t3319028937_StaticFields, ___positiveInfinityVector_7)); }
inline Vector4_t3319028937 get_positiveInfinityVector_7() const { return ___positiveInfinityVector_7; }
inline Vector4_t3319028937 * get_address_of_positiveInfinityVector_7() { return &___positiveInfinityVector_7; }
inline void set_positiveInfinityVector_7(Vector4_t3319028937 value)
{
___positiveInfinityVector_7 = value;
}
inline static int32_t get_offset_of_negativeInfinityVector_8() { return static_cast<int32_t>(offsetof(Vector4_t3319028937_StaticFields, ___negativeInfinityVector_8)); }
inline Vector4_t3319028937 get_negativeInfinityVector_8() const { return ___negativeInfinityVector_8; }
inline Vector4_t3319028937 * get_address_of_negativeInfinityVector_8() { return &___negativeInfinityVector_8; }
inline void set_negativeInfinityVector_8(Vector4_t3319028937 value)
{
___negativeInfinityVector_8 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VECTOR4_T3319028937_H
#ifndef CONTEXTMENU_T1295656858_H
#define CONTEXTMENU_T1295656858_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.ContextMenu
struct ContextMenu_t1295656858 : public Attribute_t861562559
{
public:
// System.String UnityEngine.ContextMenu::menuItem
String_t* ___menuItem_0;
// System.Boolean UnityEngine.ContextMenu::validate
bool ___validate_1;
// System.Int32 UnityEngine.ContextMenu::priority
int32_t ___priority_2;
public:
inline static int32_t get_offset_of_menuItem_0() { return static_cast<int32_t>(offsetof(ContextMenu_t1295656858, ___menuItem_0)); }
inline String_t* get_menuItem_0() const { return ___menuItem_0; }
inline String_t** get_address_of_menuItem_0() { return &___menuItem_0; }
inline void set_menuItem_0(String_t* value)
{
___menuItem_0 = value;
Il2CppCodeGenWriteBarrier((&___menuItem_0), value);
}
inline static int32_t get_offset_of_validate_1() { return static_cast<int32_t>(offsetof(ContextMenu_t1295656858, ___validate_1)); }
inline bool get_validate_1() const { return ___validate_1; }
inline bool* get_address_of_validate_1() { return &___validate_1; }
inline void set_validate_1(bool value)
{
___validate_1 = value;
}
inline static int32_t get_offset_of_priority_2() { return static_cast<int32_t>(offsetof(ContextMenu_t1295656858, ___priority_2)); }
inline int32_t get_priority_2() const { return ___priority_2; }
inline int32_t* get_address_of_priority_2() { return &___priority_2; }
inline void set_priority_2(int32_t value)
{
___priority_2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CONTEXTMENU_T1295656858_H
#ifndef ORDERBLOCK_T1585977831_H
#define ORDERBLOCK_T1585977831_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.BeforeRenderHelper/OrderBlock
struct OrderBlock_t1585977831
{
public:
// System.Int32 UnityEngine.BeforeRenderHelper/OrderBlock::order
int32_t ___order_0;
// UnityEngine.Events.UnityAction UnityEngine.BeforeRenderHelper/OrderBlock::callback
UnityAction_t3245792599 * ___callback_1;
public:
inline static int32_t get_offset_of_order_0() { return static_cast<int32_t>(offsetof(OrderBlock_t1585977831, ___order_0)); }
inline int32_t get_order_0() const { return ___order_0; }
inline int32_t* get_address_of_order_0() { return &___order_0; }
inline void set_order_0(int32_t value)
{
___order_0 = value;
}
inline static int32_t get_offset_of_callback_1() { return static_cast<int32_t>(offsetof(OrderBlock_t1585977831, ___callback_1)); }
inline UnityAction_t3245792599 * get_callback_1() const { return ___callback_1; }
inline UnityAction_t3245792599 ** get_address_of_callback_1() { return &___callback_1; }
inline void set_callback_1(UnityAction_t3245792599 * value)
{
___callback_1 = value;
Il2CppCodeGenWriteBarrier((&___callback_1), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.BeforeRenderHelper/OrderBlock
struct OrderBlock_t1585977831_marshaled_pinvoke
{
int32_t ___order_0;
Il2CppMethodPointer ___callback_1;
};
// Native definition for COM marshalling of UnityEngine.BeforeRenderHelper/OrderBlock
struct OrderBlock_t1585977831_marshaled_com
{
int32_t ___order_0;
Il2CppMethodPointer ___callback_1;
};
#endif // ORDERBLOCK_T1585977831_H
#ifndef NATIVECLASSATTRIBUTE_T2601352714_H
#define NATIVECLASSATTRIBUTE_T2601352714_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.NativeClassAttribute
struct NativeClassAttribute_t2601352714 : public Attribute_t861562559
{
public:
// System.String UnityEngine.NativeClassAttribute::<QualifiedNativeName>k__BackingField
String_t* ___U3CQualifiedNativeNameU3Ek__BackingField_0;
public:
inline static int32_t get_offset_of_U3CQualifiedNativeNameU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(NativeClassAttribute_t2601352714, ___U3CQualifiedNativeNameU3Ek__BackingField_0)); }
inline String_t* get_U3CQualifiedNativeNameU3Ek__BackingField_0() const { return ___U3CQualifiedNativeNameU3Ek__BackingField_0; }
inline String_t** get_address_of_U3CQualifiedNativeNameU3Ek__BackingField_0() { return &___U3CQualifiedNativeNameU3Ek__BackingField_0; }
inline void set_U3CQualifiedNativeNameU3Ek__BackingField_0(String_t* value)
{
___U3CQualifiedNativeNameU3Ek__BackingField_0 = value;
Il2CppCodeGenWriteBarrier((&___U3CQualifiedNativeNameU3Ek__BackingField_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // NATIVECLASSATTRIBUTE_T2601352714_H
#ifndef SPHERICALHARMONICSL2_T3220866195_H
#define SPHERICALHARMONICSL2_T3220866195_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Rendering.SphericalHarmonicsL2
struct SphericalHarmonicsL2_t3220866195
{
public:
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shr0
float ___shr0_0;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shr1
float ___shr1_1;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shr2
float ___shr2_2;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shr3
float ___shr3_3;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shr4
float ___shr4_4;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shr5
float ___shr5_5;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shr6
float ___shr6_6;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shr7
float ___shr7_7;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shr8
float ___shr8_8;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shg0
float ___shg0_9;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shg1
float ___shg1_10;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shg2
float ___shg2_11;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shg3
float ___shg3_12;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shg4
float ___shg4_13;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shg5
float ___shg5_14;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shg6
float ___shg6_15;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shg7
float ___shg7_16;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shg8
float ___shg8_17;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shb0
float ___shb0_18;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shb1
float ___shb1_19;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shb2
float ___shb2_20;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shb3
float ___shb3_21;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shb4
float ___shb4_22;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shb5
float ___shb5_23;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shb6
float ___shb6_24;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shb7
float ___shb7_25;
// System.Single UnityEngine.Rendering.SphericalHarmonicsL2::shb8
float ___shb8_26;
public:
inline static int32_t get_offset_of_shr0_0() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shr0_0)); }
inline float get_shr0_0() const { return ___shr0_0; }
inline float* get_address_of_shr0_0() { return &___shr0_0; }
inline void set_shr0_0(float value)
{
___shr0_0 = value;
}
inline static int32_t get_offset_of_shr1_1() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shr1_1)); }
inline float get_shr1_1() const { return ___shr1_1; }
inline float* get_address_of_shr1_1() { return &___shr1_1; }
inline void set_shr1_1(float value)
{
___shr1_1 = value;
}
inline static int32_t get_offset_of_shr2_2() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shr2_2)); }
inline float get_shr2_2() const { return ___shr2_2; }
inline float* get_address_of_shr2_2() { return &___shr2_2; }
inline void set_shr2_2(float value)
{
___shr2_2 = value;
}
inline static int32_t get_offset_of_shr3_3() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shr3_3)); }
inline float get_shr3_3() const { return ___shr3_3; }
inline float* get_address_of_shr3_3() { return &___shr3_3; }
inline void set_shr3_3(float value)
{
___shr3_3 = value;
}
inline static int32_t get_offset_of_shr4_4() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shr4_4)); }
inline float get_shr4_4() const { return ___shr4_4; }
inline float* get_address_of_shr4_4() { return &___shr4_4; }
inline void set_shr4_4(float value)
{
___shr4_4 = value;
}
inline static int32_t get_offset_of_shr5_5() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shr5_5)); }
inline float get_shr5_5() const { return ___shr5_5; }
inline float* get_address_of_shr5_5() { return &___shr5_5; }
inline void set_shr5_5(float value)
{
___shr5_5 = value;
}
inline static int32_t get_offset_of_shr6_6() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shr6_6)); }
inline float get_shr6_6() const { return ___shr6_6; }
inline float* get_address_of_shr6_6() { return &___shr6_6; }
inline void set_shr6_6(float value)
{
___shr6_6 = value;
}
inline static int32_t get_offset_of_shr7_7() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shr7_7)); }
inline float get_shr7_7() const { return ___shr7_7; }
inline float* get_address_of_shr7_7() { return &___shr7_7; }
inline void set_shr7_7(float value)
{
___shr7_7 = value;
}
inline static int32_t get_offset_of_shr8_8() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shr8_8)); }
inline float get_shr8_8() const { return ___shr8_8; }
inline float* get_address_of_shr8_8() { return &___shr8_8; }
inline void set_shr8_8(float value)
{
___shr8_8 = value;
}
inline static int32_t get_offset_of_shg0_9() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shg0_9)); }
inline float get_shg0_9() const { return ___shg0_9; }
inline float* get_address_of_shg0_9() { return &___shg0_9; }
inline void set_shg0_9(float value)
{
___shg0_9 = value;
}
inline static int32_t get_offset_of_shg1_10() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shg1_10)); }
inline float get_shg1_10() const { return ___shg1_10; }
inline float* get_address_of_shg1_10() { return &___shg1_10; }
inline void set_shg1_10(float value)
{
___shg1_10 = value;
}
inline static int32_t get_offset_of_shg2_11() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shg2_11)); }
inline float get_shg2_11() const { return ___shg2_11; }
inline float* get_address_of_shg2_11() { return &___shg2_11; }
inline void set_shg2_11(float value)
{
___shg2_11 = value;
}
inline static int32_t get_offset_of_shg3_12() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shg3_12)); }
inline float get_shg3_12() const { return ___shg3_12; }
inline float* get_address_of_shg3_12() { return &___shg3_12; }
inline void set_shg3_12(float value)
{
___shg3_12 = value;
}
inline static int32_t get_offset_of_shg4_13() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shg4_13)); }
inline float get_shg4_13() const { return ___shg4_13; }
inline float* get_address_of_shg4_13() { return &___shg4_13; }
inline void set_shg4_13(float value)
{
___shg4_13 = value;
}
inline static int32_t get_offset_of_shg5_14() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shg5_14)); }
inline float get_shg5_14() const { return ___shg5_14; }
inline float* get_address_of_shg5_14() { return &___shg5_14; }
inline void set_shg5_14(float value)
{
___shg5_14 = value;
}
inline static int32_t get_offset_of_shg6_15() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shg6_15)); }
inline float get_shg6_15() const { return ___shg6_15; }
inline float* get_address_of_shg6_15() { return &___shg6_15; }
inline void set_shg6_15(float value)
{
___shg6_15 = value;
}
inline static int32_t get_offset_of_shg7_16() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shg7_16)); }
inline float get_shg7_16() const { return ___shg7_16; }
inline float* get_address_of_shg7_16() { return &___shg7_16; }
inline void set_shg7_16(float value)
{
___shg7_16 = value;
}
inline static int32_t get_offset_of_shg8_17() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shg8_17)); }
inline float get_shg8_17() const { return ___shg8_17; }
inline float* get_address_of_shg8_17() { return &___shg8_17; }
inline void set_shg8_17(float value)
{
___shg8_17 = value;
}
inline static int32_t get_offset_of_shb0_18() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shb0_18)); }
inline float get_shb0_18() const { return ___shb0_18; }
inline float* get_address_of_shb0_18() { return &___shb0_18; }
inline void set_shb0_18(float value)
{
___shb0_18 = value;
}
inline static int32_t get_offset_of_shb1_19() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shb1_19)); }
inline float get_shb1_19() const { return ___shb1_19; }
inline float* get_address_of_shb1_19() { return &___shb1_19; }
inline void set_shb1_19(float value)
{
___shb1_19 = value;
}
inline static int32_t get_offset_of_shb2_20() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shb2_20)); }
inline float get_shb2_20() const { return ___shb2_20; }
inline float* get_address_of_shb2_20() { return &___shb2_20; }
inline void set_shb2_20(float value)
{
___shb2_20 = value;
}
inline static int32_t get_offset_of_shb3_21() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shb3_21)); }
inline float get_shb3_21() const { return ___shb3_21; }
inline float* get_address_of_shb3_21() { return &___shb3_21; }
inline void set_shb3_21(float value)
{
___shb3_21 = value;
}
inline static int32_t get_offset_of_shb4_22() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shb4_22)); }
inline float get_shb4_22() const { return ___shb4_22; }
inline float* get_address_of_shb4_22() { return &___shb4_22; }
inline void set_shb4_22(float value)
{
___shb4_22 = value;
}
inline static int32_t get_offset_of_shb5_23() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shb5_23)); }
inline float get_shb5_23() const { return ___shb5_23; }
inline float* get_address_of_shb5_23() { return &___shb5_23; }
inline void set_shb5_23(float value)
{
___shb5_23 = value;
}
inline static int32_t get_offset_of_shb6_24() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shb6_24)); }
inline float get_shb6_24() const { return ___shb6_24; }
inline float* get_address_of_shb6_24() { return &___shb6_24; }
inline void set_shb6_24(float value)
{
___shb6_24 = value;
}
inline static int32_t get_offset_of_shb7_25() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shb7_25)); }
inline float get_shb7_25() const { return ___shb7_25; }
inline float* get_address_of_shb7_25() { return &___shb7_25; }
inline void set_shb7_25(float value)
{
___shb7_25 = value;
}
inline static int32_t get_offset_of_shb8_26() { return static_cast<int32_t>(offsetof(SphericalHarmonicsL2_t3220866195, ___shb8_26)); }
inline float get_shb8_26() const { return ___shb8_26; }
inline float* get_address_of_shb8_26() { return &___shb8_26; }
inline void set_shb8_26(float value)
{
___shb8_26 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SPHERICALHARMONICSL2_T3220866195_H
#ifndef SORTINGLAYER_T2251519173_H
#define SORTINGLAYER_T2251519173_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.SortingLayer
struct SortingLayer_t2251519173
{
public:
// System.Int32 UnityEngine.SortingLayer::m_Id
int32_t ___m_Id_0;
public:
inline static int32_t get_offset_of_m_Id_0() { return static_cast<int32_t>(offsetof(SortingLayer_t2251519173, ___m_Id_0)); }
inline int32_t get_m_Id_0() const { return ___m_Id_0; }
inline int32_t* get_address_of_m_Id_0() { return &___m_Id_0; }
inline void set_m_Id_0(int32_t value)
{
___m_Id_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SORTINGLAYER_T2251519173_H
#ifndef DEFAULTEXECUTIONORDER_T3059642329_H
#define DEFAULTEXECUTIONORDER_T3059642329_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.DefaultExecutionOrder
struct DefaultExecutionOrder_t3059642329 : public Attribute_t861562559
{
public:
// System.Int32 UnityEngine.DefaultExecutionOrder::<order>k__BackingField
int32_t ___U3CorderU3Ek__BackingField_0;
public:
inline static int32_t get_offset_of_U3CorderU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(DefaultExecutionOrder_t3059642329, ___U3CorderU3Ek__BackingField_0)); }
inline int32_t get_U3CorderU3Ek__BackingField_0() const { return ___U3CorderU3Ek__BackingField_0; }
inline int32_t* get_address_of_U3CorderU3Ek__BackingField_0() { return &___U3CorderU3Ek__BackingField_0; }
inline void set_U3CorderU3Ek__BackingField_0(int32_t value)
{
___U3CorderU3Ek__BackingField_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DEFAULTEXECUTIONORDER_T3059642329_H
#ifndef COLOR_T2555686324_H
#define COLOR_T2555686324_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Color
struct Color_t2555686324
{
public:
// System.Single UnityEngine.Color::r
float ___r_0;
// System.Single UnityEngine.Color::g
float ___g_1;
// System.Single UnityEngine.Color::b
float ___b_2;
// System.Single UnityEngine.Color::a
float ___a_3;
public:
inline static int32_t get_offset_of_r_0() { return static_cast<int32_t>(offsetof(Color_t2555686324, ___r_0)); }
inline float get_r_0() const { return ___r_0; }
inline float* get_address_of_r_0() { return &___r_0; }
inline void set_r_0(float value)
{
___r_0 = value;
}
inline static int32_t get_offset_of_g_1() { return static_cast<int32_t>(offsetof(Color_t2555686324, ___g_1)); }
inline float get_g_1() const { return ___g_1; }
inline float* get_address_of_g_1() { return &___g_1; }
inline void set_g_1(float value)
{
___g_1 = value;
}
inline static int32_t get_offset_of_b_2() { return static_cast<int32_t>(offsetof(Color_t2555686324, ___b_2)); }
inline float get_b_2() const { return ___b_2; }
inline float* get_address_of_b_2() { return &___b_2; }
inline void set_b_2(float value)
{
___b_2 = value;
}
inline static int32_t get_offset_of_a_3() { return static_cast<int32_t>(offsetof(Color_t2555686324, ___a_3)); }
inline float get_a_3() const { return ___a_3; }
inline float* get_address_of_a_3() { return &___a_3; }
inline void set_a_3(float value)
{
___a_3 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COLOR_T2555686324_H
#ifndef SCENE_T2348375561_H
#define SCENE_T2348375561_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.SceneManagement.Scene
struct Scene_t2348375561
{
public:
// System.Int32 UnityEngine.SceneManagement.Scene::m_Handle
int32_t ___m_Handle_0;
public:
inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(Scene_t2348375561, ___m_Handle_0)); }
inline int32_t get_m_Handle_0() const { return ___m_Handle_0; }
inline int32_t* get_address_of_m_Handle_0() { return &___m_Handle_0; }
inline void set_m_Handle_0(int32_t value)
{
___m_Handle_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SCENE_T2348375561_H
#ifndef EXCLUDEFROMPRESETATTRIBUTE_T3751627762_H
#define EXCLUDEFROMPRESETATTRIBUTE_T3751627762_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.ExcludeFromPresetAttribute
struct ExcludeFromPresetAttribute_t3751627762 : public Attribute_t861562559
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // EXCLUDEFROMPRESETATTRIBUTE_T3751627762_H
#ifndef EXECUTEINEDITMODE_T3727731349_H
#define EXECUTEINEDITMODE_T3727731349_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.ExecuteInEditMode
struct ExecuteInEditMode_t3727731349 : public Attribute_t861562559
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // EXECUTEINEDITMODE_T3727731349_H
#ifndef CREATEASSETMENUATTRIBUTE_T2029823454_H
#define CREATEASSETMENUATTRIBUTE_T2029823454_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.CreateAssetMenuAttribute
struct CreateAssetMenuAttribute_t2029823454 : public Attribute_t861562559
{
public:
// System.String UnityEngine.CreateAssetMenuAttribute::<menuName>k__BackingField
String_t* ___U3CmenuNameU3Ek__BackingField_0;
// System.String UnityEngine.CreateAssetMenuAttribute::<fileName>k__BackingField
String_t* ___U3CfileNameU3Ek__BackingField_1;
// System.Int32 UnityEngine.CreateAssetMenuAttribute::<order>k__BackingField
int32_t ___U3CorderU3Ek__BackingField_2;
public:
inline static int32_t get_offset_of_U3CmenuNameU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(CreateAssetMenuAttribute_t2029823454, ___U3CmenuNameU3Ek__BackingField_0)); }
inline String_t* get_U3CmenuNameU3Ek__BackingField_0() const { return ___U3CmenuNameU3Ek__BackingField_0; }
inline String_t** get_address_of_U3CmenuNameU3Ek__BackingField_0() { return &___U3CmenuNameU3Ek__BackingField_0; }
inline void set_U3CmenuNameU3Ek__BackingField_0(String_t* value)
{
___U3CmenuNameU3Ek__BackingField_0 = value;
Il2CppCodeGenWriteBarrier((&___U3CmenuNameU3Ek__BackingField_0), value);
}
inline static int32_t get_offset_of_U3CfileNameU3Ek__BackingField_1() { return static_cast<int32_t>(offsetof(CreateAssetMenuAttribute_t2029823454, ___U3CfileNameU3Ek__BackingField_1)); }
inline String_t* get_U3CfileNameU3Ek__BackingField_1() const { return ___U3CfileNameU3Ek__BackingField_1; }
inline String_t** get_address_of_U3CfileNameU3Ek__BackingField_1() { return &___U3CfileNameU3Ek__BackingField_1; }
inline void set_U3CfileNameU3Ek__BackingField_1(String_t* value)
{
___U3CfileNameU3Ek__BackingField_1 = value;
Il2CppCodeGenWriteBarrier((&___U3CfileNameU3Ek__BackingField_1), value);
}
inline static int32_t get_offset_of_U3CorderU3Ek__BackingField_2() { return static_cast<int32_t>(offsetof(CreateAssetMenuAttribute_t2029823454, ___U3CorderU3Ek__BackingField_2)); }
inline int32_t get_U3CorderU3Ek__BackingField_2() const { return ___U3CorderU3Ek__BackingField_2; }
inline int32_t* get_address_of_U3CorderU3Ek__BackingField_2() { return &___U3CorderU3Ek__BackingField_2; }
inline void set_U3CorderU3Ek__BackingField_2(int32_t value)
{
___U3CorderU3Ek__BackingField_2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CREATEASSETMENUATTRIBUTE_T2029823454_H
#ifndef ADDCOMPONENTMENU_T415040132_H
#define ADDCOMPONENTMENU_T415040132_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AddComponentMenu
struct AddComponentMenu_t415040132 : public Attribute_t861562559
{
public:
// System.String UnityEngine.AddComponentMenu::m_AddComponentMenu
String_t* ___m_AddComponentMenu_0;
// System.Int32 UnityEngine.AddComponentMenu::m_Ordering
int32_t ___m_Ordering_1;
public:
inline static int32_t get_offset_of_m_AddComponentMenu_0() { return static_cast<int32_t>(offsetof(AddComponentMenu_t415040132, ___m_AddComponentMenu_0)); }
inline String_t* get_m_AddComponentMenu_0() const { return ___m_AddComponentMenu_0; }
inline String_t** get_address_of_m_AddComponentMenu_0() { return &___m_AddComponentMenu_0; }
inline void set_m_AddComponentMenu_0(String_t* value)
{
___m_AddComponentMenu_0 = value;
Il2CppCodeGenWriteBarrier((&___m_AddComponentMenu_0), value);
}
inline static int32_t get_offset_of_m_Ordering_1() { return static_cast<int32_t>(offsetof(AddComponentMenu_t415040132, ___m_Ordering_1)); }
inline int32_t get_m_Ordering_1() const { return ___m_Ordering_1; }
inline int32_t* get_address_of_m_Ordering_1() { return &___m_Ordering_1; }
inline void set_m_Ordering_1(int32_t value)
{
___m_Ordering_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ADDCOMPONENTMENU_T415040132_H
#ifndef RECT_T2360479859_H
#define RECT_T2360479859_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Rect
struct Rect_t2360479859
{
public:
// System.Single UnityEngine.Rect::m_XMin
float ___m_XMin_0;
// System.Single UnityEngine.Rect::m_YMin
float ___m_YMin_1;
// System.Single UnityEngine.Rect::m_Width
float ___m_Width_2;
// System.Single UnityEngine.Rect::m_Height
float ___m_Height_3;
public:
inline static int32_t get_offset_of_m_XMin_0() { return static_cast<int32_t>(offsetof(Rect_t2360479859, ___m_XMin_0)); }
inline float get_m_XMin_0() const { return ___m_XMin_0; }
inline float* get_address_of_m_XMin_0() { return &___m_XMin_0; }
inline void set_m_XMin_0(float value)
{
___m_XMin_0 = value;
}
inline static int32_t get_offset_of_m_YMin_1() { return static_cast<int32_t>(offsetof(Rect_t2360479859, ___m_YMin_1)); }
inline float get_m_YMin_1() const { return ___m_YMin_1; }
inline float* get_address_of_m_YMin_1() { return &___m_YMin_1; }
inline void set_m_YMin_1(float value)
{
___m_YMin_1 = value;
}
inline static int32_t get_offset_of_m_Width_2() { return static_cast<int32_t>(offsetof(Rect_t2360479859, ___m_Width_2)); }
inline float get_m_Width_2() const { return ___m_Width_2; }
inline float* get_address_of_m_Width_2() { return &___m_Width_2; }
inline void set_m_Width_2(float value)
{
___m_Width_2 = value;
}
inline static int32_t get_offset_of_m_Height_3() { return static_cast<int32_t>(offsetof(Rect_t2360479859, ___m_Height_3)); }
inline float get_m_Height_3() const { return ___m_Height_3; }
inline float* get_address_of_m_Height_3() { return &___m_Height_3; }
inline void set_m_Height_3(float value)
{
___m_Height_3 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RECT_T2360479859_H
#ifndef CULLINGGROUPEVENT_T1722745023_H
#define CULLINGGROUPEVENT_T1722745023_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.CullingGroupEvent
struct CullingGroupEvent_t1722745023
{
public:
// System.Int32 UnityEngine.CullingGroupEvent::m_Index
int32_t ___m_Index_0;
// System.Byte UnityEngine.CullingGroupEvent::m_PrevState
uint8_t ___m_PrevState_1;
// System.Byte UnityEngine.CullingGroupEvent::m_ThisState
uint8_t ___m_ThisState_2;
public:
inline static int32_t get_offset_of_m_Index_0() { return static_cast<int32_t>(offsetof(CullingGroupEvent_t1722745023, ___m_Index_0)); }
inline int32_t get_m_Index_0() const { return ___m_Index_0; }
inline int32_t* get_address_of_m_Index_0() { return &___m_Index_0; }
inline void set_m_Index_0(int32_t value)
{
___m_Index_0 = value;
}
inline static int32_t get_offset_of_m_PrevState_1() { return static_cast<int32_t>(offsetof(CullingGroupEvent_t1722745023, ___m_PrevState_1)); }
inline uint8_t get_m_PrevState_1() const { return ___m_PrevState_1; }
inline uint8_t* get_address_of_m_PrevState_1() { return &___m_PrevState_1; }
inline void set_m_PrevState_1(uint8_t value)
{
___m_PrevState_1 = value;
}
inline static int32_t get_offset_of_m_ThisState_2() { return static_cast<int32_t>(offsetof(CullingGroupEvent_t1722745023, ___m_ThisState_2)); }
inline uint8_t get_m_ThisState_2() const { return ___m_ThisState_2; }
inline uint8_t* get_address_of_m_ThisState_2() { return &___m_ThisState_2; }
inline void set_m_ThisState_2(uint8_t value)
{
___m_ThisState_2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CULLINGGROUPEVENT_T1722745023_H
#ifndef VECTOR3_T3722313464_H
#define VECTOR3_T3722313464_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Vector3
struct Vector3_t3722313464
{
public:
// System.Single UnityEngine.Vector3::x
float ___x_1;
// System.Single UnityEngine.Vector3::y
float ___y_2;
// System.Single UnityEngine.Vector3::z
float ___z_3;
public:
inline static int32_t get_offset_of_x_1() { return static_cast<int32_t>(offsetof(Vector3_t3722313464, ___x_1)); }
inline float get_x_1() const { return ___x_1; }
inline float* get_address_of_x_1() { return &___x_1; }
inline void set_x_1(float value)
{
___x_1 = value;
}
inline static int32_t get_offset_of_y_2() { return static_cast<int32_t>(offsetof(Vector3_t3722313464, ___y_2)); }
inline float get_y_2() const { return ___y_2; }
inline float* get_address_of_y_2() { return &___y_2; }
inline void set_y_2(float value)
{
___y_2 = value;
}
inline static int32_t get_offset_of_z_3() { return static_cast<int32_t>(offsetof(Vector3_t3722313464, ___z_3)); }
inline float get_z_3() const { return ___z_3; }
inline float* get_address_of_z_3() { return &___z_3; }
inline void set_z_3(float value)
{
___z_3 = value;
}
};
struct Vector3_t3722313464_StaticFields
{
public:
// UnityEngine.Vector3 UnityEngine.Vector3::zeroVector
Vector3_t3722313464 ___zeroVector_4;
// UnityEngine.Vector3 UnityEngine.Vector3::oneVector
Vector3_t3722313464 ___oneVector_5;
// UnityEngine.Vector3 UnityEngine.Vector3::upVector
Vector3_t3722313464 ___upVector_6;
// UnityEngine.Vector3 UnityEngine.Vector3::downVector
Vector3_t3722313464 ___downVector_7;
// UnityEngine.Vector3 UnityEngine.Vector3::leftVector
Vector3_t3722313464 ___leftVector_8;
// UnityEngine.Vector3 UnityEngine.Vector3::rightVector
Vector3_t3722313464 ___rightVector_9;
// UnityEngine.Vector3 UnityEngine.Vector3::forwardVector
Vector3_t3722313464 ___forwardVector_10;
// UnityEngine.Vector3 UnityEngine.Vector3::backVector
Vector3_t3722313464 ___backVector_11;
// UnityEngine.Vector3 UnityEngine.Vector3::positiveInfinityVector
Vector3_t3722313464 ___positiveInfinityVector_12;
// UnityEngine.Vector3 UnityEngine.Vector3::negativeInfinityVector
Vector3_t3722313464 ___negativeInfinityVector_13;
public:
inline static int32_t get_offset_of_zeroVector_4() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___zeroVector_4)); }
inline Vector3_t3722313464 get_zeroVector_4() const { return ___zeroVector_4; }
inline Vector3_t3722313464 * get_address_of_zeroVector_4() { return &___zeroVector_4; }
inline void set_zeroVector_4(Vector3_t3722313464 value)
{
___zeroVector_4 = value;
}
inline static int32_t get_offset_of_oneVector_5() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___oneVector_5)); }
inline Vector3_t3722313464 get_oneVector_5() const { return ___oneVector_5; }
inline Vector3_t3722313464 * get_address_of_oneVector_5() { return &___oneVector_5; }
inline void set_oneVector_5(Vector3_t3722313464 value)
{
___oneVector_5 = value;
}
inline static int32_t get_offset_of_upVector_6() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___upVector_6)); }
inline Vector3_t3722313464 get_upVector_6() const { return ___upVector_6; }
inline Vector3_t3722313464 * get_address_of_upVector_6() { return &___upVector_6; }
inline void set_upVector_6(Vector3_t3722313464 value)
{
___upVector_6 = value;
}
inline static int32_t get_offset_of_downVector_7() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___downVector_7)); }
inline Vector3_t3722313464 get_downVector_7() const { return ___downVector_7; }
inline Vector3_t3722313464 * get_address_of_downVector_7() { return &___downVector_7; }
inline void set_downVector_7(Vector3_t3722313464 value)
{
___downVector_7 = value;
}
inline static int32_t get_offset_of_leftVector_8() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___leftVector_8)); }
inline Vector3_t3722313464 get_leftVector_8() const { return ___leftVector_8; }
inline Vector3_t3722313464 * get_address_of_leftVector_8() { return &___leftVector_8; }
inline void set_leftVector_8(Vector3_t3722313464 value)
{
___leftVector_8 = value;
}
inline static int32_t get_offset_of_rightVector_9() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___rightVector_9)); }
inline Vector3_t3722313464 get_rightVector_9() const { return ___rightVector_9; }
inline Vector3_t3722313464 * get_address_of_rightVector_9() { return &___rightVector_9; }
inline void set_rightVector_9(Vector3_t3722313464 value)
{
___rightVector_9 = value;
}
inline static int32_t get_offset_of_forwardVector_10() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___forwardVector_10)); }
inline Vector3_t3722313464 get_forwardVector_10() const { return ___forwardVector_10; }
inline Vector3_t3722313464 * get_address_of_forwardVector_10() { return &___forwardVector_10; }
inline void set_forwardVector_10(Vector3_t3722313464 value)
{
___forwardVector_10 = value;
}
inline static int32_t get_offset_of_backVector_11() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___backVector_11)); }
inline Vector3_t3722313464 get_backVector_11() const { return ___backVector_11; }
inline Vector3_t3722313464 * get_address_of_backVector_11() { return &___backVector_11; }
inline void set_backVector_11(Vector3_t3722313464 value)
{
___backVector_11 = value;
}
inline static int32_t get_offset_of_positiveInfinityVector_12() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___positiveInfinityVector_12)); }
inline Vector3_t3722313464 get_positiveInfinityVector_12() const { return ___positiveInfinityVector_12; }
inline Vector3_t3722313464 * get_address_of_positiveInfinityVector_12() { return &___positiveInfinityVector_12; }
inline void set_positiveInfinityVector_12(Vector3_t3722313464 value)
{
___positiveInfinityVector_12 = value;
}
inline static int32_t get_offset_of_negativeInfinityVector_13() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___negativeInfinityVector_13)); }
inline Vector3_t3722313464 get_negativeInfinityVector_13() const { return ___negativeInfinityVector_13; }
inline Vector3_t3722313464 * get_address_of_negativeInfinityVector_13() { return &___negativeInfinityVector_13; }
inline void set_negativeInfinityVector_13(Vector3_t3722313464 value)
{
___negativeInfinityVector_13 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VECTOR3_T3722313464_H
#ifndef REQUIRECOMPONENT_T3490506609_H
#define REQUIRECOMPONENT_T3490506609_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.RequireComponent
struct RequireComponent_t3490506609 : public Attribute_t861562559
{
public:
// System.Type UnityEngine.RequireComponent::m_Type0
Type_t * ___m_Type0_0;
// System.Type UnityEngine.RequireComponent::m_Type1
Type_t * ___m_Type1_1;
// System.Type UnityEngine.RequireComponent::m_Type2
Type_t * ___m_Type2_2;
public:
inline static int32_t get_offset_of_m_Type0_0() { return static_cast<int32_t>(offsetof(RequireComponent_t3490506609, ___m_Type0_0)); }
inline Type_t * get_m_Type0_0() const { return ___m_Type0_0; }
inline Type_t ** get_address_of_m_Type0_0() { return &___m_Type0_0; }
inline void set_m_Type0_0(Type_t * value)
{
___m_Type0_0 = value;
Il2CppCodeGenWriteBarrier((&___m_Type0_0), value);
}
inline static int32_t get_offset_of_m_Type1_1() { return static_cast<int32_t>(offsetof(RequireComponent_t3490506609, ___m_Type1_1)); }
inline Type_t * get_m_Type1_1() const { return ___m_Type1_1; }
inline Type_t ** get_address_of_m_Type1_1() { return &___m_Type1_1; }
inline void set_m_Type1_1(Type_t * value)
{
___m_Type1_1 = value;
Il2CppCodeGenWriteBarrier((&___m_Type1_1), value);
}
inline static int32_t get_offset_of_m_Type2_2() { return static_cast<int32_t>(offsetof(RequireComponent_t3490506609, ___m_Type2_2)); }
inline Type_t * get_m_Type2_2() const { return ___m_Type2_2; }
inline Type_t ** get_address_of_m_Type2_2() { return &___m_Type2_2; }
inline void set_m_Type2_2(Type_t * value)
{
___m_Type2_2 = value;
Il2CppCodeGenWriteBarrier((&___m_Type2_2), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // REQUIRECOMPONENT_T3490506609_H
#ifndef VECTOR2_T2156229523_H
#define VECTOR2_T2156229523_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Vector2
struct Vector2_t2156229523
{
public:
// System.Single UnityEngine.Vector2::x
float ___x_0;
// System.Single UnityEngine.Vector2::y
float ___y_1;
public:
inline static int32_t get_offset_of_x_0() { return static_cast<int32_t>(offsetof(Vector2_t2156229523, ___x_0)); }
inline float get_x_0() const { return ___x_0; }
inline float* get_address_of_x_0() { return &___x_0; }
inline void set_x_0(float value)
{
___x_0 = value;
}
inline static int32_t get_offset_of_y_1() { return static_cast<int32_t>(offsetof(Vector2_t2156229523, ___y_1)); }
inline float get_y_1() const { return ___y_1; }
inline float* get_address_of_y_1() { return &___y_1; }
inline void set_y_1(float value)
{
___y_1 = value;
}
};
struct Vector2_t2156229523_StaticFields
{
public:
// UnityEngine.Vector2 UnityEngine.Vector2::zeroVector
Vector2_t2156229523 ___zeroVector_2;
// UnityEngine.Vector2 UnityEngine.Vector2::oneVector
Vector2_t2156229523 ___oneVector_3;
// UnityEngine.Vector2 UnityEngine.Vector2::upVector
Vector2_t2156229523 ___upVector_4;
// UnityEngine.Vector2 UnityEngine.Vector2::downVector
Vector2_t2156229523 ___downVector_5;
// UnityEngine.Vector2 UnityEngine.Vector2::leftVector
Vector2_t2156229523 ___leftVector_6;
// UnityEngine.Vector2 UnityEngine.Vector2::rightVector
Vector2_t2156229523 ___rightVector_7;
// UnityEngine.Vector2 UnityEngine.Vector2::positiveInfinityVector
Vector2_t2156229523 ___positiveInfinityVector_8;
// UnityEngine.Vector2 UnityEngine.Vector2::negativeInfinityVector
Vector2_t2156229523 ___negativeInfinityVector_9;
public:
inline static int32_t get_offset_of_zeroVector_2() { return static_cast<int32_t>(offsetof(Vector2_t2156229523_StaticFields, ___zeroVector_2)); }
inline Vector2_t2156229523 get_zeroVector_2() const { return ___zeroVector_2; }
inline Vector2_t2156229523 * get_address_of_zeroVector_2() { return &___zeroVector_2; }
inline void set_zeroVector_2(Vector2_t2156229523 value)
{
___zeroVector_2 = value;
}
inline static int32_t get_offset_of_oneVector_3() { return static_cast<int32_t>(offsetof(Vector2_t2156229523_StaticFields, ___oneVector_3)); }
inline Vector2_t2156229523 get_oneVector_3() const { return ___oneVector_3; }
inline Vector2_t2156229523 * get_address_of_oneVector_3() { return &___oneVector_3; }
inline void set_oneVector_3(Vector2_t2156229523 value)
{
___oneVector_3 = value;
}
inline static int32_t get_offset_of_upVector_4() { return static_cast<int32_t>(offsetof(Vector2_t2156229523_StaticFields, ___upVector_4)); }
inline Vector2_t2156229523 get_upVector_4() const { return ___upVector_4; }
inline Vector2_t2156229523 * get_address_of_upVector_4() { return &___upVector_4; }
inline void set_upVector_4(Vector2_t2156229523 value)
{
___upVector_4 = value;
}
inline static int32_t get_offset_of_downVector_5() { return static_cast<int32_t>(offsetof(Vector2_t2156229523_StaticFields, ___downVector_5)); }
inline Vector2_t2156229523 get_downVector_5() const { return ___downVector_5; }
inline Vector2_t2156229523 * get_address_of_downVector_5() { return &___downVector_5; }
inline void set_downVector_5(Vector2_t2156229523 value)
{
___downVector_5 = value;
}
inline static int32_t get_offset_of_leftVector_6() { return static_cast<int32_t>(offsetof(Vector2_t2156229523_StaticFields, ___leftVector_6)); }
inline Vector2_t2156229523 get_leftVector_6() const { return ___leftVector_6; }
inline Vector2_t2156229523 * get_address_of_leftVector_6() { return &___leftVector_6; }
inline void set_leftVector_6(Vector2_t2156229523 value)
{
___leftVector_6 = value;
}
inline static int32_t get_offset_of_rightVector_7() { return static_cast<int32_t>(offsetof(Vector2_t2156229523_StaticFields, ___rightVector_7)); }
inline Vector2_t2156229523 get_rightVector_7() const { return ___rightVector_7; }
inline Vector2_t2156229523 * get_address_of_rightVector_7() { return &___rightVector_7; }
inline void set_rightVector_7(Vector2_t2156229523 value)
{
___rightVector_7 = value;
}
inline static int32_t get_offset_of_positiveInfinityVector_8() { return static_cast<int32_t>(offsetof(Vector2_t2156229523_StaticFields, ___positiveInfinityVector_8)); }
inline Vector2_t2156229523 get_positiveInfinityVector_8() const { return ___positiveInfinityVector_8; }
inline Vector2_t2156229523 * get_address_of_positiveInfinityVector_8() { return &___positiveInfinityVector_8; }
inline void set_positiveInfinityVector_8(Vector2_t2156229523 value)
{
___positiveInfinityVector_8 = value;
}
inline static int32_t get_offset_of_negativeInfinityVector_9() { return static_cast<int32_t>(offsetof(Vector2_t2156229523_StaticFields, ___negativeInfinityVector_9)); }
inline Vector2_t2156229523 get_negativeInfinityVector_9() const { return ___negativeInfinityVector_9; }
inline Vector2_t2156229523 * get_address_of_negativeInfinityVector_9() { return &___negativeInfinityVector_9; }
inline void set_negativeInfinityVector_9(Vector2_t2156229523 value)
{
___negativeInfinityVector_9 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VECTOR2_T2156229523_H
#ifndef DISALLOWMULTIPLECOMPONENT_T1422053217_H
#define DISALLOWMULTIPLECOMPONENT_T1422053217_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.DisallowMultipleComponent
struct DisallowMultipleComponent_t1422053217 : public Attribute_t861562559
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DISALLOWMULTIPLECOMPONENT_T1422053217_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 COLOR32_T2600501292_H
#define COLOR32_T2600501292_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Color32
struct Color32_t2600501292
{
public:
union
{
#pragma pack(push, tp, 1)
struct
{
// System.Int32 UnityEngine.Color32::rgba
int32_t ___rgba_0;
};
#pragma pack(pop, tp)
struct
{
int32_t ___rgba_0_forAlignmentOnly;
};
#pragma pack(push, tp, 1)
struct
{
// System.Byte UnityEngine.Color32::r
uint8_t ___r_1;
};
#pragma pack(pop, tp)
struct
{
uint8_t ___r_1_forAlignmentOnly;
};
#pragma pack(push, tp, 1)
struct
{
char ___g_2_OffsetPadding[1];
// System.Byte UnityEngine.Color32::g
uint8_t ___g_2;
};
#pragma pack(pop, tp)
struct
{
char ___g_2_OffsetPadding_forAlignmentOnly[1];
uint8_t ___g_2_forAlignmentOnly;
};
#pragma pack(push, tp, 1)
struct
{
char ___b_3_OffsetPadding[2];
// System.Byte UnityEngine.Color32::b
uint8_t ___b_3;
};
#pragma pack(pop, tp)
struct
{
char ___b_3_OffsetPadding_forAlignmentOnly[2];
uint8_t ___b_3_forAlignmentOnly;
};
#pragma pack(push, tp, 1)
struct
{
char ___a_4_OffsetPadding[3];
// System.Byte UnityEngine.Color32::a
uint8_t ___a_4;
};
#pragma pack(pop, tp)
struct
{
char ___a_4_OffsetPadding_forAlignmentOnly[3];
uint8_t ___a_4_forAlignmentOnly;
};
};
public:
inline static int32_t get_offset_of_rgba_0() { return static_cast<int32_t>(offsetof(Color32_t2600501292, ___rgba_0)); }
inline int32_t get_rgba_0() const { return ___rgba_0; }
inline int32_t* get_address_of_rgba_0() { return &___rgba_0; }
inline void set_rgba_0(int32_t value)
{
___rgba_0 = value;
}
inline static int32_t get_offset_of_r_1() { return static_cast<int32_t>(offsetof(Color32_t2600501292, ___r_1)); }
inline uint8_t get_r_1() const { return ___r_1; }
inline uint8_t* get_address_of_r_1() { return &___r_1; }
inline void set_r_1(uint8_t value)
{
___r_1 = value;
}
inline static int32_t get_offset_of_g_2() { return static_cast<int32_t>(offsetof(Color32_t2600501292, ___g_2)); }
inline uint8_t get_g_2() const { return ___g_2; }
inline uint8_t* get_address_of_g_2() { return &___g_2; }
inline void set_g_2(uint8_t value)
{
___g_2 = value;
}
inline static int32_t get_offset_of_b_3() { return static_cast<int32_t>(offsetof(Color32_t2600501292, ___b_3)); }
inline uint8_t get_b_3() const { return ___b_3; }
inline uint8_t* get_address_of_b_3() { return &___b_3; }
inline void set_b_3(uint8_t value)
{
___b_3 = value;
}
inline static int32_t get_offset_of_a_4() { return static_cast<int32_t>(offsetof(Color32_t2600501292, ___a_4)); }
inline uint8_t get_a_4() const { return ___a_4; }
inline uint8_t* get_address_of_a_4() { return &___a_4; }
inline void set_a_4(uint8_t value)
{
___a_4 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COLOR32_T2600501292_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 TOUCHSCREENKEYBOARD_INTERNALCONSTRUCTORHELPERARGUMENTS_T1462448236_H
#define TOUCHSCREENKEYBOARD_INTERNALCONSTRUCTORHELPERARGUMENTS_T1462448236_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.TouchScreenKeyboard_InternalConstructorHelperArguments
struct TouchScreenKeyboard_InternalConstructorHelperArguments_t1462448236
{
public:
// System.UInt32 UnityEngine.TouchScreenKeyboard_InternalConstructorHelperArguments::keyboardType
uint32_t ___keyboardType_0;
// System.UInt32 UnityEngine.TouchScreenKeyboard_InternalConstructorHelperArguments::autocorrection
uint32_t ___autocorrection_1;
// System.UInt32 UnityEngine.TouchScreenKeyboard_InternalConstructorHelperArguments::multiline
uint32_t ___multiline_2;
// System.UInt32 UnityEngine.TouchScreenKeyboard_InternalConstructorHelperArguments::secure
uint32_t ___secure_3;
// System.UInt32 UnityEngine.TouchScreenKeyboard_InternalConstructorHelperArguments::alert
uint32_t ___alert_4;
// System.Int32 UnityEngine.TouchScreenKeyboard_InternalConstructorHelperArguments::characterLimit
int32_t ___characterLimit_5;
public:
inline static int32_t get_offset_of_keyboardType_0() { return static_cast<int32_t>(offsetof(TouchScreenKeyboard_InternalConstructorHelperArguments_t1462448236, ___keyboardType_0)); }
inline uint32_t get_keyboardType_0() const { return ___keyboardType_0; }
inline uint32_t* get_address_of_keyboardType_0() { return &___keyboardType_0; }
inline void set_keyboardType_0(uint32_t value)
{
___keyboardType_0 = value;
}
inline static int32_t get_offset_of_autocorrection_1() { return static_cast<int32_t>(offsetof(TouchScreenKeyboard_InternalConstructorHelperArguments_t1462448236, ___autocorrection_1)); }
inline uint32_t get_autocorrection_1() const { return ___autocorrection_1; }
inline uint32_t* get_address_of_autocorrection_1() { return &___autocorrection_1; }
inline void set_autocorrection_1(uint32_t value)
{
___autocorrection_1 = value;
}
inline static int32_t get_offset_of_multiline_2() { return static_cast<int32_t>(offsetof(TouchScreenKeyboard_InternalConstructorHelperArguments_t1462448236, ___multiline_2)); }
inline uint32_t get_multiline_2() const { return ___multiline_2; }
inline uint32_t* get_address_of_multiline_2() { return &___multiline_2; }
inline void set_multiline_2(uint32_t value)
{
___multiline_2 = value;
}
inline static int32_t get_offset_of_secure_3() { return static_cast<int32_t>(offsetof(TouchScreenKeyboard_InternalConstructorHelperArguments_t1462448236, ___secure_3)); }
inline uint32_t get_secure_3() const { return ___secure_3; }
inline uint32_t* get_address_of_secure_3() { return &___secure_3; }
inline void set_secure_3(uint32_t value)
{
___secure_3 = value;
}
inline static int32_t get_offset_of_alert_4() { return static_cast<int32_t>(offsetof(TouchScreenKeyboard_InternalConstructorHelperArguments_t1462448236, ___alert_4)); }
inline uint32_t get_alert_4() const { return ___alert_4; }
inline uint32_t* get_address_of_alert_4() { return &___alert_4; }
inline void set_alert_4(uint32_t value)
{
___alert_4 = value;
}
inline static int32_t get_offset_of_characterLimit_5() { return static_cast<int32_t>(offsetof(TouchScreenKeyboard_InternalConstructorHelperArguments_t1462448236, ___characterLimit_5)); }
inline int32_t get_characterLimit_5() const { return ___characterLimit_5; }
inline int32_t* get_address_of_characterLimit_5() { return &___characterLimit_5; }
inline void set_characterLimit_5(int32_t value)
{
___characterLimit_5 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TOUCHSCREENKEYBOARD_INTERNALCONSTRUCTORHELPERARGUMENTS_T1462448236_H
#ifndef MONOPINVOKECALLBACKATTRIBUTE_T378106515_H
#define MONOPINVOKECALLBACKATTRIBUTE_T378106515_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// AOT.MonoPInvokeCallbackAttribute
struct MonoPInvokeCallbackAttribute_t378106515 : public Attribute_t861562559
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MONOPINVOKECALLBACKATTRIBUTE_T378106515_H
#ifndef RESOLUTION_T2487619763_H
#define RESOLUTION_T2487619763_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Resolution
struct Resolution_t2487619763
{
public:
// System.Int32 UnityEngine.Resolution::m_Width
int32_t ___m_Width_0;
// System.Int32 UnityEngine.Resolution::m_Height
int32_t ___m_Height_1;
// System.Int32 UnityEngine.Resolution::m_RefreshRate
int32_t ___m_RefreshRate_2;
public:
inline static int32_t get_offset_of_m_Width_0() { return static_cast<int32_t>(offsetof(Resolution_t2487619763, ___m_Width_0)); }
inline int32_t get_m_Width_0() const { return ___m_Width_0; }
inline int32_t* get_address_of_m_Width_0() { return &___m_Width_0; }
inline void set_m_Width_0(int32_t value)
{
___m_Width_0 = value;
}
inline static int32_t get_offset_of_m_Height_1() { return static_cast<int32_t>(offsetof(Resolution_t2487619763, ___m_Height_1)); }
inline int32_t get_m_Height_1() const { return ___m_Height_1; }
inline int32_t* get_address_of_m_Height_1() { return &___m_Height_1; }
inline void set_m_Height_1(int32_t value)
{
___m_Height_1 = value;
}
inline static int32_t get_offset_of_m_RefreshRate_2() { return static_cast<int32_t>(offsetof(Resolution_t2487619763, ___m_RefreshRate_2)); }
inline int32_t get_m_RefreshRate_2() const { return ___m_RefreshRate_2; }
inline int32_t* get_address_of_m_RefreshRate_2() { return &___m_RefreshRate_2; }
inline void set_m_RefreshRate_2(int32_t value)
{
___m_RefreshRate_2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RESOLUTION_T2487619763_H
#ifndef EXCLUDEFROMOBJECTFACTORYATTRIBUTE_T1303686376_H
#define EXCLUDEFROMOBJECTFACTORYATTRIBUTE_T1303686376_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.ExcludeFromObjectFactoryAttribute
struct ExcludeFromObjectFactoryAttribute_t1303686376 : public Attribute_t861562559
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // EXCLUDEFROMOBJECTFACTORYATTRIBUTE_T1303686376_H
#ifndef DRIVENRECTTRANSFORMTRACKER_T2562230146_H
#define DRIVENRECTTRANSFORMTRACKER_T2562230146_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.DrivenRectTransformTracker
struct DrivenRectTransformTracker_t2562230146
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DRIVENRECTTRANSFORMTRACKER_T2562230146_H
#ifndef LAYERMASK_T3493934918_H
#define LAYERMASK_T3493934918_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.LayerMask
struct LayerMask_t3493934918
{
public:
// System.Int32 UnityEngine.LayerMask::m_Mask
int32_t ___m_Mask_0;
public:
inline static int32_t get_offset_of_m_Mask_0() { return static_cast<int32_t>(offsetof(LayerMask_t3493934918, ___m_Mask_0)); }
inline int32_t get_m_Mask_0() const { return ___m_Mask_0; }
inline int32_t* get_address_of_m_Mask_0() { return &___m_Mask_0; }
inline void set_m_Mask_0(int32_t value)
{
___m_Mask_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LAYERMASK_T3493934918_H
#ifndef KEYFRAME_T4206410242_H
#define KEYFRAME_T4206410242_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Keyframe
struct Keyframe_t4206410242
{
public:
// System.Single UnityEngine.Keyframe::m_Time
float ___m_Time_0;
// System.Single UnityEngine.Keyframe::m_Value
float ___m_Value_1;
// System.Single UnityEngine.Keyframe::m_InTangent
float ___m_InTangent_2;
// System.Single UnityEngine.Keyframe::m_OutTangent
float ___m_OutTangent_3;
// System.Int32 UnityEngine.Keyframe::m_WeightedMode
int32_t ___m_WeightedMode_4;
// System.Single UnityEngine.Keyframe::m_InWeight
float ___m_InWeight_5;
// System.Single UnityEngine.Keyframe::m_OutWeight
float ___m_OutWeight_6;
public:
inline static int32_t get_offset_of_m_Time_0() { return static_cast<int32_t>(offsetof(Keyframe_t4206410242, ___m_Time_0)); }
inline float get_m_Time_0() const { return ___m_Time_0; }
inline float* get_address_of_m_Time_0() { return &___m_Time_0; }
inline void set_m_Time_0(float value)
{
___m_Time_0 = value;
}
inline static int32_t get_offset_of_m_Value_1() { return static_cast<int32_t>(offsetof(Keyframe_t4206410242, ___m_Value_1)); }
inline float get_m_Value_1() const { return ___m_Value_1; }
inline float* get_address_of_m_Value_1() { return &___m_Value_1; }
inline void set_m_Value_1(float value)
{
___m_Value_1 = value;
}
inline static int32_t get_offset_of_m_InTangent_2() { return static_cast<int32_t>(offsetof(Keyframe_t4206410242, ___m_InTangent_2)); }
inline float get_m_InTangent_2() const { return ___m_InTangent_2; }
inline float* get_address_of_m_InTangent_2() { return &___m_InTangent_2; }
inline void set_m_InTangent_2(float value)
{
___m_InTangent_2 = value;
}
inline static int32_t get_offset_of_m_OutTangent_3() { return static_cast<int32_t>(offsetof(Keyframe_t4206410242, ___m_OutTangent_3)); }
inline float get_m_OutTangent_3() const { return ___m_OutTangent_3; }
inline float* get_address_of_m_OutTangent_3() { return &___m_OutTangent_3; }
inline void set_m_OutTangent_3(float value)
{
___m_OutTangent_3 = value;
}
inline static int32_t get_offset_of_m_WeightedMode_4() { return static_cast<int32_t>(offsetof(Keyframe_t4206410242, ___m_WeightedMode_4)); }
inline int32_t get_m_WeightedMode_4() const { return ___m_WeightedMode_4; }
inline int32_t* get_address_of_m_WeightedMode_4() { return &___m_WeightedMode_4; }
inline void set_m_WeightedMode_4(int32_t value)
{
___m_WeightedMode_4 = value;
}
inline static int32_t get_offset_of_m_InWeight_5() { return static_cast<int32_t>(offsetof(Keyframe_t4206410242, ___m_InWeight_5)); }
inline float get_m_InWeight_5() const { return ___m_InWeight_5; }
inline float* get_address_of_m_InWeight_5() { return &___m_InWeight_5; }
inline void set_m_InWeight_5(float value)
{
___m_InWeight_5 = value;
}
inline static int32_t get_offset_of_m_OutWeight_6() { return static_cast<int32_t>(offsetof(Keyframe_t4206410242, ___m_OutWeight_6)); }
inline float get_m_OutWeight_6() const { return ___m_OutWeight_6; }
inline float* get_address_of_m_OutWeight_6() { return &___m_OutWeight_6; }
inline void set_m_OutWeight_6(float value)
{
___m_OutWeight_6 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // KEYFRAME_T4206410242_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 ASSEMBLYISEDITORASSEMBLY_T3442416807_H
#define ASSEMBLYISEDITORASSEMBLY_T3442416807_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AssemblyIsEditorAssembly
struct AssemblyIsEditorAssembly_t3442416807 : public Attribute_t861562559
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ASSEMBLYISEDITORASSEMBLY_T3442416807_H
#ifndef COROUTINE_T3829159415_H
#define COROUTINE_T3829159415_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Coroutine
struct Coroutine_t3829159415 : public YieldInstruction_t403091072
{
public:
// System.IntPtr UnityEngine.Coroutine::m_Ptr
intptr_t ___m_Ptr_0;
public:
inline static int32_t get_offset_of_m_Ptr_0() { return static_cast<int32_t>(offsetof(Coroutine_t3829159415, ___m_Ptr_0)); }
inline intptr_t get_m_Ptr_0() const { return ___m_Ptr_0; }
inline intptr_t* get_address_of_m_Ptr_0() { return &___m_Ptr_0; }
inline void set_m_Ptr_0(intptr_t value)
{
___m_Ptr_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.Coroutine
struct Coroutine_t3829159415_marshaled_pinvoke : public YieldInstruction_t403091072_marshaled_pinvoke
{
intptr_t ___m_Ptr_0;
};
// Native definition for COM marshalling of UnityEngine.Coroutine
struct Coroutine_t3829159415_marshaled_com : public YieldInstruction_t403091072_marshaled_com
{
intptr_t ___m_Ptr_0;
};
#endif // COROUTINE_T3829159415_H
#ifndef SPACE_T654135784_H
#define SPACE_T654135784_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Space
struct Space_t654135784
{
public:
// System.Int32 UnityEngine.Space::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Space_t654135784, ___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 // SPACE_T654135784_H
#ifndef RUNTIMEPLATFORM_T4159857903_H
#define RUNTIMEPLATFORM_T4159857903_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.RuntimePlatform
struct RuntimePlatform_t4159857903
{
public:
// System.Int32 UnityEngine.RuntimePlatform::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(RuntimePlatform_t4159857903, ___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 // RUNTIMEPLATFORM_T4159857903_H
#ifndef LOGTYPE_T73765434_H
#define LOGTYPE_T73765434_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.LogType
struct LogType_t73765434
{
public:
// System.Int32 UnityEngine.LogType::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(LogType_t73765434, ___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 // LOGTYPE_T73765434_H
#ifndef BOOTCONFIGDATA_T3818279794_H
#define BOOTCONFIGDATA_T3818279794_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.BootConfigData
struct BootConfigData_t3818279794 : public RuntimeObject
{
public:
// System.IntPtr UnityEngine.BootConfigData::m_Ptr
intptr_t ___m_Ptr_0;
public:
inline static int32_t get_offset_of_m_Ptr_0() { return static_cast<int32_t>(offsetof(BootConfigData_t3818279794, ___m_Ptr_0)); }
inline intptr_t get_m_Ptr_0() const { return ___m_Ptr_0; }
inline intptr_t* get_address_of_m_Ptr_0() { return &___m_Ptr_0; }
inline void set_m_Ptr_0(intptr_t value)
{
___m_Ptr_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BOOTCONFIGDATA_T3818279794_H
#ifndef BOUNDS_T2266837910_H
#define BOUNDS_T2266837910_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Bounds
struct Bounds_t2266837910
{
public:
// UnityEngine.Vector3 UnityEngine.Bounds::m_Center
Vector3_t3722313464 ___m_Center_0;
// UnityEngine.Vector3 UnityEngine.Bounds::m_Extents
Vector3_t3722313464 ___m_Extents_1;
public:
inline static int32_t get_offset_of_m_Center_0() { return static_cast<int32_t>(offsetof(Bounds_t2266837910, ___m_Center_0)); }
inline Vector3_t3722313464 get_m_Center_0() const { return ___m_Center_0; }
inline Vector3_t3722313464 * get_address_of_m_Center_0() { return &___m_Center_0; }
inline void set_m_Center_0(Vector3_t3722313464 value)
{
___m_Center_0 = value;
}
inline static int32_t get_offset_of_m_Extents_1() { return static_cast<int32_t>(offsetof(Bounds_t2266837910, ___m_Extents_1)); }
inline Vector3_t3722313464 get_m_Extents_1() const { return ___m_Extents_1; }
inline Vector3_t3722313464 * get_address_of_m_Extents_1() { return &___m_Extents_1; }
inline void set_m_Extents_1(Vector3_t3722313464 value)
{
___m_Extents_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BOUNDS_T2266837910_H
#ifndef INTERNAL_DRAWTEXTUREARGUMENTS_T1705718261_H
#define INTERNAL_DRAWTEXTUREARGUMENTS_T1705718261_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Internal_DrawTextureArguments
struct Internal_DrawTextureArguments_t1705718261
{
public:
// UnityEngine.Rect UnityEngine.Internal_DrawTextureArguments::screenRect
Rect_t2360479859 ___screenRect_0;
// UnityEngine.Rect UnityEngine.Internal_DrawTextureArguments::sourceRect
Rect_t2360479859 ___sourceRect_1;
// System.Int32 UnityEngine.Internal_DrawTextureArguments::leftBorder
int32_t ___leftBorder_2;
// System.Int32 UnityEngine.Internal_DrawTextureArguments::rightBorder
int32_t ___rightBorder_3;
// System.Int32 UnityEngine.Internal_DrawTextureArguments::topBorder
int32_t ___topBorder_4;
// System.Int32 UnityEngine.Internal_DrawTextureArguments::bottomBorder
int32_t ___bottomBorder_5;
// UnityEngine.Color32 UnityEngine.Internal_DrawTextureArguments::color
Color32_t2600501292 ___color_6;
// UnityEngine.Vector4 UnityEngine.Internal_DrawTextureArguments::borderWidths
Vector4_t3319028937 ___borderWidths_7;
// UnityEngine.Vector4 UnityEngine.Internal_DrawTextureArguments::cornerRadiuses
Vector4_t3319028937 ___cornerRadiuses_8;
// System.Int32 UnityEngine.Internal_DrawTextureArguments::pass
int32_t ___pass_9;
// UnityEngine.Texture UnityEngine.Internal_DrawTextureArguments::texture
Texture_t3661962703 * ___texture_10;
// UnityEngine.Material UnityEngine.Internal_DrawTextureArguments::mat
Material_t340375123 * ___mat_11;
public:
inline static int32_t get_offset_of_screenRect_0() { return static_cast<int32_t>(offsetof(Internal_DrawTextureArguments_t1705718261, ___screenRect_0)); }
inline Rect_t2360479859 get_screenRect_0() const { return ___screenRect_0; }
inline Rect_t2360479859 * get_address_of_screenRect_0() { return &___screenRect_0; }
inline void set_screenRect_0(Rect_t2360479859 value)
{
___screenRect_0 = value;
}
inline static int32_t get_offset_of_sourceRect_1() { return static_cast<int32_t>(offsetof(Internal_DrawTextureArguments_t1705718261, ___sourceRect_1)); }
inline Rect_t2360479859 get_sourceRect_1() const { return ___sourceRect_1; }
inline Rect_t2360479859 * get_address_of_sourceRect_1() { return &___sourceRect_1; }
inline void set_sourceRect_1(Rect_t2360479859 value)
{
___sourceRect_1 = value;
}
inline static int32_t get_offset_of_leftBorder_2() { return static_cast<int32_t>(offsetof(Internal_DrawTextureArguments_t1705718261, ___leftBorder_2)); }
inline int32_t get_leftBorder_2() const { return ___leftBorder_2; }
inline int32_t* get_address_of_leftBorder_2() { return &___leftBorder_2; }
inline void set_leftBorder_2(int32_t value)
{
___leftBorder_2 = value;
}
inline static int32_t get_offset_of_rightBorder_3() { return static_cast<int32_t>(offsetof(Internal_DrawTextureArguments_t1705718261, ___rightBorder_3)); }
inline int32_t get_rightBorder_3() const { return ___rightBorder_3; }
inline int32_t* get_address_of_rightBorder_3() { return &___rightBorder_3; }
inline void set_rightBorder_3(int32_t value)
{
___rightBorder_3 = value;
}
inline static int32_t get_offset_of_topBorder_4() { return static_cast<int32_t>(offsetof(Internal_DrawTextureArguments_t1705718261, ___topBorder_4)); }
inline int32_t get_topBorder_4() const { return ___topBorder_4; }
inline int32_t* get_address_of_topBorder_4() { return &___topBorder_4; }
inline void set_topBorder_4(int32_t value)
{
___topBorder_4 = value;
}
inline static int32_t get_offset_of_bottomBorder_5() { return static_cast<int32_t>(offsetof(Internal_DrawTextureArguments_t1705718261, ___bottomBorder_5)); }
inline int32_t get_bottomBorder_5() const { return ___bottomBorder_5; }
inline int32_t* get_address_of_bottomBorder_5() { return &___bottomBorder_5; }
inline void set_bottomBorder_5(int32_t value)
{
___bottomBorder_5 = value;
}
inline static int32_t get_offset_of_color_6() { return static_cast<int32_t>(offsetof(Internal_DrawTextureArguments_t1705718261, ___color_6)); }
inline Color32_t2600501292 get_color_6() const { return ___color_6; }
inline Color32_t2600501292 * get_address_of_color_6() { return &___color_6; }
inline void set_color_6(Color32_t2600501292 value)
{
___color_6 = value;
}
inline static int32_t get_offset_of_borderWidths_7() { return static_cast<int32_t>(offsetof(Internal_DrawTextureArguments_t1705718261, ___borderWidths_7)); }
inline Vector4_t3319028937 get_borderWidths_7() const { return ___borderWidths_7; }
inline Vector4_t3319028937 * get_address_of_borderWidths_7() { return &___borderWidths_7; }
inline void set_borderWidths_7(Vector4_t3319028937 value)
{
___borderWidths_7 = value;
}
inline static int32_t get_offset_of_cornerRadiuses_8() { return static_cast<int32_t>(offsetof(Internal_DrawTextureArguments_t1705718261, ___cornerRadiuses_8)); }
inline Vector4_t3319028937 get_cornerRadiuses_8() const { return ___cornerRadiuses_8; }
inline Vector4_t3319028937 * get_address_of_cornerRadiuses_8() { return &___cornerRadiuses_8; }
inline void set_cornerRadiuses_8(Vector4_t3319028937 value)
{
___cornerRadiuses_8 = value;
}
inline static int32_t get_offset_of_pass_9() { return static_cast<int32_t>(offsetof(Internal_DrawTextureArguments_t1705718261, ___pass_9)); }
inline int32_t get_pass_9() const { return ___pass_9; }
inline int32_t* get_address_of_pass_9() { return &___pass_9; }
inline void set_pass_9(int32_t value)
{
___pass_9 = value;
}
inline static int32_t get_offset_of_texture_10() { return static_cast<int32_t>(offsetof(Internal_DrawTextureArguments_t1705718261, ___texture_10)); }
inline Texture_t3661962703 * get_texture_10() const { return ___texture_10; }
inline Texture_t3661962703 ** get_address_of_texture_10() { return &___texture_10; }
inline void set_texture_10(Texture_t3661962703 * value)
{
___texture_10 = value;
Il2CppCodeGenWriteBarrier((&___texture_10), value);
}
inline static int32_t get_offset_of_mat_11() { return static_cast<int32_t>(offsetof(Internal_DrawTextureArguments_t1705718261, ___mat_11)); }
inline Material_t340375123 * get_mat_11() const { return ___mat_11; }
inline Material_t340375123 ** get_address_of_mat_11() { return &___mat_11; }
inline void set_mat_11(Material_t340375123 * value)
{
___mat_11 = value;
Il2CppCodeGenWriteBarrier((&___mat_11), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.Internal_DrawTextureArguments
struct Internal_DrawTextureArguments_t1705718261_marshaled_pinvoke
{
Rect_t2360479859 ___screenRect_0;
Rect_t2360479859 ___sourceRect_1;
int32_t ___leftBorder_2;
int32_t ___rightBorder_3;
int32_t ___topBorder_4;
int32_t ___bottomBorder_5;
Color32_t2600501292 ___color_6;
Vector4_t3319028937 ___borderWidths_7;
Vector4_t3319028937 ___cornerRadiuses_8;
int32_t ___pass_9;
Texture_t3661962703 * ___texture_10;
Material_t340375123 * ___mat_11;
};
// Native definition for COM marshalling of UnityEngine.Internal_DrawTextureArguments
struct Internal_DrawTextureArguments_t1705718261_marshaled_com
{
Rect_t2360479859 ___screenRect_0;
Rect_t2360479859 ___sourceRect_1;
int32_t ___leftBorder_2;
int32_t ___rightBorder_3;
int32_t ___topBorder_4;
int32_t ___bottomBorder_5;
Color32_t2600501292 ___color_6;
Vector4_t3319028937 ___borderWidths_7;
Vector4_t3319028937 ___cornerRadiuses_8;
int32_t ___pass_9;
Texture_t3661962703 * ___texture_10;
Material_t340375123 * ___mat_11;
};
#endif // INTERNAL_DRAWTEXTUREARGUMENTS_T1705718261_H
#ifndef MATERIALPROPERTYBLOCK_T3213117958_H
#define MATERIALPROPERTYBLOCK_T3213117958_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.MaterialPropertyBlock
struct MaterialPropertyBlock_t3213117958 : public RuntimeObject
{
public:
// System.IntPtr UnityEngine.MaterialPropertyBlock::m_Ptr
intptr_t ___m_Ptr_0;
public:
inline static int32_t get_offset_of_m_Ptr_0() { return static_cast<int32_t>(offsetof(MaterialPropertyBlock_t3213117958, ___m_Ptr_0)); }
inline intptr_t get_m_Ptr_0() const { return ___m_Ptr_0; }
inline intptr_t* get_address_of_m_Ptr_0() { return &___m_Ptr_0; }
inline void set_m_Ptr_0(intptr_t value)
{
___m_Ptr_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MATERIALPROPERTYBLOCK_T3213117958_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 ASYNCOPERATION_T1445031843_H
#define ASYNCOPERATION_T1445031843_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AsyncOperation
struct AsyncOperation_t1445031843 : public YieldInstruction_t403091072
{
public:
// System.IntPtr UnityEngine.AsyncOperation::m_Ptr
intptr_t ___m_Ptr_0;
// System.Action`1<UnityEngine.AsyncOperation> UnityEngine.AsyncOperation::m_completeCallback
Action_1_t1617499438 * ___m_completeCallback_1;
public:
inline static int32_t get_offset_of_m_Ptr_0() { return static_cast<int32_t>(offsetof(AsyncOperation_t1445031843, ___m_Ptr_0)); }
inline intptr_t get_m_Ptr_0() const { return ___m_Ptr_0; }
inline intptr_t* get_address_of_m_Ptr_0() { return &___m_Ptr_0; }
inline void set_m_Ptr_0(intptr_t value)
{
___m_Ptr_0 = value;
}
inline static int32_t get_offset_of_m_completeCallback_1() { return static_cast<int32_t>(offsetof(AsyncOperation_t1445031843, ___m_completeCallback_1)); }
inline Action_1_t1617499438 * get_m_completeCallback_1() const { return ___m_completeCallback_1; }
inline Action_1_t1617499438 ** get_address_of_m_completeCallback_1() { return &___m_completeCallback_1; }
inline void set_m_completeCallback_1(Action_1_t1617499438 * value)
{
___m_completeCallback_1 = value;
Il2CppCodeGenWriteBarrier((&___m_completeCallback_1), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.AsyncOperation
struct AsyncOperation_t1445031843_marshaled_pinvoke : public YieldInstruction_t403091072_marshaled_pinvoke
{
intptr_t ___m_Ptr_0;
Il2CppMethodPointer ___m_completeCallback_1;
};
// Native definition for COM marshalling of UnityEngine.AsyncOperation
struct AsyncOperation_t1445031843_marshaled_com : public YieldInstruction_t403091072_marshaled_com
{
intptr_t ___m_Ptr_0;
Il2CppMethodPointer ___m_completeCallback_1;
};
#endif // ASYNCOPERATION_T1445031843_H
#ifndef SENDMESSAGEOPTIONS_T3580193095_H
#define SENDMESSAGEOPTIONS_T3580193095_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.SendMessageOptions
struct SendMessageOptions_t3580193095
{
public:
// System.Int32 UnityEngine.SendMessageOptions::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(SendMessageOptions_t3580193095, ___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 // SENDMESSAGEOPTIONS_T3580193095_H
#ifndef EDGE_T1530570602_H
#define EDGE_T1530570602_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.RectTransform/Edge
struct Edge_t1530570602
{
public:
// System.Int32 UnityEngine.RectTransform/Edge::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Edge_t1530570602, ___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 // EDGE_T1530570602_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 IMECOMPOSITIONMODE_T2677948540_H
#define IMECOMPOSITIONMODE_T2677948540_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.IMECompositionMode
struct IMECompositionMode_t2677948540
{
public:
// System.Int32 UnityEngine.IMECompositionMode::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(IMECompositionMode_t2677948540, ___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 // IMECOMPOSITIONMODE_T2677948540_H
#ifndef COMMANDBUFFER_T2206337031_H
#define COMMANDBUFFER_T2206337031_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Rendering.CommandBuffer
struct CommandBuffer_t2206337031 : public RuntimeObject
{
public:
// System.IntPtr UnityEngine.Rendering.CommandBuffer::m_Ptr
intptr_t ___m_Ptr_0;
public:
inline static int32_t get_offset_of_m_Ptr_0() { return static_cast<int32_t>(offsetof(CommandBuffer_t2206337031, ___m_Ptr_0)); }
inline intptr_t get_m_Ptr_0() const { return ___m_Ptr_0; }
inline intptr_t* get_address_of_m_Ptr_0() { return &___m_Ptr_0; }
inline void set_m_Ptr_0(intptr_t value)
{
___m_Ptr_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COMMANDBUFFER_T2206337031_H
#ifndef RECTOFFSET_T1369453676_H
#define RECTOFFSET_T1369453676_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.RectOffset
struct RectOffset_t1369453676 : public RuntimeObject
{
public:
// System.IntPtr UnityEngine.RectOffset::m_Ptr
intptr_t ___m_Ptr_0;
// System.Object UnityEngine.RectOffset::m_SourceStyle
RuntimeObject * ___m_SourceStyle_1;
public:
inline static int32_t get_offset_of_m_Ptr_0() { return static_cast<int32_t>(offsetof(RectOffset_t1369453676, ___m_Ptr_0)); }
inline intptr_t get_m_Ptr_0() const { return ___m_Ptr_0; }
inline intptr_t* get_address_of_m_Ptr_0() { return &___m_Ptr_0; }
inline void set_m_Ptr_0(intptr_t value)
{
___m_Ptr_0 = value;
}
inline static int32_t get_offset_of_m_SourceStyle_1() { return static_cast<int32_t>(offsetof(RectOffset_t1369453676, ___m_SourceStyle_1)); }
inline RuntimeObject * get_m_SourceStyle_1() const { return ___m_SourceStyle_1; }
inline RuntimeObject ** get_address_of_m_SourceStyle_1() { return &___m_SourceStyle_1; }
inline void set_m_SourceStyle_1(RuntimeObject * value)
{
___m_SourceStyle_1 = value;
Il2CppCodeGenWriteBarrier((&___m_SourceStyle_1), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.RectOffset
struct RectOffset_t1369453676_marshaled_pinvoke
{
intptr_t ___m_Ptr_0;
Il2CppIUnknown* ___m_SourceStyle_1;
};
// Native definition for COM marshalling of UnityEngine.RectOffset
struct RectOffset_t1369453676_marshaled_com
{
intptr_t ___m_Ptr_0;
Il2CppIUnknown* ___m_SourceStyle_1;
};
#endif // RECTOFFSET_T1369453676_H
#ifndef TOUCHPHASE_T72348083_H
#define TOUCHPHASE_T72348083_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.TouchPhase
struct TouchPhase_t72348083
{
public:
// System.Int32 UnityEngine.TouchPhase::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(TouchPhase_t72348083, ___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 // TOUCHPHASE_T72348083_H
#ifndef STATUS_T785886969_H
#define STATUS_T785886969_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.TouchScreenKeyboard/Status
struct Status_t785886969
{
public:
// System.Int32 UnityEngine.TouchScreenKeyboard/Status::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Status_t785886969, ___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 // STATUS_T785886969_H
#ifndef TOUCHSCREENKEYBOARD_T731888065_H
#define TOUCHSCREENKEYBOARD_T731888065_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.TouchScreenKeyboard
struct TouchScreenKeyboard_t731888065 : public RuntimeObject
{
public:
// System.IntPtr UnityEngine.TouchScreenKeyboard::m_Ptr
intptr_t ___m_Ptr_0;
public:
inline static int32_t get_offset_of_m_Ptr_0() { return static_cast<int32_t>(offsetof(TouchScreenKeyboard_t731888065, ___m_Ptr_0)); }
inline intptr_t get_m_Ptr_0() const { return ___m_Ptr_0; }
inline intptr_t* get_address_of_m_Ptr_0() { return &___m_Ptr_0; }
inline void set_m_Ptr_0(intptr_t value)
{
___m_Ptr_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TOUCHSCREENKEYBOARD_T731888065_H
#ifndef GRADIENT_T3067099924_H
#define GRADIENT_T3067099924_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Gradient
struct Gradient_t3067099924 : public RuntimeObject
{
public:
// System.IntPtr UnityEngine.Gradient::m_Ptr
intptr_t ___m_Ptr_0;
public:
inline static int32_t get_offset_of_m_Ptr_0() { return static_cast<int32_t>(offsetof(Gradient_t3067099924, ___m_Ptr_0)); }
inline intptr_t get_m_Ptr_0() const { return ___m_Ptr_0; }
inline intptr_t* get_address_of_m_Ptr_0() { return &___m_Ptr_0; }
inline void set_m_Ptr_0(intptr_t value)
{
___m_Ptr_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.Gradient
struct Gradient_t3067099924_marshaled_pinvoke
{
intptr_t ___m_Ptr_0;
};
// Native definition for COM marshalling of UnityEngine.Gradient
struct Gradient_t3067099924_marshaled_com
{
intptr_t ___m_Ptr_0;
};
#endif // GRADIENT_T3067099924_H
#ifndef ANIMATIONCURVE_T3046754366_H
#define ANIMATIONCURVE_T3046754366_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AnimationCurve
struct AnimationCurve_t3046754366 : public RuntimeObject
{
public:
// System.IntPtr UnityEngine.AnimationCurve::m_Ptr
intptr_t ___m_Ptr_0;
public:
inline static int32_t get_offset_of_m_Ptr_0() { return static_cast<int32_t>(offsetof(AnimationCurve_t3046754366, ___m_Ptr_0)); }
inline intptr_t get_m_Ptr_0() const { return ___m_Ptr_0; }
inline intptr_t* get_address_of_m_Ptr_0() { return &___m_Ptr_0; }
inline void set_m_Ptr_0(intptr_t value)
{
___m_Ptr_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.AnimationCurve
struct AnimationCurve_t3046754366_marshaled_pinvoke
{
intptr_t ___m_Ptr_0;
};
// Native definition for COM marshalling of UnityEngine.AnimationCurve
struct AnimationCurve_t3046754366_marshaled_com
{
intptr_t ___m_Ptr_0;
};
#endif // ANIMATIONCURVE_T3046754366_H
#ifndef DISPLAY_T1387065949_H
#define DISPLAY_T1387065949_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Display
struct Display_t1387065949 : public RuntimeObject
{
public:
// System.IntPtr UnityEngine.Display::nativeDisplay
intptr_t ___nativeDisplay_0;
public:
inline static int32_t get_offset_of_nativeDisplay_0() { return static_cast<int32_t>(offsetof(Display_t1387065949, ___nativeDisplay_0)); }
inline intptr_t get_nativeDisplay_0() const { return ___nativeDisplay_0; }
inline intptr_t* get_address_of_nativeDisplay_0() { return &___nativeDisplay_0; }
inline void set_nativeDisplay_0(intptr_t value)
{
___nativeDisplay_0 = value;
}
};
struct Display_t1387065949_StaticFields
{
public:
// UnityEngine.Display[] UnityEngine.Display::displays
DisplayU5BU5D_t103034768* ___displays_1;
// UnityEngine.Display UnityEngine.Display::_mainDisplay
Display_t1387065949 * ____mainDisplay_2;
// UnityEngine.Display/DisplaysUpdatedDelegate UnityEngine.Display::onDisplaysUpdated
DisplaysUpdatedDelegate_t51287044 * ___onDisplaysUpdated_3;
public:
inline static int32_t get_offset_of_displays_1() { return static_cast<int32_t>(offsetof(Display_t1387065949_StaticFields, ___displays_1)); }
inline DisplayU5BU5D_t103034768* get_displays_1() const { return ___displays_1; }
inline DisplayU5BU5D_t103034768** get_address_of_displays_1() { return &___displays_1; }
inline void set_displays_1(DisplayU5BU5D_t103034768* value)
{
___displays_1 = value;
Il2CppCodeGenWriteBarrier((&___displays_1), value);
}
inline static int32_t get_offset_of__mainDisplay_2() { return static_cast<int32_t>(offsetof(Display_t1387065949_StaticFields, ____mainDisplay_2)); }
inline Display_t1387065949 * get__mainDisplay_2() const { return ____mainDisplay_2; }
inline Display_t1387065949 ** get_address_of__mainDisplay_2() { return &____mainDisplay_2; }
inline void set__mainDisplay_2(Display_t1387065949 * value)
{
____mainDisplay_2 = value;
Il2CppCodeGenWriteBarrier((&____mainDisplay_2), value);
}
inline static int32_t get_offset_of_onDisplaysUpdated_3() { return static_cast<int32_t>(offsetof(Display_t1387065949_StaticFields, ___onDisplaysUpdated_3)); }
inline DisplaysUpdatedDelegate_t51287044 * get_onDisplaysUpdated_3() const { return ___onDisplaysUpdated_3; }
inline DisplaysUpdatedDelegate_t51287044 ** get_address_of_onDisplaysUpdated_3() { return &___onDisplaysUpdated_3; }
inline void set_onDisplaysUpdated_3(DisplaysUpdatedDelegate_t51287044 * value)
{
___onDisplaysUpdated_3 = value;
Il2CppCodeGenWriteBarrier((&___onDisplaysUpdated_3), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DISPLAY_T1387065949_H
#ifndef LOADSCENEMODE_T3251202195_H
#define LOADSCENEMODE_T3251202195_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.SceneManagement.LoadSceneMode
struct LoadSceneMode_t3251202195
{
public:
// System.Int32 UnityEngine.SceneManagement.LoadSceneMode::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(LoadSceneMode_t3251202195, ___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 // LOADSCENEMODE_T3251202195_H
#ifndef SCRIPTABLERENDERCONTEXT_T274343796_H
#define SCRIPTABLERENDERCONTEXT_T274343796_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Experimental.Rendering.ScriptableRenderContext
struct ScriptableRenderContext_t274343796
{
public:
// System.IntPtr UnityEngine.Experimental.Rendering.ScriptableRenderContext::m_Ptr
intptr_t ___m_Ptr_0;
public:
inline static int32_t get_offset_of_m_Ptr_0() { return static_cast<int32_t>(offsetof(ScriptableRenderContext_t274343796, ___m_Ptr_0)); }
inline intptr_t get_m_Ptr_0() const { return ___m_Ptr_0; }
inline intptr_t* get_address_of_m_Ptr_0() { return &___m_Ptr_0; }
inline void set_m_Ptr_0(intptr_t value)
{
___m_Ptr_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SCRIPTABLERENDERCONTEXT_T274343796_H
#ifndef DRIVENTRANSFORMPROPERTIES_T3813433528_H
#define DRIVENTRANSFORMPROPERTIES_T3813433528_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.DrivenTransformProperties
struct DrivenTransformProperties_t3813433528
{
public:
// System.Int32 UnityEngine.DrivenTransformProperties::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(DrivenTransformProperties_t3813433528, ___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 // DRIVENTRANSFORMPROPERTIES_T3813433528_H
#ifndef CULLINGGROUP_T2096318768_H
#define CULLINGGROUP_T2096318768_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.CullingGroup
struct CullingGroup_t2096318768 : public RuntimeObject
{
public:
// System.IntPtr UnityEngine.CullingGroup::m_Ptr
intptr_t ___m_Ptr_0;
// UnityEngine.CullingGroup/StateChanged UnityEngine.CullingGroup::m_OnStateChanged
StateChanged_t2136737110 * ___m_OnStateChanged_1;
public:
inline static int32_t get_offset_of_m_Ptr_0() { return static_cast<int32_t>(offsetof(CullingGroup_t2096318768, ___m_Ptr_0)); }
inline intptr_t get_m_Ptr_0() const { return ___m_Ptr_0; }
inline intptr_t* get_address_of_m_Ptr_0() { return &___m_Ptr_0; }
inline void set_m_Ptr_0(intptr_t value)
{
___m_Ptr_0 = value;
}
inline static int32_t get_offset_of_m_OnStateChanged_1() { return static_cast<int32_t>(offsetof(CullingGroup_t2096318768, ___m_OnStateChanged_1)); }
inline StateChanged_t2136737110 * get_m_OnStateChanged_1() const { return ___m_OnStateChanged_1; }
inline StateChanged_t2136737110 ** get_address_of_m_OnStateChanged_1() { return &___m_OnStateChanged_1; }
inline void set_m_OnStateChanged_1(StateChanged_t2136737110 * value)
{
___m_OnStateChanged_1 = value;
Il2CppCodeGenWriteBarrier((&___m_OnStateChanged_1), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.CullingGroup
struct CullingGroup_t2096318768_marshaled_pinvoke
{
intptr_t ___m_Ptr_0;
Il2CppMethodPointer ___m_OnStateChanged_1;
};
// Native definition for COM marshalling of UnityEngine.CullingGroup
struct CullingGroup_t2096318768_marshaled_com
{
intptr_t ___m_Ptr_0;
Il2CppMethodPointer ___m_OnStateChanged_1;
};
#endif // CULLINGGROUP_T2096318768_H
#ifndef AXIS_T1856666072_H
#define AXIS_T1856666072_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.RectTransform/Axis
struct Axis_t1856666072
{
public:
// System.Int32 UnityEngine.RectTransform/Axis::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Axis_t1856666072, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AXIS_T1856666072_H
#ifndef CURSORLOCKMODE_T2840764040_H
#define CURSORLOCKMODE_T2840764040_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.CursorLockMode
struct CursorLockMode_t2840764040
{
public:
// System.Int32 UnityEngine.CursorLockMode::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(CursorLockMode_t2840764040, ___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 // CURSORLOCKMODE_T2840764040_H
#ifndef TOUCHTYPE_T2034578258_H
#define TOUCHTYPE_T2034578258_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.TouchType
struct TouchType_t2034578258
{
public:
// System.Int32 UnityEngine.TouchType::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(TouchType_t2034578258, ___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 // TOUCHTYPE_T2034578258_H
#ifndef LIGHTPROBES_T649210852_H
#define LIGHTPROBES_T649210852_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.LightProbes
struct LightProbes_t649210852 : public Object_t631007953
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LIGHTPROBES_T649210852_H
#ifndef FAILEDTOLOADSCRIPTOBJECT_T547604379_H
#define FAILEDTOLOADSCRIPTOBJECT_T547604379_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.FailedToLoadScriptObject
struct FailedToLoadScriptObject_t547604379 : public Object_t631007953
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.FailedToLoadScriptObject
struct FailedToLoadScriptObject_t547604379_marshaled_pinvoke : public Object_t631007953_marshaled_pinvoke
{
};
// Native definition for COM marshalling of UnityEngine.FailedToLoadScriptObject
struct FailedToLoadScriptObject_t547604379_marshaled_com : public Object_t631007953_marshaled_com
{
};
#endif // FAILEDTOLOADSCRIPTOBJECT_T547604379_H
#ifndef LIGHTMAPSETTINGS_T3712213346_H
#define LIGHTMAPSETTINGS_T3712213346_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.LightmapSettings
struct LightmapSettings_t3712213346 : public Object_t631007953
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LIGHTMAPSETTINGS_T3712213346_H
#ifndef SPRITEATLAS_T646931412_H
#define SPRITEATLAS_T646931412_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.U2D.SpriteAtlas
struct SpriteAtlas_t646931412 : public Object_t631007953
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SPRITEATLAS_T646931412_H
#ifndef RESOURCEREQUEST_T3109103591_H
#define RESOURCEREQUEST_T3109103591_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.ResourceRequest
struct ResourceRequest_t3109103591 : public AsyncOperation_t1445031843
{
public:
// System.String UnityEngine.ResourceRequest::m_Path
String_t* ___m_Path_2;
// System.Type UnityEngine.ResourceRequest::m_Type
Type_t * ___m_Type_3;
public:
inline static int32_t get_offset_of_m_Path_2() { return static_cast<int32_t>(offsetof(ResourceRequest_t3109103591, ___m_Path_2)); }
inline String_t* get_m_Path_2() const { return ___m_Path_2; }
inline String_t** get_address_of_m_Path_2() { return &___m_Path_2; }
inline void set_m_Path_2(String_t* value)
{
___m_Path_2 = value;
Il2CppCodeGenWriteBarrier((&___m_Path_2), value);
}
inline static int32_t get_offset_of_m_Type_3() { return static_cast<int32_t>(offsetof(ResourceRequest_t3109103591, ___m_Type_3)); }
inline Type_t * get_m_Type_3() const { return ___m_Type_3; }
inline Type_t ** get_address_of_m_Type_3() { return &___m_Type_3; }
inline void set_m_Type_3(Type_t * value)
{
___m_Type_3 = value;
Il2CppCodeGenWriteBarrier((&___m_Type_3), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.ResourceRequest
struct ResourceRequest_t3109103591_marshaled_pinvoke : public AsyncOperation_t1445031843_marshaled_pinvoke
{
char* ___m_Path_2;
Type_t * ___m_Type_3;
};
// Native definition for COM marshalling of UnityEngine.ResourceRequest
struct ResourceRequest_t3109103591_marshaled_com : public AsyncOperation_t1445031843_marshaled_com
{
Il2CppChar* ___m_Path_2;
Type_t * ___m_Type_3;
};
#endif // RESOURCEREQUEST_T3109103591_H
#ifndef GAMEOBJECT_T1113636619_H
#define GAMEOBJECT_T1113636619_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.GameObject
struct GameObject_t1113636619 : public Object_t631007953
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // GAMEOBJECT_T1113636619_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 SHADER_T4151988712_H
#define SHADER_T4151988712_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Shader
struct Shader_t4151988712 : public Object_t631007953
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SHADER_T4151988712_H
#ifndef MATERIAL_T340375123_H
#define MATERIAL_T340375123_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Material
struct Material_t340375123 : public Object_t631007953
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MATERIAL_T340375123_H
#ifndef SPRITE_T280657092_H
#define SPRITE_T280657092_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Sprite
struct Sprite_t280657092 : public Object_t631007953
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SPRITE_T280657092_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 TOUCH_T1921856868_H
#define TOUCH_T1921856868_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Touch
struct Touch_t1921856868
{
public:
// System.Int32 UnityEngine.Touch::m_FingerId
int32_t ___m_FingerId_0;
// UnityEngine.Vector2 UnityEngine.Touch::m_Position
Vector2_t2156229523 ___m_Position_1;
// UnityEngine.Vector2 UnityEngine.Touch::m_RawPosition
Vector2_t2156229523 ___m_RawPosition_2;
// UnityEngine.Vector2 UnityEngine.Touch::m_PositionDelta
Vector2_t2156229523 ___m_PositionDelta_3;
// System.Single UnityEngine.Touch::m_TimeDelta
float ___m_TimeDelta_4;
// System.Int32 UnityEngine.Touch::m_TapCount
int32_t ___m_TapCount_5;
// UnityEngine.TouchPhase UnityEngine.Touch::m_Phase
int32_t ___m_Phase_6;
// UnityEngine.TouchType UnityEngine.Touch::m_Type
int32_t ___m_Type_7;
// System.Single UnityEngine.Touch::m_Pressure
float ___m_Pressure_8;
// System.Single UnityEngine.Touch::m_maximumPossiblePressure
float ___m_maximumPossiblePressure_9;
// System.Single UnityEngine.Touch::m_Radius
float ___m_Radius_10;
// System.Single UnityEngine.Touch::m_RadiusVariance
float ___m_RadiusVariance_11;
// System.Single UnityEngine.Touch::m_AltitudeAngle
float ___m_AltitudeAngle_12;
// System.Single UnityEngine.Touch::m_AzimuthAngle
float ___m_AzimuthAngle_13;
public:
inline static int32_t get_offset_of_m_FingerId_0() { return static_cast<int32_t>(offsetof(Touch_t1921856868, ___m_FingerId_0)); }
inline int32_t get_m_FingerId_0() const { return ___m_FingerId_0; }
inline int32_t* get_address_of_m_FingerId_0() { return &___m_FingerId_0; }
inline void set_m_FingerId_0(int32_t value)
{
___m_FingerId_0 = value;
}
inline static int32_t get_offset_of_m_Position_1() { return static_cast<int32_t>(offsetof(Touch_t1921856868, ___m_Position_1)); }
inline Vector2_t2156229523 get_m_Position_1() const { return ___m_Position_1; }
inline Vector2_t2156229523 * get_address_of_m_Position_1() { return &___m_Position_1; }
inline void set_m_Position_1(Vector2_t2156229523 value)
{
___m_Position_1 = value;
}
inline static int32_t get_offset_of_m_RawPosition_2() { return static_cast<int32_t>(offsetof(Touch_t1921856868, ___m_RawPosition_2)); }
inline Vector2_t2156229523 get_m_RawPosition_2() const { return ___m_RawPosition_2; }
inline Vector2_t2156229523 * get_address_of_m_RawPosition_2() { return &___m_RawPosition_2; }
inline void set_m_RawPosition_2(Vector2_t2156229523 value)
{
___m_RawPosition_2 = value;
}
inline static int32_t get_offset_of_m_PositionDelta_3() { return static_cast<int32_t>(offsetof(Touch_t1921856868, ___m_PositionDelta_3)); }
inline Vector2_t2156229523 get_m_PositionDelta_3() const { return ___m_PositionDelta_3; }
inline Vector2_t2156229523 * get_address_of_m_PositionDelta_3() { return &___m_PositionDelta_3; }
inline void set_m_PositionDelta_3(Vector2_t2156229523 value)
{
___m_PositionDelta_3 = value;
}
inline static int32_t get_offset_of_m_TimeDelta_4() { return static_cast<int32_t>(offsetof(Touch_t1921856868, ___m_TimeDelta_4)); }
inline float get_m_TimeDelta_4() const { return ___m_TimeDelta_4; }
inline float* get_address_of_m_TimeDelta_4() { return &___m_TimeDelta_4; }
inline void set_m_TimeDelta_4(float value)
{
___m_TimeDelta_4 = value;
}
inline static int32_t get_offset_of_m_TapCount_5() { return static_cast<int32_t>(offsetof(Touch_t1921856868, ___m_TapCount_5)); }
inline int32_t get_m_TapCount_5() const { return ___m_TapCount_5; }
inline int32_t* get_address_of_m_TapCount_5() { return &___m_TapCount_5; }
inline void set_m_TapCount_5(int32_t value)
{
___m_TapCount_5 = value;
}
inline static int32_t get_offset_of_m_Phase_6() { return static_cast<int32_t>(offsetof(Touch_t1921856868, ___m_Phase_6)); }
inline int32_t get_m_Phase_6() const { return ___m_Phase_6; }
inline int32_t* get_address_of_m_Phase_6() { return &___m_Phase_6; }
inline void set_m_Phase_6(int32_t value)
{
___m_Phase_6 = value;
}
inline static int32_t get_offset_of_m_Type_7() { return static_cast<int32_t>(offsetof(Touch_t1921856868, ___m_Type_7)); }
inline int32_t get_m_Type_7() const { return ___m_Type_7; }
inline int32_t* get_address_of_m_Type_7() { return &___m_Type_7; }
inline void set_m_Type_7(int32_t value)
{
___m_Type_7 = value;
}
inline static int32_t get_offset_of_m_Pressure_8() { return static_cast<int32_t>(offsetof(Touch_t1921856868, ___m_Pressure_8)); }
inline float get_m_Pressure_8() const { return ___m_Pressure_8; }
inline float* get_address_of_m_Pressure_8() { return &___m_Pressure_8; }
inline void set_m_Pressure_8(float value)
{
___m_Pressure_8 = value;
}
inline static int32_t get_offset_of_m_maximumPossiblePressure_9() { return static_cast<int32_t>(offsetof(Touch_t1921856868, ___m_maximumPossiblePressure_9)); }
inline float get_m_maximumPossiblePressure_9() const { return ___m_maximumPossiblePressure_9; }
inline float* get_address_of_m_maximumPossiblePressure_9() { return &___m_maximumPossiblePressure_9; }
inline void set_m_maximumPossiblePressure_9(float value)
{
___m_maximumPossiblePressure_9 = value;
}
inline static int32_t get_offset_of_m_Radius_10() { return static_cast<int32_t>(offsetof(Touch_t1921856868, ___m_Radius_10)); }
inline float get_m_Radius_10() const { return ___m_Radius_10; }
inline float* get_address_of_m_Radius_10() { return &___m_Radius_10; }
inline void set_m_Radius_10(float value)
{
___m_Radius_10 = value;
}
inline static int32_t get_offset_of_m_RadiusVariance_11() { return static_cast<int32_t>(offsetof(Touch_t1921856868, ___m_RadiusVariance_11)); }
inline float get_m_RadiusVariance_11() const { return ___m_RadiusVariance_11; }
inline float* get_address_of_m_RadiusVariance_11() { return &___m_RadiusVariance_11; }
inline void set_m_RadiusVariance_11(float value)
{
___m_RadiusVariance_11 = value;
}
inline static int32_t get_offset_of_m_AltitudeAngle_12() { return static_cast<int32_t>(offsetof(Touch_t1921856868, ___m_AltitudeAngle_12)); }
inline float get_m_AltitudeAngle_12() const { return ___m_AltitudeAngle_12; }
inline float* get_address_of_m_AltitudeAngle_12() { return &___m_AltitudeAngle_12; }
inline void set_m_AltitudeAngle_12(float value)
{
___m_AltitudeAngle_12 = value;
}
inline static int32_t get_offset_of_m_AzimuthAngle_13() { return static_cast<int32_t>(offsetof(Touch_t1921856868, ___m_AzimuthAngle_13)); }
inline float get_m_AzimuthAngle_13() const { return ___m_AzimuthAngle_13; }
inline float* get_address_of_m_AzimuthAngle_13() { return &___m_AzimuthAngle_13; }
inline void set_m_AzimuthAngle_13(float value)
{
___m_AzimuthAngle_13 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TOUCH_T1921856868_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 DISPLAYSUPDATEDDELEGATE_T51287044_H
#define DISPLAYSUPDATEDDELEGATE_T51287044_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Display/DisplaysUpdatedDelegate
struct DisplaysUpdatedDelegate_t51287044 : public MulticastDelegate_t
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DISPLAYSUPDATEDDELEGATE_T51287044_H
#ifndef STATECHANGED_T2136737110_H
#define STATECHANGED_T2136737110_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.CullingGroup/StateChanged
struct StateChanged_t2136737110 : public MulticastDelegate_t
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // STATECHANGED_T2136737110_H
#ifndef CAMERACALLBACK_T190067161_H
#define CAMERACALLBACK_T190067161_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Camera/CameraCallback
struct CameraCallback_t190067161 : public MulticastDelegate_t
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CAMERACALLBACK_T190067161_H
#ifndef REQUESTATLASCALLBACK_T3100554279_H
#define REQUESTATLASCALLBACK_T3100554279_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.U2D.SpriteAtlasManager/RequestAtlasCallback
struct RequestAtlasCallback_t3100554279 : public MulticastDelegate_t
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // REQUESTATLASCALLBACK_T3100554279_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 RENDERER_T2627027031_H
#define RENDERER_T2627027031_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Renderer
struct Renderer_t2627027031 : public Component_t1923634451
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RENDERER_T2627027031_H
#ifndef TEXTURE2D_T3840446185_H
#define TEXTURE2D_T3840446185_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Texture2D
struct Texture2D_t3840446185 : public Texture_t3661962703
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TEXTURE2D_T3840446185_H
#ifndef RENDERTEXTURE_T2108887433_H
#define RENDERTEXTURE_T2108887433_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.RenderTexture
struct RenderTexture_t2108887433 : public Texture_t3661962703
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RENDERTEXTURE_T2108887433_H
#ifndef TRANSFORM_T3600365921_H
#define TRANSFORM_T3600365921_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Transform
struct Transform_t3600365921 : public Component_t1923634451
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TRANSFORM_T3600365921_H
#ifndef REAPPLYDRIVENPROPERTIES_T1258266594_H
#define REAPPLYDRIVENPROPERTIES_T1258266594_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.RectTransform/ReapplyDrivenProperties
struct ReapplyDrivenProperties_t1258266594 : public MulticastDelegate_t
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // REAPPLYDRIVENPROPERTIES_T1258266594_H
#ifndef GUILAYER_T2783472903_H
#define GUILAYER_T2783472903_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.GUILayer
struct GUILayer_t2783472903 : public Behaviour_t1437897464
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // GUILAYER_T2783472903_H
#ifndef LINERENDERER_T3154350270_H
#define LINERENDERER_T3154350270_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.LineRenderer
struct LineRenderer_t3154350270 : public Renderer_t2627027031
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LINERENDERER_T3154350270_H
#ifndef LIGHT_T3756812086_H
#define LIGHT_T3756812086_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Light
struct Light_t3756812086 : public Behaviour_t1437897464
{
public:
// System.Int32 UnityEngine.Light::m_BakedIndex
int32_t ___m_BakedIndex_2;
public:
inline static int32_t get_offset_of_m_BakedIndex_2() { return static_cast<int32_t>(offsetof(Light_t3756812086, ___m_BakedIndex_2)); }
inline int32_t get_m_BakedIndex_2() const { return ___m_BakedIndex_2; }
inline int32_t* get_address_of_m_BakedIndex_2() { return &___m_BakedIndex_2; }
inline void set_m_BakedIndex_2(int32_t value)
{
___m_BakedIndex_2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LIGHT_T3756812086_H
#ifndef SPRITERENDERER_T3235626157_H
#define SPRITERENDERER_T3235626157_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.SpriteRenderer
struct SpriteRenderer_t3235626157 : public Renderer_t2627027031
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SPRITERENDERER_T3235626157_H
#ifndef RECTTRANSFORM_T3704657025_H
#define RECTTRANSFORM_T3704657025_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.RectTransform
struct RectTransform_t3704657025 : public Transform_t3600365921
{
public:
public:
};
struct RectTransform_t3704657025_StaticFields
{
public:
// UnityEngine.RectTransform/ReapplyDrivenProperties UnityEngine.RectTransform::reapplyDrivenProperties
ReapplyDrivenProperties_t1258266594 * ___reapplyDrivenProperties_2;
public:
inline static int32_t get_offset_of_reapplyDrivenProperties_2() { return static_cast<int32_t>(offsetof(RectTransform_t3704657025_StaticFields, ___reapplyDrivenProperties_2)); }
inline ReapplyDrivenProperties_t1258266594 * get_reapplyDrivenProperties_2() const { return ___reapplyDrivenProperties_2; }
inline ReapplyDrivenProperties_t1258266594 ** get_address_of_reapplyDrivenProperties_2() { return &___reapplyDrivenProperties_2; }
inline void set_reapplyDrivenProperties_2(ReapplyDrivenProperties_t1258266594 * value)
{
___reapplyDrivenProperties_2 = value;
Il2CppCodeGenWriteBarrier((&___reapplyDrivenProperties_2), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RECTTRANSFORM_T3704657025_H
#ifndef GUIELEMENT_T3567083079_H
#define GUIELEMENT_T3567083079_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.GUIElement
struct GUIElement_t3567083079 : public Behaviour_t1437897464
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // GUIELEMENT_T3567083079_H
#ifndef CAMERA_T4157153871_H
#define CAMERA_T4157153871_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Camera
struct Camera_t4157153871 : public Behaviour_t1437897464
{
public:
public:
};
struct Camera_t4157153871_StaticFields
{
public:
// UnityEngine.Camera/CameraCallback UnityEngine.Camera::onPreCull
CameraCallback_t190067161 * ___onPreCull_2;
// UnityEngine.Camera/CameraCallback UnityEngine.Camera::onPreRender
CameraCallback_t190067161 * ___onPreRender_3;
// UnityEngine.Camera/CameraCallback UnityEngine.Camera::onPostRender
CameraCallback_t190067161 * ___onPostRender_4;
public:
inline static int32_t get_offset_of_onPreCull_2() { return static_cast<int32_t>(offsetof(Camera_t4157153871_StaticFields, ___onPreCull_2)); }
inline CameraCallback_t190067161 * get_onPreCull_2() const { return ___onPreCull_2; }
inline CameraCallback_t190067161 ** get_address_of_onPreCull_2() { return &___onPreCull_2; }
inline void set_onPreCull_2(CameraCallback_t190067161 * value)
{
___onPreCull_2 = value;
Il2CppCodeGenWriteBarrier((&___onPreCull_2), value);
}
inline static int32_t get_offset_of_onPreRender_3() { return static_cast<int32_t>(offsetof(Camera_t4157153871_StaticFields, ___onPreRender_3)); }
inline CameraCallback_t190067161 * get_onPreRender_3() const { return ___onPreRender_3; }
inline CameraCallback_t190067161 ** get_address_of_onPreRender_3() { return &___onPreRender_3; }
inline void set_onPreRender_3(CameraCallback_t190067161 * value)
{
___onPreRender_3 = value;
Il2CppCodeGenWriteBarrier((&___onPreRender_3), value);
}
inline static int32_t get_offset_of_onPostRender_4() { return static_cast<int32_t>(offsetof(Camera_t4157153871_StaticFields, ___onPostRender_4)); }
inline CameraCallback_t190067161 * get_onPostRender_4() const { return ___onPostRender_4; }
inline CameraCallback_t190067161 ** get_address_of_onPostRender_4() { return &___onPostRender_4; }
inline void set_onPostRender_4(CameraCallback_t190067161 * value)
{
___onPostRender_4 = value;
Il2CppCodeGenWriteBarrier((&___onPostRender_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CAMERA_T4157153871_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1300 = { sizeof (Camera_t4157153871), -1, sizeof(Camera_t4157153871_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1300[3] =
{
Camera_t4157153871_StaticFields::get_offset_of_onPreCull_2(),
Camera_t4157153871_StaticFields::get_offset_of_onPreRender_3(),
Camera_t4157153871_StaticFields::get_offset_of_onPostRender_4(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1301 = { sizeof (CameraCallback_t190067161), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1302 = { sizeof (UnhandledExceptionHandler_t1162846485), -1, sizeof(UnhandledExceptionHandler_t1162846485_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1302[1] =
{
UnhandledExceptionHandler_t1162846485_StaticFields::get_offset_of_U3CU3Ef__mgU24cache0_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1303 = { sizeof (CullingGroupEvent_t1722745023)+ sizeof (RuntimeObject), sizeof(CullingGroupEvent_t1722745023 ), 0, 0 };
extern const int32_t g_FieldOffsetTable1303[3] =
{
CullingGroupEvent_t1722745023::get_offset_of_m_Index_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
CullingGroupEvent_t1722745023::get_offset_of_m_PrevState_1() + static_cast<int32_t>(sizeof(RuntimeObject)),
CullingGroupEvent_t1722745023::get_offset_of_m_ThisState_2() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1304 = { sizeof (CullingGroup_t2096318768), sizeof(CullingGroup_t2096318768_marshaled_pinvoke), 0, 0 };
extern const int32_t g_FieldOffsetTable1304[2] =
{
CullingGroup_t2096318768::get_offset_of_m_Ptr_0(),
CullingGroup_t2096318768::get_offset_of_m_OnStateChanged_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1305 = { sizeof (StateChanged_t2136737110), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1306 = { sizeof (CursorLockMode_t2840764040)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1306[4] =
{
CursorLockMode_t2840764040::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1307 = { sizeof (Cursor_t1422555833), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1308 = { sizeof (Display_t1387065949), -1, sizeof(Display_t1387065949_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1308[4] =
{
Display_t1387065949::get_offset_of_nativeDisplay_0(),
Display_t1387065949_StaticFields::get_offset_of_displays_1(),
Display_t1387065949_StaticFields::get_offset_of__mainDisplay_2(),
Display_t1387065949_StaticFields::get_offset_of_onDisplaysUpdated_3(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1309 = { sizeof (DisplaysUpdatedDelegate_t51287044), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1310 = { sizeof (GameObject_t1113636619), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1311 = { sizeof (Gradient_t3067099924), sizeof(Gradient_t3067099924_marshaled_pinvoke), 0, 0 };
extern const int32_t g_FieldOffsetTable1311[1] =
{
Gradient_t3067099924::get_offset_of_m_Ptr_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1312 = { sizeof (NoAllocHelpers_t1437076930), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1313 = { sizeof (Graphics_t783367614), -1, sizeof(Graphics_t783367614_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1313[1] =
{
Graphics_t783367614_StaticFields::get_offset_of_kMaxDrawMeshInstanceCount_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1314 = { sizeof (LightProbes_t649210852), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1315 = { sizeof (LightmapSettings_t3712213346), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1316 = { sizeof (RectOffset_t1369453676), sizeof(RectOffset_t1369453676_marshaled_pinvoke), 0, 0 };
extern const int32_t g_FieldOffsetTable1316[2] =
{
RectOffset_t1369453676::get_offset_of_m_Ptr_0(),
RectOffset_t1369453676::get_offset_of_m_SourceStyle_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1317 = { sizeof (GUIElement_t3567083079), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1318 = { sizeof (GUILayer_t2783472903), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1319 = { sizeof (TouchScreenKeyboard_InternalConstructorHelperArguments_t1462448236)+ sizeof (RuntimeObject), sizeof(TouchScreenKeyboard_InternalConstructorHelperArguments_t1462448236 ), 0, 0 };
extern const int32_t g_FieldOffsetTable1319[6] =
{
TouchScreenKeyboard_InternalConstructorHelperArguments_t1462448236::get_offset_of_keyboardType_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
TouchScreenKeyboard_InternalConstructorHelperArguments_t1462448236::get_offset_of_autocorrection_1() + static_cast<int32_t>(sizeof(RuntimeObject)),
TouchScreenKeyboard_InternalConstructorHelperArguments_t1462448236::get_offset_of_multiline_2() + static_cast<int32_t>(sizeof(RuntimeObject)),
TouchScreenKeyboard_InternalConstructorHelperArguments_t1462448236::get_offset_of_secure_3() + static_cast<int32_t>(sizeof(RuntimeObject)),
TouchScreenKeyboard_InternalConstructorHelperArguments_t1462448236::get_offset_of_alert_4() + static_cast<int32_t>(sizeof(RuntimeObject)),
TouchScreenKeyboard_InternalConstructorHelperArguments_t1462448236::get_offset_of_characterLimit_5() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1320 = { sizeof (TouchScreenKeyboard_t731888065), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1320[1] =
{
TouchScreenKeyboard_t731888065::get_offset_of_m_Ptr_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1321 = { sizeof (Status_t785886969)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1321[5] =
{
Status_t785886969::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1322 = { sizeof (TouchPhase_t72348083)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1322[6] =
{
TouchPhase_t72348083::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1323 = { sizeof (IMECompositionMode_t2677948540)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1323[4] =
{
IMECompositionMode_t2677948540::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1324 = { sizeof (TouchType_t2034578258)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1324[4] =
{
TouchType_t2034578258::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1325 = { sizeof (Touch_t1921856868)+ sizeof (RuntimeObject), sizeof(Touch_t1921856868 ), 0, 0 };
extern const int32_t g_FieldOffsetTable1325[14] =
{
Touch_t1921856868::get_offset_of_m_FingerId_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
Touch_t1921856868::get_offset_of_m_Position_1() + static_cast<int32_t>(sizeof(RuntimeObject)),
Touch_t1921856868::get_offset_of_m_RawPosition_2() + static_cast<int32_t>(sizeof(RuntimeObject)),
Touch_t1921856868::get_offset_of_m_PositionDelta_3() + static_cast<int32_t>(sizeof(RuntimeObject)),
Touch_t1921856868::get_offset_of_m_TimeDelta_4() + static_cast<int32_t>(sizeof(RuntimeObject)),
Touch_t1921856868::get_offset_of_m_TapCount_5() + static_cast<int32_t>(sizeof(RuntimeObject)),
Touch_t1921856868::get_offset_of_m_Phase_6() + static_cast<int32_t>(sizeof(RuntimeObject)),
Touch_t1921856868::get_offset_of_m_Type_7() + static_cast<int32_t>(sizeof(RuntimeObject)),
Touch_t1921856868::get_offset_of_m_Pressure_8() + static_cast<int32_t>(sizeof(RuntimeObject)),
Touch_t1921856868::get_offset_of_m_maximumPossiblePressure_9() + static_cast<int32_t>(sizeof(RuntimeObject)),
Touch_t1921856868::get_offset_of_m_Radius_10() + static_cast<int32_t>(sizeof(RuntimeObject)),
Touch_t1921856868::get_offset_of_m_RadiusVariance_11() + static_cast<int32_t>(sizeof(RuntimeObject)),
Touch_t1921856868::get_offset_of_m_AltitudeAngle_12() + static_cast<int32_t>(sizeof(RuntimeObject)),
Touch_t1921856868::get_offset_of_m_AzimuthAngle_13() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1326 = { sizeof (Gyroscope_t3288342876), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1327 = { sizeof (Input_t1431474628), -1, sizeof(Input_t1431474628_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1327[1] =
{
Input_t1431474628_StaticFields::get_offset_of_m_MainGyro_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1328 = { sizeof (LayerMask_t3493934918)+ sizeof (RuntimeObject), sizeof(LayerMask_t3493934918 ), 0, 0 };
extern const int32_t g_FieldOffsetTable1328[1] =
{
LayerMask_t3493934918::get_offset_of_m_Mask_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1329 = { sizeof (Light_t3756812086), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1329[1] =
{
Light_t3756812086::get_offset_of_m_BakedIndex_2(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1330 = { sizeof (Keyframe_t4206410242)+ sizeof (RuntimeObject), sizeof(Keyframe_t4206410242 ), 0, 0 };
extern const int32_t g_FieldOffsetTable1330[7] =
{
Keyframe_t4206410242::get_offset_of_m_Time_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
Keyframe_t4206410242::get_offset_of_m_Value_1() + static_cast<int32_t>(sizeof(RuntimeObject)),
Keyframe_t4206410242::get_offset_of_m_InTangent_2() + static_cast<int32_t>(sizeof(RuntimeObject)),
Keyframe_t4206410242::get_offset_of_m_OutTangent_3() + static_cast<int32_t>(sizeof(RuntimeObject)),
Keyframe_t4206410242::get_offset_of_m_WeightedMode_4() + static_cast<int32_t>(sizeof(RuntimeObject)),
Keyframe_t4206410242::get_offset_of_m_InWeight_5() + static_cast<int32_t>(sizeof(RuntimeObject)),
Keyframe_t4206410242::get_offset_of_m_OutWeight_6() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1331 = { sizeof (AnimationCurve_t3046754366), sizeof(AnimationCurve_t3046754366_marshaled_pinvoke), 0, 0 };
extern const int32_t g_FieldOffsetTable1331[1] =
{
AnimationCurve_t3046754366::get_offset_of_m_Ptr_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1332 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1333 = { sizeof (PlayerConnectionInternal_t3892293164), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1334 = { sizeof (CommandBuffer_t2206337031), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1334[1] =
{
CommandBuffer_t2206337031::get_offset_of_m_Ptr_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1335 = { sizeof (ResourceRequest_t3109103591), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1335[2] =
{
ResourceRequest_t3109103591::get_offset_of_m_Path_2(),
ResourceRequest_t3109103591::get_offset_of_m_Type_3(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1336 = { sizeof (Resources_t2942265397), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1337 = { sizeof (Shader_t4151988712), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1338 = { sizeof (Material_t340375123), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1339 = { sizeof (SortingLayer_t2251519173)+ sizeof (RuntimeObject), sizeof(SortingLayer_t2251519173 ), 0, 0 };
extern const int32_t g_FieldOffsetTable1339[1] =
{
SortingLayer_t2251519173::get_offset_of_m_Id_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1340 = { sizeof (SphericalHarmonicsL2_t3220866195)+ sizeof (RuntimeObject), sizeof(SphericalHarmonicsL2_t3220866195 ), 0, 0 };
extern const int32_t g_FieldOffsetTable1340[27] =
{
SphericalHarmonicsL2_t3220866195::get_offset_of_shr0_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shr1_1() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shr2_2() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shr3_3() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shr4_4() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shr5_5() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shr6_6() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shr7_7() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shr8_8() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shg0_9() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shg1_10() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shg2_11() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shg3_12() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shg4_13() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shg5_14() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shg6_15() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shg7_16() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shg8_17() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shb0_18() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shb1_19() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shb2_20() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shb3_21() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shb4_22() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shb5_23() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shb6_24() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shb7_25() + static_cast<int32_t>(sizeof(RuntimeObject)),
SphericalHarmonicsL2_t3220866195::get_offset_of_shb8_26() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1341 = { sizeof (Sprite_t280657092), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1342 = { sizeof (SpriteRenderer_t3235626157), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1343 = { sizeof (DataUtility_t2196215967), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1344 = { sizeof (Texture_t3661962703), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1345 = { sizeof (Texture2D_t3840446185), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1346 = { sizeof (RenderTexture_t2108887433), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1347 = { sizeof (Scene_t2348375561)+ sizeof (RuntimeObject), sizeof(Scene_t2348375561 ), 0, 0 };
extern const int32_t g_FieldOffsetTable1347[1] =
{
Scene_t2348375561::get_offset_of_m_Handle_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1348 = { sizeof (LoadSceneMode_t3251202195)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1348[3] =
{
LoadSceneMode_t3251202195::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1349 = { sizeof (SceneManager_t2787271929), -1, sizeof(SceneManager_t2787271929_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1349[3] =
{
SceneManager_t2787271929_StaticFields::get_offset_of_sceneLoaded_0(),
SceneManager_t2787271929_StaticFields::get_offset_of_sceneUnloaded_1(),
SceneManager_t2787271929_StaticFields::get_offset_of_activeSceneChanged_2(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1350 = { sizeof (ScriptableRenderContext_t274343796)+ sizeof (RuntimeObject), sizeof(ScriptableRenderContext_t274343796 ), 0, 0 };
extern const int32_t g_FieldOffsetTable1350[1] =
{
ScriptableRenderContext_t274343796::get_offset_of_m_Ptr_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1351 = { sizeof (Transform_t3600365921), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1352 = { sizeof (Enumerator_t3442430665), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1352[2] =
{
Enumerator_t3442430665::get_offset_of_outer_0(),
Enumerator_t3442430665::get_offset_of_currentIndex_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1353 = { sizeof (DrivenTransformProperties_t3813433528)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1353[26] =
{
DrivenTransformProperties_t3813433528::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1354 = { sizeof (DrivenRectTransformTracker_t2562230146)+ sizeof (RuntimeObject), sizeof(DrivenRectTransformTracker_t2562230146 ), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1355 = { sizeof (RectTransform_t3704657025), -1, sizeof(RectTransform_t3704657025_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1355[1] =
{
RectTransform_t3704657025_StaticFields::get_offset_of_reapplyDrivenProperties_2(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1356 = { sizeof (ReapplyDrivenProperties_t1258266594), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1357 = { sizeof (Edge_t1530570602)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1357[5] =
{
Edge_t1530570602::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1358 = { sizeof (Axis_t1856666072)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1358[3] =
{
Axis_t1856666072::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1359 = { sizeof (SpriteAtlasManager_t3158462485), -1, sizeof(SpriteAtlasManager_t3158462485_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1359[2] =
{
SpriteAtlasManager_t3158462485_StaticFields::get_offset_of_atlasRequested_0(),
SpriteAtlasManager_t3158462485_StaticFields::get_offset_of_U3CU3Ef__mgU24cache0_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1360 = { sizeof (RequestAtlasCallback_t3100554279), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1361 = { sizeof (SpriteAtlas_t646931412), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1362 = { sizeof (MonoPInvokeCallbackAttribute_t378106515), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1363 = { sizeof (AttributeHelperEngine_t2735742303), -1, sizeof(AttributeHelperEngine_t2735742303_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1363[3] =
{
AttributeHelperEngine_t2735742303_StaticFields::get_offset_of__disallowMultipleComponentArray_0(),
AttributeHelperEngine_t2735742303_StaticFields::get_offset_of__executeInEditModeArray_1(),
AttributeHelperEngine_t2735742303_StaticFields::get_offset_of__requireComponentArray_2(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1364 = { sizeof (DisallowMultipleComponent_t1422053217), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1365 = { sizeof (RequireComponent_t3490506609), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1365[3] =
{
RequireComponent_t3490506609::get_offset_of_m_Type0_0(),
RequireComponent_t3490506609::get_offset_of_m_Type1_1(),
RequireComponent_t3490506609::get_offset_of_m_Type2_2(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1366 = { sizeof (AddComponentMenu_t415040132), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1366[2] =
{
AddComponentMenu_t415040132::get_offset_of_m_AddComponentMenu_0(),
AddComponentMenu_t415040132::get_offset_of_m_Ordering_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1367 = { sizeof (CreateAssetMenuAttribute_t2029823454), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1367[3] =
{
CreateAssetMenuAttribute_t2029823454::get_offset_of_U3CmenuNameU3Ek__BackingField_0(),
CreateAssetMenuAttribute_t2029823454::get_offset_of_U3CfileNameU3Ek__BackingField_1(),
CreateAssetMenuAttribute_t2029823454::get_offset_of_U3CorderU3Ek__BackingField_2(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1368 = { sizeof (ContextMenu_t1295656858), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1368[3] =
{
ContextMenu_t1295656858::get_offset_of_menuItem_0(),
ContextMenu_t1295656858::get_offset_of_validate_1(),
ContextMenu_t1295656858::get_offset_of_priority_2(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1369 = { sizeof (ExecuteInEditMode_t3727731349), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1370 = { sizeof (DefaultExecutionOrder_t3059642329), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1370[1] =
{
DefaultExecutionOrder_t3059642329::get_offset_of_U3CorderU3Ek__BackingField_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1371 = { sizeof (NativeClassAttribute_t2601352714), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1371[1] =
{
NativeClassAttribute_t2601352714::get_offset_of_U3CQualifiedNativeNameU3Ek__BackingField_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1372 = { sizeof (AssemblyIsEditorAssembly_t3442416807), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1373 = { sizeof (ExcludeFromPresetAttribute_t3751627762), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1374 = { sizeof (SendMessageOptions_t3580193095)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1374[3] =
{
SendMessageOptions_t3580193095::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1375 = { sizeof (Space_t654135784)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1375[3] =
{
Space_t654135784::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1376 = { sizeof (RuntimePlatform_t4159857903)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1376[34] =
{
RuntimePlatform_t4159857903::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1377 = { sizeof (LogType_t73765434)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1377[6] =
{
LogType_t73765434::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1378 = { sizeof (BeforeRenderHelper_t1336903776), -1, sizeof(BeforeRenderHelper_t1336903776_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1378[1] =
{
BeforeRenderHelper_t1336903776_StaticFields::get_offset_of_s_OrderBlocks_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1379 = { sizeof (OrderBlock_t1585977831)+ sizeof (RuntimeObject), sizeof(OrderBlock_t1585977831_marshaled_pinvoke), 0, 0 };
extern const int32_t g_FieldOffsetTable1379[2] =
{
OrderBlock_t1585977831::get_offset_of_order_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
OrderBlock_t1585977831::get_offset_of_callback_1() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1380 = { sizeof (BootConfigData_t3818279794), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1380[1] =
{
BootConfigData_t3818279794::get_offset_of_m_Ptr_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1381 = { sizeof (Bounds_t2266837910)+ sizeof (RuntimeObject), sizeof(Bounds_t2266837910 ), 0, 0 };
extern const int32_t g_FieldOffsetTable1381[2] =
{
Bounds_t2266837910::get_offset_of_m_Center_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
Bounds_t2266837910::get_offset_of_m_Extents_1() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1382 = { 0, 0, 0, 0 };
extern const int32_t g_FieldOffsetTable1382[2] =
{
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1383 = { sizeof (ClassLibraryInitializer_t2339504045), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1384 = { sizeof (Color_t2555686324)+ sizeof (RuntimeObject), sizeof(Color_t2555686324 ), 0, 0 };
extern const int32_t g_FieldOffsetTable1384[4] =
{
Color_t2555686324::get_offset_of_r_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
Color_t2555686324::get_offset_of_g_1() + static_cast<int32_t>(sizeof(RuntimeObject)),
Color_t2555686324::get_offset_of_b_2() + static_cast<int32_t>(sizeof(RuntimeObject)),
Color_t2555686324::get_offset_of_a_3() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1385 = { sizeof (Color32_t2600501292)+ sizeof (RuntimeObject), sizeof(Color32_t2600501292 ), 0, 0 };
extern const int32_t g_FieldOffsetTable1385[5] =
{
Color32_t2600501292::get_offset_of_rgba_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
Color32_t2600501292::get_offset_of_r_1() + static_cast<int32_t>(sizeof(RuntimeObject)),
Color32_t2600501292::get_offset_of_g_2() + static_cast<int32_t>(sizeof(RuntimeObject)),
Color32_t2600501292::get_offset_of_b_3() + static_cast<int32_t>(sizeof(RuntimeObject)),
Color32_t2600501292::get_offset_of_a_4() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1386 = { sizeof (Component_t1923634451), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1387 = { sizeof (Coroutine_t3829159415), sizeof(Coroutine_t3829159415_marshaled_pinvoke), 0, 0 };
extern const int32_t g_FieldOffsetTable1387[1] =
{
Coroutine_t3829159415::get_offset_of_m_Ptr_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1388 = { sizeof (SetupCoroutine_t2062820429), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1389 = { sizeof (CustomYieldInstruction_t1895667560), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1390 = { sizeof (DebugLogHandler_t826086171), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1391 = { sizeof (Debug_t3317548046), -1, sizeof(Debug_t3317548046_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1391[1] =
{
Debug_t3317548046_StaticFields::get_offset_of_s_Logger_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1392 = { sizeof (ExcludeFromObjectFactoryAttribute_t1303686376), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1393 = { sizeof (FailedToLoadScriptObject_t547604379), sizeof(FailedToLoadScriptObject_t547604379_marshaled_pinvoke), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1394 = { sizeof (Screen_t3860757715), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1395 = { sizeof (Resolution_t2487619763)+ sizeof (RuntimeObject), sizeof(Resolution_t2487619763 ), 0, 0 };
extern const int32_t g_FieldOffsetTable1395[3] =
{
Resolution_t2487619763::get_offset_of_m_Width_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
Resolution_t2487619763::get_offset_of_m_Height_1() + static_cast<int32_t>(sizeof(RuntimeObject)),
Resolution_t2487619763::get_offset_of_m_RefreshRate_2() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1396 = { sizeof (Internal_DrawTextureArguments_t1705718261)+ sizeof (RuntimeObject), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1396[12] =
{
Internal_DrawTextureArguments_t1705718261::get_offset_of_screenRect_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
Internal_DrawTextureArguments_t1705718261::get_offset_of_sourceRect_1() + static_cast<int32_t>(sizeof(RuntimeObject)),
Internal_DrawTextureArguments_t1705718261::get_offset_of_leftBorder_2() + static_cast<int32_t>(sizeof(RuntimeObject)),
Internal_DrawTextureArguments_t1705718261::get_offset_of_rightBorder_3() + static_cast<int32_t>(sizeof(RuntimeObject)),
Internal_DrawTextureArguments_t1705718261::get_offset_of_topBorder_4() + static_cast<int32_t>(sizeof(RuntimeObject)),
Internal_DrawTextureArguments_t1705718261::get_offset_of_bottomBorder_5() + static_cast<int32_t>(sizeof(RuntimeObject)),
Internal_DrawTextureArguments_t1705718261::get_offset_of_color_6() + static_cast<int32_t>(sizeof(RuntimeObject)),
Internal_DrawTextureArguments_t1705718261::get_offset_of_borderWidths_7() + static_cast<int32_t>(sizeof(RuntimeObject)),
Internal_DrawTextureArguments_t1705718261::get_offset_of_cornerRadiuses_8() + static_cast<int32_t>(sizeof(RuntimeObject)),
Internal_DrawTextureArguments_t1705718261::get_offset_of_pass_9() + static_cast<int32_t>(sizeof(RuntimeObject)),
Internal_DrawTextureArguments_t1705718261::get_offset_of_texture_10() + static_cast<int32_t>(sizeof(RuntimeObject)),
Internal_DrawTextureArguments_t1705718261::get_offset_of_mat_11() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1397 = { sizeof (LineRenderer_t3154350270), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1398 = { sizeof (MaterialPropertyBlock_t3213117958), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1398[1] =
{
MaterialPropertyBlock_t3213117958::get_offset_of_m_Ptr_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1399 = { sizeof (Renderer_t2627027031), -1, 0, 0 };
#ifdef __clang__
#pragma clang diagnostic pop
#endif
| [
"snowxu@Snows-MacBook-Pro.local"
] | snowxu@Snows-MacBook-Pro.local |
263afbb5a42a8cf3221e3c75a54437478268135c | 05a09b9d2b277b6f805141191d580858938cb971 | /MSCL/source/mscl/MicroStrain/Wireless/Commands/AutoCal.cpp | ef9f36fc51f215656cf336f8fb4cc84449bf959f | [
"MIT",
"BSL-1.0",
"OpenSSL"
] | permissive | HTLife/MSCL | 22465b0414c1564e58e289bff337db4f640ac19e | 9d84ed27a176ff20e058b9188a97d6ff81de7604 | refs/heads/master | 2020-03-17T14:31:01.947310 | 2018-05-16T14:26:21 | 2018-05-16T14:26:21 | 133,675,133 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,776 | cpp | /*******************************************************************************
Copyright(c) 2015-2018 LORD Corporation. All rights reserved.
MIT Licensed. See the included LICENSE.txt for a copy of the full MIT License.
*******************************************************************************/
#include "stdafx.h"
#include "AutoCal.h"
#include "AutoCalInfo.h"
#include "WirelessProtocol.h"
#include "mscl/MicroStrain/ByteStream.h"
#include "mscl/MicroStrain/Wireless/Configuration/InputRange.h"
#include "mscl/MicroStrain/Wireless/Packets/WirelessPacket.h"
namespace mscl
{
ByteStream AutoCal::buildCommand_shmLink(WirelessPacket::AsppVersion asppVer, NodeAddress nodeAddress)
{
//build the command ByteStream
ByteStream cmd;
if(asppVer == WirelessPacket::aspp_v3)
{
cmd.append_uint8(WirelessPacket::ASPP_V3_SOP); //Start of Packet
cmd.append_uint8(0x04); //Delivery Stop Flag
cmd.append_uint8(0x00); //App Data Type
cmd.append_uint32(nodeAddress); //Node address
cmd.append_uint16(0x0002); //Payload length
cmd.append_uint16(WirelessProtocol::cmdId_autoCal_v1); //Command ID
cmd.append_uint16(0x7F7F); //dummy RSSI bytes
cmd.append_uint32(cmd.calculateCrcChecksum()); //Checksum
}
else
{
cmd.append_uint8(WirelessPacket::ASPP_V1_SOP); //Start of Packet
cmd.append_uint8(0x05); //Delivery Stop Flag
cmd.append_uint8(0x00); //App Data Type
cmd.append_uint16(static_cast<uint16>(nodeAddress)); //Node address
cmd.append_uint8(0x02); //Payload length
cmd.append_uint16(WirelessProtocol::cmdId_autoCal_v1); //Command ID
cmd.append_uint16(cmd.calculateSimpleChecksum(1, 7)); //Checksum
}
return cmd;
}
ByteStream AutoCal::buildCommand_shmLink201(WirelessPacket::AsppVersion asppVer, NodeAddress nodeAddress)
{
//uses the same command packet as the SHM-Link
return buildCommand_shmLink(asppVer, nodeAddress);
}
ByteStream AutoCal::buildCommand_shuntCal(WirelessPacket::AsppVersion asppVer, NodeAddress nodeAddress, const ShuntCalCmdInfo& info, uint8 chNum, WirelessModels::NodeModel nodeType, WirelessTypes::ChannelType chType)
{
uint16 inputRangeEepromVal = InputRange::inputRangeToEepromVal(info.inputRange, nodeType, chType);
uint8 internalShunt = (info.useInternalShunt) ? 1 : 0;
//build the command ByteStream
ByteStream cmd;
if(asppVer == WirelessPacket::aspp_v3)
{
cmd.append_uint8(WirelessPacket::ASPP_V3_SOP); //Start of Packet
cmd.append_uint8(0x04); //Delivery Stop Flag
cmd.append_uint8(0x00); //App Data Type
cmd.append_uint32(nodeAddress); //Node address
cmd.append_uint16(18); //Payload length
cmd.append_uint16(WirelessProtocol::cmdId_autoCal_v1); //Command ID
cmd.append_uint8(chNum);
cmd.append_uint8(internalShunt);
cmd.append_uint8(static_cast<uint8>(inputRangeEepromVal));
cmd.append_uint16(info.hardwareOffset);
cmd.append_uint8(info.numActiveGauges);
cmd.append_uint16(info.gaugeResistance);
cmd.append_uint32(info.shuntResistance);
cmd.append_float(info.gaugeFactor);
cmd.append_uint16(0x7F7F); //dummy RSSI bytes
cmd.append_uint32(cmd.calculateCrcChecksum()); //Checksum
}
else
{
cmd.append_uint8(WirelessPacket::ASPP_V1_SOP); //Start of Packet
cmd.append_uint8(0x05); //Delivery Stop Flag
cmd.append_uint8(0x00); //App Data Type
cmd.append_uint16(static_cast<uint16>(nodeAddress)); //Node address
cmd.append_uint8(18); //Payload length
cmd.append_uint16(WirelessProtocol::cmdId_autoCal_v1); //Command ID
cmd.append_uint8(chNum);
cmd.append_uint8(internalShunt);
cmd.append_uint8(static_cast<uint8>(inputRangeEepromVal));
cmd.append_uint16(info.hardwareOffset);
cmd.append_uint8(info.numActiveGauges);
cmd.append_uint16(info.gaugeResistance);
cmd.append_uint32(info.shuntResistance);
cmd.append_float(info.gaugeFactor);
cmd.append_uint16(cmd.calculateSimpleChecksum(1, 23)); //Checksum
}
return cmd;
}
AutoCal::Response::Response(NodeAddress nodeAddress, std::weak_ptr<ResponseCollector> collector):
WirelessResponsePattern(collector, WirelessProtocol::cmdId_autoCal_v1, nodeAddress),
m_nodeAddress(nodeAddress),
m_calStarted(false),
m_completionFlag(WirelessTypes::autocal_notComplete),
m_timeUntilCompletion(0.0f)
{
}
bool AutoCal::Response::calStarted() const
{
return m_calStarted;
}
float AutoCal::Response::calTime() const
{
return m_timeUntilCompletion;
}
WirelessTypes::AutoCalCompletionFlag AutoCal::Response::completionFlag() const
{
return m_completionFlag;
}
const Bytes& AutoCal::Response::infoBytes() const
{
return m_infoBytes;
}
bool AutoCal::Response::match(const WirelessPacket& packet)
{
//get a lock on the parsing mutex
mutex_lock_guard lock(m_parsingMutex);
//if the Node hasn't said it started yet
if(!m_calStarted)
{
//check if this matches the "Node Received AutoCal Command" response
if(match_nodeReceived(packet))
{
//if the autocal has now started
if(m_calStarted)
{
//successfully started, not complete so don't set the fullyMatched flag
//notify that the response was matched
m_matchCondition.notify();
return true;
}
else
{
//got a bad status, so autocal won't be started (not expecting another packet)
m_fullyMatched = true;
//notify that the response was matched
m_matchCondition.notify();
return true;
}
}
}
if(matchSuccessResponse(packet))
{
//we have fully matched the response
m_fullyMatched = true;
m_success = true;
//notify that the response was matched
m_matchCondition.notify();
return true;
}
return false;
}
bool AutoCal::Response::match_nodeReceived(const WirelessPacket& packet)
{
WirelessPacket::Payload payload = packet.payload();
//check the main bytes of the packet
if(!packet.deliveryStopFlags().pc || //delivery stop flag
packet.type() != WirelessPacket::packetType_nodeReceived || //app data type
packet.nodeAddress() != m_nodeAddress || //node address
payload.size() != 7 || //payload length
payload.read_uint16(0) != WirelessProtocol::cmdId_autoCal_v1 //command id
)
{
//failed to match some of the bytes
return false;
}
//if the status flag is success (0)
if(payload.read_uint8(2) == 0)
{
m_calStarted = true;
//only want to read the time until completion if the cal has started
m_timeUntilCompletion = payload.read_float(3);
}
return true;
}
AutoCal::ShmResponse::ShmResponse(NodeAddress nodeAddress, std::weak_ptr<ResponseCollector> collector):
AutoCal::Response(nodeAddress, collector)
{
}
bool AutoCal::ShmResponse::matchSuccessResponse(const WirelessPacket& packet)
{
WirelessPacket::Payload payload = packet.payload();
std::size_t payloadLen = payload.size();
//check the main bytes of the packet
if(!packet.deliveryStopFlags().pc || //delivery stop flag
packet.type() != WirelessPacket::packetType_nodeSuccessReply || //app data type
packet.nodeAddress() != m_nodeAddress || //node address
payloadLen != 22 || //payload length
payload.read_uint16(0) != WirelessProtocol::cmdId_autoCal_v1 //command id
)
{
//failed to match some of the bytes
return false;
}
//Pass/Fail Flag
m_completionFlag = static_cast<WirelessTypes::AutoCalCompletionFlag>(payload.read_uint8(2));
//Info Bytes
for(std::size_t i = 3; i < payloadLen; ++i)
{
//add all of the payload info bytes to m_infoBytes
m_infoBytes.push_back(payload.read_uint8(i));
}
return true;
}
AutoCal::Shm201Response::Shm201Response(NodeAddress nodeAddress, std::weak_ptr<ResponseCollector> collector):
AutoCal::Response(nodeAddress, collector)
{
}
bool AutoCal::Shm201Response::matchSuccessResponse(const WirelessPacket& packet)
{
WirelessPacket::Payload payload = packet.payload();
std::size_t payloadLen = payload.size();
//check the main bytes of the packet
if(!packet.deliveryStopFlags().pc || //delivery stop flag
packet.type() != WirelessPacket::packetType_nodeSuccessReply || //app data type
packet.nodeAddress() != m_nodeAddress || //node address
payloadLen != 34 || //payload length
payload.read_uint16(0) != WirelessProtocol::cmdId_autoCal_v1 //command id
)
{
//failed to match some of the bytes
return false;
}
//Pass/Fail Flag
m_completionFlag = static_cast<WirelessTypes::AutoCalCompletionFlag>(payload.read_uint8(2));
//Info Bytes
for(std::size_t i = 3; i < payloadLen; ++i)
{
//add all of the payload info bytes to m_infoBytes
m_infoBytes.push_back(payload.read_uint8(i));
}
return true;
}
AutoCal::ShuntCalResponse::ShuntCalResponse(NodeAddress nodeAddress, std::weak_ptr<ResponseCollector> collector, uint8 channelNumber):
AutoCal::Response(nodeAddress, collector),
m_channelNumber(channelNumber)
{
}
bool AutoCal::ShuntCalResponse::matchSuccessResponse(const WirelessPacket& packet)
{
WirelessPacket::Payload payload = packet.payload();
std::size_t payloadLen = payload.size();
//check the main bytes of the packet
if(!packet.deliveryStopFlags().pc || //delivery stop flag
packet.type() != WirelessPacket::packetType_nodeSuccessReply || //app data type
packet.nodeAddress() != m_nodeAddress || //node address
payloadLen != 37 || //payload length
payload.read_uint16(0) != WirelessProtocol::cmdId_autoCal_v1 || //command id
payload.read_uint8(3) != m_channelNumber //channel number
)
{
//failed to match some of the bytes
return false;
}
//Pass/Fail Flag
m_completionFlag = static_cast<WirelessTypes::AutoCalCompletionFlag>(payload.read_uint8(2));
//Info Bytes
for(std::size_t i = 3; i < payloadLen; ++i)
{
//add all of the payload info bytes to m_infoBytes
m_infoBytes.push_back(payload.read_uint8(i));
}
return true;
}
} | [
"richard.stoneback@lord.com"
] | richard.stoneback@lord.com |
983b9ade7203efb4fa533d1b727c8a97298e12e9 | 8ef4e5f96a621dd4ff8e4382ec8bb59c11999d53 | /graphics/graphics_render_pipeline.h | 7de965a711f04904bf23683d509a0f756428ccf9 | [] | no_license | martinnj/GOD | 22d922975276e4823e7d81abe940a238d6cbc1bf | 4246496599fb0ecaa497e1779a91b53c495b80cb | refs/heads/master | 2020-04-30T09:32:33.237056 | 2012-03-21T11:30:45 | 2012-03-21T11:30:45 | 3,593,916 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 30,772 | h | #ifndef GRAPHICS_RENDER_PIPELINE_H
#define GRAPHICS_RENDER_PIPELINE_H
//
// Graphics Framework.
// Copyright (C) 2008 Department of Computer Science, University of Copenhagen.
// Extremely overhauled by kaiip@diku.dk 2009.
//
#include <iostream>
#include <iomanip>
#include <stdexcept>
#include <cmath>
#include "graphics_vertex_program.h"
#include "graphics_rasterizer.h"
#include "graphics_fragment_program.h"
#include "graphics_zbuffer.h"
#include "graphics_framebuffer.h"
#include "graphics_state.h"
namespace graphics
{
/**
* Render Pipeline.
* This class implements a simple software driven hardware render pipeline.
*
* It mimics the real-life hardware without too many nifty-gritty details. It
* consist basically of the following components:
*
* - vertex program
* - rasterizer
* - fragment program
* - framebuffer
* - zbuffer
*
* The vertex program processes vertex data (coordinates, normals and colors)
* specified by the end user (by invoking the draw_triangle method).
*
* The vertex program is responsible for performing the model view projection
* transformation. Thus upon return from a vertex program the vertex data have
* been transformed into screen-space.
*
* Prior to drawing a triangle end-users are responsible for setting up the
* transformation matrices themself. This is done using the state-method to
* retrieve the current state information about the render pipeline and then
* invoke the model- and projection methods on the state instance to change
* these matrices.
*
* The current graphics state is passed along to the vertex program, so it
* can extract whatever information that it may need about the current state
* of the render pipeline.
*
* Once vertex data have been transformed into screen-space the rasterizer are
* asked to convert the triangle into fragment. A fragment is an entity that
* potential ends up on the screen as a pixel. In order to do so the fragment
* must survive all the way through the render pipeline and be written to the
* frame buffer.
*
* The render pipeline contineously extract fragment information from the
* rasterizer until no more fragments exist. For each fragment the render
* pipeline performs a depth test using a z-buffer. If the depth-test is
* passed then the fragment is being processed by a fragment program.
*
* The fragment program is responsible for computing the final color that
* should be used when the fragment (now it will have become a pixel) is
* written into the framebuffer. Like the vertex program the fragment program
* is passed the current graphcis state, such that need information about
* light and material can be extracted in order to compute the output color.
*
* To instantiate a render pipeline one needs to specify what math_types
* that should be used. This is done by creating an empty class with all
* the needed typedefs. (The compiler will output errors if one forgets a
* typedef). A simple-minded example would be
*
*
* class MyMathTypes
* {
* public:
* typedef float real_type;
* typedef float vector2_type[2];
* typedef float vector3_type[3];
* typedef float vector4_type[4];
* typedef float matrix4x4_type[16];
* };
*
* Now one can create a render pipeline type by writting
*
* RenderPipeline<MyMathTypes> render_pipeline;
*
* Once the render pipeline is created one needs to setup the ``hardware'' by
* specifying what vertex-, fragement-, and rasterizers the render pipeline
* should use.
*
* First one would need to create those components by inheriting from
* the VertexProgram, FragmentProgram and Rasterizer base classes.
*
* template<typename math_types>
* class MyVertexProgram : public VertexProgram<math_types>
* {
* // add your implementation here
* };
*
* template<typename math_types>
* class MyFragmentProgram : public FragmentProgram<math_types>
* {
* // add your implementation here
* };
*
* template<typename math_types>
* class MyRasterizer : public Rasterizer<math_types>
* {
* // add your implementation here
* };
*
* Now create the objects and load them into the render pipeline.
*
* MyVertexProgram<MyMathTypes> vertex_program;
* MyFragmentProgram<MyMathTypes> fragment_program;
* MyRasterizer<MyMathTypes> rasterizer;
* render_pipeline.load_vertex_program( vertex_program );
* render_pipeline.load_fragment_program( fragment_program );
* render_pipeline.load_rasterizer( rasterizer);
*
* Now you have connected all the hardware the next task is to
* allocate memory for the internal buffers of the render pipeline.
* This is done by invoking the set_resolution method.
*
* render_pipeline.set_resolution(1024, 768 );
*
* Before starting to render one needs to make sure that the graphics
* state is setup correctly. In order to do so you will need to the
* query the graphics state and modify whatever you need.
*
* render_pipeline.state().projection() = ....;
* render_pipeline.state().model() = ....;
* render_pipeline.state().light_position() = ....;
* ...
* render_pipeline.state().fall_off() = ....;
*
* Now we are ready to setup our renderloop. First we need to clear
* the buffers, then draw the triangles and finally flush everything
* onto the actual screen.
*
* render_pipeline.clear( z_value, color );
* for( .... )
* render_pipeline.draw_triangle( .... );
* render_pipeline.flush();
*
* This is it, enjoy!
*/
template< typename math_types >
class RenderPipeline
{
/**
* Public types.
*/
public:
/// The actual type of the elements of vectors and matrices.
typedef typename math_types::real_type real_type;
/// The actual type of a vector2.
typedef typename math_types::vector2_type vector2_type;
/// The actual type of a vector3.
typedef typename math_types::vector3_type vector3_type;
/// The actual type of a vector4.
typedef typename math_types::vector4_type vector4_type;
/// Tha actual type of a matrix4x4.
typedef typename math_types::matrix4x4_type matrix4x4_type;
public:
/// The type of the class which contains the actual state of the RenderPipeline.
typedef GraphicsState<math_types> graphics_state_type;
/// The actual type of a VertexProgram.
typedef VertexProgram<math_types> vertex_program_type;
/// The actual type of the Rasterizer.
typedef Rasterizer<math_types> rasterizer_type;
/// The actual type of the FragmentProgram.
typedef FragmentProgram<math_types> fragment_program_type;
/// The actual type of the ZBuffer.
typedef ZBuffer<math_types> zbuffer_type;
/// The actual type of the FrameBuffer.
typedef FrameBuffer<math_types> frame_buffer_type;
public:
/**
* Creates a new RenderPipeline with a default state.
* That is: A FrameBuffer of size 500 x 500, but no VertexProgram, Rasterizer nor FragmentProgram.
*/
RenderPipeline() : m_width(500), m_height(500),
m_vertex_program(0),
m_rasterizer(0),
m_fragment_program(0),
m_unitlength(1)
{
this->m_frame_buffer.set_resolution(this->m_width, this->m_height);
this->m_zbuffer.set_resolution(this->m_width, this->m_height);
}
/**
* Creates a new RenderPipeline with a FrameBuffer of size width x height, and default state.
* That is: No VertexProgram, Rasterizer nor FragmentProgram.
* @param width The width of the FrameBuffer.
* @param height The height of the FrameBuffer.
*/
RenderPipeline(int width, int height) : m_width(width), m_height(height),
m_vertex_program(0),
m_fragment_program(0),
m_rasterizer(0),
m_unitlength(1)
{
this->m_frame_buffer.set_resolution(this->m_width, this->m_height);
this->m_zbuffer.set_resolution(this->m_width, this->m_height);
}
/**
* Destroys the RenderPipeline.
*/
virtual ~RenderPipeline()
{}
/**
* Set Resolution.
*
* @param width The number of pixels in a row. Must be larger than 1 otherwise
* an exception is thrown.
* @param height The number of pixels in a colum. Must be larger than 1 otherwise
* an exception is thrown.
*/
void set_resolution(int width, int height)
{
this->m_width = width;
this->m_height = height;
this->m_frame_buffer.set_resolution(this->m_width, this->m_height);
this->m_zbuffer.set_resolution(this->m_width, this->m_height);
}
/**
* Get the resolution of the screen.
*
* @return the resulution in the x- and y-directions.
*/
vector2_type get_resolution() const
{
vector2_type resolution;
resolution[1] = this->m_frame_buffer.width();
resolution[2] = this->m_frame_buffer.height();
}
/**
* The width of the FrameBuffer.
* @return the width (in pixels) of the FrameBuffer.
*/
int width() const
{
return this->m_frame_buffer.width();
}
/**
* The height of the FrameBuffer.
* @return the height (in pixels) of the FrameBuffer.
*/
int height() const
{
return this->m_frame_buffer.height();
}
/**
* Clear Buffers.
* This method should be used to setup the background color and z-values before
* doing any kind of drawing.
*
* @param color The color to be used to clear the buffer.
* Each color component must be in the interval [0..1]
* otherwise an exception is thrown.
* @param depth The value to be used to clear the buffer.
* Must be in the interval [0..1] otherwise an exception is thrown.
*
*/
void clear(real_type const& depth, vector3_type const& color)
{
this->m_frame_buffer.clear(color);
this->m_zbuffer.clear(depth);
}
/**
* The Graphics State.
*
* @return A read-only reference to the current state of the RenderPipeline.
*/
graphics_state_type const& state() const
{
return this->m_state;
}
/**
* The Graphics State.
*
* @return A writable reference to the current state of the RenderPipeline.
*/
graphics_state_type& state()
{
return this->m_state;
}
public:
/**
* Load a Vertex Program.
* @param program The VertexProgram to be loaded.
*/
void load_vertex_program( vertex_program_type& program )
{
this->m_vertex_program = &program;
}
/**
* Load a Rasterizer.
* @param rasterizer The Rasterizer to be loaded.
*/
void load_rasterizer( rasterizer_type& rasterizer )
{
this->m_rasterizer = &rasterizer;
}
/**
* Load a Fragment Program.
* @param program The FragmentProgram to be loaded.
*/
void load_fragment_program( fragment_program_type& program )
{
this->m_fragment_program = &program;
}
protected:
/**
* This is the place where the "local variables" are declared.
*/
/// Contains the state of the whole RenderPipeline.
graphics_state_type m_state;
/// The actual VertexProgram. Initially == 0.
vertex_program_type* m_vertex_program;
/// The actual Rasterizer. Initially == 0.
rasterizer_type* m_rasterizer;
/// The actual FragmentProgram. Initially == 0.
fragment_program_type* m_fragment_program;
/// The actual FrameBuffer. Implemented with std::vector.
frame_buffer_type m_frame_buffer;
/// The actual Zbuffer. Implemented with std::vector.
zbuffer_type m_zbuffer;
/// The width of the actual FrameBuffer.
int m_width;
/// The height of the actual FrameBuffer.
int m_height;
/// unitlength is a Debug attribute.
int m_unitlength;
public:
// This is all the Debug Stuff. It relates to the Contained Rasterizer.
/**
* Turn on the Debug Option.
* If the Rasterizer has not been initialized, a runtime_error exception is thrown.
*/
bool DebugOn()
{
if (this->m_rasterizer == 0)
throw std::runtime_error("RenderPipeline::DebugOn(): m_rasterizer not initialized");
else {
bool oldvalue = this->m_rasterizer->DebugOn();
return oldvalue;
}
}
/**
* Turn off the Debug Option.
* If the Rasterizer has not been initialized, a runtime_error exception is thrown.y
*/
bool DebugOff()
{
if (this->m_rasterizer == 0)
throw std::runtime_error("RenderPipeline::DebugOff(): m_rasterizer not initialized");
else {
bool oldvalue = this->m_rasterizer->DebugOff();
return oldvalue;
}
}
/**
* The unit length can have different values. It works like a scalefactor, used to
* magnify the screen.
* @return The actual unit length in pixels.
*/
int unit_length() const
{
return this->m_unitlength;
}
/**
* The unit length can have different values. It works like a scalefactor, used to
* magnify the screen.
* @param new_unitlength The new unit length (scale factor).
* @return The previous unit length.
*/
int unit_length(int new_unitlength)
{
int old_unitlength = this->m_unitlength;
this->m_unitlength = new_unitlength;
return old_unitlength;
}
/**
* Draws a grid on the screen with a specified spacing and color.
* The specified spacing is multiplied by the actual unit length.
* So, if the specified spacing is equal to 4, and unit length == 2,
* the actual spacing will be equal to: 4 * 2 = 8 pixels, because unit length
* is just a scale factor, used to magnify the screen.
* @param x_spacing The spacing in the x-direction.
* @param y_spacing The spacing in the y-direction.
* @param color The color of the grid lines.
*/
void draw_grid(int x_spacing, int y_spacing, vector3_type const& color)
{
int width = this->m_frame_buffer.width();
int height = this->m_frame_buffer.height();
int delta_x = x_spacing * this->m_unitlength;
for (int x = 0; x < width; x += delta_x) {
for (int y = 0; y < height;++y) {
this->m_frame_buffer.write_pixel(x, y, color);
}
}
int delta_y = y_spacing * this->m_unitlength;
for (int y = 0; y < height; y += delta_y) {
for (int x = 0; x < width; ++x) {
this->m_frame_buffer.write_pixel(x, y, color);
}
}
}
/**
* Draws a Disk on the the screen representing a pixel.
* @param vertex A vector3 which contains the coordinates of the point.
* @param color A vector3 which contains the color of the point.
*/
void draw_debugpoint(vector3_type const& vertex, vector3_type const& color)
{
std::cout << "-->draw_debugpoint(1)" << std::endl;
int x = static_cast<int>(round(vertex[1]));
int y = static_cast<int>(round(vertex[2]));
std::cout << "\tdraw_debugpoint(1)" << std::endl;
std::cout << "\t=============================" << std::endl;
std::cout << "\t\tPoint = [" << vertex << "]" << std::endl;
std::cout << "\t\tColor = [" << color << "]" << std::endl;
this->draw_debugpoint(x, y, color);
std::cout << "<--draw_debugpoint(1)" << std::endl;
}
/**
* Draws a Disk on the screen representing a pixel.
* @param x The x-coordinate of the pixel.
* @param y The y-coordinate of the pixel.
* @param color The color of the pixel.
*/
void draw_debugpoint(int x, int y, vector3_type const& color)
{
std::cout << "\t-->draw_debugpoint(2)" << std::endl;
std::cout << "\t\tdraw_debugpoint(2)" << std::endl;
std::cout << "\t\t==================" << std::endl;
std::cout << "\t\t\tPoint = [" << x << ", " << y << "]" << std::endl;
std::cout << "\t\t\tColor = [" << color << "]" << std::endl;
std::cout << "\t\tthis->m_frame_buffer.write_pixel(x, y, color);" << std::endl;
this->m_frame_buffer.write_pixel(x, y, color);
std::cout << "\t<--draw_debugpoint(2)" << std::endl;
}
/**
* Draws a thin 2D line on the sreen (one pixel wide).
* The start and end points are scaled by unit length. and no transformations are applied.
* The method can be used for Debug purpurses.
* @param v1 A vector3 which contains the start point (the third coordinate is ignored).
* @param v2 A vector3 which contains the end point (the third coordinate is ignored).
* @param color The color of the line.
*/
void draw_debugline(vector3_type const& v1, vector3_type const& v2, vector3_type const& color)
{
int x1 = static_cast<int>(round(v1[1]));
int y1 = static_cast<int>(round(v1[2]));
int x2 = static_cast<int>(round(v2[1]));
int y2 = static_cast<int>(round(v2[2]));
this->draw_debugline(x1, y1, x2, y2, color);
}
/**
* Draws a thin 2D line on the sreen (one pixel wide).
* The start and end points are scaled by unit length. and no transformations are applied.
* The method can be used for Debug purpurses.
* @param x1 The x-coordinate of the start point.
* @param y1 The y-coordinate of the start point.
* @param x2 The x-coordinate of the end point.
* @param y2 The y-coordinate of the end point.
* @param color The color of the line.
*/
void draw_debugline(int x1, int y1, int x2, int y2, vector3_type const& color)
{
int x_start = x1 * this->m_unitlength;
int y_start = y1 * this->m_unitlength;
int x_stop = x2 * this->m_unitlength;
int y_stop = y2 * this->m_unitlength;
int x_current = x_start;
int y_current = y_start;
int dx = x_stop - x_start;
int dy = y_stop - y_start;
int DeltaX = (dx < 0) ? -1 : 1;
int DeltaY = (dy < 0) ? -1 : 1;
int abs_2dx = std::abs(dx) << 1;
int abs_2dy = std::abs(dy) << 1;
if (abs_2dx > abs_2dy) {
// x-dominant
bool leftrightscan = (DeltaX > 0) ? true : false;
int distance = abs_2dy - abs_2dx >> 1;
while (true) {
this->m_frame_buffer.write_pixel(x_current, y_current, color);
if (x_current == x_stop) return;
if ((distance > 0) || ((distance == 0) && leftrightscan)) {
y_current += DeltaY;
distance -= abs_2dx;
}
x_current += DeltaX;
distance += abs_2dy;
}
}
else {
// y-dominant
bool leftrightscan = (DeltaY > 0) ? true : false;
int distance = abs_2dx - abs_2dy >> 1;
while (true) {
this->m_frame_buffer.write_pixel(x_current, y_current, color);
if (y_current == y_stop) return;
if ((distance > 0) || ((distance == 0) && leftrightscan)) {
x_current += DeltaX;
distance -= abs_2dy;
}
y_current += DeltaY;
distance += abs_2dx;
}
}
}
void write_pixel_to_frame_buffer(int x, int y, vector3_type const& color)
{
if (this->m_unitlength == 1) {
this->m_frame_buffer.write_pixel(x, y, color);
}
else {
this->draw_disk(x * this->m_unitlength, y * this->m_unitlength,
(this->m_unitlength - 1) / 2, color);
}
}
void draw_disk(int Xcenter, int Ycenter, int Radius, vector3_type const& color)
{
int X = 0;
int Y = Radius;
int d = 1 - Radius;
int deltaE = 3;
int deltaSE = -2 * Radius + 5;
CirclePointsFill(Xcenter, Ycenter, X, Y, color);
while (Y > X) {
if (d < 0) {
d += deltaE;
deltaSE += 2;
}
else {
d += deltaSE;
deltaSE += 4;
--Y;
}
++X;
deltaE += 2;
CirclePointsFill(Xcenter, Ycenter, X, Y, color);
}
}
void CirclePointsFill(int Xcenter, int Ycenter, int X, int Y, vector3_type const& color)
{
for (int x = Xcenter - X; x <= Xcenter + X; ++x) {
this->m_frame_buffer.write_pixel(x, Ycenter - Y, color);
}
for (int x = Xcenter - X; x <= Xcenter + X; ++x) {
this->m_frame_buffer.write_pixel(x, Ycenter + Y, color);
}
for (int x = Xcenter - Y; x <= Xcenter + Y; ++x) {
this->m_frame_buffer.write_pixel(x, Ycenter - X, color);
}
for (int x = Xcenter - Y; x <= Xcenter + Y; ++x) {
this->m_frame_buffer.write_pixel(x, Ycenter + X, color);
}
}
/**
* Draw Point.
* This method process the vertex data that makes up a point (1 coordinate,
* and 1 color). Vertex data is basically turned into pixels in
* the framebuffer.
*
* Note: If renderpipeline is not correctly setup then an exception is thrown.
*
*
* @param in_vertex1
* @param in_color1
*/
void draw_point(vector3_type const& in_vertex1,
vector3_type const& in_color1)
{
//--- Test if render pipeline was set up correctly
if(this->m_vertex_program == 0)
throw std::logic_error("vertex program was not loaded");
if(this->m_rasterizer == 0)
throw std::logic_error("rasterizer was not loaded");
if(this->m_fragment_program == 0)
throw std::logic_error("fragment program was not loaded");
//--- Temporaries used to hold output from vertex program
vector3_type out_vertex1;
vector3_type out_color1;
//--- Ask vertex program to process all the vertex data.
this->m_vertex_program->run(this->state(),
in_vertex1, in_color1,
out_vertex1, out_color1);
//--- Initialize rasterizer with output from the vertex program
this->m_rasterizer->init(out_vertex1, out_color1);
//--- Keep on processing fragments until there are none left
while( this->m_rasterizer->more_fragments() )
{
//--- get screen location of the current fragment
int screen_x = this->m_rasterizer->x();
int screen_y = this->m_rasterizer->y();
//--- extract old and new z value and perform a z-test
real_type z_old = this->m_zbuffer.read( screen_x, screen_y );
real_type z_new = this->m_rasterizer->depth();
if( this->state().ztest( z_old, z_new ) )
{
//--- The fragment passed the z-test, now we need to ask
//--- the fragment program to compute the color of the fragment.
vector3_type out_color; // uninitialized!
out_color = this->m_rasterizer->color(); // now initialized!
this->m_fragment_program->run(this->state(),
m_rasterizer->position(),
m_rasterizer->normal(),
m_rasterizer->color(),
out_color);
//--- Finally we write the new z-value to the z-buffer
//--- and the new color to the frame buffer.
this->m_zbuffer.write( screen_x, screen_y, z_new);
this->write_pixel_to_frame_buffer(screen_x, screen_y, out_color);
}
//--- We finished processing the fragment, so we
//--- can advance to the next fragment.
this->m_rasterizer->next_fragment();
}
}
/**
* Draw Line.
* This method process the vertex data that makes up a line (2 coordinates,
* and 2 colors). Vertex data is basically turned into pixels in
* the framebuffer.
*
* Note: If renderpipeline is not correctly setup then an exception is thrown.
*
*
* @param in_vertex1
* @param in_color1
* @param in_vertex2
* @param in_color2
*/
void draw_line(vector3_type const& in_vertex1,
vector3_type const& in_color1,
vector3_type const& in_vertex2,
vector3_type const& in_color2)
{
//--- Test if render pipeline was set up correctly
if(!(this->m_vertex_program))
throw std::logic_error("vertex program was not loaded");
if(!(this->m_rasterizer))
throw std::logic_error("rasterizer was not loaded");
if(!(this->m_fragment_program))
throw std::logic_error("fragment program was not loaded");
//--- Temporaries used to hold output from vertex program
vector3_type out_vertex1;
vector3_type out_vertex2;
vector3_type out_color1;
vector3_type out_color2;
//--- Ask vertex program to process all the vertex data.
m_vertex_program->run(this->state(),
in_vertex1, in_color1,
out_vertex1, out_color1);
m_vertex_program->run(this->state(),
in_vertex2, in_color2,
out_vertex2, out_color2);
//--- Initialize rasterizer with output from the vertex program
m_rasterizer->init(out_vertex1, out_color1,
out_vertex2, out_color2);
//--- Keep on processing fragments until there are none left
while( this->m_rasterizer->more_fragments() )
{
//--- get screen location of the current fragment
int screen_x = this->m_rasterizer->x();
int screen_y = this->m_rasterizer->y();
//--- extract old and new z value and perform a z-test
real_type z_old = this->m_zbuffer.read( screen_x, screen_y );
real_type z_new = this->m_rasterizer->depth();
if( this->state().ztest( z_old, z_new ) )
{
//--- The fragment passed the z-test, now we need to ask
//--- the fragment program to compute the color of the fragment.
vector3_type out_color; // uninitialized!
out_color = this->m_rasterizer->color(); // now initialized!
this->m_fragment_program->run(this->state(),
m_rasterizer->position(),
m_rasterizer->normal(),
m_rasterizer->color(),
out_color);
//--- Finally we write the new z-value to the z-buffer
//--- and the new color to the frame buffer.
this->m_zbuffer.write( screen_x, screen_y, z_new);
this->write_pixel_to_frame_buffer(screen_x, screen_y, out_color);
}
//--- We finished processing the fragment, so we
//--- can advance to the next fragment.
this->m_rasterizer->next_fragment();
}
}
/**
* Draw Triangle.
* This method process the vertex data that makes up a triangle (3 coordinates,
* 3 normals, and 3 colors). Vertex data is basically turned into pixels in
* the framebuffer.
*
* Note: If renderpipeline is not correctly setup then an exception is thrown.
*
*
* @param in_vertex1
* @param in_normal1
* @param in_color1
* @param in_vertex2
* @param in_normal2
* @param in_color2
* @param in_vertex3
* @param in_normal3
* @param in_color3
*/
void draw_triangle(vector3_type const& in_vertex1,
vector3_type const& in_normal1,
vector3_type const& in_color1,
vector3_type const& in_vertex2,
vector3_type const& in_normal2,
vector3_type const& in_color2,
vector3_type const& in_vertex3,
vector3_type const& in_normal3,
vector3_type const& in_color3)
{
//--- Test if render pipeline was set up correctly
if(!m_vertex_program)
throw std::logic_error("vertex program was not loaded");
if(!m_rasterizer)
throw std::logic_error("rasterizer was not loaded");
if(!m_fragment_program)
throw std::logic_error("fragment program was not loaded");
vector3_type Worldvertex1 = in_vertex1;
vector3_type Worldvertex2 = in_vertex2;
vector3_type Worldvertex3 = in_vertex3;
//--- Temporaries used to hold output from vertex program
vector3_type out_vertex1;
vector3_type out_vertex2;
vector3_type out_vertex3;
vector3_type out_normal1;
vector3_type out_normal2;
vector3_type out_normal3;
vector3_type out_color1;
vector3_type out_color2;
vector3_type out_color3;
//--- Ask vertex program to process all the vertex data.
m_vertex_program->run(this->state(),
in_vertex1, in_normal1, in_color1,
out_vertex1, out_normal1, out_color1);
m_vertex_program->run(this->state(),
in_vertex2, in_normal2, in_color2,
out_vertex2, out_normal2, out_color2);
m_vertex_program->run(this->state(),
in_vertex3, in_normal3, in_color3,
out_vertex3, out_normal3, out_color3);
//printf("pipeline init rasterizer\n");
//--- Initialize rasterizer with output from the vertex program
m_rasterizer->init(out_vertex1, out_normal1, Worldvertex1, out_color1,
out_vertex2, out_normal2, Worldvertex2, out_color2,
out_vertex3, out_normal3, Worldvertex3, out_color3);
//--- Keep on processing fragments until there are none left
//printf("initialized - starting draw loop\n");
while( m_rasterizer->more_fragments() )
{
//--- get screen location of the current fragment
int screen_x = m_rasterizer->x();
int screen_y = m_rasterizer->y();
//printf("x:%d,y:%d\n",m_rasterizer->x(),m_rasterizer->y());
//--- extract old and new z value and perform a z-test
real_type z_old = m_zbuffer.read( screen_x, screen_y );
real_type z_new = m_rasterizer->depth();
if( this->state().ztest( z_old, z_new ) )
{
//--- The fragment passed the z-test, now we need to ask
//--- the fragment program to compute the color of the fragment.
vector3_type out_color; // uninitialized!
out_color = m_rasterizer->color(); // now initialized!
//printf("color:%d,%d,%d\n",out_color[1],
// out_color[2], out_color[3]);
m_fragment_program->run(this->state(),
m_rasterizer->position(),
m_rasterizer->normal(),
m_rasterizer->color(),
out_color);
//--- Finally we write the new z-value to the z-buffer
//--- and the new color to the frame buffer.
m_zbuffer.write( screen_x, screen_y, z_new);
this->write_pixel_to_frame_buffer(screen_x, screen_y, out_color);
}
//--- We finished processing the fragment, so we
//--- can advance to the next fragment.
m_rasterizer->next_fragment();
}
}
/**
* Flush to Screen.
* When this method is invoked whatever content of
* the framebuffer will be shown on the screen.
*
* This method should be invoked when finished
* drawing all triangles.
*/
void flush()
{
this->m_frame_buffer.flush();
}
};
}// end namespace graphics
// GRAPHICS_RENDER_PIPELINE_H
#endif
| [
"martinnjorgensen@gmail.com"
] | martinnjorgensen@gmail.com |
8480ec31dd47d251deba875be2ad42abd4331167 | 0061af0b567675394bddabc2083745a7e4030630 | /algorithm/算法的乐趣代码/code07/gs/stdafx.cpp | 8935984d2d6741eef289bf9abe6b2df87e42f780 | [] | no_license | dreamsxin/example | b4dae24c7431c1a94e8d1ff22577993fc8bd5696 | 3a9b847e5e5b952974d80354d04dabcba48348e8 | refs/heads/master | 2023-09-01T01:33:14.992085 | 2023-08-30T02:18:29 | 2023-08-30T02:18:29 | 27,425,067 | 146 | 45 | null | 2019-10-23T05:37:43 | 2014-12-02T09:30:33 | JavaScript | UTF-8 | C++ | false | false | 289 | cpp | // stdafx.cpp : source file that includes just the standard includes
// gs.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
| [
"dreamsxin@126.com"
] | dreamsxin@126.com |
d5e62585e4d4a166f59cc29d76166fb9d80f2f9f | ae4ae301c5b39631f5bd9050d5a7f944718a726c | /RRTstarBearingChecks/include/ompl/base/PlannerData.h | 8541271569026b75a810e1afec381ad2dc97ee4e | [] | no_license | megan-starr9/UAV_Aiolos | 04263f88946a435b97bf839e08b9ef70d015f4ca | f7ed6ecacfa2be914fbc8a5b84d23bbb93184d4e | refs/heads/master | 2021-01-17T05:42:33.994969 | 2012-07-05T16:21:11 | 2012-07-05T16:21:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,268 | h | /*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2011, Rice University
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the Rice University nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*********************************************************************/
/* Author: Ioan Sucan */
#ifndef OMPL_BASE_PLANNER_DATA_
#define OMPL_BASE_PLANNER_DATA_
#include "ompl/base/SpaceInformation.h"
#include <iostream>
#include <vector>
#include <string>
#include <map>
namespace ompl
{
namespace base
{
/** \brief Datatype holding data a planner can expose for debug purposes. */
class PlannerData
{
public:
PlannerData(void)
{
}
virtual ~PlannerData(void)
{
}
/** \brief Record an edge between two states. This
function is called by planners to fill \e states, \e
stateIndex and \e edges. If the same state/edge is
seen multiple times, it is added only once.
\return index of s1 in state array when an edge is added,
-1 otherwise. */
int recordEdge(const State *s1, const State *s2);
/** \brief Assign a tag to a state */
void tagState(const State *s, int tag);
/** \brief Clear any stored data */
virtual void clear(void);
/** \brief Print this data to a stream */
virtual void print(std::ostream &out = std::cout) const;
/** \brief The space information containing the states of the exploration datastructure */
SpaceInformationPtr si;
/** \brief The list of states in the current exploration datastructure */
std::vector< const State* > states;
/** \brief For every state, a tag may be associated by the planner. For example, a bi-directional planner
may assign one tag for states in the start tree and another for states in the goal tree. By default the tag has value 0. */
std::vector< int > tags;
/** \brief The same list of states as above, provided for convenience, in a manner that allows finding out a
state's index from its pointer value */
std::map< const State *, unsigned int > stateIndex;
/** \brief For each i, edges[i] contains the values edges[i][j] such that states[i] connects to every states[edges[i][j]] */
std::vector< std::vector<unsigned int> > edges;
/** \brief Any extra properties (key-value pairs) the planner can set. */
std::map<std::string, std::string> properties;
};
}
}
#endif
| [
"megan_starr9@yahoo.com"
] | megan_starr9@yahoo.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.