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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c0be4e37a196b38219fd3c79718f530c79773f46 | 166729f27064d7565dac923450bd41c2fe6eb7a4 | /logdevice/common/protocol/GAP_Message.h | 6b17b3861c7aa79ca79634c8e0679d16bab4d7dc | [
"BSD-3-Clause"
] | permissive | abhishekg785/LogDevice | 742e7bd6bf3177056774346c8095b43a7fe82c79 | 060da71ef84b61f3371115ed352a7ee7b07ba9e2 | refs/heads/master | 2020-04-17T05:26:15.201210 | 2019-01-17T14:18:09 | 2019-01-17T14:23:57 | 166,278,849 | 1 | 0 | NOASSERTION | 2019-01-17T18:53:23 | 2019-01-17T18:53:22 | null | UTF-8 | C++ | false | false | 3,110 | h | /**
* Copyright (c) 2017-present, Facebook, Inc. and its affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <string>
#include "logdevice/common/protocol/FixedSizeMessage.h"
#include "logdevice/common/types_internal.h"
#include "logdevice/include/EnumMap.h"
#include "logdevice/include/Record.h"
namespace facebook { namespace logdevice {
/**
* @file GAP is the message sent by a storage node to clients to report that
* the node doesn't have any records in the interval [start_lsn, end_lsn].
*
* Note that clients assume that no records with sequence numbers smaller
* than start_lsn will be delievered after this message.
*/
/**
* Reason for the gap, from a storage node's perspective.
*/
enum class GapReason : uint8_t {
// Log trimmed up to the specified lsn
TRIM = 0,
// There are no records in the specified range
NO_RECORDS = 1,
// Record failed checksum
CHECKSUM_FAIL = 2,
// No longer used but keeping the value reserved to avoid confusing old
// clients
EPOCH_NOT_CLEAN_DEPRECATED = 3,
// Equivalent to NO_RECORDS, but the storage node knows that it may
// be missing records near the current read position.
UNDER_REPLICATED = 4,
// Supported when protocol >= Compatibility::SERVER_CAN_FILTER
// ServerReadStream send this GAP when records are filtered out on the
// server-side.[Experimental Feature]
FILTERED_OUT = 5,
// The number of valid GapReason constants.
MAX,
INVALID
};
typedef uint8_t GAP_flags_t;
extern EnumMap<GapReason, std::string> gap_reason_names;
struct GAP_Header {
logid_t log_id;
read_stream_id_t read_stream_id;
lsn_t start_lsn;
lsn_t end_lsn;
GapReason reason;
GAP_flags_t flags;
shard_index_t shard;
// This is a digest GAP message. It is a part of a read stream that
// was created by a START message with the DIGEST flag set. Digest
// gaps are used in epoch recovery.
static const GAP_flags_t DIGEST = 1 << 5; //=32
/**
* @return a human-readable string with the GAP's log id, lsn range,
* and the reason for the gap.
*/
std::string identify() const;
} __attribute((packed));
class GAP_Message : public Message {
public:
// identifies the origin of the gap
enum class Source { LOCAL_LOG_STORE, CACHED_DIGEST };
explicit GAP_Message(const GAP_Header&,
TrafficClass = TrafficClass::READ_BACKLOG,
Source source = Source::LOCAL_LOG_STORE);
// see Message.h
void serialize(ProtocolWriter&) const override;
Disposition onReceived(const Address& from) override;
static Message::deserializer_t deserialize;
const GAP_Header& getHeader() const {
return header_;
}
std::string identify() const {
return header_.identify();
}
GAP_Header header_;
// used only on the sending end
Source source_;
virtual std::vector<std::pair<std::string, folly::dynamic>>
getDebugInfo() const override;
};
}} // namespace facebook::logdevice
| [
"facebook-github-bot@users.noreply.github.com"
] | facebook-github-bot@users.noreply.github.com |
67ca89f469b26f7a87500061025edbcb01ddafed | 4352b5c9e6719d762e6a80e7a7799630d819bca3 | /tutorials/oldd/old/movingMeshRhoPimpleFoam/rhoPimpleArbitraryFoam/1.17/uniform/time | dc07eeb5bd5cc46a9dd6164168496e72c1c6945a | [] | no_license | dashqua/epicProject | d6214b57c545110d08ad053e68bc095f1d4dc725 | 54afca50a61c20c541ef43e3d96408ef72f0bcbc | refs/heads/master | 2022-02-28T17:20:20.291864 | 2019-10-28T13:33:16 | 2019-10-28T13:33:16 | 184,294,390 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 838 | /*--------------------------------*- 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 dictionary;
location "1.17/uniform";
object time;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
value 1.16999999999999993;
name "1.17";
index 7800;
deltaT 0.000156211;
deltaT0 0.000156211;
// ************************************************************************* //
| [
"thomasdigiusto@me.com"
] | thomasdigiusto@me.com | |
cc16be3a38bd475426ca12161d68f5bfdeb2335f | 84737883b1a0dc218331027d31e9c67584e7da2e | /Communication/MsgRequester.cpp | e60d189d241871254a68da81c9567454f4780ae7 | [
"Apache-2.0"
] | permissive | Cavalia/Cavalia | b12940211bd539123dca21837afda84f7f9eb986 | d6a48ad5b4e28301ca02512ce7b70de98af003f5 | refs/heads/master | 2021-01-18T12:12:16.338787 | 2018-09-27T03:48:18 | 2018-09-27T03:48:18 | 46,721,730 | 121 | 33 | null | 2016-03-19T05:10:36 | 2015-11-23T13:24:40 | C++ | UTF-8 | C++ | false | false | 1,616 | cpp | #include "MsgRequester.h"
MsgRequester::MsgRequester(const std::string &address){
zmq_address_ = "tcp://" + address;
context_ = zmq_ctx_new();
socket_ = zmq_socket(context_, ZMQ_REQ);
int rc = zmq_connect(socket_, zmq_address_.c_str());
assert(rc == 0);
}
MsgRequester::~MsgRequester(){
zmq_close(socket_);
zmq_ctx_destroy(context_);
socket_ = NULL;
context_ = NULL;
}
void MsgRequester::IssueRequest(const char *request, const size_t &request_size, char *&reply, size_t &reply_size){
zmq_msg_t request_msg;
zmq_msg_init_size(&request_msg, request_size);
memcpy(zmq_msg_data(&request_msg), request, request_size);
int rc = zmq_msg_send(&request_msg, socket_, 0);
assert(rc != -1);
zmq_msg_close(&request_msg);
zmq_msg_t reply_msg;
zmq_msg_init(&reply_msg);
rc = zmq_msg_recv(&reply_msg, socket_, 0);
assert(rc != -1);
reply_size = zmq_msg_size(&reply_msg);
reply = static_cast<char*>(malloc(reply_size));
memcpy(reply, zmq_msg_data(&reply_msg), reply_size);
zmq_msg_close(&reply_msg);
}
void MsgRequester::IssueRequest(const CharArray &request_str, CharArray &reply_str){
zmq_msg_t request_msg;
zmq_msg_init_size(&request_msg, request_str.size_);
memcpy(zmq_msg_data(&request_msg), request_str.char_ptr_, request_str.size_);
int rc = zmq_msg_send(&request_msg, socket_, 0);
assert(rc != -1);
zmq_msg_close(&request_msg);
zmq_msg_t reply_msg;
zmq_msg_init(&reply_msg);
rc = zmq_msg_recv(&reply_msg, socket_, 0);
assert(rc != -1);
reply_str.Allocate(zmq_msg_size(&reply_msg));
memcpy(reply_str.char_ptr_, zmq_msg_data(&reply_msg), reply_str.size_);
zmq_msg_close(&reply_msg);
}
| [
"wu.yj0616@gmail.com"
] | wu.yj0616@gmail.com |
0cc162a9673b27b083e80602a4a2a538785e4a75 | ed65cdc29982eca7bb2993d227c4b9f5919040ed | /src/signalprocessing.cpp | d0f9d2f2044f3965df859abcbea580edf54294e9 | [
"BSD-3-Clause"
] | permissive | nagyistoce/arrayfire_js | 264dbe3056aae1ef11ac52f512a80ea281bf3201 | bc7962ce712ce0c28292e44261660cb9edf7936c | refs/heads/master | 2021-01-23T16:39:51.006486 | 2015-07-11T09:56:38 | 2015-07-11T09:56:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,429 | cpp | /*
Copyright (c) 2014-2015, ArrayFire
Copyright (c) 2015 Gábor Mező aka unbornchikken (gabor.mezo@outlook.com)
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 ArrayFire nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "ext.h"
#include "computervision.h"
#include "helpers.h"
#include "arraywrapper.h"
#include "errors.h"
#include "guard.h"
using namespace v8;
using namespace std;
using namespace node;
NAN_METHOD(ConvolveSeparable)
{
NanScope();
try
{
ARGS_LEN(3);
auto pArray1 = ArrayWrapper::GetArrayAt(args, 0);
auto pArray2 = ArrayWrapper::GetArrayAt(args, 1);
auto pArray3 = ArrayWrapper::GetArrayAt(args, 2);
af::convMode mode = AF_CONV_DEFAULT;
if (args.Length() > 3) mode = (af::convMode)args[3]->Uint32Value();
Guard();
ArrayWrapper::New(af::convolve(*pArray1, *pArray2, *pArray3, mode));
}
ARRAYFIRE_CATCH;
}
#define ARRAYFIRE_CONVOLVE(F, f)\
NAN_METHOD(F)\
{\
NanScope();\
try\
{\
ARGS_LEN(2);\
auto pArray1 = ArrayWrapper::GetArrayAt(args, 0);\
auto pArray2 = ArrayWrapper::GetArrayAt(args, 1);\
af::convMode mode = AF_CONV_DEFAULT;\
af::convDomain domain = AF_CONV_AUTO;\
if (args.Length() > 2) mode = (af::convMode)args[2]->Uint32Value();\
if (args.Length() > 3) domain = (af::convDomain)args[3]->Uint32Value();\
Guard();\
ArrayWrapper::New(af::f(*pArray1, *pArray2, mode, domain));\
}\
ARRAYFIRE_CATCH;\
}
ARRAYFIRE_CONVOLVE(Convolve, convolve)
ARRAYFIRE_CONVOLVE(Convolve1, convolve1)
ARRAYFIRE_CONVOLVE(Convolve2, convolve2)
ARRAYFIRE_CONVOLVE(Convolve3, convolve3)
#undef ARRAYFIRE_CONVOLVE
#define ARRAYFIRE_CONVOLVE(F, f)\
NAN_METHOD(F)\
{\
NanScope();\
try\
{\
ARGS_LEN(2);\
auto pArray1 = ArrayWrapper::GetArrayAt(args, 0);\
auto pArray2 = ArrayWrapper::GetArrayAt(args, 1);\
af::convMode mode = AF_CONV_DEFAULT;\
if (args.Length() > 2) mode = (af::convMode)args[2]->Uint32Value();\
Guard();\
ArrayWrapper::New(af::f(*pArray1, *pArray2, mode));\
}\
ARRAYFIRE_CATCH;\
}
ARRAYFIRE_CONVOLVE(FFTConvolve, fftConvolve)
ARRAYFIRE_CONVOLVE(FFTConvolve2, fftConvolve2)
ARRAYFIRE_CONVOLVE(FFTConvolve3, fftConvolve3)
#undef ARRAYFIRE_CONVOLVE
#define ARRAY_FIRE_FFTNORM(F, f)\
NAN_METHOD(F)\
{\
NanScope();\
try\
{\
ARGS_LEN(2);\
auto pArray = ArrayWrapper::GetArrayAt(args, 0);\
double factor = args[1]->NumberValue();\
dim_t odim0 = 0;\
if (args.Length() > 2) odim0 = args[2]->Uint32Value();\
Guard();\
ArrayWrapper::New(af::f(*pArray, factor, odim0));\
}\
ARRAYFIRE_CATCH;\
}
ARRAY_FIRE_FFTNORM(FFTNorm, fftNorm)
ARRAY_FIRE_FFTNORM(IFFTNorm, ifftNorm)
#undef ARRAY_FIRE_FFTNORM
#define ARRAY_FIRE_FFT(F, f)\
NAN_METHOD(F)\
{\
NanScope();\
try\
{\
ARGS_LEN(2);\
auto pArray = ArrayWrapper::GetArrayAt(args, 0);\
dim_t odim0 = 0;\
if (args.Length() > 1) odim0 = args[1]->Uint32Value();\
Guard();\
ArrayWrapper::New(af::f(*pArray, odim0));\
}\
ARRAYFIRE_CATCH;\
}
ARRAY_FIRE_FFT(FFT, fft)
ARRAY_FIRE_FFT(IFFT, ifft)
#undef ARRAY_FIRE_FFT
#define ARRAYFIRE_DFT(F, f)\
NAN_METHOD(F)\
{\
NanScope();\
try\
{\
ARGS_LEN(1);\
auto pArray = ArrayWrapper::GetArrayAt(args, 0);\
if (args.Length() == 1)\
{\
Guard();\
ArrayWrapper::New(af::f(*pArray));\
}\
else if (args.Length() == 2)\
{\
Guard();\
ArrayWrapper::New(af::f(*pArray, ToDim4(args[1])));\
}\
else if (args.Length() == 3)\
{\
Guard();\
ArrayWrapper::New(af::f(*pArray, args[1]->NumberValue(), ToDim4(args[2])));\
}\
else \
{\
NAN_THROW_INVALID_NO_OF_ARGS();\
}\
}\
ARRAYFIRE_CATCH;\
}
ARRAYFIRE_DFT(DFT, dft)
ARRAYFIRE_DFT(IDFT, idft)
#undef ARRAYFIRE_DFT
#define ARRAYFIRE_FFT2(F, f)\
NAN_METHOD(F)\
{\
NanScope();\
try\
{\
ARGS_LEN(1);\
auto pArray = ArrayWrapper::GetArrayAt(args, 0);\
dim_t dim0 = 0;\
dim_t dim1 = 0;\
if (args.Length() > 1) dim0 = args[1]->Uint32Value();\
if (args.Length() > 2) dim1 = args[2]->Uint32Value();\
Guard();\
ArrayWrapper::New(af::f(*pArray, dim0, dim1));\
}\
ARRAYFIRE_CATCH;\
}
ARRAYFIRE_FFT2(FFT2, fft2)
ARRAYFIRE_FFT2(IFFT2, ifft2)
#undef ARRAYFIRE_FFT2
#define ARRAYFIRE_FFT3(F, f)\
NAN_METHOD(F)\
{\
NanScope();\
try\
{\
ARGS_LEN(1);\
auto pArray = ArrayWrapper::GetArrayAt(args, 0);\
dim_t dim0 = 0;\
dim_t dim1 = 0;\
dim_t dim2 = 0;\
if (args.Length() > 1) dim0 = args[1]->Uint32Value();\
if (args.Length() > 2) dim1 = args[2]->Uint32Value();\
if (args.Length() > 3) dim2 = args[3]->Uint32Value();\
Guard();\
ArrayWrapper::New(af::f(*pArray, dim0, dim1, dim2));\
}\
ARRAYFIRE_CATCH;\
}
ARRAYFIRE_FFT3(FFT3, fft3)
ARRAYFIRE_FFT3(IFFT3, ifft3)
#undef ARRAYFIRE_FFT3
#define ARRAYFIRE_FFT2NORM(F, f)\
NAN_METHOD(F)\
{\
NanScope();\
try\
{\
ARGS_LEN(2);\
auto pArray = ArrayWrapper::GetArrayAt(args, 0);\
double factor = args[1]->NumberValue();\
dim_t dim0 = 0;\
dim_t dim1 = 0;\
if (args.Length() > 2) dim0 = args[2]->Uint32Value();\
if (args.Length() > 3) dim1 = args[3]->Uint32Value();\
Guard();\
ArrayWrapper::New(af::f(*pArray, factor, dim0, dim1));\
}\
ARRAYFIRE_CATCH;\
}
ARRAYFIRE_FFT2NORM(FFT2Norm, fft2Norm)
ARRAYFIRE_FFT2NORM(IFFT2Norm, ifft2Norm)
#undef ARRAYFIRE_FFT2NORM
#define ARRAYFIRE_FFT3NORM(F, f)\
NAN_METHOD(F)\
{\
NanScope();\
try\
{\
ARGS_LEN(2);\
auto pArray = ArrayWrapper::GetArrayAt(args, 0);\
double factor = args[1]->NumberValue();\
dim_t dim0 = 0;\
dim_t dim1 = 0;\
dim_t dim2 = 0;\
if (args.Length() > 2) dim0 = args[2]->Uint32Value();\
if (args.Length() > 3) dim1 = args[3]->Uint32Value();\
if (args.Length() > 4) dim2 = args[4]->Uint32Value();\
Guard();\
ArrayWrapper::New(af::f(*pArray, factor, dim0, dim1, dim2));\
}\
ARRAYFIRE_CATCH;\
}
ARRAYFIRE_FFT3NORM(FFT3Norm, fft3Norm)
ARRAYFIRE_FFT3NORM(IFFT3Norm, ifft3Norm)
#undef ARRAYFIRE_FFT3NORM
ARRAYFIRE_SYNC_METHOD_ARR_ARR(FIR, fir)
ARRAYFIRE_SYNC_METHOD_ARR_ARR_ARR(IIR, iir)
NAN_METHOD(Approx1)
{
NanScope();
try
{
ARGS_LEN(2);
auto pArray1 = ArrayWrapper::GetArrayAt(args, 0);
auto pArray2 = ArrayWrapper::GetArrayAt(args, 1);
af::interpType method = AF_INTERP_LINEAR;
float offGrid = 0.0f;
if (args.Length() > 2) method = (af::interpType)args[2]->Uint32Value();
if (args.Length() > 3) offGrid = args[3]->NumberValue();
Guard();
ArrayWrapper::New(af::approx1(*pArray1, *pArray2, method, offGrid));
}
ARRAYFIRE_CATCH;
}
NAN_METHOD(Approx2)
{
NanScope();
try
{
ARGS_LEN(3);
auto pArray1 = ArrayWrapper::GetArrayAt(args, 0);
auto pArray2 = ArrayWrapper::GetArrayAt(args, 1);
auto pArray3 = ArrayWrapper::GetArrayAt(args, 2);
af::interpType method = AF_INTERP_LINEAR;
float offGrid = 0.0f;
if (args.Length() > 3) method = (af::interpType)args[3]->Uint32Value();
if (args.Length() > 4) offGrid = args[4]->NumberValue();
Guard();
ArrayWrapper::New(af::approx2(*pArray1, *pArray2, *pArray3, method, offGrid));
}
ARRAYFIRE_CATCH;
}
void InitSignalProcessing(v8::Handle<v8::Object> exports)
{
exports->Set(NanNew("convolveSeparable"), NanNew<FunctionTemplate>(ConvolveSeparable)->GetFunction());
exports->Set(NanNew("convolve"), NanNew<FunctionTemplate>(Convolve)->GetFunction());
exports->Set(NanNew("convolve1"), NanNew<FunctionTemplate>(Convolve1)->GetFunction());
exports->Set(NanNew("convolve2"), NanNew<FunctionTemplate>(Convolve2)->GetFunction());
exports->Set(NanNew("convolve3"), NanNew<FunctionTemplate>(Convolve3)->GetFunction());
exports->Set(NanNew("fftConvolve"), NanNew<FunctionTemplate>(FFTConvolve)->GetFunction());
exports->Set(NanNew("fftConvolve2"), NanNew<FunctionTemplate>(FFTConvolve2)->GetFunction());
exports->Set(NanNew("fftConvolve3"), NanNew<FunctionTemplate>(FFTConvolve3)->GetFunction());
exports->Set(NanNew("fftNorm"), NanNew<FunctionTemplate>(FFTNorm)->GetFunction());
exports->Set(NanNew("iFFTNorm"), NanNew<FunctionTemplate>(IFFTNorm)->GetFunction());
exports->Set(NanNew("fft"), NanNew<FunctionTemplate>(FFT)->GetFunction());
exports->Set(NanNew("iFFT"), NanNew<FunctionTemplate>(IFFT)->GetFunction());
exports->Set(NanNew("dFT"), NanNew<FunctionTemplate>(DFT)->GetFunction());
exports->Set(NanNew("iDFT"), NanNew<FunctionTemplate>(IDFT)->GetFunction());
exports->Set(NanNew("fft2"), NanNew<FunctionTemplate>(FFT2)->GetFunction());
exports->Set(NanNew("iFFT2"), NanNew<FunctionTemplate>(IFFT2)->GetFunction());
exports->Set(NanNew("fft3"), NanNew<FunctionTemplate>(FFT3)->GetFunction());
exports->Set(NanNew("iFFT3"), NanNew<FunctionTemplate>(IFFT3)->GetFunction());
exports->Set(NanNew("fft2Norm"), NanNew<FunctionTemplate>(FFT2Norm)->GetFunction());
exports->Set(NanNew("iFFT2Norm"), NanNew<FunctionTemplate>(IFFT2Norm)->GetFunction());
exports->Set(NanNew("fft3Norm"), NanNew<FunctionTemplate>(FFT3Norm)->GetFunction());
exports->Set(NanNew("iFFT3Norm"), NanNew<FunctionTemplate>(IFFT3Norm)->GetFunction());
exports->Set(NanNew("fir"), NanNew<FunctionTemplate>(FIR)->GetFunction());
exports->Set(NanNew("iir"), NanNew<FunctionTemplate>(IIR)->GetFunction());
exports->Set(NanNew("approx1"), NanNew<FunctionTemplate>(Approx1)->GetFunction());
exports->Set(NanNew("approx2"), NanNew<FunctionTemplate>(Approx2)->GetFunction());
}
| [
"gabor.mezo@outlook.com"
] | gabor.mezo@outlook.com |
c6a04701f857847ae76fdb60737d114520d7edd7 | ec102b10ffa56498b36380509230daf84f97727b | /OptionSpreads.cpp | cbe42a80344bb861ba408ed065262754d60df632 | [] | no_license | jnwickremasinghe/OptionSpreads | 16a27e563cca74c0e0a7caa5ced1b5e0a25bcb56 | 6cbf4031e4af7869d1218055a9920f243f52a52d | refs/heads/master | 2020-04-28T12:41:54.505845 | 2013-07-22T03:45:34 | 2013-07-22T03:45:34 | 8,087,745 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 633 | cpp | /*
* hworld.cpp
* Hello world sample by Robert Roebling
* Adapted for unicode by Max Berger
*/
#include "wx/wx.h"
#include "optiongui.h"
#include <oauth.h>
class MyApp: public wxApp
{
virtual bool OnInit();
};
enum
{
ID_Quit = 1,
ID_About,
};
/*
BEGIN_EVENT_TABLE(MainFrame, wxFrame)
EVT_MENU(ID_Quit, MainFrame::OnQuit)
EVT_MENU(ID_About, MainFrame::OnAbout)
END_EVENT_TABLE()
*/
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
MainFrame *frame = new MainFrame(NULL,-1, wxT("Hello World"),
wxPoint(50,50), wxSize(1700,1340) );
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
}
| [
"jnwickremasinghe@yahoo.com"
] | jnwickremasinghe@yahoo.com |
bd5aac4c3f2afaa84a5cd9c58007027356732c22 | 329a671e3e6b042014ecd27451d255326b975a4a | /include/chasm/lex/detail/type_traits.hpp | 827129b10b4bfb864ea2a5fb178cbb5fdec637ab | [
"MIT"
] | permissive | Ostoic/chasm | 5760b731cd8a6e67ead950e1c41d7113bd630275 | 9ffab5686cac79158699d704368c67ec29551327 | refs/heads/master | 2022-12-28T10:28:50.905704 | 2020-10-12T22:50:20 | 2020-10-12T22:50:20 | 200,614,710 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,358 | hpp | #pragma once
#include <type_traits>
namespace chasm::lex::detail
{
struct nonesuch
{
~nonesuch() = delete;
nonesuch(nonesuch const&) = delete;
void operator=(nonesuch const&) = delete;
};
// detection:
template <
class Default,
class AlwaysVoid,
template<class...> class Op,
class... Args
>
struct detector
{
using value_t = std::false_type;
using type = Default;
};
template <class Default, template<class...> class Op, class... Args>
struct detector<Default, std::void_t<Op<Args...>>, Op, Args...>
{
using value_t = std::true_type;
using type = Op<Args...>;
};
template <template<class...> class Op, class... Args>
using is_detected = typename detail::detector<nonesuch, void, Op, Args...>::value_t;
template <template<class...> class Op, class... Args>
inline constexpr bool is_detected_v = is_detected<Op, Args...>::value;
template <template<class...> class Op, class... Args>
using detected_t = typename detail::detector<nonesuch, void, Op, Args...>::type;
template <class Default, template<class...> class Op, class... Args>
using detected_or = detail::detector<Default, void, Op, Args...>;
template <class T>
struct function;
template <class R, class... Ts>
struct function<R(Ts...)>
{
using type = R(*)(Ts...);
};
template <class T>
using fn_ptr = typename detail::function<T>::type;
} | [
"dinnertable@hotmail.ca"
] | dinnertable@hotmail.ca |
a4f3eba908bc3c2091d894fc6f171f211d607fcb | 62b6a09cbc6b7a29258af7262ea887580c7fc21b | /labs/lab03/q2/main.cpp | 44d54c1cd5651bf1e1689bd80864fe0726c724d5 | [] | no_license | ahtamaral/EEL670 | f7dd71ebf40cba2e44d9bca070e63f5fae8ac896 | 8d42a6e1490def30d1b8b1a6540127c60724052f | refs/heads/master | 2023-07-15T12:45:48.455779 | 2021-08-28T19:54:46 | 2021-08-28T19:54:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 385 | cpp | // EEL670 - Linguagens de programação
// Período 2021.1 - Laboratório 02
// Autor: Artur Amaral
#include "agenda.h"
int main (){
Agenda a;
int i;
string nomeRecebido;
while (i < 4)
{
cout << "Insira um nome na agenda: ";
cin >> nomeRecebido;
a.insereNomes(nomeRecebido);
i ++;
}
a.mostraNomes();
return 0;
} | [
"artur_amaral@poli.ufrj.br"
] | artur_amaral@poli.ufrj.br |
75a1c34165ae73fa0fd9cc134d93b9865e7967d5 | c7eba6d2ce129f735f466fa76eb3deea1fd73e29 | /target/G_Tugas3/kelvin_kurniawan.cc | dcb32019f1d1f4496f4a1e4951ae5a378def4746 | [] | no_license | wowotek/Kuliah_Asdos_Grafkom_2020 | a537dba6a43637e089dcbd3a46bc667934c3748a | 4e543acf006bb48f38273eb197a0929d643df89d | refs/heads/master | 2022-11-29T17:40:08.050977 | 2020-08-14T16:12:46 | 2020-08-14T16:12:46 | 287,574,326 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,394 | cc | #include <iostream> // Opsional
#include <math.h>
#include <GL/freeglut.h>
#include <vector>
#include <algorithm>
std::vector<unsigned char> myKey;
int x_pos, y_pos;
void renderObject() {
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}
void displayTerminal() {
system("cls");
std::cout << "Mouse Coordinates, X : " << x_pos << " | Y : " << y_pos << std::endl;
for (unsigned char x : myKey) {
std::cout << x << " ";
}
}
void onKeyboardDownEvent(unsigned char key, int mouseX, int mouseY) {
myKey.push_back(key);
displayTerminal();
}
void onKeyboardUpEvent(unsigned char key, int mouseX, int mouseY) {
myKey.erase(std::remove(myKey.begin(), myKey.end(), key), myKey.end());
displayTerminal();
}
void mouseEvent(int x, int y) {
x_pos = x;
y_pos = y;
displayTerminal();
}
int main(int argc, char** argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
glutInitWindowSize(600, 600);
glutInitWindowPosition(500, 0);
glutCreateWindow("Tugas Ketiga ~ Kelvin Kurniawan");
glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF);
glutDisplayFunc(renderObject);
glutKeyboardFunc(onKeyboardDownEvent);
glutKeyboardUpFunc(onKeyboardUpEvent);
glutMotionFunc(mouseEvent);
gluOrtho2D(0, 200, 0, 200);
glutMainLoop();
glClearColor(1.0, 1.0, 1.0, 1.0);
glPointSize(10);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 100.0, 0.0, 100.0);
return 0;
} | [
"erlanggaibr2@gmail.com"
] | erlanggaibr2@gmail.com |
7609239cf61a85e93e2245c975e737a6507d469a | 0599f5106f3812d7c0297fefd5f385079d630af6 | /Project.cpp | 171d14414059425a4aa21194bf1b4535db6a8834 | [] | no_license | sor-ee/C-plus-plus- | 16e70da936ffbb427c582c9b6e97aa0173a01cb8 | f9fb8c1749c5be182bb24765a12993069beecd3c | refs/heads/master | 2023-01-03T16:46:18.858327 | 2020-10-21T03:55:11 | 2020-10-21T03:55:11 | 281,298,647 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,927 | cpp | #include <iostream>
#include <string>
#include <iomanip>
using namespace std;
string members[100][4];
string products[100][3];
string name[100];
string number,goods;
string product[100];
int prices[100][2];
int total_stock[100] ;
int stocks[100];
int each_price[100];
int count_member = 0;
int count_product = 0;
int total_prices = 0;
int stock = 0;
int noname = 0;
int count_stock = 0;
int count = 1;
int total_all;
char menu,select;
bool haveproduct = false;
void insert_product();
void insert_member();
void sell();
int main()
{
cout<<"***********************"<<endl;
cout << "1.costumer data\n";
cout << "2.goods data\n";
cout << "3.buy product\n";
cout << "4.report and exit\n";
//cout << "5.Exit\n";
cout<<"***********************"<<endl;
do{
cout<<"Enter menu : ";
cin>>menu;
if (menu=='1')
{
system("cls");
insert_member();
}
else if (menu=='2')
{
system("cls");
insert_product();
}
else if (menu=='3')
{
system("cls");
sell();
}
else if (menu=='4')
{
system("cls");
cout<<setw(32)<<"ALL STOCKS\n";
cout<<"--------------------------------------------------------"<<endl;
cout<< setw(10)<<left<<"No."<<setw(10)<<left<< "ID."<<setw(10)<<left<< "Name."<<setw(10)<<left<< "price"<<setw(10)<<left<<"stock"<<endl;
cout<<"--------------------------------------------------------"<<endl;
cout<<endl;
for (int i =0 ;i <count_product;i++){
cout<<setw(10)<<left<< i+1 ;
for (int j = 0 ; j<2 ; j++){
cout<<setw(10)<<left<<products[i][j];
}
for (int n = 0 ; n<1 ; n++){
cout<<setw(10)<<left<< prices[i][n];
}
for (int a = 0;a<1;a++)
{
cout<<setw(10)<<left<< prices[i][1]<<endl;
}
}
cout<<endl;
cout<<"--------------------------------------------------------"<<endl;
cout<<endl;
cout<<"REMAINING STOCKS\n";
cout<<"--------------------------------------------------------"<<endl;
cout<< setw(10)<<left<<"Name"<<setw(10)<<left <<"stock"<<endl;
cout<<"--------------------------------------------------------"<<endl;
for (int i =0 ;i <count_product;i++)
{
cout<<setw(10)<<left<<products[i][1]<<setw(10)<<left<< total_stock[i]<<endl;
}
cout<<"--------------------------------------------------------"<<endl;
cout<<endl;
cout <<"DAILY SELL\n";
cout<<"--------------------------------------------------------"<<endl;
cout <<setw(25)<<left<< "Name"<<setw(15)<<left<<"Product"<<setw(10)<<left<<"Amount"<<setw(10)<<left<<"Price"<<endl;
cout<<"--------------------------------------------------------"<<endl;
for (int n =0 ;n <count_product;n++)
{
cout<<setw(25)<<left<<name[n]<<setw(15)<<left<<product[n]<<setw(10)<<left<<stocks[n]<<setw(10)<<left<<each_price[n];
cout << endl;
}
cout<<"--------------------------------------------------------"<<endl;
cout<<"TOTAL:"<< total_all<<endl;
cout<<"--------------------------------------------------------"<<endl;
cin.get();
cin.ignore();
}
}
while(menu!= '4');
if (menu == '4') exit(0);
main();
cout <<"\nExit\n";
system("pause");
return 0;
}
void insert_member()
{
char select;
cout << "Enter ID Member : ";
cin >> members[count_member][0];
cout << "Enter Name : ";
cin.get();
getline(cin, members[count_member][1]);
cout << "Enter Telephone Number : ";
cin >> members[count_member][2];
cout << "Enter Email : ";
cin >> members[count_member][3];
cout << "1 = again 2 = back : ";
count_member++;
cin >> select ;
switch(select){
case '1' :
system("cls");
insert_member();
break;
case '2' :
system("cls");
main();
}
}
void insert_product()
{
char select;
cout << "Enter ID Product : ";
cin >> products[count_product][0];
cout << "Enter Name Product : ";
cin >> products[count_product][1];
cout << "Enter Price : ";
cin >> prices[count_product][0];
cout << "Enter Stock : ";
cin >> prices[count_product][1];
total_stock[count_product] = prices[count_product][1];
cout << "1 = again 2 = back : ";
count_product++;
cin >> select ;
switch(select){
case '1' :
system("cls");
insert_product();
break;
}
system("cls");
main();
}
void sell()
{
bool haveproduct = false;
cout<<"Enter member ID : ";
cin>>number;
int noname=0;
total_prices = 0;
for (int i = 0 ; i < count_member ; i++)
{
if (number==members[i][0])
{
cout << "Hello " << members[i][1] << endl;
cout<<"Input product ID : ";
cin>>goods;
if (name[i]!=members[i][1])
{
name[i]+=members[i][1];
}
for (int j = 0 ; j < count_product ; j++)
{
if (goods==products[j][0])
{
count_stock+=j;
haveproduct = true;
for (int n = 0 ; n < count_product ; n++)
{
if (product[j]!=products[j][1])
{
product[j]+=products[j][1];
}
do {
if ((stock>total_stock[count_stock])) cout << "Not enough product" << endl;
cout << "Enter amount : ";
cin >> stock;
} while (stock>total_stock[count_stock]);
if (stock<=total_stock[count_stock])
{
stocks[j]+=stock;
cout<<"you can buy"<<endl;
total_prices+=prices[j][0]*stock;
cout << "Price : "<< total_prices<< " Baht" << endl;
total_all+=total_prices;
each_price[j]+=total_prices;
//cin.get();
//cin.ignore();
if(count==1)
{
//name[i]+=members[i][1];
total_stock[count_stock] = prices[count_stock][1] - stock ;
}
else
{
total_stock[count_stock] = total_stock[count_stock] - stock;
}
count_stock = 0;
/*if (total_stock[count_stock] == 0)
{
products[j][1] = "Out of stock";
}*/
count++;
cout << "1 = buy again 2 = back : ";
cin >> select ;
switch(select){
case '1' :
sell();
break;
}
}
else
{
cout << "Not enough\n";
break;
}
break;
}
}
}
noname=1;
break;
}
else
{
noname=0;
}
}
if(noname==0)
{
cout<<"Not found member in data\n";
cout << "Please enter back to menu please select menu 1 for regster before use! . . .";
cin.get();
cin.ignore();
system("cls");
main();
haveproduct = true;
}
if (haveproduct == false)
{
cout << "Don't have product\n";
}
cout << "please Enter to continue";
cin.get();
cin.ignore();
system("cls");
main();
}
| [
"noreply@github.com"
] | noreply@github.com |
b6414aeac5288a6aa93f8895b9b006438aaf9f3f | 10f9592ce8b37326927ac611179a580ebd19b8ec | /display/liboverlay/overlayMem.h | a0074618380a7832cbb960bd7189a5b7d877483a | [] | no_license | mickybart/device_sony_nozomi | 9a8606bf0995ee7fdf5aadb1bf31b907b26e8d47 | accd7925b6b07cbca5e0b03cb0d160d3664cf1de | refs/heads/nAOSP-6.0 | 2021-03-19T08:01:38.712731 | 2016-09-30T14:23:55 | 2016-09-30T14:23:55 | 23,836,672 | 13 | 35 | null | 2016-11-26T00:00:48 | 2014-09-09T14:24:18 | C++ | UTF-8 | C++ | false | false | 5,102 | h | /*
* Copyright (c) 2011, The Linux Foundation. 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 Linux Foundation 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 "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* 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 OVERLAY_MEM_H
#define OVERLAY_MEM_H
#include <sys/mman.h>
#include <fcntl.h>
#include <alloc_controller.h>
#include <memalloc.h>
#include "gralloc_priv.h"
#include "overlayUtils.h"
namespace overlay {
/*
* Holds base address, offset and the fd
* */
class OvMem {
public:
/* ctor init*/
explicit OvMem();
/* dtor DO NOT call close so it can be copied */
~OvMem();
/* Use libgralloc to retrieve fd, base addr, alloc type */
bool open(uint32_t numbufs,
uint32_t bufSz, bool isSecure);
/* close fd. assign base address to invalid*/
bool close();
/* return underlying fd */
int getFD() const;
/* return true if fd is valid and base address is valid */
bool valid() const;
/* dump the state of the object */
void dump() const;
/* return underlying address */
void* addr() const;
/* return underlying offset */
uint32_t bufSz() const;
/* return number of bufs */
uint32_t numBufs() const ;
private:
/* actual os fd */
int mFd;
/* points to base addr (mmap)*/
void* mBaseAddr;
/* allocated buffer type determined by gralloc (ashmem, ion, etc) */
int mAllocType;
/* holds buf size */
uint32_t mBufSz;
/* num of bufs */
uint32_t mNumBuffers;
/* gralloc alloc controller */
gralloc::IAllocController* mAlloc;
};
//-------------------Inlines-----------------------------------
using gralloc::IMemAlloc;
using gralloc::alloc_data;
inline OvMem::OvMem() {
mFd = -1;
mBaseAddr = MAP_FAILED;
mAllocType = 0;
mBufSz = 0;
mNumBuffers = 0;
mAlloc = gralloc::IAllocController::getInstance();
}
inline OvMem::~OvMem() { }
inline bool OvMem::open(uint32_t numbufs,
uint32_t bufSz, bool isSecure)
{
alloc_data data;
int allocFlags = 0;
if(isSecure) {
allocFlags = GRALLOC_USAGE_PRIVATE_MM_HEAP;
allocFlags |= GRALLOC_USAGE_PROTECTED;
allocFlags |= GRALLOC_USAGE_PRIVATE_UNCACHED;
}
int err = 0;
OVASSERT(numbufs && bufSz, "numbufs=%d bufSz=%d", numbufs, bufSz);
mBufSz = bufSz;
mNumBuffers = numbufs;
data.base = 0;
data.fd = -1;
data.offset = 0;
data.size = mBufSz * mNumBuffers;
data.align = getpagesize();
data.uncached = true;
err = mAlloc->allocate(data, allocFlags);
if (err != 0) {
ALOGE("OvMem: Error allocating memory");
return false;
}
mFd = data.fd;
mBaseAddr = data.base;
mAllocType = data.allocType;
return true;
}
inline bool OvMem::close()
{
int ret = 0;
if(!valid()) {
return true;
}
IMemAlloc* memalloc = mAlloc->getAllocator(mAllocType);
ret = memalloc->free_buffer(mBaseAddr, mBufSz * mNumBuffers, 0, mFd);
if (ret != 0) {
ALOGE("OvMem: error freeing buffer");
return false;
}
mFd = -1;
mBaseAddr = MAP_FAILED;
mAllocType = 0;
mBufSz = 0;
mNumBuffers = 0;
return true;
}
inline bool OvMem::valid() const
{
return (mFd != -1) && (mBaseAddr != MAP_FAILED);
}
inline int OvMem::getFD() const
{
return mFd;
}
inline void* OvMem::addr() const
{
return mBaseAddr;
}
inline uint32_t OvMem::bufSz() const
{
return mBufSz;
}
inline uint32_t OvMem::numBufs() const
{
return mNumBuffers;
}
inline void OvMem::dump() const
{
ALOGE("== Dump OvMem start ==");
ALOGE("fd=%d addr=%p type=%d bufsz=%u", mFd, mBaseAddr, mAllocType, mBufSz);
ALOGE("== Dump OvMem end ==");
}
} // overlay
#endif // OVERLAY_MEM_H
| [
"cb@cb-ubuntu.(none)"
] | cb@cb-ubuntu.(none) |
51ee51c07615e43d44147551b2f12bbbe707c672 | bb5258ea8c1f8cbcc247b92971cd926264479002 | /ds2/lib_demonsaw/object/transfer/chunk.h | 9cbf5c862496bbe7b54449b04a49fd9a669984c1 | [
"MIT"
] | permissive | demonsaw/Code | 16fa41f07600e83f16713a657ac8fffa0b6b7f9b | b036d455e9e034d7fd178e63d5e992242d62989a | refs/heads/master | 2021-11-07T21:37:03.738542 | 2021-10-26T03:47:14 | 2021-10-26T03:47:14 | 98,356,418 | 134 | 19 | MIT | 2019-01-06T03:20:12 | 2017-07-25T22:50:36 | C++ | UTF-8 | C++ | false | false | 3,332 | h | //
// The MIT License(MIT)
//
// Copyright(c) 2014 Demonsaw LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef _EJA_CHUNK_
#define _EJA_CHUNK_
#include <memory>
#include <string>
#include "object/object.h"
#include "system/mutex/mutex_list.h"
#include "system/mutex/mutex_map.h"
#include "system/mutex/mutex_queue.h"
#include "system/mutex/mutex_vector.h"
#include "system/type.h"
namespace eja
{
class chunk : public object
{
private:
u64 m_size = 0;
u64 m_offset = 0;
bool m_ack = false;
std::string m_data;
public:
using ptr = std::shared_ptr<chunk>;
public:
chunk() { }
chunk(const eja::chunk& chunk) : object(chunk), m_size(chunk.m_size), m_offset(chunk.m_offset), m_data(chunk.m_data) { }
chunk(const u64 size) : m_size(size) { }
chunk(const u64 size, const u64 offset) : m_size(size), m_offset(offset) { }
virtual ~chunk() override { }
// Interface
virtual void clear() override;
void shrink();
// Utility
virtual bool valid() const override { return object::valid() && has_size(); }
bool has_ack() const { return m_ack; }
bool has_size() const { return m_size > 0; }
bool has_data() const { return !m_data.empty(); }
// Mutator
void set_size(const u64 size) { m_size = size; }
void set_offset(const u64 offset) { m_offset = offset; }
void set_ack(const bool ack) { m_ack = ack; }
void set_data(const std::string& data) { m_data = data; }
void set_data() { m_data.clear(); }
// Accessor
const u64 get_size() const { return m_size; }
const u64 get_offset() const { return m_offset; }
const std::string& get_data() const { return m_data; }
// Static
static ptr create() { return std::make_shared<chunk>(); }
static ptr create(const eja::chunk& chunk) { return std::make_shared<eja::chunk>(chunk); }
static ptr create(const chunk::ptr chunk) { return std::make_shared<eja::chunk>(*chunk); }
static ptr create(const u64 size) { return std::make_shared<chunk>(size); }
static ptr create(const u64 size, const u64 offset) { return std::make_shared<chunk>(size, offset); }
};
// Container
derived_type(chunk_list, mutex_list<chunk>);
derived_type(chunk_map, mutex_map<std::string, chunk>);
derived_type(chunk_queue, mutex_queue<chunk>);
derived_type(chunk_vector, mutex_vector<chunk>);
}
#endif
| [
"eric@robotard.com"
] | eric@robotard.com |
c49952642afe08e79c3d45482e55a72d43567e36 | 7d505a2845fc9a24283aadab6c9b95fd187fe27f | /ParamedicCommander.cpp | 82d2be71c3c88abcbbc2f10f4265be45537c9d1b | [
"MIT"
] | permissive | LeeKochav/cpp_hm4_b | 5d430d2cc6220fcc176fe98aec90cc828750649e | 192f15f05eebb436c639878a87a232711e9b76d7 | refs/heads/master | 2022-09-11T01:21:14.706050 | 2020-06-03T15:07:00 | 2020-06-03T15:07:00 | 269,074,872 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,801 | cpp | #include "ParamedicCommander.hpp"
ParamedicCommander::ParamedicCommander(uint player_number)
{
m_player_number = player_number;
m_hp = 200;
m_power = 0;
m_t = Type::ParamedicC;
}
void ParamedicCommander::action(std::vector<std::vector<Soldier *>> &b, pair<int, int> location)
{
int size = b.size();
int x = location.first;
int y = location.second;
Soldier *curr_sol;
std::vector<Soldier *> sqaudTeam;
std::vector<pair<int, int>> sqaudTeamLocations;
int col = b.size();
int row = b.size();
if (x + 1 < size)
{
curr_sol = b[x + 1][y];
if (curr_sol != nullptr)
{
if (curr_sol->get_player_number() == this->get_player_number())
{
uint initHp = curr_sol->get_initial_hp();
curr_sol->set_hp(initHp);
}
}
}
if (y + 1 < size)
{
curr_sol = b[x][y + 1];
if (curr_sol != nullptr)
{
if (curr_sol->get_player_number() == this->get_player_number())
{
uint initHp = curr_sol->get_initial_hp();
curr_sol->set_hp(initHp);
}
}
}
if (x - 1 >= 0)
{
curr_sol = b[x - 1][y];
if (curr_sol != nullptr)
{
if (curr_sol->get_player_number() == this->get_player_number())
{
uint initHp = curr_sol->get_initial_hp();
curr_sol->set_hp(initHp);
}
}
}
if (y - 1 >= 0)
{
curr_sol = b[x][y - 1];
if (curr_sol != nullptr)
{
if (curr_sol->get_player_number() == this->get_player_number())
{
uint initHp = curr_sol->get_initial_hp();
curr_sol->set_hp(initHp);
}
}
}
if ((y - 1 >= 0) && (x - 1 >= 0))
{
curr_sol = b[x - 1][y - 1];
if (curr_sol != nullptr)
{
if (curr_sol->get_player_number() == this->get_player_number())
{
uint initHp = curr_sol->get_initial_hp();
curr_sol->set_hp(initHp);
}
}
}
if ((y + 1 < size) && (x + 1 < size))
{
curr_sol = b[x + 1][y + 1];
if (curr_sol != nullptr)
{
if (curr_sol->get_player_number() == this->get_player_number())
{
uint initHp = curr_sol->get_initial_hp();
curr_sol->set_hp(initHp);
}
}
}
if ((y + 1 < size) && (x - 1 >= 0))
{
curr_sol = b[x - 1][y + 1];
if (curr_sol != nullptr)
{
if (curr_sol->get_player_number() == this->get_player_number())
{
uint initHp = curr_sol->get_initial_hp();
curr_sol->set_hp(initHp);
}
}
}
if ((y - 1 >= 0) && (x + 1 < size))
{
curr_sol = b[x + 1][y - 1];
if (curr_sol != nullptr)
{
if (curr_sol->get_player_number() == this->get_player_number())
{
uint initHp = curr_sol->get_initial_hp();
curr_sol->set_hp(initHp);
}
}
}
for (int i = 0; i < row; i++)
{
for (int j = 0; j < col; j++)
{
if (b[i][j] != nullptr)
{
Soldier *temp = b[i][j];
if (temp->get_player_number() == this->get_player_number())
{
if (temp->get_type() == ParamedicS)
temp->action(b, {i, j});
}
}
}
}
}
uint ParamedicCommander::get_initial_hp()
{
return 200;
}
void ParamedicCommander::print()
{
printf("{(%d): ParamedicC, hp: %d}", m_player_number, m_hp);
} | [
"leekochav@gmail.com"
] | leekochav@gmail.com |
275e6c439956332cdaab7de2abf14b368beef6f1 | 963cb891ae4d757fc739d3fca829fea844ae499e | /game/state/rules/doodad_type.cpp | 1be9c4c588385771cd2ef423a93d0f05990eda76 | [
"MIT"
] | permissive | TrollingChar/OpenApoc | 0b69618b769bd5a70803cbf7ec8e69c782dc6b3a | 7b4b789907aaa18eb9d49b15f9939650a4b06721 | refs/heads/master | 2021-04-26T08:31:08.357597 | 2017-10-12T17:05:35 | 2017-10-12T17:05:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 597 | cpp | #include "game/state/rules/doodad_type.h"
#include "game/state/gamestate.h"
#include "library/strings.h"
namespace OpenApoc
{
sp<DoodadType> DoodadType::get(const GameState &state, const UString &id)
{
auto it = state.doodad_types.find(id);
if (it == state.doodad_types.end())
{
LogError("No doodad type matching ID \"%s\"", id);
return nullptr;
}
return it->second;
}
const UString &DoodadType::getPrefix()
{
static UString prefix = "DOODAD_";
return prefix;
}
const UString &DoodadType::getTypeName()
{
static UString name = "DoodadType";
return name;
}
}; // namespace OpenApoc
| [
"jtrhamilton@gmail.com"
] | jtrhamilton@gmail.com |
80815547507f007af238c7ed5a2938701d40e4f8 | a14da086a2832b3f0ba4c85138925d681cab215f | /RZExternal/src/FitSDKRelease_20/fit_speed_zone_mesg_listener.hpp | 135b97677e7b74e5bfd79e54592c321e3e8ffe08 | [
"MIT"
] | permissive | roznet/iossimfinder | 671757ec24f9ba09c556e73edf9712b7fe167bb9 | eeb581d0229544dd0e950785fccf7a45c102943e | refs/heads/master | 2021-05-14T01:12:08.097417 | 2020-11-15T14:36:41 | 2020-11-15T14:36:41 | 116,559,413 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,321 | hpp | ////////////////////////////////////////////////////////////////////////////////
// The following FIT Protocol software provided may be used with FIT protocol
// devices only and remains the copyrighted property of Garmin Canada Inc.
// The software is being provided on an "as-is" basis and as an accommodation,
// and therefore all warranties, representations, or guarantees of any kind
// (whether express, implied or statutory) including, without limitation,
// warranties of merchantability, non-infringement, or fitness for a particular
// purpose, are specifically disclaimed.
//
// Copyright 2018 Garmin Canada Inc.
////////////////////////////////////////////////////////////////////////////////
// ****WARNING**** This file is auto-generated! Do NOT edit this file.
// Profile Version = 20.80Release
// Tag = production/akw/20.80.00-0-g64ad259
////////////////////////////////////////////////////////////////////////////////
#if !defined(FIT_SPEED_ZONE_MESG_LISTENER_HPP)
#define FIT_SPEED_ZONE_MESG_LISTENER_HPP
#include "fit_speed_zone_mesg.hpp"
namespace fit
{
class SpeedZoneMesgListener
{
public:
virtual ~SpeedZoneMesgListener() {}
virtual void OnMesg(SpeedZoneMesg& mesg) = 0;
};
} // namespace fit
#endif // !defined(FIT_SPEED_ZONE_MESG_LISTENER_HPP)
| [
"briceguard-git@yahoo.com"
] | briceguard-git@yahoo.com |
ff6dfed56a4780479c3a2f4146fff42f95585628 | 883e53051c4579b32e85a0d8d35b814da0f26dfe | /Andreas/Lektion 2/Numbers (3.1)/ClothingCalc.h | 2924ca40a9d2132d817bd1879fa4fb99af143d64 | [] | no_license | Andreasgdp/Cpp-2.-semester | fa8b2b5b462d558cd88f6f75c04fca0fb8afc9cb | 8180e6ea86bb933f8c0f16579c57eeeac8345eff | refs/heads/main | 2023-06-10T00:20:44.345868 | 2021-06-23T15:00:12 | 2021-06-23T15:00:12 | 335,230,193 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 531 | h | #ifndef CLOTHINGCALC_H
#define CLOTHINGCALC_H
#pragma once
class ClothingCalc
{
public:
ClothingCalc();
ClothingCalc(double height, double weight, unsigned int age);
void setHeight(double height);
void setWeight(double weight);
void setAge(unsigned int age);
double calcHat() const;
double calcJacket() const;
double calcWaist() const;
double calcLeg() const;
private:
double mHeight, mWeight;
unsigned int mAge;
unsigned int yearsOverX(unsigned int x, unsigned int fullYears) const;
};
#endif // !CLOTHINGCALC_H
| [
"andreasgdp@gmail.com"
] | andreasgdp@gmail.com |
a1323632b6a0094e17c750bc9f28004adfb5a6cc | 2479ee7e00a63130bad04bcb06efb3a6536c0856 | /firmware/GyverMatrixOS_v1.13/animation.ino | f520d0523c8d06f5031d5575413e6365b7d80b26 | [] | no_license | Kegarri/GyverMatrixWiFi | 3ac53c9021e73f29e11d6ef51309d1d2677930ac | 1d35bf2b1b02b7d9c4770a890177417b9aad4caa | refs/heads/master | 2020-08-05T21:14:43.773816 | 2019-10-03T10:14:45 | 2019-10-03T10:14:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,233 | ino | #define FRAME_WIDTH 16
#define FRAME_HEIGHT 16
// ------------------- Загрузка картинок и фреймов анимации -------------------
// Данный пример работает при размере матрицы 16x16 - такие картинки подготовлены в этом файле
// для других размеров матрицы - подготовьте собственные картинки
timerMinim gifTimer(D_GIF_SPEED);
void loadImage(const uint16_t (*frame)) {
int8_t offset_x = (WIDTH - FRAME_WIDTH) / 2;
int8_t offset_y = (HEIGHT - FRAME_HEIGHT) / 2;
for (byte i = 0; i < FRAME_WIDTH; i++) {
if (offset_x + i < 0 || offset_x + i > WIDTH - 1) continue;
for (byte j = 0; j < FRAME_HEIGHT; j++) {
if (offset_y + j < 0 || offset_y + j > HEIGHT - 1) continue;
drawPixelXY(offset_x + i, offset_y + j, gammaCorrection(expandColor((pgm_read_word(&(frame[(HEIGHT - j - 1) * WIDTH + i]))))));
}
}
}
void animation(byte n) {
// "n" - индекс в наборе анимаций (подготовленных картинок)
if (loadingFlag) {
loadingFlag = false;
modeCode = MC_IMAGE;
}
bool isReady = gifTimer.isReady();
if (isReady) {
switch (n) {
case 1:
// EFFECT_ANIMATION_1
loadImage(mario_array[frameNum]);
if (++frameNum >= sizeof(mario_array) / sizeof(mario_array[0])) frameNum = 0;
break;
case 2:
// EFFECT_ANIMATION_2
loadImage(flame_array[frameNum]);
if (++frameNum >= sizeof(flame_array) / sizeof(flame_array[0])) frameNum = 0;
break;
case 3:
// EFFECT_ANIMATION_3
loadImage(ghost_array[frameNum]);
if (++frameNum >= sizeof(ghost_array) / sizeof(ghost_array[0])) frameNum = 0;
break;
case 4:
// EFFECT_ANIMATION_4
loadImage(ironMan_array[frameNum]);
if (++frameNum >= sizeof(ironMan_array) / sizeof(ironMan_array[0])) frameNum = 0;
break;
case 5:
// EFFECT_ANIMATION_5
loadImage(characters_array[frameNum]);
if (++frameNum >= sizeof(characters_array) / sizeof(characters_array[0])) frameNum = 0;
break;
}
}
}
| [
"vvip@mail.ru"
] | vvip@mail.ru |
d19c80df6ef6f7cfe4f3f034bcb77ea9796cfbb3 | 0203e5a6d7beb1e0f83113dac4c167b171756f24 | /lib/air/test/unit_test/process/fake_global_meta_getter.h | a95b8065aee270068edd680e1625813f26f5e8af | [
"BSD-3-Clause"
] | permissive | Wonchul08Lee/poseidonos | eaafe277fc56a0f5b5fcca3b70acc9bfe5d5d1ae | 6fe410cdf88f3243ad9210f763c2b5a2f7e8b46a | refs/heads/main | 2023-03-30T13:41:09.660647 | 2021-04-08T06:43:26 | 2021-04-08T06:43:26 | 355,819,746 | 0 | 0 | BSD-3-Clause | 2021-04-08T08:17:27 | 2021-04-08T08:17:26 | null | UTF-8 | C++ | false | false | 585 | h |
#ifndef FAKE_GLOBAL_META_GETTER_H
#define FAKE_GLOBAL_META_GETTER_H
#include "src/meta/GlobalMeta.h"
class FakeGlobalMetaGetter : public meta::GlobalMetaGetter
{
public:
FakeGlobalMetaGetter() { enable = true; }
virtual ~FakeGlobalMetaGetter() {}
bool Enable() const {
return enable;
}
void SetEnable(bool new_enable) {
enable = new_enable;
}
uint32_t StreamingInterval() const {
return 1;
}
uint32_t AidSize() const {
return 32;
}
private:
bool enable;
};
#endif // #define FAKE_GLOBAL_META_GETTER_H
| [
"poseidonos@samsung.net"
] | poseidonos@samsung.net |
82deb3c645765a0cd2dce2084bee8a2f67f109b9 | 91a882547e393d4c4946a6c2c99186b5f72122dd | /Source/XPSP1/NT/drivers/wdm/capture/mini/atiwdm/atishare/i2clog.cpp | 118984d2e0d55b1d25c3170e65cc47e23015f736 | [] | no_license | IAmAnubhavSaini/cryptoAlgorithm-nt5src | 94f9b46f101b983954ac6e453d0cf8d02aa76fc7 | d9e1cdeec650b9d6d3ce63f9f0abe50dabfaf9e2 | refs/heads/master | 2023-09-02T10:14:14.795579 | 2021-11-20T13:47:06 | 2021-11-20T13:47:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,609 | cpp | //==========================================================================;
//
// I2CLog.CPP
// WDM MiniDrivers development.
// I2CScript implementation.
// I2CLog Class implemenation.
// Copyright (c) 1997 - 1998 ATI Technologies Inc. All Rights Reserved.
//
// $Date: 28 Apr 1998 09:34:38 $
// $Revision: 1.0 $
// $Author: KLEBANOV $
//
//==========================================================================;
extern"C"
{
#include "strmini.h"
#include "wdmdebug.h"
}
#include "i2script.h"
#include "i2clog.h"
#include "wdmdrv.h"
#include "registry.h"
/*^^*
* ~CI2CLog() destructor
* Purpose : close I2C Log file
*
* Inputs : none
* Outputs : none
* Author : IKLEBANOV
*^^*/
CI2CLog::~CI2CLog( void)
{
if( m_hLogFile != NULL)
::ZwClose( m_hLogFile);
}
/*^^*
* CI2CLog() constructor
* Purpose : Finds out from the Registry, if the I2C Log option is enabled, and
* gets teh Log file name ( if not specified the default log file name
* is used). The Log file is overwritten every system reboot.
*
* Inputs : PDEVICE_OBJECT pDeviceObject : pointer to DeviceObject
* PBOOL pbLogStarted : poinetr to return BOOL
* Outputs : none
* Author : IKLEBANOV
*^^*/
CI2CLog::CI2CLog( PDEVICE_OBJECT pDeviceObject)
{
#if 0
HANDLE hDevice;
NTSTATUS ntStatus;
WCHAR wchFileName[MAXIMUM_FILENAME_LENGTH];
PWCHAR pwchLogFileName;
ULONG ulEnable, ulLength;
UNICODE_STRING unicodeFullName, unicodeName;
OBJECT_ATTRIBUTES objectAttributes;
IO_STATUS_BLOCK ioStatus;
hDevice = NULL;
m_bLogStarted = FALSE;
unicodeFullName.Buffer = NULL;
ENSURE
{
ntStatus = ::IoOpenDeviceRegistryKey( pDeviceObject,
PLUGPLAY_REGKEY_DRIVER, STANDARD_RIGHTS_ALL,
&hDevice);
if( !NT_SUCCESS( ntStatus) || ( hDevice == NULL))
FAIL;
if( !NT_SUCCESS( ::ReadStringFromRegistryFolder( hDevice,
UNICODE_WDM_I2CLOG_ENABLE,
( PWCHAR)&ulEnable,
sizeof( ULONG))))
FAIL;
if( !ulEnable)
FAIL;
if( NT_SUCCESS( ::ReadStringFromRegistryFolder( hDevice,
UNICODE_WDM_I2CLOG_FILENAME,
wchFileName,
sizeof( wchFileName))))
pwchLogFileName = wchFileName;
else
// the default file name is used
if( NT_SUCCESS( ::ReadStringFromRegistryFolder( hDevice,
L"NTMPDriver",
wchFileName,
sizeof( wchFileName))))
{
ulLength = 0;
while( ulLength < MAXIMUM_FILENAME_LENGTH)
if( wchFileName[ulLength ++] == L'.')
break;
if( ulLength >= MAXIMUM_FILENAME_LENGTH)
FAIL;
::RtlMoveMemory( &wchFileName[ulLength],
UNICODE_WDM_I2CLOG_DEFAULTEXTENSION,
sizeof( UNICODE_WDM_I2CLOG_DEFAULTEXTENSION));
pwchLogFileName = wchFileName;
}
else
FAIL;
::RtlInitUnicodeString( &unicodeName, pwchLogFileName);
ulLength = sizeof( UNICODE_WDM_I2CLOG_ABSOLUTEPATH) - sizeof( WCHAR) + unicodeName.MaximumLength;
unicodeFullName.Buffer = ( USHORT *)::ExAllocatePool( NonPagedPool, ulLength);
if( unicodeFullName.Buffer == NULL)
{
OutputDebugError(( "CI2CLog: Full file name buffer allocation failure ulLength = %d\n", ulLength));
FAIL;
}
unicodeFullName.MaximumLength = ( USHORT)ulLength;
// don't copy the trailing NULL
ulLength = sizeof( UNICODE_WDM_I2CLOG_ABSOLUTEPATH) - sizeof( WCHAR);
::RtlMoveMemory( unicodeFullName.Buffer,
UNICODE_WDM_I2CLOG_ABSOLUTEPATH,
ulLength);
unicodeFullName.Length = ( USHORT)ulLength;
if( !NT_SUCCESS( ::RtlAppendUnicodeStringToString( &unicodeFullName, &unicodeName)))
FAIL;
InitializeObjectAttributes( &objectAttributes,
&unicodeFullName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
OutputDebugTrace(( "CI2CLog: creating I2C Private Log file %wZ\n", pwchLogFileName));
FAIL;
ntStatus = ::ZwCreateFile( &m_hLogFile,
GENERIC_WRITE | SYNCHRONIZE | FILE_APPEND_DATA,
&objectAttributes,
&ioStatus,
NULL,
FILE_ATTRIBUTE_NORMAL,
0,
FILE_OVERWRITE_IF,
FILE_SYNCHRONOUS_IO_NONALERT,
NULL,
0);
if( !NT_SUCCESS( ntStatus))
FAIL;
m_bLogStarted = TRUE;
} END_ENSURE;
if( !m_bLogStarted)
OutputDebugError(( "CI2CLog: creating I2C Private Log failure\n"));
if( hDevice != NULL)
::ZwClose( hDevice);
if( unicodeFullName.Buffer != NULL)
::ExFreePool( unicodeFullName.Buffer);
#else
OutputDebugError(( "I2C Log feature is yet not available\n"));
#endif // not compiled
}
| [
"support@cryptoalgo.cf"
] | support@cryptoalgo.cf |
1c863c85324b3ed513de6867f5f828cfad101ec9 | 374fa4020a950682ad987fb950660cc9960fc16a | /dawn/test/integration-test/serializer/RegenerateIIRMain.cpp | 716f0b000a9f47f7750d38f17c39aa7d8a1f686d | [
"MIT"
] | permissive | circleci/dawn | 55f840f64db015326c20a99568490675bb4d8f55 | fce56c26fc9f665f970554ef3a4ec765e0585bd7 | refs/heads/master | 2023-01-20T11:29:58.023690 | 2023-01-16T16:39:54 | 2023-01-16T16:39:54 | 249,577,073 | 2 | 5 | MIT | 2023-01-16T16:39:56 | 2020-03-24T00:44:00 | null | UTF-8 | C++ | false | false | 1,742 | cpp | //===--------------------------------------------------------------------------------*- C++ -*-===//
// _
// | |
// __| | __ ___ ___ ___
// / _` |/ _` \ \ /\ / / '_ |
// | (_| | (_| |\ V V /| | | |
// \__,_|\__,_| \_/\_/ |_| |_| - Compiler Toolchain
//
//
// This file is distributed under the MIT License (MIT).
// See LICENSE.txt for details.
//
//===------------------------------------------------------------------------------------------===//
#include "GenerateInMemoryStencils.h"
#include "dawn/Compiler/DawnCompiler.h"
#include "dawn/Serialization/IIRSerializer.h"
#include <memory>
using namespace dawn;
int main(int argc, char* argv[]) {
Options compileOptions;
OptimizerContext::OptimizerContextOptions optimizerOptions;
DawnCompiler compiler(compileOptions);
OptimizerContext optimizer(compiler.getDiagnostics(), optimizerOptions,
std::make_shared<dawn::SIR>(ast::GridType::Cartesian));
UIDGenerator::getInstance()->reset();
IIRSerializer::serialize("reference_iir/copy_stencil.iir",
createCopyStencilIIRInMemory(optimizer), IIRSerializer::Format::Json);
UIDGenerator::getInstance()->reset();
IIRSerializer::serialize("reference_iir/lap_stencil.iir", createLapStencilIIRInMemory(optimizer),
IIRSerializer::Format::Json);
UIDGenerator::getInstance()->reset();
IIRSerializer::serialize("reference_iir/unstructured_sum_edge_to_cells.iir",
createUnstructuredSumEdgeToCellsIIRInMemory(optimizer),
IIRSerializer::Format::Json);
}
| [
"noreply@github.com"
] | noreply@github.com |
d6cbf05daa2edbab89634dc5a3adeac4ad01db65 | bd1fea86d862456a2ec9f56d57f8948456d55ee6 | /000/246/593/CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_83_goodG2B.cpp | 134f27c60e248819a9ea51012e796bb1407ef4ca | [] | no_license | CU-0xff/juliet-cpp | d62b8485104d8a9160f29213368324c946f38274 | d8586a217bc94cbcfeeec5d39b12d02e9c6045a2 | refs/heads/master | 2021-03-07T15:44:19.446957 | 2020-03-10T12:45:40 | 2020-03-10T12:45:40 | 246,275,244 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,608 | cpp | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_83_goodG2B.cpp
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-83_goodG2B.tmpl.cpp
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: connect_socket Read data using a connect socket (client side)
* GoodSource: Fixed string
* Sinks: w32_execv
* BadSink : execute command with wexecv
* Flow Variant: 83 Data flow: data passed to class constructor and destructor by declaring the class object on the stack
*
* */
#ifndef OMITGOOD
#include "std_testcase.h"
#include "CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_83.h"
#include <process.h>
#define EXECV _wexecv
namespace CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_83
{
CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_83_goodG2B::CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_83_goodG2B(wchar_t * dataCopy)
{
data = dataCopy;
/* FIX: Append a fixed string to data (not user / external input) */
wcscat(data, L"*.*");
}
CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_83_goodG2B::~CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_83_goodG2B()
{
{
wchar_t *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL};
/* wexecv - specify the path where the command is located */
/* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */
EXECV(COMMAND_INT_PATH, args);
}
}
}
#endif /* OMITGOOD */
| [
"frank@fischer.com.mt"
] | frank@fischer.com.mt |
4f433cf34dba1c0cd672ba67670c17369684bb8c | cbf9d42397cc2bda21d2451d576c6e0307666243 | /src/Rodin/Array.h | 0e88479f68e445405770da8a0f7152b0827564fd | [
"BSL-1.0"
] | permissive | cbritopacheco/rodin | 272bd34b8d91ec825934a617d1fea751786a9632 | a64520db90ac444b7ce61ca353aa9fe85e4868d0 | refs/heads/master | 2023-08-21T20:19:35.539806 | 2023-08-14T20:36:37 | 2023-08-14T20:36:37 | 422,234,328 | 24 | 5 | BSL-1.0 | 2023-08-14T18:42:04 | 2021-10-28T14:22:55 | C++ | UTF-8 | C++ | false | false | 412 | h | /*
* Copyright Carlos BRITO PACHECO 2021 - 2023.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE or copy at
* https://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef RODIN_ARRAY_H
#define RODIN_ARRAY_H
#include <Eigen/Core>
#include <Eigen/Dense>
namespace Rodin
{
template <class Scalar>
using Array = Eigen::ArrayX<Scalar>;
}
#endif
| [
"carlos.brito524@gmail.com"
] | carlos.brito524@gmail.com |
6c7fb0644e8d6a970ac1c181410623ad438cda41 | a68195278267b091957927393435145f1bf8ed97 | /Funciones con punteros.cpp | d117fd595962a5fcf6f57ec1904a355be9f0e4d5 | [] | no_license | David-sqrtpi/Cpp | 29548528c88dcd4139e40a87a976081383275676 | 750b3ee6988f006a01d4b1abb73dab74e9a1597f | refs/heads/master | 2020-08-07T14:44:12.440238 | 2020-08-02T04:10:38 | 2020-08-02T04:10:38 | 213,493,005 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 544 | cpp | #include <iostream>
using namespace std;
void Intercambio(float*, float*);
int main(){
float Numero1=2.2, Numero2=5.65;
cout<<"Valor del numero 1 > "<<Numero1<<endl;
cout<<"Valor del numero 2 > "<<Numero2<<endl<<endl;
Intercambio(&Numero1, &Numero2);
cout<<"Nuevo valor del numero 1 > "<<Numero1<<endl;
cout<<"Nuevo valor del numero 2 > "<<Numero2<<endl;
return 0;
}
void Intercambio(float *PNumero1, float *PNumero2){
float Aux=*PNumero1;
*PNumero1=*PNumero2;
*PNumero2=Aux;
}
| [
"noreply@github.com"
] | noreply@github.com |
cd2a03bda004e21f914e8e503b189741aba9d5ef | a34fa6f88c2c5ca6a738951479523a694f1af878 | /cmstrom_led.cpp | f929888b3b530b50951be2e330b2f9b9d371d022 | [] | no_license | Tedezed/cmstrom_led_control | c44221c96f1484cddaca82fe7e71d8204e7a7d58 | bd49d4274073fce402548e5fe4f037c968e78b69 | refs/heads/master | 2023-02-06T06:05:51.048163 | 2021-01-02T19:12:01 | 2021-01-02T19:12:01 | 262,419,804 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,537 | cpp | // By Tedezed
#include <iostream>
#include <thread>
#include <chrono>
#include <fstream>
#include <string>
#include <string.h>
#include <stdio.h>
#include <linux/input.h>
using namespace std;
/*
Sources:
- https://stackoverflow.com/questions/9015506/how-to-identify-shift-ctrl-keys-were-pressed-in-the-linux-world-without-using-g
- https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h
*/
int main (int argc, char *argv[])
{
ofstream brightness; // Write
bool led_state = true;
struct input_event ev;
FILE *kbd = fopen("/dev/input/by-id/usb-SINO_WEALTH_USB_KEYBOARD-event-kbd", "r");
// Check argument for /sys/class/leds/input
if (argc < 2 || (argc > 2))
{
cerr << "Need one argument" << endl;
return -1;
}
else
{
cout << "input: " << argv[1] << endl;
}
string led_path = "/sys/class/leds/input" + string(argv[1]) + "::scrolllock/brightness";
cout << led_path << endl;
while (fread(&ev, sizeof(ev), 1, kbd) == 1)
{
if (ev.type == EV_KEY && (ev.code == KEY_SCROLLLOCK && ev.value == 0))
{
//cout << led_state << endl;
if (led_state)
{
led_state = false;
}
else
{
led_state = true;
}
}
brightness.open(led_path);
if (led_state)
{
brightness << "0";
}
else
{
brightness << "1";
}
brightness.close();
std::this_thread::sleep_for(std::chrono::nanoseconds(10000000));
}
fclose(kbd);
return 0;
} | [
"Tedezed"
] | Tedezed |
79a75cebff9c559e14d30c225e371e690c4bd20c | 0ece5dd81a1d847b58ff61f027dbdf73330ee9d5 | /plugins/JadeMiniSynth/JadeMiniVoice.cpp | b28042745e7ace2b5db68620a75f0c0209dcc5e8 | [
"BSD-3-Clause"
] | permissive | JoergBitzer/DAFx2020 | 1fc7e3ce8114d5862947eb993b3a13db70289b1d | 64e2f02047ad843760aaf4dcc0aa6986cc82d1d2 | refs/heads/master | 2021-05-25T17:17:52.021490 | 2021-01-05T20:24:07 | 2021-01-05T20:24:07 | 253,839,045 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 20,887 | cpp | #include "JadeMiniVoice.h"
#include "JadeMiniSound.h"
// ToDo legato needs another solution
JadeMiniVoice::JadeMiniVoice()
:SynthesiserVoice(),
m_isAudioOn(false),
m_a0tuning(440.0),
m_pitchbendWidth_semitones(12.0),
m_waveforms(m_wavelen, 16000.0, 44100.0 / m_wavelen),
m_level(1.0),
m_portaTime_ms(-1.0)
{
std::vector<double> wave;
wave.resize(m_wavelen);
m_waveforms.getWavetable(wave, BasicWaveforms::waveforms::saw);
m_osc1.addF0Wavetable(wave);
m_osc2.addF0Wavetable(wave);
m_waveforms.getWavetable(wave, BasicWaveforms::waveforms::rect);
m_osc1.addF0Wavetable(wave);
m_osc2.addF0Wavetable(wave);
m_waveforms.getWavetable(wave, BasicWaveforms::waveforms::tri);
m_osc1.addF0Wavetable(wave);
m_osc2.addF0Wavetable(wave);
m_waveforms.getWavetable(wave, BasicWaveforms::waveforms::noise, 1);
m_osc1.addF0Wavetable(wave);
m_osc2.addF0Wavetable(wave);
m_waveforms.getWavetable(wave, BasicWaveforms::waveforms::noise, 1234);
m_osc1.addF0Wavetable(wave);
m_osc2.addF0Wavetable(wave);
m_waveforms.getWavetable(wave, BasicWaveforms::waveforms::noise, 2345);
m_osc1.addF0Wavetable(wave);
m_osc2.addF0Wavetable(wave);
m_waveforms.getWavetable(wave, BasicWaveforms::waveforms::rectPWM, 75);
m_osc1.addF0Wavetable(wave);
m_osc2.addF0Wavetable(wave);
m_waveforms.getWavetable(wave, BasicWaveforms::waveforms::rectPWM, 50);
m_osc1.addF0Wavetable(wave);
m_osc2.addF0Wavetable(wave);
m_waveforms.getWavetable(wave, BasicWaveforms::waveforms::rectPWM, 25);
m_osc1.addF0Wavetable(wave);
m_osc2.addF0Wavetable(wave);
m_waveforms.getWavetable(wave, BasicWaveforms::waveforms::rectPWM, 5);
m_osc1.addF0Wavetable(wave);
m_osc2.addF0Wavetable(wave);
m_osc1.setSecondWaveform(1);
m_osc1.setWaveform(0);
m_osc1.setWaveformXFade(0.0);
m_osc2.setSecondWaveform(1);
m_osc2.setWaveform(0);
m_osc2.setWaveformXFade(0.0);
m_envelope.setDelayTime(0.0);
m_envelope.setAttackRate(5.0);
m_envelope.setHoldTime(0.5);
m_envelope.setDecayRate(20.0);
m_envelope.setSustainLevel(0.2);
m_envelope.setReleaseRate(300.0);
m_envelope.setMaxLevel(1.0);
m_envelope.setInvertOnOff(false);
m_envelope2.setDelayTime(0.0);
m_envelope2.setAttackRate(5.0);
m_envelope2.setHoldTime(0.5);
m_envelope2.setDecayRate(20.0);
m_envelope2.setSustainLevel(0.2);
m_envelope2.setReleaseRate(300.0);
m_envelope2.setMaxLevel(1.0);
m_envelope2.setInvertOnOff(false);
m_filter.setCutoffFrequency(1000.0);
m_filter.setSamplerate(44100.0);
m_filter.setResonance(1.0);
// noiseGen
m_noisegen.setHighpassCutoff(10000.f);
m_noisegen.setLowpassCutoff(150.0);
// Lfo
m_lfo1.setMin(0.0);
m_lfo1.setMax(0.0000000000000001);
m_lfo1.setPhase(0.0);
m_lfo1.setLFOFunction(LFO::LFOFunctions::sinus);
m_lfo1.setStartphase(0.0);
m_lfo1.setFrequency(0.0);
m_lfo2.setMin(0.0);
m_lfo2.setMax(0.0000000000000001);
m_lfo2.setPhase(0.0);
m_lfo2.setLFOFunction(LFO::LFOFunctions::sinus);
m_lfo2.setStartphase(0.0);
m_lfo2.setFrequency(0.0);
resetOldParams();
}
JadeMiniVoice::~JadeMiniVoice()
{
}
bool JadeMiniVoice::canPlaySound(SynthesiserSound* sound)
{
return dynamic_cast<JadeMiniSound*>(sound) != nullptr;
}
void JadeMiniVoice::startNote(int midiNoteNumber, float velocity, SynthesiserSound* sound, int currentPitchWheelPosition)
{
m_curSound = dynamic_cast<JadeMiniSound*> (getCurrentlyPlayingSound().get());
resetOldParams();
// global
float portaTime = exp(*(m_curSound->m_voicePortamentoTime));
if (portaTime != m_oldvoicePortamentoTime)
{
if (portaTime < 0.2f) // SwitchOff Portamento for very small values
m_portaTime_ms = -1.0;
else
m_portaTime_ms = portaTime;
m_oldvoicePortamentoTime = portaTime;
}
Envelope::envelopePhases envphase = m_envelope.getEnvelopeStatus();
if (envphase == Envelope::envelopePhases::Off)
{
m_osc1.setPortamentoTime(-1.0);
m_osc2.setPortamentoTime(-1.0);
}
else
{
m_osc1.setPortamentoTime(m_portaTime_ms);
m_osc2.setPortamentoTime(m_portaTime_ms);
}
const int midia0 = 69;
m_curNote = midiNoteNumber;
int distanceInSemitones = m_curNote - midia0;
m_freq = m_a0tuning * pow(2.0, double(distanceInSemitones) / 12.0);
m_osc1.setFrequency(m_freq);
m_osc2.setFrequency(m_freq);
pitchWheelMoved(currentPitchWheelPosition);
// m_isAudioOn = true;
m_envelope.NoteOn();
m_envelope2.NoteOn(); // filter envelope // ToDo legato need another solution here
float modKeyboard = *(m_curSound->m_modKeyboard);
if (modKeyboard != m_oldmodKeyboard)
{
m_filter.setKeyboardModulation(modKeyboard);
m_oldmodKeyboard = modKeyboard;
}
m_filter.setMidiNote(midiNoteNumber);
m_filter.reset();
m_level = velocity;
m_lfo1.reset();
m_lfo2.reset();
}
void JadeMiniVoice::stopNote(float velocity, bool allowTailOff)
{
//m_isAudioOn = false;
//clearCurrentNote(); // EIgentlich erst wenn release zu Ende ist.
m_envelope.NoteOff();
m_envelope2.NoteOff();
}
void JadeMiniVoice::pitchWheelMoved(int newPitchWheelValue)
{
double pitchBend = double(newPitchWheelValue - m_pitchBendMidPos)/8192.0;
m_osc1.changeFrequencyRelative(pitchBend*m_pitchbendWidth_semitones);
m_osc2.changeFrequencyRelative(pitchBend * m_pitchbendWidth_semitones);
}
void JadeMiniVoice::controllerMoved(int controllerNumber, int newControllerValue)
{
if (controllerNumber == 1)
{
double val = double(newControllerValue) / 127.0;
m_osc1.setWaveformXFade(val);
m_osc2.setWaveformXFade(val);
}
}
void JadeMiniVoice::renderNextBlock(AudioBuffer<float>& outputBuffer, int startSample, int numSamples)
{
if (getCurrentlyPlayingNote() <= 0)
return;
updateParameter();
// data gen
m_data.resize(numSamples);
m_osc1.getData(m_data);
m_data2.resize(numSamples);
m_osc2.getData(m_data2);
m_noisedata.resize(numSamples);
m_noisegen.getData(m_noisedata);
for (auto kk = 0u; kk < numSamples; kk++)
{
m_data[kk] += m_noisedata[kk];
m_data[kk] += m_data2[kk];
}
m_envdata.resize(numSamples);
m_envelope.getData(m_envdata);
m_env2data.resize(numSamples);
m_envelope2.getData(m_env2data);
m_lfo1data.resize(numSamples);
m_lfo1.getData(m_lfo1data);
m_lfo2data.resize(numSamples);
m_lfo1.getData(m_lfo2data);
for (auto kk = 0u; kk < numSamples; kk++)
m_env2data[kk] += m_lfo1data[kk];
m_filter.setModData(m_env2data);
m_filter.processData(m_data, m_data);
// noise Source
auto* channelData = outputBuffer.getArrayOfWritePointers();
int counter;
for (int channel = 0; channel < outputBuffer.getNumChannels(); ++channel)
{
counter = 0;
for (auto kk = startSample; kk < startSample + numSamples; ++kk)
{
channelData[channel][kk] += m_level*(m_data[counter]) * m_envdata[counter];
counter++;
}
}
if (m_envelope.getEnvelopeStatus() == Envelope::envelopePhases::Off)
{
clearCurrentNote();
}
}
void JadeMiniVoice::prepareVoice(double samplerate, int maxBlockLen)
{
m_fs = samplerate;
m_maxLen = maxBlockLen;
m_data.resize(m_maxLen);
m_osc1.setSamplerate(m_fs);
m_osc2.setSamplerate(m_fs);
m_envdata.resize(m_maxLen);
m_env2data.resize(m_maxLen);
m_envelope.setSamplerate(m_fs);
m_envelope2.setSamplerate(m_fs);
m_filter.setSamplerate(m_fs);
m_noisegen.setSamplerate(m_fs);
m_lfo1.setSamplerate(m_fs);
m_lfo2.setSamplerate(m_fs);
}
void JadeMiniVoice::resetOldParams()
{
m_oldvoiceTuneA0 = -1.f;
m_oldvoicePortamentoTime = -100.f;
m_oldcutoff = -1.f;
m_oldreso = -1.f;
m_oldmodKeyboard = -2.f;
m_oldmodDepth = -100.f;
m_oldosc1wave1 = -1.0;
m_oldosc1wave2 = -1.0;
m_oldosc1level = -100.0;
m_oldosc1xfade = -1.0;
m_oldosc1moddepth = 0.0;
m_oldosc1tunecoarse = -1000.0;
m_oldosc1tunefine = -100.0;
m_oldosc2wave1 = -1.0;
m_oldosc2wave2 = -1.0;
m_oldosc2level = -100.0;
m_oldosc2xfade = -1.0;
m_oldosc2moddepth = 0.0;
m_oldosc2tunecoarse = -1000.0;
m_oldosc2tunefine = -100.0;
m_oldenv1Delay = -1.0;
m_oldenv1Attack = 0.0;
m_oldenv1Hold = -1.0;
m_oldenv1Decay = 0.0;
m_oldenv1Sustain = -1.0;
m_oldenv1Release = 0.0;
m_oldenv1Level = -100.0;
m_oldenv2Delay = -1.0;
m_oldenv2Attack = 0.0;
m_oldenv2Hold = -1.0;
m_oldenv2Decay = 0.0;
m_oldenv2Sustain = -1.0;
m_oldenv2Release = 0.0;
m_oldenv2Level = -100.0;
m_oldenv2Invert = -1.f;
m_oldwhiteLevel = -1000.f;
m_oldwhiteGraininess = -1.f;
m_oldcoloredLow = -1.f;
m_oldcoloredHigh = 1.f;
m_oldlfo1level = -100.f;
m_oldlfo1rate = -1.f;
m_oldlfo1waveform = -1.f;
m_oldlfo2level = -100.f;
m_oldlfo2rate = -1.f;
m_oldlfo2waveform = -1.f;
}
void JadeMiniVoice::updateParameter()
{
float globalTuneA0 = *(m_curSound->m_voiceTuneA0);
if (globalTuneA0 != m_oldvoiceTuneA0)
{
m_oldvoiceTuneA0 = globalTuneA0;
m_a0tuning = globalTuneA0;
}
float osc1waveform1 = *(m_curSound->m_osc1wave1);
if (osc1waveform1 != m_oldosc1wave1)
{
m_oldosc1wave1 = osc1waveform1;
m_osc1.setWaveform(static_cast<int> (osc1waveform1));
}
float osc1waveform2 = *(m_curSound->m_osc1wave2);
if (osc1waveform2 != m_oldosc1wave2)
{
m_oldosc1wave2 = osc1waveform2;
m_osc1.setSecondWaveform(static_cast<int> (osc1waveform2));
}
float osc1xfade = *(m_curSound->m_osc1xfade);
if (osc1xfade != m_oldosc1xfade)
{
m_oldosc1xfade = osc1xfade;
m_osc1.setWaveformXFade(osc1xfade * 0.01); // % in 0 ..1
}
float osc1tunecoarse = int(*(m_curSound->m_osc1tunecoarse) + 0.5);
if (osc1tunecoarse != m_oldosc1tunecoarse)
{
m_oldosc1tunecoarse = osc1tunecoarse;
m_osc1.setTuneCoarse(osc1tunecoarse);
}
float osc1tunefine = *(m_curSound->m_osc1tunefine);
if (osc1tunefine != m_oldosc1tunefine)
{
m_oldosc1tunefine = osc1tunefine;
m_osc1.setTuneFine(osc1tunefine);
}
float osc1level = *(m_curSound->m_osc1level);
if (osc1level != m_oldosc1level)
{
m_oldosc1level = osc1level;
m_osc1.setLevel(osc1level);
}
float osc2waveform1 = *(m_curSound->m_osc2wave1);
if (osc2waveform1 != m_oldosc2wave1)
{
m_oldosc2wave1 = osc2waveform1;
m_osc2.setWaveform(static_cast<int> (osc2waveform1));
}
float osc2waveform2 = *(m_curSound->m_osc2wave2);
if (osc2waveform2 != m_oldosc2wave2)
{
m_oldosc2wave2 = osc2waveform2;
m_osc2.setSecondWaveform(static_cast<int> (osc2waveform2));
}
float osc2xfade = *(m_curSound->m_osc2xfade);
if (osc2xfade != m_oldosc2xfade)
{
m_oldosc2xfade = osc2xfade;
m_osc2.setWaveformXFade(osc2xfade * 0.01); // % in 0 ..1
}
float osc2tunecoarse = int(*(m_curSound->m_osc2tunecoarse) + 0.5);
if (osc2tunecoarse != m_oldosc2tunecoarse)
{
m_oldosc2tunecoarse = osc2tunecoarse;
m_osc2.setTuneCoarse(osc2tunecoarse);
}
float osc2tunefine = *(m_curSound->m_osc2tunefine);
if (osc2tunefine != m_oldosc2tunefine)
{
m_oldosc2tunefine = osc2tunefine;
m_osc2.setTuneFine(osc2tunefine);
}
float osc2level = *(m_curSound->m_osc2level);
if (osc2level != m_oldosc2level)
{
m_oldosc2level = osc2level;
m_osc2.setLevel(osc2level);
}
float env1Delay = *(m_curSound->m_env1Delay);
if (env1Delay != m_oldenv1Delay)
{
m_oldenv1Delay = env1Delay;
m_envelope.setDelayTime(env1Delay);
}
float env1Hold = *(m_curSound->m_env1Hold);
if (env1Hold != m_oldenv1Hold)
{
m_oldenv1Hold = env1Hold;
m_envelope.setHoldTime(env1Hold);
}
float env1Sustain = *(m_curSound->m_env1Sustain);
if (env1Sustain != m_oldenv1Sustain)
{
m_oldenv1Sustain = env1Sustain;
m_envelope.setSustainLevel(env1Sustain);
}
float env1Attack = exp(*(m_curSound->m_env1Attack));
if (env1Attack != m_oldenv1Attack)
{
m_oldenv1Attack = env1Attack;
m_envelope.setAttackRate(env1Attack);
}
float env1Decay = exp(*(m_curSound->m_env1Decay));
if (env1Decay != m_oldenv1Decay)
{
m_oldenv1Decay = env1Decay;
m_envelope.setDecayRate(env1Decay);
}
float env1Release = exp(*(m_curSound->m_env1Release));
if (env1Release != m_oldenv1Release)
{
m_oldenv1Release = env1Release;
m_envelope.setReleaseRate(env1Release);
}
float env1Level = pow(10.f, *(m_curSound->m_env1Level) / 20.f);
if (env1Level != m_oldenv1Level)
{
m_oldenv1Level = env1Level;
m_envelope.setMaxLevel(env1Level);
}
// envelope filter
float env2Delay = *(m_curSound->m_env2Delay);
if (env2Delay != m_oldenv2Delay)
{
m_oldenv2Delay = env2Delay;
m_envelope2.setDelayTime(env2Delay);
}
float env2Hold = *(m_curSound->m_env2Hold);
if (env2Hold != m_oldenv2Hold)
{
m_oldenv2Hold = env2Hold;
m_envelope2.setHoldTime(env2Hold);
}
float env2Sustain = *(m_curSound->m_env2Sustain);
if (env2Sustain != m_oldenv2Sustain)
{
m_oldenv2Sustain = env2Sustain;
m_envelope2.setSustainLevel(env2Sustain);
}
float env2Attack = exp(*(m_curSound->m_env2Attack));
if (env2Attack != m_oldenv2Attack)
{
m_oldenv2Attack = env2Attack;
m_envelope2.setAttackRate(env2Attack);
}
float env2Decay = exp(*(m_curSound->m_env2Decay));
if (env2Decay != m_oldenv2Decay)
{
m_oldenv2Decay = env2Decay;
m_envelope2.setDecayRate(env2Decay);
}
float env2Release = exp(*(m_curSound->m_env2Release));
if (env2Release != m_oldenv2Release)
{
m_oldenv2Release = env2Release;
m_envelope2.setReleaseRate(env2Release);
}
float env2Level = pow(10.f, *(m_curSound->m_env2Level) / 20.f);
if (env2Level != m_oldenv2Level)
{
m_oldenv2Level = env2Level;
m_envelope2.setMaxLevel(env2Level);
}
float env2Invert = *(m_curSound->m_env2Invert);
if (env2Invert != m_oldenv2Invert)
{
m_oldenv2Invert = env2Invert;
if (env2Invert > 0.5)
m_envelope2.setInvertOnOff(true);
else
m_envelope2.setInvertOnOff(false);
}
float cutoff = exp(*(m_curSound->m_cutoff));
if (cutoff != m_oldcutoff)
{
m_filter.setCutoffFrequency(cutoff);
m_oldcutoff = cutoff;
}
float reso = *(m_curSound->m_reso);
if (reso != m_oldreso)
{
m_filter.setResonance(reso);
m_oldreso = reso;
}
float modKeyboard = *(m_curSound->m_modKeyboard);
if (modKeyboard != m_oldmodKeyboard)
{
m_filter.setKeyboardModulation(modKeyboard);
m_oldmodKeyboard = modKeyboard;
}
float modDepth = pow(10.f, *(m_curSound->m_modDepth) / 20.f);
if (modDepth != m_oldmodDepth)
{
m_filter.setModDepth(modDepth);
m_oldmodDepth = modDepth;
}
// noise Generator
float whiteLevel = *(m_curSound->m_whiteLevel);
if (whiteLevel != m_oldwhiteLevel)
{
m_noisegen.setLogAmplitude(whiteLevel);
// m_filter.setResonance(modLfo);
m_oldwhiteLevel = whiteLevel;
}
float whitegraininess = log(*(m_curSound->m_whiteGraininess));
if (whitegraininess != m_oldwhiteGraininess)
{
m_noisegen.setGraininess(whitegraininess);
// m_filter.setResonance(modLfo);
m_oldwhiteGraininess = whitegraininess;
}
float coloredLow = *(m_curSound->m_coloredLow);
if (whitegraininess != m_oldcoloredLow)
{
m_noisegen.setLowpassOrder(coloredLow);
// m_filter.setResonance(modLfo);
m_oldcoloredLow = coloredLow;
}
float coloredHigh = *(m_curSound->m_coloredHigh);
if (coloredHigh != m_oldcoloredHigh)
{
m_noisegen.setHighpassOrder(coloredHigh);
// m_filter.setResonance(modLfo);
m_oldcoloredHigh = coloredHigh;
}
float lfo1waveform = *(m_curSound->m_lfo1waveform);
if (lfo1waveform != m_oldlfo1waveform)
{
m_oldlfo1waveform = lfo1waveform;
int index = int(lfo1waveform + 0.5);
m_lfo1.setLFOFunction(static_cast <LFO::LFOFunctions> (index));
}
float lfo1rate = exp(*(m_curSound->m_lfo1rate));
if (lfo1rate != m_oldlfo1rate)
{
m_oldlfo1rate = lfo1rate;
m_lfo1.setFrequency(lfo1rate);
}
float lfo1level = pow(10.f, *(m_curSound->m_lfo1level) / 20.f);
if (lfo1level != m_oldlfo1level)
{
m_oldlfo1level = lfo1level;
m_lfo1.setMax(lfo1level);
}
float lfo2waveform = *(m_curSound->m_lfo2waveform);
if (lfo2waveform != m_oldlfo2waveform)
{
m_oldlfo2waveform = lfo2waveform;
int index = int(lfo2waveform + 0.5);
m_lfo2.setLFOFunction(static_cast <LFO::LFOFunctions> (index));
}
float lfo2rate = exp(*(m_curSound->m_lfo2rate));
if (lfo2rate != m_oldlfo2rate)
{
m_oldlfo2rate = lfo2rate;
m_lfo2.setFrequency(lfo2rate);
}
float lfo2level = pow(10.f, *(m_curSound->m_lfo2level) / 20.f);
if (lfo2level != m_oldlfo2level)
{
m_oldlfo2level = lfo2level;
m_lfo2.setMax(lfo2level);
}
}
int VoiceParameter::addParameter(std::vector < std::unique_ptr<RangedAudioParameter>>& paramVector)
{
paramVector.push_back(std::make_unique<AudioParameterFloat>(paramGlobalPortamentoTime.ID,
paramGlobalPortamentoTime.name,
NormalisableRange<float>(paramGlobalPortamentoTime.minValue, paramGlobalPortamentoTime.maxValue),
paramGlobalPortamentoTime.defaultValue,
paramGlobalPortamentoTime.unitName,
AudioProcessorParameter::genericParameter,
[](float value, int MaxLen) {value = int(exp(value) * 10) * 0.1;
if (value < 0.2)
return String("Off");
else
return String(value, MaxLen);
},
[](const String& text) { return text.getFloatValue(); }));
paramVector.push_back(std::make_unique<AudioParameterFloat>(paramGlobalNrOfVoices.ID,
paramGlobalNrOfVoices.name,
NormalisableRange<float>(paramGlobalNrOfVoices.minValue, paramGlobalNrOfVoices.maxValue),
paramGlobalNrOfVoices.defaultValue,
paramGlobalNrOfVoices.unitName,
AudioProcessorParameter::genericParameter,
[](float value, int MaxLen) {value = int(value+0.5); return String(value, MaxLen); },
[](const String& text) { return text.getFloatValue(); }));
paramVector.push_back(std::make_unique<AudioParameterFloat>(paramGlobalTuneA0.ID,
paramGlobalTuneA0.name,
NormalisableRange<float>(paramGlobalTuneA0.minValue, paramGlobalTuneA0.maxValue),
paramGlobalTuneA0.defaultValue,
paramGlobalTuneA0.unitName,
AudioProcessorParameter::genericParameter,
[](float value, int MaxLen) {value = int((value) * 10) * 0.1; return String(value, MaxLen); },
[](const String& text) { return text.getFloatValue(); }));
return 0;
}
VoiceParameterComponent::VoiceParameterComponent(AudioProcessorValueTreeState& vts)
:m_vts(vts), somethingChanged(nullptr), m_style(ComponentStyle::horizontal)
{
m_PortamentoTimeLabel.setText("Glide", NotificationType::dontSendNotification);
m_PortamentoTimeLabel.setJustificationType(Justification::centred);
addAndMakeVisible(m_PortamentoTimeLabel);
m_PortamentoTimeSlider.setSliderStyle(Slider::SliderStyle::Rotary);
m_PortamentoTimeSlider.setTextBoxStyle(Slider::TextEntryBoxPosition::TextBoxBelow, true, 60, 20);
m_PortamentoTimeAttachment = std::make_unique<SliderAttachment>(m_vts, paramGlobalPortamentoTime.ID, m_PortamentoTimeSlider);
addAndMakeVisible(m_PortamentoTimeSlider);
m_PortamentoTimeSlider.onValueChange = [this]() {if (somethingChanged != nullptr) somethingChanged(); };
m_NrOfVoicesLabel.setText("NrOfVoices", NotificationType::dontSendNotification);
m_NrOfVoicesLabel.setJustificationType(Justification::centred);
addAndMakeVisible(m_NrOfVoicesLabel);
m_NrOfVoicesSlider.setSliderStyle(Slider::SliderStyle::Rotary);
m_NrOfVoicesSlider.setTextBoxStyle(Slider::TextEntryBoxPosition::TextBoxBelow, true, 60, 20);
m_NrOfVoicesAttachment = std::make_unique<SliderAttachment>(m_vts, paramGlobalNrOfVoices.ID, m_NrOfVoicesSlider);
addAndMakeVisible(m_NrOfVoicesSlider);
m_NrOfVoicesSlider.onValueChange = [this]() {if (somethingChanged != nullptr) somethingChanged(); };
m_GlobalTuneA0Label.setText("TuneA0", NotificationType::dontSendNotification);
m_GlobalTuneA0Label.setJustificationType(Justification::centred);
addAndMakeVisible(m_GlobalTuneA0Label);
m_GlobalTuneA0Slider.setSliderStyle(Slider::SliderStyle::Rotary);
m_GlobalTuneA0Slider.setTextBoxStyle(Slider::TextEntryBoxPosition::TextBoxBelow, true, 60, 20);
m_GlobalTuneA0Attachment = std::make_unique<SliderAttachment>(m_vts, paramGlobalTuneA0.ID, m_GlobalTuneA0Slider);
addAndMakeVisible(m_GlobalTuneA0Slider);
m_GlobalTuneA0Slider.onValueChange = [this]() {if (somethingChanged != nullptr) somethingChanged(); };
}
void VoiceParameterComponent::paint(Graphics& g)
{
g.fillAll((getLookAndFeel().findColour(ResizableWindow::backgroundColourId)).darker(0.2));
}
#define GLOBAL_LABEL_WIDTH 60
#define GLOBAL_ROTARY_WIDTH 60
#define GLOBAL_MIN_DISTANCE 5
#define GLOBAL_LABEL_HEIGHT 20
void VoiceParameterComponent::resized()
{
auto r = getLocalBounds();
r.reduce(GLOBAL_MIN_DISTANCE, GLOBAL_MIN_DISTANCE);
auto s = r;
auto t = r;
switch (m_style)
{
case ComponentStyle::compact:
break;
case ComponentStyle::horizontal:
s = r.removeFromTop(GLOBAL_LABEL_HEIGHT);
m_NrOfVoicesLabel.setBounds(s.removeFromLeft(GLOBAL_LABEL_WIDTH));
s.removeFromLeft(GLOBAL_MIN_DISTANCE);
m_GlobalTuneA0Label.setBounds(s.removeFromLeft(GLOBAL_LABEL_WIDTH));
s.removeFromLeft(GLOBAL_MIN_DISTANCE);
m_PortamentoTimeLabel.setBounds(s.removeFromLeft(GLOBAL_LABEL_WIDTH));
s = r;
t = s.removeFromBottom(GLOBAL_ROTARY_WIDTH);
m_NrOfVoicesSlider.setBounds(t.removeFromLeft(GLOBAL_ROTARY_WIDTH));
t.removeFromLeft(GLOBAL_MIN_DISTANCE);
m_GlobalTuneA0Slider.setBounds(t.removeFromLeft(GLOBAL_ROTARY_WIDTH));
t.removeFromLeft(GLOBAL_MIN_DISTANCE);
m_PortamentoTimeSlider.setBounds(t.removeFromLeft(GLOBAL_ROTARY_WIDTH));
break;
case ComponentStyle::vertical:
break;
}
}
| [
"joerg.bitzer@jade-hs.de"
] | joerg.bitzer@jade-hs.de |
88645553cb19f1673ae48d9a98017148ae62212f | 52bea6fbc70608793b313199e8b6070252765771 | /Execution/RunEnv.hpp | 7468ac5f441c0dd7ac1267fed8cc8f6cc11df851 | [] | no_license | strangeprogrammer/Dimensions | 373a440171a372f67c4e2a9b05f34a193b0c64e1 | 7c2dba559676c2a235325d2b5e1b497f54658a47 | refs/heads/master | 2020-03-19T10:05:29.174230 | 2018-05-16T06:43:44 | 2018-05-16T06:43:44 | 136,342,655 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 529 | hpp | #ifndef RUNENV_HPP
#define RUNENV_HPP
using namespace Details;
using namespace ExecBlocks;
class RunEnv{
private:
bool owngen;
public:
Instruction *start,
*current;
Storage<Axes*,Cell*> *s;
Axes *position,
*velocity;
RunEnv(Instruction* start,Instruction* current,Storage<Axes*,Cell*>* s,Axes* position,Axes* velocity);
RunEnv(Instruction* start);
//Constructor sets 'start' and 's' to given values and zeroes position and velocity
~RunEnv();
//Destructor zeroes all variables
};
#endif //RUNENV_HPP
| [
"stephen.m.fedele@wmich.edu"
] | stephen.m.fedele@wmich.edu |
2c48fe058c5bb2527d8acb6837f59ecc96a2453a | bb14d9164472a7a7542765dc81f360253ea815d7 | /3rdparty/redis_cluster/adapters/hiredis-boostasio-adapter/boostasio.cpp | 3f64574df12a7be58367fce3557f22f41248f6e5 | [
"BSD-3-Clause"
] | permissive | MelLain/cluster-bigartm | f044787985ec9cba6a8d2af62df7c8c4ca0bfd24 | bbd2a08a8c3f84238d6d3d44ffd305dde93eea7c | refs/heads/master | 2020-03-29T06:29:59.266188 | 2019-02-27T23:28:22 | 2019-02-27T23:29:11 | 149,627,572 | 0 | 0 | BSD-3-Clause | 2019-02-27T13:31:19 | 2018-09-20T15:03:46 | C++ | UTF-8 | C++ | false | false | 2,748 | cpp | #include "boostasio.hpp"
redisBoostClient::redisBoostClient(boost::asio::io_service& io_service,redisAsyncContext *ac)
: context_(ac),
socket_(io_service),
read_requested_(false),
write_requested_(false),
read_in_progress_(false),
write_in_progress_(false)
{
/*this gives us access to c->fd*/
redisContext *c = &(ac->c);
/*hiredis already connected
*use the existing native socket
*/
socket_.assign(boost::asio::ip::tcp::v4(),c->fd);
/*register hooks with the hiredis async context*/
ac->ev.addRead = call_C_addRead;
ac->ev.delRead = call_C_delRead;
ac->ev.addWrite = call_C_addWrite;
ac->ev.delWrite = call_C_delWrite;
ac->ev.cleanup = call_C_cleanup;
/*C wrapper functions will use this pointer to call class members.*/
ac->ev.data = this;
}
void redisBoostClient::operate()
{
if(read_requested_ && !read_in_progress_) {
read_in_progress_ = true;
socket_.async_read_some(boost::asio::null_buffers(),
boost::bind(&redisBoostClient::handle_read,this,boost::asio::placeholders::error));
}
if(write_requested_ && !write_in_progress_) {
write_in_progress_ = true;
socket_.async_write_some(boost::asio::null_buffers(),
boost::bind(&redisBoostClient::handle_write,this,boost::asio::placeholders::error));
}
}
void redisBoostClient::handle_read(boost::system::error_code ec)
{
read_in_progress_ = false;
if(!ec) {
redisAsyncHandleRead(context_);
}
if (!ec || ec == boost::asio::error::would_block)
operate();
}
void redisBoostClient::handle_write(boost::system::error_code ec)
{
write_in_progress_ = false;
if(!ec) {
redisAsyncHandleWrite(context_);
}
if (!ec || ec == boost::asio::error::would_block)
operate();
}
void redisBoostClient::add_read()
{
read_requested_ = true;
operate();
}
void redisBoostClient::del_read()
{
read_requested_ = false;
}
void redisBoostClient::add_write()
{
write_requested_ = true;
operate();
}
void redisBoostClient::del_write()
{
write_requested_ = false;
}
void redisBoostClient::cleanup()
{
/*Do I even need this?*/
printf("cleanup called...\n");
}
static inline redisBoostClient * cast_to_client(void *privdata)
{
assert(privdata);
return static_cast<redisBoostClient *>(privdata);
}
/*wrappers*/
extern "C" void call_C_addRead(void *privdata)
{
cast_to_client(privdata)->add_read();
}
extern "C" void call_C_delRead(void *privdata)
{
cast_to_client(privdata)->del_read();
}
extern "C" void call_C_addWrite(void *privdata)
{
cast_to_client(privdata)->add_write();
}
extern "C" void call_C_delWrite(void *privdata)
{
cast_to_client(privdata)->del_write();
}
extern "C" void call_C_cleanup(void *privdata)
{
cast_to_client(privdata)->cleanup();
}
/*end of wrappers*/
| [
"mel-lain@yandex-team.ru"
] | mel-lain@yandex-team.ru |
909ebc2868683dbcd7310171c595d6753e84b000 | 67fc9e51437e351579fe9d2d349040c25936472a | /wrappers/7.0.0/vtkProteinRibbonFilterWrap.cc | 4f6aed3f7620c37b60c0fc4223226b94f5188b59 | [] | permissive | axkibe/node-vtk | 51b3207c7a7d3b59a4dd46a51e754984c3302dec | 900ad7b5500f672519da5aa24c99aa5a96466ef3 | refs/heads/master | 2023-03-05T07:45:45.577220 | 2020-03-30T09:31:07 | 2020-03-30T09:31:07 | 48,490,707 | 6 | 0 | BSD-3-Clause | 2022-12-07T20:41:45 | 2015-12-23T12:58:43 | C++ | UTF-8 | C++ | false | false | 12,394 | cc | /* this file has been autogenerated by vtkNodeJsWrap */
/* editing this might proof futile */
#define VTK_WRAPPING_CXX
#define VTK_STREAMS_FWD_ONLY
#include <nan.h>
#include "vtkPolyDataAlgorithmWrap.h"
#include "vtkProteinRibbonFilterWrap.h"
#include "vtkObjectWrap.h"
#include "../../plus/plus.h"
using namespace v8;
extern Nan::Persistent<v8::Object> vtkNodeJsNoWrap;
Nan::Persistent<v8::FunctionTemplate> VtkProteinRibbonFilterWrap::ptpl;
VtkProteinRibbonFilterWrap::VtkProteinRibbonFilterWrap()
{ }
VtkProteinRibbonFilterWrap::VtkProteinRibbonFilterWrap(vtkSmartPointer<vtkProteinRibbonFilter> _native)
{ native = _native; }
VtkProteinRibbonFilterWrap::~VtkProteinRibbonFilterWrap()
{ }
void VtkProteinRibbonFilterWrap::Init(v8::Local<v8::Object> exports)
{
Nan::SetAccessor(exports, Nan::New("vtkProteinRibbonFilter").ToLocalChecked(), ConstructorGetter);
Nan::SetAccessor(exports, Nan::New("ProteinRibbonFilter").ToLocalChecked(), ConstructorGetter);
}
void VtkProteinRibbonFilterWrap::ConstructorGetter(
v8::Local<v8::String> property,
const Nan::PropertyCallbackInfo<v8::Value>& info)
{
InitPtpl();
info.GetReturnValue().Set(Nan::New(ptpl)->GetFunction());
}
void VtkProteinRibbonFilterWrap::InitPtpl()
{
if (!ptpl.IsEmpty()) return;
v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
VtkPolyDataAlgorithmWrap::InitPtpl( );
tpl->Inherit(Nan::New<FunctionTemplate>(VtkPolyDataAlgorithmWrap::ptpl));
tpl->SetClassName(Nan::New("VtkProteinRibbonFilterWrap").ToLocalChecked());
tpl->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetPrototypeMethod(tpl, "GetClassName", GetClassName);
Nan::SetPrototypeMethod(tpl, "getClassName", GetClassName);
Nan::SetPrototypeMethod(tpl, "GetCoilWidth", GetCoilWidth);
Nan::SetPrototypeMethod(tpl, "getCoilWidth", GetCoilWidth);
Nan::SetPrototypeMethod(tpl, "GetDrawSmallMoleculesAsSpheres", GetDrawSmallMoleculesAsSpheres);
Nan::SetPrototypeMethod(tpl, "getDrawSmallMoleculesAsSpheres", GetDrawSmallMoleculesAsSpheres);
Nan::SetPrototypeMethod(tpl, "GetHelixWidth", GetHelixWidth);
Nan::SetPrototypeMethod(tpl, "getHelixWidth", GetHelixWidth);
Nan::SetPrototypeMethod(tpl, "GetSphereResolution", GetSphereResolution);
Nan::SetPrototypeMethod(tpl, "getSphereResolution", GetSphereResolution);
Nan::SetPrototypeMethod(tpl, "GetSubdivideFactor", GetSubdivideFactor);
Nan::SetPrototypeMethod(tpl, "getSubdivideFactor", GetSubdivideFactor);
Nan::SetPrototypeMethod(tpl, "IsA", IsA);
Nan::SetPrototypeMethod(tpl, "isA", IsA);
Nan::SetPrototypeMethod(tpl, "NewInstance", NewInstance);
Nan::SetPrototypeMethod(tpl, "newInstance", NewInstance);
Nan::SetPrototypeMethod(tpl, "SafeDownCast", SafeDownCast);
Nan::SetPrototypeMethod(tpl, "safeDownCast", SafeDownCast);
Nan::SetPrototypeMethod(tpl, "SetCoilWidth", SetCoilWidth);
Nan::SetPrototypeMethod(tpl, "setCoilWidth", SetCoilWidth);
Nan::SetPrototypeMethod(tpl, "SetDrawSmallMoleculesAsSpheres", SetDrawSmallMoleculesAsSpheres);
Nan::SetPrototypeMethod(tpl, "setDrawSmallMoleculesAsSpheres", SetDrawSmallMoleculesAsSpheres);
Nan::SetPrototypeMethod(tpl, "SetHelixWidth", SetHelixWidth);
Nan::SetPrototypeMethod(tpl, "setHelixWidth", SetHelixWidth);
Nan::SetPrototypeMethod(tpl, "SetSphereResolution", SetSphereResolution);
Nan::SetPrototypeMethod(tpl, "setSphereResolution", SetSphereResolution);
Nan::SetPrototypeMethod(tpl, "SetSubdivideFactor", SetSubdivideFactor);
Nan::SetPrototypeMethod(tpl, "setSubdivideFactor", SetSubdivideFactor);
#ifdef VTK_NODE_PLUS_VTKPROTEINRIBBONFILTERWRAP_INITPTPL
VTK_NODE_PLUS_VTKPROTEINRIBBONFILTERWRAP_INITPTPL
#endif
ptpl.Reset( tpl );
}
void VtkProteinRibbonFilterWrap::New(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
if(!info.IsConstructCall())
{
Nan::ThrowError("Constructor not called in a construct call.");
return;
}
if(info.Length() == 0)
{
vtkSmartPointer<vtkProteinRibbonFilter> native = vtkSmartPointer<vtkProteinRibbonFilter>::New();
VtkProteinRibbonFilterWrap* obj = new VtkProteinRibbonFilterWrap(native);
obj->Wrap(info.This());
}
else
{
if(info[0]->ToObject() != vtkNodeJsNoWrap )
{
Nan::ThrowError("Parameter Error");
return;
}
}
info.GetReturnValue().Set(info.This());
}
void VtkProteinRibbonFilterWrap::GetClassName(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
VtkProteinRibbonFilterWrap *wrapper = ObjectWrap::Unwrap<VtkProteinRibbonFilterWrap>(info.Holder());
vtkProteinRibbonFilter *native = (vtkProteinRibbonFilter *)wrapper->native.GetPointer();
char const * r;
if(info.Length() != 0)
{
Nan::ThrowError("Too many parameters.");
return;
}
r = native->GetClassName();
info.GetReturnValue().Set(Nan::New(r).ToLocalChecked());
}
void VtkProteinRibbonFilterWrap::GetCoilWidth(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
VtkProteinRibbonFilterWrap *wrapper = ObjectWrap::Unwrap<VtkProteinRibbonFilterWrap>(info.Holder());
vtkProteinRibbonFilter *native = (vtkProteinRibbonFilter *)wrapper->native.GetPointer();
float r;
if(info.Length() != 0)
{
Nan::ThrowError("Too many parameters.");
return;
}
r = native->GetCoilWidth();
info.GetReturnValue().Set(Nan::New(r));
}
void VtkProteinRibbonFilterWrap::GetDrawSmallMoleculesAsSpheres(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
VtkProteinRibbonFilterWrap *wrapper = ObjectWrap::Unwrap<VtkProteinRibbonFilterWrap>(info.Holder());
vtkProteinRibbonFilter *native = (vtkProteinRibbonFilter *)wrapper->native.GetPointer();
bool r;
if(info.Length() != 0)
{
Nan::ThrowError("Too many parameters.");
return;
}
r = native->GetDrawSmallMoleculesAsSpheres();
info.GetReturnValue().Set(Nan::New(r));
}
void VtkProteinRibbonFilterWrap::GetHelixWidth(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
VtkProteinRibbonFilterWrap *wrapper = ObjectWrap::Unwrap<VtkProteinRibbonFilterWrap>(info.Holder());
vtkProteinRibbonFilter *native = (vtkProteinRibbonFilter *)wrapper->native.GetPointer();
float r;
if(info.Length() != 0)
{
Nan::ThrowError("Too many parameters.");
return;
}
r = native->GetHelixWidth();
info.GetReturnValue().Set(Nan::New(r));
}
void VtkProteinRibbonFilterWrap::GetSphereResolution(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
VtkProteinRibbonFilterWrap *wrapper = ObjectWrap::Unwrap<VtkProteinRibbonFilterWrap>(info.Holder());
vtkProteinRibbonFilter *native = (vtkProteinRibbonFilter *)wrapper->native.GetPointer();
int r;
if(info.Length() != 0)
{
Nan::ThrowError("Too many parameters.");
return;
}
r = native->GetSphereResolution();
info.GetReturnValue().Set(Nan::New(r));
}
void VtkProteinRibbonFilterWrap::GetSubdivideFactor(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
VtkProteinRibbonFilterWrap *wrapper = ObjectWrap::Unwrap<VtkProteinRibbonFilterWrap>(info.Holder());
vtkProteinRibbonFilter *native = (vtkProteinRibbonFilter *)wrapper->native.GetPointer();
int r;
if(info.Length() != 0)
{
Nan::ThrowError("Too many parameters.");
return;
}
r = native->GetSubdivideFactor();
info.GetReturnValue().Set(Nan::New(r));
}
void VtkProteinRibbonFilterWrap::IsA(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
VtkProteinRibbonFilterWrap *wrapper = ObjectWrap::Unwrap<VtkProteinRibbonFilterWrap>(info.Holder());
vtkProteinRibbonFilter *native = (vtkProteinRibbonFilter *)wrapper->native.GetPointer();
if(info.Length() > 0 && info[0]->IsString())
{
Nan::Utf8String a0(info[0]);
int r;
if(info.Length() != 1)
{
Nan::ThrowError("Too many parameters.");
return;
}
r = native->IsA(
*a0
);
info.GetReturnValue().Set(Nan::New(r));
return;
}
Nan::ThrowError("Parameter mismatch");
}
void VtkProteinRibbonFilterWrap::NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
VtkProteinRibbonFilterWrap *wrapper = ObjectWrap::Unwrap<VtkProteinRibbonFilterWrap>(info.Holder());
vtkProteinRibbonFilter *native = (vtkProteinRibbonFilter *)wrapper->native.GetPointer();
vtkProteinRibbonFilter * r;
if(info.Length() != 0)
{
Nan::ThrowError("Too many parameters.");
return;
}
r = native->NewInstance();
VtkProteinRibbonFilterWrap::InitPtpl();
v8::Local<v8::Value> argv[1] =
{ Nan::New(vtkNodeJsNoWrap) };
v8::Local<v8::Function> cons =
Nan::New<v8::FunctionTemplate>(VtkProteinRibbonFilterWrap::ptpl)->GetFunction();
v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
VtkProteinRibbonFilterWrap *w = new VtkProteinRibbonFilterWrap();
w->native = r;
w->Wrap(wo);
info.GetReturnValue().Set(wo);
}
void VtkProteinRibbonFilterWrap::SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
VtkProteinRibbonFilterWrap *wrapper = ObjectWrap::Unwrap<VtkProteinRibbonFilterWrap>(info.Holder());
vtkProteinRibbonFilter *native = (vtkProteinRibbonFilter *)wrapper->native.GetPointer();
if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkObjectWrap::ptpl))->HasInstance(info[0]))
{
VtkObjectWrap *a0 = ObjectWrap::Unwrap<VtkObjectWrap>(info[0]->ToObject());
vtkProteinRibbonFilter * r;
if(info.Length() != 1)
{
Nan::ThrowError("Too many parameters.");
return;
}
r = native->SafeDownCast(
(vtkObject *) a0->native.GetPointer()
);
VtkProteinRibbonFilterWrap::InitPtpl();
v8::Local<v8::Value> argv[1] =
{ Nan::New(vtkNodeJsNoWrap) };
v8::Local<v8::Function> cons =
Nan::New<v8::FunctionTemplate>(VtkProteinRibbonFilterWrap::ptpl)->GetFunction();
v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
VtkProteinRibbonFilterWrap *w = new VtkProteinRibbonFilterWrap();
w->native = r;
w->Wrap(wo);
info.GetReturnValue().Set(wo);
return;
}
Nan::ThrowError("Parameter mismatch");
}
void VtkProteinRibbonFilterWrap::SetCoilWidth(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
VtkProteinRibbonFilterWrap *wrapper = ObjectWrap::Unwrap<VtkProteinRibbonFilterWrap>(info.Holder());
vtkProteinRibbonFilter *native = (vtkProteinRibbonFilter *)wrapper->native.GetPointer();
if(info.Length() > 0 && info[0]->IsNumber())
{
if(info.Length() != 1)
{
Nan::ThrowError("Too many parameters.");
return;
}
native->SetCoilWidth(
info[0]->NumberValue()
);
return;
}
Nan::ThrowError("Parameter mismatch");
}
void VtkProteinRibbonFilterWrap::SetDrawSmallMoleculesAsSpheres(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
VtkProteinRibbonFilterWrap *wrapper = ObjectWrap::Unwrap<VtkProteinRibbonFilterWrap>(info.Holder());
vtkProteinRibbonFilter *native = (vtkProteinRibbonFilter *)wrapper->native.GetPointer();
if(info.Length() > 0 && info[0]->IsBoolean())
{
if(info.Length() != 1)
{
Nan::ThrowError("Too many parameters.");
return;
}
native->SetDrawSmallMoleculesAsSpheres(
info[0]->BooleanValue()
);
return;
}
Nan::ThrowError("Parameter mismatch");
}
void VtkProteinRibbonFilterWrap::SetHelixWidth(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
VtkProteinRibbonFilterWrap *wrapper = ObjectWrap::Unwrap<VtkProteinRibbonFilterWrap>(info.Holder());
vtkProteinRibbonFilter *native = (vtkProteinRibbonFilter *)wrapper->native.GetPointer();
if(info.Length() > 0 && info[0]->IsNumber())
{
if(info.Length() != 1)
{
Nan::ThrowError("Too many parameters.");
return;
}
native->SetHelixWidth(
info[0]->NumberValue()
);
return;
}
Nan::ThrowError("Parameter mismatch");
}
void VtkProteinRibbonFilterWrap::SetSphereResolution(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
VtkProteinRibbonFilterWrap *wrapper = ObjectWrap::Unwrap<VtkProteinRibbonFilterWrap>(info.Holder());
vtkProteinRibbonFilter *native = (vtkProteinRibbonFilter *)wrapper->native.GetPointer();
if(info.Length() > 0 && info[0]->IsInt32())
{
if(info.Length() != 1)
{
Nan::ThrowError("Too many parameters.");
return;
}
native->SetSphereResolution(
info[0]->Int32Value()
);
return;
}
Nan::ThrowError("Parameter mismatch");
}
void VtkProteinRibbonFilterWrap::SetSubdivideFactor(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
VtkProteinRibbonFilterWrap *wrapper = ObjectWrap::Unwrap<VtkProteinRibbonFilterWrap>(info.Holder());
vtkProteinRibbonFilter *native = (vtkProteinRibbonFilter *)wrapper->native.GetPointer();
if(info.Length() > 0 && info[0]->IsInt32())
{
if(info.Length() != 1)
{
Nan::ThrowError("Too many parameters.");
return;
}
native->SetSubdivideFactor(
info[0]->Int32Value()
);
return;
}
Nan::ThrowError("Parameter mismatch");
}
| [
"axkibe@gmail.com"
] | axkibe@gmail.com |
adbf9ab2f6210dd4fd10845d7a9135463bc438f6 | 2dadfe24e51d3a8ceb94a71cc1f48de4ed0e4b30 | /Book/Roam.cpp | 7595560ae521068009a820ee3bbd92e73c9dd65c | [] | no_license | Wasrek/POSN15 | 12e1ee582e04b21580e230325cc6288e93ae5a04 | 8fe2999ab0bc3f9b54c485b4643d8630cbb878a8 | refs/heads/master | 2020-09-06T23:44:11.761136 | 2020-02-27T08:11:23 | 2020-02-27T08:11:23 | 220,591,575 | 0 | 0 | null | 2020-02-27T08:11:24 | 2019-11-09T04:34:10 | C++ | UTF-8 | C++ | false | false | 461 | cpp | /*
TASK:Roam
LANG: CPP
AUTHOR: KersW
SCHOOL: REPS
*/
#include<bits/stdc++.h>
using namespace std;
int dp[100100];
int main()
{
int n,m,a,b,i,q;
scanf("%d %d",&n,&m);
while(m--)
{
scanf("%d %d",&a,&b);
dp[a]++,dp[b+1]--;
}
for(i=1;i<=n;i++)
dp[i]+=dp[i-1];
scanf("%d",&q);
while(q--){
scanf("%d",&a);
printf("%d\n",dp[a]);
}
return 0;
}
| [
"noreply@github.com"
] | noreply@github.com |
b477aeba1a6addcb050f7d5f88da006d110475db | a5a7c59b04a1a64fe34653c7970c3cf173f9c1df | /externals/numeric_bindings/boost/numeric/bindings/lapack/driver/sbgv.hpp | 930822c5d8a5a4a5f8fedf7cfb0f883fad987d53 | [
"BSL-1.0",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | siconos/siconos | a7afdba41a2bc1192ad8dcd93ac7266fa281f4cf | 82a8d1338bfc1be0d36b5e8a9f40c1ad5384a641 | refs/heads/master | 2023-08-21T22:22:55.625941 | 2023-07-17T13:07:32 | 2023-07-17T13:07:32 | 37,709,357 | 166 | 33 | Apache-2.0 | 2023-07-17T12:31:16 | 2015-06-19T07:55:53 | C | UTF-8 | C++ | false | false | 9,695 | hpp | //
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// 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)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_LAPACK_DRIVER_SBGV_HPP
#define BOOST_NUMERIC_BINDINGS_LAPACK_DRIVER_SBGV_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/bandwidth.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/is_column_major.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/lapack/workspace.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/uplo_tag.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_const.hpp>
//
// The LAPACK-backend for sbgv is the netlib-compatible backend.
//
#include <boost/numeric/bindings/lapack/detail/lapack.h>
#include <boost/numeric/bindings/lapack/detail/lapack_option.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace lapack {
//
// The detail namespace contains value-type-overloaded functions that
// dispatch to the appropriate back-end LAPACK-routine.
//
namespace detail {
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * float value-type.
//
template< typename UpLo >
inline std::ptrdiff_t sbgv( const char jobz, const UpLo, const fortran_int_t n,
const fortran_int_t ka, const fortran_int_t kb, float* ab,
const fortran_int_t ldab, float* bb, const fortran_int_t ldbb,
float* w, float* z, const fortran_int_t ldz, float* work ) {
fortran_int_t info(0);
LAPACK_SSBGV( &jobz, &lapack_option< UpLo >::value, &n, &ka, &kb, ab,
&ldab, bb, &ldbb, w, z, &ldz, work, &info );
return info;
}
//
// Overloaded function for dispatching to
// * netlib-compatible LAPACK backend (the default), and
// * double value-type.
//
template< typename UpLo >
inline std::ptrdiff_t sbgv( const char jobz, const UpLo, const fortran_int_t n,
const fortran_int_t ka, const fortran_int_t kb, double* ab,
const fortran_int_t ldab, double* bb, const fortran_int_t ldbb,
double* w, double* z, const fortran_int_t ldz, double* work ) {
fortran_int_t info(0);
LAPACK_DSBGV( &jobz, &lapack_option< UpLo >::value, &n, &ka, &kb, ab,
&ldab, bb, &ldbb, w, z, &ldz, work, &info );
return info;
}
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to sbgv.
//
template< typename Value >
struct sbgv_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
//
// Static member function for user-defined workspaces, that
// * Deduces the required arguments for dispatching to LAPACK, and
// * Asserts that most arguments make sense.
//
template< typename MatrixAB, typename MatrixBB, typename VectorW,
typename MatrixZ, typename WORK >
static std::ptrdiff_t invoke( const char jobz, MatrixAB& ab, MatrixBB& bb,
VectorW& w, MatrixZ& z, detail::workspace1< WORK > work ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixAB >::value) );
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixBB >::value) );
BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixZ >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixAB >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixBB >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixAB >::type >::type,
typename remove_const< typename bindings::value_type<
VectorW >::type >::type >::value) );
BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const<
typename bindings::value_type< MatrixAB >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixZ >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAB >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixBB >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorW >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixZ >::value) );
BOOST_ASSERT( bindings::bandwidth(ab, uplo()) >= 0 );
BOOST_ASSERT( bindings::bandwidth(bb, uplo()) >= 0 );
BOOST_ASSERT( bindings::size(work.select(real_type())) >=
min_size_work( bindings::size_column(ab) ));
BOOST_ASSERT( bindings::size_column(ab) >= 0 );
BOOST_ASSERT( bindings::size_minor(ab) == 1 ||
bindings::stride_minor(ab) == 1 );
BOOST_ASSERT( bindings::size_minor(bb) == 1 ||
bindings::stride_minor(bb) == 1 );
BOOST_ASSERT( bindings::size_minor(z) == 1 ||
bindings::stride_minor(z) == 1 );
BOOST_ASSERT( bindings::stride_major(ab) >= bindings::bandwidth(ab,
uplo())+1 );
BOOST_ASSERT( bindings::stride_major(bb) >= bindings::bandwidth(bb,
uplo())+1 );
BOOST_ASSERT( jobz == 'N' || jobz == 'V' );
return detail::sbgv( jobz, uplo(), bindings::size_column(ab),
bindings::bandwidth(ab, uplo()), bindings::bandwidth(bb,
uplo()), bindings::begin_value(ab),
bindings::stride_major(ab), bindings::begin_value(bb),
bindings::stride_major(bb), bindings::begin_value(w),
bindings::begin_value(z), bindings::stride_major(z),
bindings::begin_value(work.select(real_type())) );
}
//
// Static member function that
// * Figures out the minimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member function
// * Enables the unblocked algorithm (BLAS level 2)
//
template< typename MatrixAB, typename MatrixBB, typename VectorW,
typename MatrixZ >
static std::ptrdiff_t invoke( const char jobz, MatrixAB& ab, MatrixBB& bb,
VectorW& w, MatrixZ& z, minimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
bindings::detail::array< real_type > tmp_work( min_size_work(
bindings::size_column(ab) ) );
return invoke( jobz, ab, bb, w, z, workspace( tmp_work ) );
}
//
// Static member function that
// * Figures out the optimal workspace requirements, and passes
// the results to the user-defined workspace overload of the
// invoke static member
// * Enables the blocked algorithm (BLAS level 3)
//
template< typename MatrixAB, typename MatrixBB, typename VectorW,
typename MatrixZ >
static std::ptrdiff_t invoke( const char jobz, MatrixAB& ab, MatrixBB& bb,
VectorW& w, MatrixZ& z, optimal_workspace ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::uplo_tag< MatrixAB >::type uplo;
return invoke( jobz, ab, bb, w, z, minimal_workspace() );
}
//
// Static member function that returns the minimum size of
// workspace-array work.
//
static std::ptrdiff_t min_size_work( const std::ptrdiff_t n ) {
return 3*n;
}
};
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access. In
// addition, if applicable, they are overloaded for user-defined workspaces.
// Calls to these functions are passed to the sbgv_impl classes. In the
// documentation, most overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for sbgv. Its overload differs for
// * User-defined workspace
//
template< typename MatrixAB, typename MatrixBB, typename VectorW,
typename MatrixZ, typename Workspace >
inline typename boost::enable_if< detail::is_workspace< Workspace >,
std::ptrdiff_t >::type
sbgv( const char jobz, MatrixAB& ab, MatrixBB& bb, VectorW& w,
MatrixZ& z, Workspace work ) {
return sbgv_impl< typename bindings::value_type<
MatrixAB >::type >::invoke( jobz, ab, bb, w, z, work );
}
//
// Overloaded function for sbgv. Its overload differs for
// * Default workspace-type (optimal)
//
template< typename MatrixAB, typename MatrixBB, typename VectorW,
typename MatrixZ >
inline typename boost::disable_if< detail::is_workspace< MatrixZ >,
std::ptrdiff_t >::type
sbgv( const char jobz, MatrixAB& ab, MatrixBB& bb, VectorW& w,
MatrixZ& z ) {
return sbgv_impl< typename bindings::value_type<
MatrixAB >::type >::invoke( jobz, ab, bb, w, z,
optimal_workspace() );
}
} // namespace lapack
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif
| [
"franck.perignon@imag.fr"
] | franck.perignon@imag.fr |
e35b75b6e767d73c91beadfb21bc7417d46f2a69 | 318b9a5fe958e536428eaff5a4217f9f96b2bcc8 | /apollo/modules/planning/behaviour_tree/tasks/lane_prioritizer/lane_prioritizer.cc | 689ecc7fc0a499ed6369e3c581ba1ec8caa51419 | [] | no_license | mengxingshifen1218/BehaviourPlanning | 96bcf040f6ec63fb5989c6ca3007fe9aad213006 | ce91810fe8b423fd7ec9b6303ff4f05affad9aa8 | refs/heads/main | 2023-04-30T03:11:26.405582 | 2021-05-20T08:07:18 | 2021-05-20T08:07:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,499 | cc | #include "modules/planning/behaviour_tree/tasks/lane_prioritizer/lane_prioritizer.h"
namespace apollo {
namespace planning {
namespace behaviour_tree {
namespace
{
const double kNearOffset = 8.0;
const double kLaneWidth = 2.0;
const double kPlanningHorizon = 60.0;
const int kLaneChangeCost = 10;
const int kLaneStayCost = 0;
const int kBlockingObstacleCost = 100;
const int kObstacleCost = 5;
const int kFrontObstacleCost = 50;
}
BTreeNodeState LanePrioritizer::Init(const BTreeNodeConfig& config)
{
config_ = config;
state_ = BTreeNodeState::NODE_INITIALIZED;
return state_;
}
BTreeNodeState LanePrioritizer::Execute(Frame* frame)
{
for (auto& ref_line : *frame->mutable_reference_line_info())
{
if (ref_line.IsChangeLanePath())
{
ref_line.AddCost(kLaneChangeCost);
}
else
{
ref_line.AddCost(kLaneStayCost);
}
Obstacle* blocking_obstacle = ref_line.GetBlockingObstacle();
if (blocking_obstacle)
{
ref_line.AddCost(kBlockingObstacleCost);
}
const auto& ego_sl_boundary = ref_line.AdcSlBoundary();
PathDecision *const path_decision = ref_line.path_decision();
for (const auto *obstacle : path_decision->obstacles().Items())
{
if (obstacle->IsVirtual())
{
continue;
}
const auto &obstacle_sl_boundary = obstacle->PerceptionSLBoundary();
double obstacle_l = (obstacle_sl_boundary.start_l() + obstacle_sl_boundary.end_l()) / 2.0;
AERROR << "Lane: " << ref_line.Lanes().Id() << " Obstacle: " << obstacle->Id() << " L: " << obstacle_l;
// Check if obstacle is not within the lane
if(std::abs(obstacle_l) > kLaneWidth / 2.0)
{
continue;
}
// Check if obstacle is too far
if (std::abs(obstacle_sl_boundary.start_s() - ego_sl_boundary.start_s()) > kPlanningHorizon)
{
continue;
}
if (obstacle_sl_boundary.start_s() > ego_sl_boundary.start_s() - kNearOffset)
{
ref_line.AddCost(kFrontObstacleCost);
}
else
{
ref_line.AddCost(kObstacleCost);
}
}
}
state_ = BTreeNodeState::NODE_DONE;
return state_;
}
BTreeNodeState LanePrioritizer::Execute(Frame* frame, ReferenceLineInfo* reference_line_info)
{
return Execute(frame);
}
} // namespace behaviour_tree
} // namespace planning
} // namespace apollo | [
"danikdanik481@gmail.com"
] | danikdanik481@gmail.com |
363040c6773b2debf5987267138ffe6227e26614 | 4eaba29c83d03e56e007f227397e9e908895216f | /Outland/Graphics Core/Polygroup.h | 239ac4b21d419c6f52c0eeae498826286bde4de3 | [] | no_license | zkrizo/SanctuarySix | 15d6908814af5cd1ff00fbf4523d85864cd536c9 | c483c69498a7d2b62ff29ee614e6578287d99102 | refs/heads/master | 2021-01-22T09:32:30.827894 | 2014-10-30T18:41:53 | 2014-10-30T18:41:53 | 25,984,810 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 763 | h | #ifndef Polygroup_H
#define Polygroup_H
#include <Outland\UnitAbstraction.h>
#include "Polygon.h"
class Polygroup
{
public:
Polygroup();
void addPoly(const Poly& poly);
void removePoly(const Poly& poly);
void polygonReduction();
void renderGroup();
void clearPolygroup();
void toggleSetup() {initialSetup=!initialSetup;};
void setRender(bool high) {highPolyReady=high;};
bool isHighPolyReady() const {return highPolyReady;};
std::vector<Poly> getHighPolys() const {return highEfficientPolys;};
std::vector<Poly> getLowPolys() const {return lowEfficientPolys;};
private:
std::vector<Poly> grid[10][10];
void clearGrid();
std::vector<Poly> lowEfficientPolys;
std::vector<Poly> highEfficientPolys;
bool highPolyReady;
bool initialSetup;
};
#endif | [
"zkrizo@users.noreply.github.com"
] | zkrizo@users.noreply.github.com |
adfa6d2c480332c8a42c2a824e0262b4541bce20 | 33cf7b462d358197667ea8c02ed94d97e76749a3 | /Framework/Source/Math/MyMatrix.h | be0a7b2da2f001388cf6ecd1bc780cb8cd674140 | [] | no_license | omrkocar/SchoolGameEngine | 3bda792d1ba872727b5821d3cede5f835e397043 | 04426af512edaab15fe283eec60cb0a46df56028 | refs/heads/main | 2023-04-27T23:56:17.413476 | 2021-05-05T23:05:59 | 2021-05-05T23:05:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,026 | h | //
// Copyright (c) 2012-2017 Jimmy Lord http://www.flatheadgames.com
//
// This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
#ifndef __MyMatrix_H__
#define __MyMatrix_H__
#include "Vector.h"
namespace fw
{
// Values are stored column major.
// m11 m21 m31 m41 Sx 0 0 Tx
// m12 m22 m32 m42 --\ 0 Sy 0 Ty
// m13 m23 m33 m43 --/ 0 0 Sz Tz
// m14 m24 m34 m44 0 0 0 1
class MyMatrix
{
public:
float m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44;
public:
MyMatrix() {}
//MyMatrix(const vec3& right, const vec3& up, const vec3& at, const vec3& pos) // view axes(inverse)
// : m11(right.x), m21(right.y), m31(right.z), m41(pos.x),
// , m12(up.x), m22(up.y), m32(up.z), m42(pos.y),
// , m13(at.x), m23(at.y), m33(at.z), m43(pos.z),
// , m14(0), m24(0), m34(0), m44(1) {}
MyMatrix(float v11, float v12, float v13, float v14,
float v21, float v22, float v23, float v24,
float v31, float v32, float v33, float v34,
float v41, float v42, float v43, float v44)
: m11(v11), m12(v12), m13(v13), m14(v14)
, m21(v21), m22(v22), m23(v23), m24(v24)
, m31(v31), m32(v32), m33(v33), m34(v34)
, m41(v41), m42(v42), m43(v43), m44(v44) {}
// Added this copy constuctor when I was having issue with Android(gcc), didn't end up using it and it shouldn't be needed.
//MyMatrix(const MyMatrix& o)
// : m11(o.m11), m21(o.m21), m31(o.m31), m41(o.m41)
// , m12(o.m12), m22(o.m22), m32(o.m32), m42(o.m42)
// , m13(o.m13), m23(o.m23), m33(o.m33), m43(o.m43)
// , m14(o.m14), m24(o.m24), m34(o.m34), m44(o.m44) {}
// The following functions will affect existing values in the matrix.
void Scale(float scale);
void Scale(float sx, float sy, float sz);
void Scale(vec3 scale);
void Rotate(float angle, float x, float y, float z);
void TranslatePreRotScale(vec3 translate);
void TranslatePreRotScale(float tx, float ty, float tz);
void Translate(vec3 pos);
void Translate(float x, float y, float z);
// All create/set functions will overright values in the matrix.
void SetIdentity();
void SetAxesView(const vec3& right, const vec3& up, const vec3& at, const vec3& pos);
void SetAxesWorld(const vec3& right, const vec3& up, const vec3& at, const vec3& pos);
void SetTranslation(vec3 pos);
void SetTranslation(float x, float y, float z);
void CreateScale(float scale);
void CreateScale(float x, float y, float z);
void CreateScale(vec3 scale);
void CreateRotation(vec3 eulerdegrees);
void CreateTranslation(float x, float y, float z);
void CreateTranslation(vec3 pos);
void CreateSRT(float scale, vec3 rot, vec3 pos);
void CreateSRT(vec3 scale, vec3 rot, vec3 pos);
void CreateFrustum(float left, float right, float bottom, float top, float nearZ, float farZ);
void CreatePerspectiveVFoV(float vertfovdegrees, float aspect, float nearZ, float farZ);
void CreatePerspectiveHFoV(float horfovdegrees, float aspect, float nearZ, float farZ);
void CreateOrtho(float left, float right, float bottom, float top, float nearZ, float farZ);
void CreateLookAtView(const vec3& eye, const vec3& up, const vec3& at);
void CreateLookAtWorld(const vec3& eye, const vec3& up, const vec3& at);
// Get values from matrix.
vec3 GetTranslation() { return vec3(m41, m42, m43); }
vec3 GetEulerAngles();
vec3 GetScale();
vec3 GetUp();
vec3 GetRight();
vec3 GetAt();
void Transpose()
{
float temp;
temp = m12; m12 = m21; m21 = temp;
temp = m13; m13 = m31; m31 = temp;
temp = m14; m14 = m41; m41 = temp;
temp = m23; m23 = m32; m32 = temp;
temp = m24; m24 = m42; m42 = temp;
temp = m34; m34 = m43; m43 = temp;
}
inline MyMatrix operator *(const float o) const
{
MyMatrix newmat;
newmat.m11 = this->m11 * o; newmat.m21 = this->m21 * o; newmat.m31 = this->m31 * o; newmat.m41 = this->m41 * o;
newmat.m12 = this->m12 * o; newmat.m22 = this->m22 * o; newmat.m32 = this->m32 * o; newmat.m42 = this->m42 * o;
newmat.m13 = this->m13 * o; newmat.m23 = this->m23 * o; newmat.m33 = this->m33 * o; newmat.m43 = this->m43 * o;
newmat.m14 = this->m14 * o; newmat.m24 = this->m24 * o; newmat.m34 = this->m34 * o; newmat.m44 = this->m44 * o;
return newmat;
}
inline vec2 operator *(const vec2 o) const
{
vec4 result = vec4(m11 * o.x + m21 * o.y + 0 + m41 * 1,
m12 * o.x + m22 * o.y + 0 + m42 * 1,
m13 * o.x + m23 * o.y + 0 + m43 * 1,
m14 * o.x + m24 * o.y + 0 + m44 * 1);
if (result.w)
return vec2(result.x / result.w, result.y / result.w);
else
return vec2(result.x, result.y);
}
inline vec3 operator *(const vec3 o) const
{
vec4 result = vec4(m11 * o.x + m21 * o.y + m31 * o.z + m41 * 1,
m12 * o.x + m22 * o.y + m32 * o.z + m42 * 1,
m13 * o.x + m23 * o.y + m33 * o.z + m43 * 1,
m14 * o.x + m24 * o.y + m34 * o.z + m44 * 1);
if (result.w)
return vec3(result.x / result.w, result.y / result.w, result.z / result.w);
else
return vec3(result.x, result.y, result.z);
}
inline vec4 operator *(const vec4 o) const
{
return vec4(m11 * o.x + m21 * o.y + m31 * o.z + m41 * o.w,
m12 * o.x + m22 * o.y + m32 * o.z + m42 * o.w,
m13 * o.x + m23 * o.y + m33 * o.z + m43 * o.w,
m14 * o.x + m24 * o.y + m34 * o.z + m44 * o.w);
}
inline MyMatrix operator *(const MyMatrix o) const
{
MyMatrix newmat;
newmat.m11 = this->m11 * o.m11 + this->m21 * o.m12 + this->m31 * o.m13 + this->m41 * o.m14;
newmat.m12 = this->m12 * o.m11 + this->m22 * o.m12 + this->m32 * o.m13 + this->m42 * o.m14;
newmat.m13 = this->m13 * o.m11 + this->m23 * o.m12 + this->m33 * o.m13 + this->m43 * o.m14;
newmat.m14 = this->m14 * o.m11 + this->m24 * o.m12 + this->m34 * o.m13 + this->m44 * o.m14;
newmat.m21 = this->m11 * o.m21 + this->m21 * o.m22 + this->m31 * o.m23 + this->m41 * o.m24;
newmat.m22 = this->m12 * o.m21 + this->m22 * o.m22 + this->m32 * o.m23 + this->m42 * o.m24;
newmat.m23 = this->m13 * o.m21 + this->m23 * o.m22 + this->m33 * o.m23 + this->m43 * o.m24;
newmat.m24 = this->m14 * o.m21 + this->m24 * o.m22 + this->m34 * o.m23 + this->m44 * o.m24;
newmat.m31 = this->m11 * o.m31 + this->m21 * o.m32 + this->m31 * o.m33 + this->m41 * o.m34;
newmat.m32 = this->m12 * o.m31 + this->m22 * o.m32 + this->m32 * o.m33 + this->m42 * o.m34;
newmat.m33 = this->m13 * o.m31 + this->m23 * o.m32 + this->m33 * o.m33 + this->m43 * o.m34;
newmat.m34 = this->m14 * o.m31 + this->m24 * o.m32 + this->m34 * o.m33 + this->m44 * o.m34;
newmat.m41 = this->m11 * o.m41 + this->m21 * o.m42 + this->m31 * o.m43 + this->m41 * o.m44;
newmat.m42 = this->m12 * o.m41 + this->m22 * o.m42 + this->m32 * o.m43 + this->m42 * o.m44;
newmat.m43 = this->m13 * o.m41 + this->m23 * o.m42 + this->m33 * o.m43 + this->m43 * o.m44;
newmat.m44 = this->m14 * o.m41 + this->m24 * o.m42 + this->m34 * o.m43 + this->m44 * o.m44;
return newmat;
}
bool Inverse(float tolerance = 0.0001f)
{
// Determinants of 2x2 submatrices.
float S0 = m11 * m22 - m12 * m21;
float S1 = m11 * m23 - m13 * m21;
float S2 = m11 * m24 - m14 * m21;
float S3 = m12 * m23 - m13 * m22;
float S4 = m12 * m24 - m14 * m22;
float S5 = m13 * m24 - m14 * m23;
float C5 = m33 * m44 - m34 * m43;
float C4 = m32 * m44 - m34 * m42;
float C3 = m32 * m43 - m33 * m42;
float C2 = m31 * m44 - m34 * m41;
float C1 = m31 * m43 - m33 * m41;
float C0 = m31 * m42 - m32 * m41;
// If determinant equals 0, there is no inverse.
float det = S0 * C5 - S1 * C4 + S2 * C3 + S3 * C2 - S4 * C1 + S5 * C0;
if (fabs(det) <= tolerance)
return false;
// Compute adjugate matrix.
*this = MyMatrix(
m22 * C5 - m23 * C4 + m24 * C3, -m12 * C5 + m13 * C4 - m14 * C3,
m42 * S5 - m43 * S4 + m44 * S3, -m32 * S5 + m33 * S4 - m34 * S3,
-m21 * C5 + m23 * C2 - m24 * C1, m11 * C5 - m13 * C2 + m14 * C1,
-m41 * S5 + m43 * S2 - m44 * S1, m31 * S5 - m33 * S2 + m34 * S1,
m21 * C4 - m22 * C2 + m24 * C0, -m11 * C4 + m12 * C2 - m14 * C0,
m41 * S4 - m42 * S2 + m44 * S0, -m31 * S4 + m32 * S2 - m34 * S0,
-m21 * C3 + m22 * C1 - m23 * C0, m11 * C3 - m12 * C1 + m13 * C0,
-m41 * S3 + m42 * S1 - m43 * S0, m31 * S3 - m32 * S1 + m33 * S0) * (1 / det);
return true;
}
MyMatrix GetInverse(float tolerance = 0.0001f)
{
MyMatrix invmat = *this;
invmat.Inverse(tolerance);
return invmat;
}
};
}
#endif //__MyMatrix_H__
| [
"koca0007@algonquinlive.com"
] | koca0007@algonquinlive.com |
9f932b36b331c317fd179a4ab1009ef225d94015 | b09623cfcc9c98686329cafb22bec499f44b4d76 | /online_clustering/test/sys/main.cpp | 0c33399c85a2e45e5102ebef304f70c802f2667e | [] | no_license | mmmonkeytao/onlineclust | 339ab30b956aa41af31574b7bc2ecf9b3edccfde | 9180587546e83df6a4b2a748afcf318453705698 | refs/heads/master | 2016-09-06T01:21:36.755797 | 2015-01-25T15:25:29 | 2015-01-25T15:25:29 | 24,497,502 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,666 | cpp | #include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/range_image/range_image.h>
#include <Eigen/Dense>
#include <Eigen/Core>
#include <Eigen/Sparse>
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <chrono>
#include "pcloud.h"
#include "hmp.h"
#include "OnlineStarClustering.h"
using namespace std;
using namespace onlineclust;
using namespace std::chrono;
int main(){
HMP hmpObj;
OnlineStarClustering osc(0.5,14000);
MatrixXd x{44,21};
x.setRandom();
uint splevel[2] = {5, 10};
hmpObj.load2Dcts("dic_1st_layer_5x5_depth.dat", "dic_2nd_layer_5x5_depth.dat", "depth");
// MatrixXd feature;
// hmpObj.hmp_core(x,"depth",splevel, feature);
// return 0;
// load data from pcl
// Initialization
const uint nfiles = 10;
//
PCloud Cloud;
Cloud.load_pcloud("../data/", nfiles);
// create viewer
pcl::visualization::PCLVisualizer viewer("KITTI Viewer");
viewer.setBackgroundColor (0, 0, 0);
//
Cloud.initCamParam();
viewer.setCameraParameters(Cloud.getCamera());
viewer.updateCamera();
// start processing points clouds
uint i = 0;
while (!viewer.wasStopped ()){
if( i < nfiles ){
// segmentation
// output clouds
_pclType1::Ptr pcloud ( new _pclType1);
//Cloud.proc_pcloud(pcloud, i);
// seg plane model
Cloud.plane_model_segmentation( Cloud.getCloud(i), pcloud);
// clustering
std::vector<pcl::PointIndices> cluster_indices;
Cloud.euclidean_cluster_extraction(pcloud, cluster_indices);
/**
* convert range image to feature
*/
pcl::RangeImage *range_image;
uint rangeImage_num;
Cloud.getRangeImage(pcloud, cluster_indices, range_image, rangeImage_num);
for(uint j = 0; j < rangeImage_num; ++j){
MatrixXd fea;
uint width = range_image[j].width;
uint height = range_image[j].height;
if(width > 20 && height > 20){
MatrixXf X{height, width};
X = Map<MatrixXf, Unaligned, Stride<1,Dynamic> >(range_image[j].getRangesArray(), height, width, Stride<1,Dynamic>(1,width));
X = X.cwiseMax(MatrixXf::Zero(height,width));
MatrixXd xnew = X.cast<double>();
high_resolution_clock::time_point t1 = high_resolution_clock::now();
hmpObj.hmp_core(xnew,"depth",splevel, fea);
high_resolution_clock::time_point t2 = high_resolution_clock::now();
cout << "Computed cloud: " << i << "\nrange image: " << j << endl
<< "size :" << xnew.rows() << "x" << xnew.cols() << endl
<< "HMP computation time(ms): " << duration_cast<milliseconds>(t2-t1).count() << endl;
cout << "Inserting into clustering:\n";
//SparseVectorXd sparse = fea.sparseView();
VectorXd sparse = fea.col(0);
osc.insert(sparse);
cout << "Clustering insertion completes.\n" << endl;
}
}
// remove all points before adding
pcl::visualization::PointCloudColorHandlerGenericField<pcl::PointXYZI> intensity_distribution(pcloud, "intensity");
viewer.removeAllPointClouds();
//viewer.setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3);
//viewer.addPointCloudNormals<pcl::PointXYZI, pcl::Normal> (ocloud, cloud_normals, 80, 0.5, "normals");
viewer.addPointCloud<pcl::PointXYZI>(pcloud, intensity_distribution, "KITTI Viewer");
viewer.spinOnce();
++i;
delete[] range_image;
} else {
//viewer.spinOnce(100);
break;
}
//boost::this_thread::sleep (boost::posix_time::microseconds (1000000));
}
osc.exportDot("overall.dot", false);
cout << ".dot output completes." << endl;
return 0;
}
| [
"mmmonkeytao@gmail.com"
] | mmmonkeytao@gmail.com |
c939bc5cd356f05e9a890c8ba32f830eba803b42 | cf1911723d07048c4180ace63afbd6ae60727eb0 | /nnnMiniGameLib/miniGameBase.cpp | f13605e13b833ffd4b0818c138700a283f2f5d4b | [] | no_license | tinyan/SystemNNN | 57490606973d95aa1e65d6090957b0e25c5b89f8 | 07e18ded880a0998bf5560c05c112b5520653e19 | refs/heads/master | 2023-05-04T17:30:42.406037 | 2023-04-16T03:38:40 | 2023-04-16T03:38:40 | 7,564,789 | 13 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,594 | cpp |
#include <windows.h>
#include "..\nyanLib\include\commonMacro.h"
#include "..\nnnUtilLib\inputStatus.h"
#include "..\nnnUtilLib\myMouseStatus.h"
#include "..\nnnUtilLib\myKeyStatus.h"
#include "allMiniGame.h"
#include "miniGameBase.h"
CMiniGameBase::CMiniGameBase(CAllMiniGame* lpAllMiniGame,int layoutParamKosuu,int* layoutParam )
{
m_allMiniGame = lpAllMiniGame;
m_layoutParamKosuu = layoutParamKosuu;
m_layoutParam = layoutParam;
m_input = m_allMiniGame->GetInputStatus();
m_mouseStatus = m_input->GetMouseStatus();
m_keyStatus = m_input->GetKeyStatus();
}
CMiniGameBase::~CMiniGameBase()
{
End();
}
void CMiniGameBase::End(void)
{
}
int CMiniGameBase::GeneralInit(void)
{
m_input = m_allMiniGame->GetInputStatus();
m_mouseStatus = m_input->GetMouseStatus();
m_keyStatus = m_input->GetKeyStatus();
m_pic1 = m_allMiniGame->GetPicture(0);
m_pic2 = m_allMiniGame->GetPicture(1);
m_pic3 = m_allMiniGame->GetPicture(2);
m_commonBG = m_allMiniGame->GetCommonBG();
m_commonParts = m_allMiniGame->GetCommonParts();
m_clearFlag = FALSE;
m_gameoverFlag = FALSE;
return Init();
}
int CMiniGameBase::GeneralCalcu(void)
{
return Calcu();
}
int CMiniGameBase::GeneralPrint(void)
{
return Print();
}
int CMiniGameBase::Init(void)
{
return -1;
}
int CMiniGameBase::Calcu(void)
{
return -1;
}
int CMiniGameBase::Print(void)
{
return -1;
}
BOOL CMiniGameBase::GetLayoutData(int* lpData,int layoutType)
{
for (int i=0;i<m_layoutParamKosuu;i++)
{
if (m_layoutParam[i*2] == layoutType)
{
*lpData = m_layoutParam[i*2+1];
return TRUE;
}
}
return FALSE;
}
| [
"tinyan@mri.biglobe.ne.jp"
] | tinyan@mri.biglobe.ne.jp |
0349a804eaa8520f91a0d31fc48d68b48199f861 | 36f8b6dca4f1b51ff0888148116cd37e67fd0820 | /sludge2/src/tests-mpi/test-param.cpp | d6ca395d369a7e0d674420627bd4767030a2f27c | [] | no_license | ybouret/iics | 925faa0a29998e268c828338dcbd59f308f7d57e | e9ccdfc0577d374e1369f8154f8136dc28ff9adc | refs/heads/master | 2021-01-15T15:46:11.393125 | 2016-09-26T11:33:30 | 2016-09-26T11:33:30 | 33,719,729 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 789 | cpp | #include "yocto/utest/run.hpp"
#include "../parameters.hpp"
YOCTO_UNIT_TEST_IMPL(param)
{
const mpi &MPI = mpi::init(&argc,&argv);
const Coord N(10,20);
const Vertex L(2.0,3.0);
Parameters param(N,L,MPI.CommWorldRank,MPI.CommWorldSize);
array_db adb;
Grid grid(param.sim_layout,adb);
param.setup_grid(grid);
SaveGrid(grid, vformat("g%d.%d.dat", MPI.CommWorldSize, MPI.CommWorldRank) );
MPI.WaitFor(MPI.CommWorldRank*0.5);
std::cerr << MPI.CommWorldSize << "." << MPI.CommWorldRank << std::endl;
std::cerr << "full_layout: " << param.full_layout << std::endl;
std::cerr << "sim_layout : " << param.sim_layout << std::endl;
std::cerr.flush();
MPI.Barrier(MPI_COMM_WORLD);
}
YOCTO_UNIT_TEST_DONE()
| [
"yann.bouret@gmail.com@cb0b72a0-0d06-b54d-855f-8f256b0ebc6e"
] | yann.bouret@gmail.com@cb0b72a0-0d06-b54d-855f-8f256b0ebc6e |
8ae90452410a1d9dcbe16ac4ed2095a7a88b86a0 | 8f1a71d039b71a0268e033a72da367c6aa035af1 | /InheritanceProject/InheritanceProject/Angiosperms.cpp | ac7cc9cb9e7ad4ad416f0afdec6bfe5217351e6d | [] | no_license | Zpop22/InheritanceProject | 93c70656fda16a16d1cb94d2dc8525308a07b3c2 | 4a40f923d3d6e1051fcb8d33b39ee1fe0172fe15 | refs/heads/master | 2023-03-02T03:32:32.232728 | 2021-02-08T18:36:22 | 2021-02-08T18:36:22 | 327,699,960 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 25 | cpp | #include "Angiosperms.h"
| [
"74429792+Zpop22@users.noreply.github.com"
] | 74429792+Zpop22@users.noreply.github.com |
ef4a5fe2b50f694c20e2f6fa33b845f0953a41b9 | b8424f2b4a53a3cba0eee3b063f6af32ddbb2702 | /sem2/ga/asg1/graph_c/interfaces/iterator.h | 09bd9601ad0517aa82a033da367e85ef6317bbab | [] | no_license | andreibratu/bachelor | f3e09a7ba75de7fb59fa180277121244b191796e | 735e26d2d9fdb4e04f527ea134efb1f923fe31ad | refs/heads/master | 2023-02-26T00:24:54.858339 | 2021-09-11T11:05:40 | 2021-09-11T11:05:40 | 155,425,216 | 5 | 2 | null | 2023-02-16T04:12:27 | 2018-10-30T17:06:24 | JavaScript | UTF-8 | C++ | false | false | 636 | h | #ifndef ITER_H
#define ITER_H
#include <vector>
class Vertex;
template <class T>
class Iterator {
private:
const std::vector<T>& container;
typename std::vector<T>::const_iterator it;
public:
/**
Iterator constructor.
@param `c` The vector to iterate over.
*/
Iterator(const std::vector<T>& c);
// Return iterator to first element.
void first();
// @return: The iterator did not reach the end of the container
bool valid() const;
// @return: Current iterated element
T getCurrent() const;
// Move iterator
void next();
};
template class Iterator<int>;
template class Iterator<Vertex>;
#endif
| [
"bratu.andrei@outlook.co"
] | bratu.andrei@outlook.co |
d97cb456831b9063f2ff435b3364f864b9511cee | b8499de1a793500b47f36e85828f997e3954e570 | /v2_3/build/Android/Debug/app/src/main/include/Fuse.Animations.RangeAdapter-1.h | 836c79e740d482b5e52f74ce021b7a80aa27baf2 | [] | no_license | shrivaibhav/boysinbits | 37ccb707340a14f31bd57ea92b7b7ddc4859e989 | 04bb707691587b253abaac064317715adb9a9fe5 | refs/heads/master | 2020-03-24T05:22:21.998732 | 2018-07-26T20:06:00 | 2018-07-26T20:06:00 | 142,485,250 | 0 | 0 | null | 2018-07-26T20:03:22 | 2018-07-26T19:30:12 | C++ | UTF-8 | C++ | false | false | 1,720 | h | // This file was generated based on C:/Users/Vaibhav/AppData/Local/Fusetools/Packages/Fuse.Animations/1.9.0/RangeAdapter.uno.
// WARNING: Changes might be lost if you edit this file directly.
#pragma once
#include <Fuse.Behavior.h>
#include <Fuse.Binding.h>
#include <Fuse.INotifyUnrooted.h>
#include <Fuse.IProperties.h>
#include <Fuse.ISourceLocation.h>
#include <Fuse.Scripting.IScriptObject.h>
#include <Uno.Collections.ICollection-1.h>
#include <Uno.Collections.IEnumerable-1.h>
#include <Uno.Collections.IList-1.h>
#include <Uno.UX.IPropertyListener.h>
namespace g{namespace Fuse{namespace Animations{struct RangeAdapter;}}}
namespace g{namespace Uno{namespace UX{struct Property1;}}}
namespace g{namespace Uno{namespace UX{struct PropertyObject;}}}
namespace g{namespace Uno{namespace UX{struct Selector;}}}
namespace g{
namespace Fuse{
namespace Animations{
// public sealed class RangeAdapter<T> :36
// {
struct RangeAdapter_type : ::g::Fuse::Node_type
{
::g::Uno::UX::IPropertyListener interface7;
};
RangeAdapter_type* RangeAdapter_typeof();
void RangeAdapter__OnRooted_fn(RangeAdapter* __this);
void RangeAdapter__OnUnrooted_fn(RangeAdapter* __this);
void RangeAdapter__get_Source_fn(RangeAdapter* __this, ::g::Uno::UX::Property1** __retval);
void RangeAdapter__set_Source_fn(RangeAdapter* __this, ::g::Uno::UX::Property1* value);
void RangeAdapter__UnoUXIPropertyListenerOnPropertyChanged_fn(RangeAdapter* __this, ::g::Uno::UX::PropertyObject* obj, ::g::Uno::UX::Selector* sel);
struct RangeAdapter : ::g::Fuse::Behavior
{
uStrong< ::g::Uno::UX::Property1*> _Source;
::g::Uno::UX::Property1* Source();
void Source(::g::Uno::UX::Property1* value);
};
// }
}}} // ::g::Fuse::Animations
| [
"shubhamanandoist@gmail.com"
] | shubhamanandoist@gmail.com |
7ced91eabad72792349d8154af7f6d5ee1552364 | 49ce7f5cc7dec6cd2a5a9ed86e849be07413ab76 | /kopija/Desktop/obj/sfml2-gorlaligit/src/ball.cpp | dfafe3f6e2dd63d8f08694a721a834bc418c993e | [] | no_license | lgoran/stara2 | 0b2eaf8530ef7cb0946c62a954ba88bf839dd139 | d5d634d1781bffced017e66376623edb5d7a40aa | refs/heads/master | 2023-01-30T00:57:13.886242 | 2020-12-01T22:53:31 | 2020-12-01T22:53:31 | 317,678,216 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 607 | cpp | #include "game.h"
#include <random>
// Ovdje dolazi vaš kod.
static char slovo='A';
Ball::Ball(){
mChar=slovo;
mFont.loadFromFile("Comfortaa-Bold.ttf");
mText.setFont( mFont );
mText.setColor(sf::Color::Green);
mText.setString(mChar);
mText.setCharacterSize( 10 );
mText.setOrigin(rect.getOrigin());
mText.setScale(2,2);
mCircle.setFillColor(sf::Color(0,0,255,128));
++slovo;
}
void Ball::draw(sf::RenderTarget &target, sf::RenderStates states ) const
{
states.transform *= getTransform();
target.draw( mText, states );
target.draw( mCircle, states );
} | [
"gorlali@student.math.hr"
] | gorlali@student.math.hr |
b6321286f7ce95f439f751cae37abf659a5931bb | 76985d62403f5b2326dc5e342689962b0c237233 | /排序题/1002/1002.cpp | 25c8f680b2483acde5d616cb62f25a6137408ca5 | [] | no_license | jpbirdy/poj | a0211dab531e21c916f8ee80c4840c1659abb684 | 26ea74b7d622df8263057306ec5ff95839445733 | refs/heads/master | 2021-03-12T22:55:17.593272 | 2014-07-13T14:35:53 | 2014-07-13T14:35:53 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,071 | cpp | #include <cstdio>
#include <algorithm>
using namespace std;
char s[31];
int num[25] = {2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,0,7,7,8,8,8,9,9,9};
//此处是精髓,每次的电话号码其实是生成了一个7位数字,排序即可。
int Hash()
{
int sum=0;
for(int i=0,k=0;k<7;i++)
{
if(s[i]>='0'&&s[i]<='9')
{
sum*=10;k++;
sum+=(s[i]-'0');
}
else if(s[i]>='A'&&s[i]<'Z')
{
sum*=10;k++;
sum+=num[s[i]-'A'];
}
}
return sum;
}
int main()
{
int n;
int data[100010];
scanf("%d",&n);
getchar();
for(int tmp=0;tmp<n;tmp++)
{
gets(s);
data[tmp]=Hash();
}
sort(data,data+n);
bool p=false;n--;
for(int i=0,num=1;i<n;i+=num=1)
{
while(data[i]==data[i+1])
{
num++;
i++;
}
if(num>1)
{
printf("%03d-%04d %d\n",data[i]/10000,data[i]%10000,num);
p=true;
}
}
if(!p)printf("No duplicates.\n");
return 0;
}
| [
"jiangpeng285@qq.com"
] | jiangpeng285@qq.com |
a117fddb2b04a90a2dd27c89074c746f4ba15d66 | 8a1d71319a42dd1a98ad9627f052f4bc6989ea6f | /std.cpp | dd6816b32ce09ead0e98c267083f266df01fbbe0 | [] | no_license | PavelErsh/C- | 29138c022eb6b5f9110869001b73dcc974d0429e | f6542a79981d2bfcf5fb58214f76903e52f3136c | refs/heads/master | 2020-04-16T20:56:04.083823 | 2019-01-15T19:26:01 | 2019-01-15T19:26:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 285 | cpp | #include <iostream>
int main (void){
using std::cout;
using std::cin;
using std::endl;
double x;
cout << "Enter value: ";
while (!(cin>>x))
{
cout << "Bad input. Place enter a number:";
cin.clear();
while (cin.get() !='\n')
continue;
}
cout << "Vallue =" << x << endl;
return 0;
}
| [
"pavel204812@gmail.com"
] | pavel204812@gmail.com |
a1517d1705ee2eb3c1e95d86777d803a64b29e63 | e4d5b80aadf7dfd8c36a9304b1317dff9e5dfbf0 | /Pilha/Pilha.cpp | 60c0e4f6db68fbe3d958d12bd924d2890d0a4ebe | [] | no_license | DouglasFrana/-C-Programs | 04ba78aa51ff61d85c56dd1ead3cdbc862282e4f | 8510cfc60c536e8fd9488cdd642feece986b6ecc | refs/heads/master | 2020-03-19T11:35:02.214871 | 2018-06-15T02:24:51 | 2018-06-15T02:24:51 | 136,463,348 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 819 | cpp | //Developed by Douglas Frana//
//Videira - SC - Brasil//
//June, 07, 18//
#include <stdio.h>
#include <stdlib.h>
#define MAX 3
int main(){
int i=0;
int desejo;
int pilha[MAX];
int j=0;
for(;;){
printf("Menu: 1=Insert, 2=Remove, 3=Print ");
scanf("%i", &desejo);
if(desejo==1){
if(i==MAX){
printf("Vector full! \n\n");
}else{
printf("Enter the value you want to insert: ");
scanf("%i",&pilha[i]);
pilha[i+1]=0;
i++;
printf("\n");
}
}
if(desejo==2){
if(i==0){
printf("Empty vector! \n");
}else{
pilha[i-1]=0;
i--;
printf("Value removed! \n \n");
}
}
if(desejo==3){
printf("\n");
for(j=0;j<i;j++){
printf("%d ", pilha[j]);
}
printf("\n\n");
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
113b54978273ffb68404c24d35519bb0e6258951 | 5e1f5f2090013041b13d1e280f747aa9f914caa4 | /src/media/playback/mediaplayer/graph/test/fake_service_provider.h | 17da0f43f6cc8335e407c74156f61a2752b2c764 | [
"BSD-2-Clause"
] | permissive | mvanotti/fuchsia-mirror | 477b7d51ae6818e456d5803eea68df35d0d0af88 | 7fb60ae374573299dcb1cc73f950b4f5f981f95c | refs/heads/main | 2022-11-29T08:52:01.817638 | 2021-10-06T05:37:42 | 2021-10-06T05:37:42 | 224,297,435 | 0 | 1 | BSD-2-Clause | 2022-11-21T01:19:37 | 2019-11-26T22:28:11 | C++ | UTF-8 | C++ | false | false | 5,084 | h | // Copyright 2019 The Fuchsia 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 SRC_MEDIA_PLAYBACK_MEDIAPLAYER_GRAPH_TEST_FAKE_SERVICE_PROVIDER_H_
#define SRC_MEDIA_PLAYBACK_MEDIAPLAYER_GRAPH_TEST_FAKE_SERVICE_PROVIDER_H_
#include <fuchsia/sysmem/cpp/fidl_test_base.h>
#include <unordered_map>
#include "lib/fidl/cpp/binding_set.h"
#include "lib/gtest/test_loop_fixture.h"
#include "src/media/playback/mediaplayer/graph/formatting.h"
#include "src/media/playback/mediaplayer/graph/payloads/payload_manager.h"
namespace media_player::test {
class FakeServiceProvider;
class FakeBufferCollection : public fuchsia::sysmem::testing::BufferCollection_TestBase {
public:
explicit FakeBufferCollection(FakeServiceProvider* owner);
~FakeBufferCollection() override;
void Bind(fidl::InterfaceRequest<fuchsia::sysmem::BufferCollection> request);
const std::vector<fuchsia::sysmem::BufferCollectionConstraints>& constraints() const {
return constraints_;
}
void SetBufferCollection(zx_status_t status,
fuchsia::sysmem::BufferCollectionInfo_2 buffer_collection_info);
private:
// fuchsia::sysmem::BufferCollection implementation.
void Sync(SyncCallback callback) override;
void SetConstraints(bool has_constraints,
fuchsia::sysmem::BufferCollectionConstraints constraints) override;
void WaitForBuffersAllocated(WaitForBuffersAllocatedCallback callback) override;
void CheckBuffersAllocated(CheckBuffersAllocatedCallback callback) override;
void SetName(uint32_t priority, std::string name) override {}
void SetDebugClientInfo(std::string name, uint64_t id) override {}
void NotImplemented_(const std::string& name) override;
FakeServiceProvider* owner_;
fidl::BindingSet<fuchsia::sysmem::BufferCollection> bindings_;
std::vector<fuchsia::sysmem::BufferCollectionConstraints> constraints_;
zx_status_t buffer_allocation_status_ = ZX_ERR_UNAVAILABLE;
std::vector<WaitForBuffersAllocatedCallback> wait_callbacks_;
fuchsia::sysmem::BufferCollectionInfo_2 buffer_collection_info_;
};
class FakeBufferCollectionToken : public fuchsia::sysmem::testing::BufferCollectionToken_TestBase {
public:
explicit FakeBufferCollectionToken(FakeServiceProvider* owner);
~FakeBufferCollectionToken() override;
void Bind(fidl::InterfaceRequest<fuchsia::sysmem::BufferCollectionToken> request);
private:
// fuchsia::sysmem::BufferCollectionToken implementation.
void Duplicate(uint32_t rights_attenuation_mask,
fidl::InterfaceRequest<fuchsia::sysmem::BufferCollectionToken> request) override;
void Sync(SyncCallback callback) override;
void SetDebugClientInfo(std::string name, uint64_t id) override {}
void SetDebugTimeoutLogDeadline(int64_t deadline) override {}
void SetDispensable() override {}
void NotImplemented_(const std::string& name) override;
FakeServiceProvider* owner_;
fidl::BindingSet<fuchsia::sysmem::BufferCollectionToken> bindings_;
};
class FakeServiceProvider : public ServiceProvider,
public fuchsia::sysmem::testing::Allocator_TestBase {
public:
FakeBufferCollection* GetCollectionFromToken(fuchsia::sysmem::BufferCollectionTokenPtr token);
~FakeServiceProvider() override;
// Methods called by FakeBufferCollection and FakeBufferCollectionToken.
void AddTokenBinding(FakeBufferCollectionToken* token, const zx::channel& channel);
void RemoveToken(FakeBufferCollectionToken* token);
void RemoveCollection(FakeBufferCollection* collection);
// ServiceProvider implementation.
void ConnectToService(std::string service_path, zx::channel channel) override;
private:
// fuchsia::sysmem::Allocator implementation.
void AllocateSharedCollection(
fidl::InterfaceRequest<fuchsia::sysmem::BufferCollectionToken> token_request) override;
void BindSharedCollection(
fidl::InterfaceHandle<class fuchsia::sysmem::BufferCollectionToken> token,
fidl::InterfaceRequest<fuchsia::sysmem::BufferCollection> buffer_collection_request) override;
void ValidateBufferCollectionToken(
uint64_t token_server_koid,
fuchsia::sysmem::Allocator::ValidateBufferCollectionTokenCallback callback) override;
void SetDebugClientInfo(std::string name, uint64_t id) override {}
void NotImplemented_(const std::string& name) override;
FakeBufferCollection* FindOrCreateCollectionForToken(zx::channel client_channel);
fidl::BindingSet<fuchsia::sysmem::Allocator> bindings_;
std::unordered_map<FakeBufferCollectionToken*, std::unique_ptr<FakeBufferCollectionToken>>
tokens_;
std::unordered_map<zx_koid_t, FakeBufferCollectionToken*> tokens_by_server_koid_;
std::unordered_map<FakeBufferCollection*, std::unique_ptr<FakeBufferCollection>> collections_;
std::unordered_map<FakeBufferCollectionToken*, FakeBufferCollection*> collections_by_token_;
};
} // namespace media_player::test
#endif // SRC_MEDIA_PLAYBACK_MEDIAPLAYER_GRAPH_TEST_FAKE_SERVICE_PROVIDER_H_
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
cdd7a62a35a93905466d40b6762cadeb0a2b92f6 | 27bb5ed9eb1011c581cdb76d96979a7a9acd63ba | /aws-cpp-sdk-iam/source/model/GetCredentialReportRequest.cpp | 1cb74293141b1c3b64a73cdd20ab8948ba3d6fea | [
"Apache-2.0",
"JSON",
"MIT"
] | permissive | exoscale/aws-sdk-cpp | 5394055f0876a0dafe3c49bf8e804d3ddf3ccc54 | 0876431920136cf638e1748d504d604c909bb596 | refs/heads/master | 2023-08-25T11:55:20.271984 | 2017-05-05T17:32:25 | 2017-05-05T17:32:25 | 90,744,509 | 0 | 0 | null | 2017-05-09T12:43:30 | 2017-05-09T12:43:30 | null | UTF-8 | C++ | false | false | 1,154 | cpp | /*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#include <aws/iam/model/GetCredentialReportRequest.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
using namespace Aws::IAM::Model;
using namespace Aws::Utils;
GetCredentialReportRequest::GetCredentialReportRequest()
{
}
Aws::String GetCredentialReportRequest::SerializePayload() const
{
Aws::StringStream ss;
ss << "Action=GetCredentialReport&";
ss << "Version=2010-05-08";
return ss.str();
}
void GetCredentialReportRequest::DumpBodyToUrl(Aws::Http::URI& uri ) const
{
uri.SetQueryString(SerializePayload());
}
| [
"henso@amazon.com"
] | henso@amazon.com |
9a3072d68ada951686fbf6c0b1a0a206e7dfd752 | 6e122a1e9eaff776d6b8d40b1e3da01758a61d1a | /28 实现strStr()/28 实现strStr().cpp | 83dd9f0549281cc06c9ae07c533b3d2b7bc9ec7e | [] | no_license | caoyongrui/leetcode- | 276acfcbd2ebf115f034871766956f034a87aceb | f245892c8ab43921d9835f83e66716957ef7c819 | refs/heads/master | 2020-06-03T23:27:31.087520 | 2019-07-15T08:17:39 | 2019-07-15T08:17:39 | 191,775,409 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,608 | cpp | /*
实现 strStr() 函数。
给定一个 haystack 字符串和一个 needle 字符串,在 haystack 字符串中找出 needle 字符串出现的第一个位置 (从0开始)。如果不存在,则返回 -1。
示例 1:
输入: haystack = "hello", needle = "ll"
输出: 2
示例 2:
输入: haystack = "aaaaa", needle = "bba"
输出: -1
说明:
当 needle 是空字符串时,我们应当返回什么值呢?这是一个在面试中很好的问题。
对于本题而言,当 needle 是空字符串时我们应当返回 0 。这与C语言的 strstr() 以及 Java的 indexOf() 定义相符。
*/
#include <iostream>
#include <string>
using namespace std;
int strStr(string haystack, string needle)
{
if (needle.length() == 0)
{
return 0;
}
int res = -1;
bool state = false;
for (int i = 0; i < haystack.length(); i++)
{
if (haystack[i] == needle[0])
{
int j;
for (j = 1; j < needle.length(); j++)
{
if (i + j >= haystack.length() || haystack[i + j] != needle[j])
{
break;
}
}
if (j == needle.length())
{
state = true;
}
}
if (state == true)
{
res = i;
break;
}
}
return res;
}
int strStr1(string haystack, string needle)
{
if (needle.length() == 0)
return 0;
if (haystack.length() < needle.length())
return -1;
for (int i = 0; i < haystack.length() - needle.length() + 1; i++)
{
if (haystack.substr(i, needle.length()) == needle)
return i;
}
return -1;
}
int main()
{
string haystack = "hello";
string needle = "ll";
int res = strStr1(haystack, needle);
cout << res << endl;
system("pause");
return 0;
} | [
"1445118489@qq.com"
] | 1445118489@qq.com |
fd59aa065d36eb9c9a8e10844fe23761b3ea905f | 6cf3c0ba1a5e5490a0964b4bafea894ca3873c2f | /Include/libc++/ext/stl_hash_fun.h | 5e38200478e3b7d9f31f45df38b94af41515aa15 | [] | no_license | DanielGit/Intrisit201202 | ebad43204846faa85aa746ea0ec208063b9902f1 | bae91fd9d11b6d5243f774bdf9bfa83c8904ca26 | refs/heads/master | 2021-01-10T20:33:21.473293 | 2012-05-29T12:21:09 | 2012-05-29T12:21:09 | 3,446,525 | 3 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 4,413 | h | // 'struct hash' from SGI -*- C++ -*-
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
/*
* Copyright (c) 1996-1998
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*/
/** @file ext/stl_hash_fun.h
* This file is a GNU extension to the Standard C++ Library (possibly
* containing extensions from the HP/SGI STL subset). You should only
* include this header if you are using GCC 3 or later.
*/
#ifndef _CPP_BITS_STL_HASH_FUN_H
#define _CPP_BITS_STL_HASH_FUN_H 1
#include <cstddef>
namespace __gnu_cxx
{
using std::size_t;
template <class _Key> struct hash { };
inline size_t __stl_hash_string(const char* __s)
{
unsigned long __h = 0;
for ( ; *__s; ++__s)
__h = 5*__h + *__s;
return size_t(__h);
}
template<> struct hash<char*>
{
size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
};
template<> struct hash<const char*>
{
size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
};
template<> struct hash<char> {
size_t operator()(char __x) const { return __x; }
};
template<> struct hash<unsigned char> {
size_t operator()(unsigned char __x) const { return __x; }
};
template<> struct hash<signed char> {
size_t operator()(unsigned char __x) const { return __x; }
};
template<> struct hash<short> {
size_t operator()(short __x) const { return __x; }
};
template<> struct hash<unsigned short> {
size_t operator()(unsigned short __x) const { return __x; }
};
template<> struct hash<int> {
size_t operator()(int __x) const { return __x; }
};
template<> struct hash<unsigned int> {
size_t operator()(unsigned int __x) const { return __x; }
};
template<> struct hash<long> {
size_t operator()(long __x) const { return __x; }
};
template<> struct hash<unsigned long> {
size_t operator()(unsigned long __x) const { return __x; }
};
} // namespace __gnu_cxx
#endif /* _CPP_BITS_STL_HASH_FUN_H */
// Local Variables:
// mode:C++
// End:
| [
"pikgen@sina.com.cn"
] | pikgen@sina.com.cn |
c55740594a39e7bfacc8d29508ab5682ac8a1d2d | a0f09b2257257923ad5345ca17c857c06fecaee7 | /hacker_earth_Andrew_and_Wengaluru_City.cpp | dc1ed23983769809c45e00574bfe84b3300e5a1b | [] | no_license | poojan124/Trunk-of-Codes | 078ac144c66c085de7fe17e23a7f3e92e5e40190 | d7325de4548fb2249a6378b1f490f838f9d366b4 | refs/heads/master | 2021-07-20T20:56:31.781406 | 2017-10-28T05:07:33 | 2017-10-28T05:07:33 | 108,621,213 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,806 | cpp | #include<bits/stdc++.h>
#define pi 3.14159265358979323846264
#define all(c) c.begin(),c.end()
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element) (find(all(container),element) != container.end())
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
int main()
{
int t;
scanf("%d",&t);
while(t--){
long long n,ans=0;
scanf("%lld",&n);
long long int arr[n];
for(int i=0;i<n;i++)
scanf("%lld",&arr[i]);
vector<long long > st;
st.push_back(arr[0]);
long long int idx=0,cmp=arr[0],ele;
for(int i=1;i<n;i++){
ans=ans%1000000007;
if(arr[i]<=st.back()){
st.push_back(arr[i]);
}
else if(arr[i]>st.back()){
if(st.back()==cmp){
cmp=arr[i];
idx=i;
st.push_back(arr[i]);
}
else if(arr[i]>cmp||arr[i]==cmp){
for(int j=idx+1;j<i;j++){
ans+=cmp-st[j];
st[j]=cmp;
}
cmp=arr[i];
idx=i;
st.push_back(arr[i]);
}
else if(arr[i]<cmp){
int ti=i-1;
while(st[ti]<arr[i]){
ans+=arr[i]-st[ti];
st[ti]=arr[i];
ti--;
}
st.push_back(arr[i]);
}
}
}
cout<<ans%1000000007<<endl;
}
}
| [
"poojan124@hotmail.com"
] | poojan124@hotmail.com |
a8e03a6d1a93eb6710de83fa266e02a0ad477453 | 9a1b942f48265a21e5366e89c680164b9ab65c69 | /Sgu/196.cpp | f9727f4c4ff0b441a1f731c4ea2852325c896ef3 | [] | 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 | 460 | cpp | #include <cstdio>
#include <cstring>
const int maxn = 10005;
int n, m;
int a[maxn];
int main() {
// freopen("in", "r", stdin);
scanf("%d%d", &n, &m);
memset(a, 0, sizeof(a));
while (m--) {
int x, y;
scanf("%d%d", &x, &y);
a[x]++;
a[y]++;
}
int ret = 0;
for (int i = 1; i <= n; i++)
ret += a[i] * a[i];
printf("%d\n", ret);
return 0;
}
| [
"zjsxzy@gmail.com"
] | zjsxzy@gmail.com |
68a4eb626ae2084ef77932e2e9fabc73e32a3377 | 9e386ab39910f5d8582218d097259f5e7609c0bf | /codeforces/A_Nastia_and_nearly_Good_Numbers.cpp | 90db1ab143d9513af725f22d7abc490bd1af4512 | [] | no_license | amansaxena1/Coding | 19770afda150731f97c1d3c39a971c2d4f3719c6 | 606e5299b052d2ef17fa07d6605afa491ad94df6 | refs/heads/master | 2023-05-02T02:32:55.048213 | 2021-05-19T05:53:20 | 2021-05-19T05:53:20 | 302,906,731 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 465 | cpp | #include <bits/stdc++.h>
#define llint long long int
using namespace std;
int main()
{
llint t;
cin >> t;
while (t--)
{
llint x, y;
cin >> x >> y;
if (x % y == 0 || y % x == 0)
{
cout << "NO"
<< "\n";
}
else
{
cout << "YES"
<< "\n";
cout << x << " " << x * y << " " << ((x * y) + x) << "\n";
}
}
return 0;
} | [
"65945317+amansaxena1@users.noreply.github.com"
] | 65945317+amansaxena1@users.noreply.github.com |
a43e856576217a88974b2bc2f606db0ef9d723ae | ae3e09f8aa3c54a91d29833bed26de032ee1f0d6 | /Square Formation.cpp | 3cc5602fd7a7360470bc80e5f543cae2e9b58f4d | [] | no_license | thecodearrow/100-Days-Of-Code | c0604c8922cb4b9c9655bcf7db8fba6fa0a629d2 | 790ef030375340bf7824380775ee239557034836 | refs/heads/master | 2021-11-24T18:56:45.611895 | 2021-10-29T00:03:38 | 2021-10-29T00:03:38 | 118,704,025 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 913 | cpp | /*
To check if given points are vertices of a square
*/
#include<bits/stdc++.h>
using namespace std;
float dist(pair<int,int> &p1,pair<int,int> &p2){
return sqrt((pow(p1.first-p2.first,2)+pow(p1.second-p2.second,2)));
}
int main(){
array<pair<int,int>,4> c;
float d[4];
for(int i=0;i<4;i++){
cin>>c[i].first>>c[i].second;
}
for(int i=1;i<4;i++){
d[i-1]=dist(c[0],c[i]);
}
float l;
//find l
if(d[0]==d[1]){
l=d[0];
}
else{
l=d[2];
}
int lcount=0,root2lcount=0;
for(int i=0;i<3;i++){
if(l==d[i]){
lcount++;
}
else if ((int)(sqrt(2)*l)==(int)d[i]){
root2lcount++;
}
}
if(lcount==2 && root2lcount==1){
cout<<"square";
}
else{
cout<<"not square";
}
return 0;
}
| [
"you@example.com"
] | you@example.com |
8ec34b618427501efb429b5a79feb8f15a3da04f | 50a8a3fe0fdffb4141b12b0ee73363f218efc222 | /src/sbi/amf_server/model/NssaiMapping.h | 0b819fff175b62bb4d09c1da930117f74aae812e | [] | no_license | dukl/fake_gnb | f89972ad50c6a50e620fe8590cece7200d2560da | b6f772e8fb82c61a9949a4f4c317637d97c36fb6 | refs/heads/master | 2022-12-07T21:55:26.285263 | 2020-08-27T07:11:37 | 2020-08-27T07:11:37 | 290,703,480 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,273 | h | /**
* Namf_Communication
* AMF Communication Service © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* NssaiMapping.h
*
*
*/
#ifndef NssaiMapping_H_
#define NssaiMapping_H_
#include "Snssai.h"
#include <nlohmann/json.hpp>
namespace oai {
namespace amf {
namespace model {
/// <summary>
///
/// </summary>
class NssaiMapping
{
public:
NssaiMapping();
virtual ~NssaiMapping();
void validate();
/////////////////////////////////////////////
/// NssaiMapping members
/// <summary>
///
/// </summary>
Snssai getMappedSnssai() const;
void setMappedSnssai(Snssai const& value);
/// <summary>
///
/// </summary>
Snssai getHSnssai() const;
void setHSnssai(Snssai const& value);
friend void to_json(nlohmann::json& j, const NssaiMapping& o);
friend void from_json(const nlohmann::json& j, NssaiMapping& o);
protected:
Snssai m_MappedSnssai;
Snssai m_HSnssai;
};
}
}
}
#endif /* NssaiMapping_H_ */
| [
"du_keliang@163.com"
] | du_keliang@163.com |
2e1cf0b33f310703a6548050bfafc5faf83c2cc9 | daf0bb565d0a253d07163ca32491169dad17cbb1 | /btree/alt_levelOrder.cpp | 416b81b415c3fa6e6dd8ca8c7ad868173a98dcf2 | [] | no_license | Rishija/practice | 461bd696eaa6f6281db387cec1c777f6f5d2314a | 784fc58e7a95ec7a7a81136bb96e846e3a88b870 | refs/heads/master | 2021-03-31T00:22:25.032290 | 2019-08-04T10:20:54 | 2019-08-04T10:20:54 | 124,773,701 | 0 | 0 | null | 2018-03-25T15:55:47 | 2018-03-11T16:02:54 | C++ | UTF-8 | C++ | false | false | 2,953 | cpp | // Print level wise but every level reverse the order.. left to right, then next level right to left. and so on
#include "btree.h"
template<class T>
void Btree<T>::alt_level_order() {
if(root == nullptr)
return;
deque<Node*>myQueue;
myQueue.push_back(root);
alt_level_order(myQueue, 1);
}
/**
* Time complexity : O(n)
* Space complexity : O(n) ( O(n) auxilliary space + O(height) in stack area )
*/
template<class T>
void Btree<T>::alt_level_order(deque<Node*> inQueue, bool level){
if(!inQueue.size()) return;
deque<Node*> outQueue, dupQueue(inQueue);
while(inQueue.size() > 0){
Node *printNode, *thisNode = inQueue.front();
if(!level) {
printNode = dupQueue.back();
dupQueue.pop_back();
}
else {
printNode = dupQueue.front();
dupQueue.pop_front();
}
cout << printNode -> val << " ";
if(thisNode -> left != nullptr)
outQueue.push_back(thisNode -> left);
if(thisNode -> right != nullptr)
outQueue.push_back(thisNode -> right);
inQueue.pop_front();
}
cout << endl;
alt_level_order(outQueue, !level);
}
/**
* Time complexity : O(n)
* Space complexity : O(n)
*/
template<class T>
void Btree<T>::alt_level_order_stack() {
stack<Node*>stack1, stack2;
if(root != nullptr)
stack1.push(root);
bool flag = true;
while(!stack1.empty()) {
while (!stack1.empty()) {
Node* thisNode = stack1.top();
stack1.pop();
cout << thisNode -> val << " ";
if(flag) {
if(thisNode -> left != nullptr)
stack2.push(thisNode -> left);
if(thisNode -> right != nullptr)
stack2.push(thisNode -> right);
}
else {
if(thisNode -> right != nullptr)
stack2.push(thisNode -> right);
if(thisNode -> left != nullptr)
stack2.push(thisNode -> left);
}
}
cout << endl;
stack1 = stack2;
while(!stack2.empty())
stack2.pop();
flag = !flag;
}
}
int main() {
Btree<int>tree;
tree.insert(87);
tree.insert(34);
tree.insert(64);
tree.insert(12);
tree.insert(673);
tree.insert(98);
tree.insert(33);
tree.insert(1);
tree.insert(39);
tree.insert(90);
tree.insert(101);
tree.insert(147);
tree.insert(13);
tree.insert(48);
tree.insert(61);
tree.insert(82);
tree.insert(17);
tree.insert(537);
tree.insert(1006);
tree.insert(289);
tree.insert(27);
tree.print_levelOrder();
cout<<endl;
tree.alt_level_order();
cout << endl;
tree.alt_level_order_stack();
return 0;
}
| [
"rishijamangla@gmail.com"
] | rishijamangla@gmail.com |
499086f7a2463549a723fb95729d7c9962bc7da8 | 0da89bb043ebb15f4da644d14812b858042b431c | /branches/Net7_TD/Net7/XmlParser.cpp | c4c09612e965b0544bd6bfe7cd1afa5bfe71d858 | [] | no_license | CyberSys/Earth-and-Beyond-server | 1c66c474aafb89efaac2a010de53da1a2a0ab7e2 | 3b46ad7c8baecca61adf8a0bedd2b23cb1936b9d | refs/heads/master | 2021-08-27T15:16:37.988861 | 2014-05-11T21:03:53 | 2014-05-11T21:03:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,294 | cpp | // XmlParser.cpp
//
// This class implements pretty simplistic XML parser routines.
//
#include "Net7.h"
#include "XmlParser.h"
#include "XmlTags.h"
XmlParser::XmlParser()
{
m_Success = true;
}
XmlParser::~XmlParser()
{
}
bool XmlParser::ParseXmlTag(char **buffer)
{
char *tag = m_Tag;
char *attributes = m_Attributes;
//bool success = false;
char *p = *buffer;
*tag = '\0';
*attributes = '\0';
m_XmlTagID = XML_TAG_ID_INVALID;
// Skip data until we reach the beginning of the tag or the end of the string
bool done = false;
while (!done)
{
// Skip forward until we find the '<' or reach the end of the buffer
while ((*p != '\0') && (*p != '<'))
{
p++;
}
// Bail out if we have reached the end of the buffer
if (*p == '\0')
{
return (false);
}
// Skip the '<'
p++;
// If this is a valid tag, stop the search
// This procedure ignores closing tags
// (i.e. "</Mission>") and comments (i.e. "<!--")
if (isalpha(*p))
{
// If the first character is alpha, this is a valid tag
done = true;
}
}
// Copy data until we reach the end
while (isalnum(*p))
{
// Warning: Nothing is done to prevent buffer overflow
*tag++ = *p++;
}
*tag = '\0';
if (*p == '\0')
{
return (false);
}
if (*p == ' ')
{
p++;
while ((*p != '\0') && (*p != '>') && (*p != '/'))
{
if (isprint(*p))
{
// Warning: Nothing is done to prevent buffer overflow
*attributes++ = *p++;
}
}
}
// skip the trailing slash
if (*p == '/')
{
p++;
}
// skip the trailing '>' marking the end of the tag
if (*p == '>')
{
p++;
}
*attributes = '\0';
*buffer = p;
// Search through the list to get the Tag ID
m_XmlTagID = XML_TAG_ID_INVALID;
XmlTagLookupTable *table = m_XmlTagLookupTable;
while (table->tag_id != XML_TAG_ID_INVALID)
{
if (strcmp(table->tag, m_Tag) == 0)
{
// The tag matched an entry in the table
m_XmlTagID = (eTagId) table->tag_id;
break;
}
table++;
}
if (m_XmlTagID == XML_TAG_ID_INVALID)
{
printf("Invalid XML tag: %s\n", m_Tag);
}
return (m_XmlTagID != XML_TAG_ID_INVALID);
}
bool XmlParser::GetXmlAttribute(char *attrib, char *value, unsigned int length, bool required)
{
bool success = false;
char *buffer = m_Attributes;
*value = '\0';
char *p = strstr(buffer, attrib);
if (p)
{
p += strlen(attrib);
if (*p == '=')
{
p++;
if (*p == '"')
{
p++;
char temp[512];
strncpy(temp, p, sizeof(temp));
temp[511] = 0;
if (strtok(temp, "\""))
{
if (strlen(temp) < length)
{
strcpy(value, temp);
success = true;
}
}
}
}
}
if (required && !success)
{
printf("Error parsing %s %s attribute\n", m_Tag, attrib);
m_Success = false;
}
return (m_Success);
}
bool XmlParser::GetXmlData(char **buffer, char *data, long length)
{
bool success = false;
char *src = *buffer;
char *workbuffer = new char[length * 6];
char *dest = workbuffer;
long remaining = length;
if (dest)
{
*dest = '\0';
while ((*src != '<') && (*src != '\0'))
{
*dest++ = *src++;
// Check length to prevent buffer overflow
if (--remaining <= 1)
{
delete [] workbuffer;
return(false);
}
}
// Add null terminator
*dest = '\0';
if ((src[0] == '<') && (src[1] == '/'))
{
*buffer = src;
success = true;
// Return the decoded string to the caller
char *temp = DecodeXmlString(workbuffer);
strncpy(data, temp, length);
data[length-1] = 0;
delete [] temp;
}
delete [] workbuffer;
}
return (success);
}
int XmlParser::ParseInt(char **buffer, int id, int min, int max)
{
int value = 0;
char data[512];
CheckID(id);
if (m_Success)
{
if (GetXmlData(buffer, data, sizeof(data)))
{
value = atoi(data);
if ((value < min) || (value > max))
{
printf("Invalid XML value \"%s\" = %s (min=%d max=%d)\n", m_Tag, data, min, max);
m_Success = false;
}
}
else
{
printf("Error parsing XML data: \"%s\"\n", m_Tag);
m_Success = false;
}
}
return (value);
}
double XmlParser::ParseDouble(char **buffer, int id, double min, double max, bool allow_minus_one)
{
double value = 0.0;
char data[512];
CheckID(id);
if (m_Success)
{
if (GetXmlData(buffer, data, sizeof(data)))
{
value = atof(data);
if (allow_minus_one && (value == -1))
{
// negative one is a legal value
}
else if ((value < min) || (value > max))
{
printf("Invalid XML value \"%s\" = %s (min=%g max=%g)\n", m_Tag, data, min, max);
m_Success = false;
}
}
else
{
printf("Error parsing XML data: \"%s\"\n", m_Tag);
m_Success = false;
}
}
return (value);
}
u32_t XmlParser::ParseColor(char **buffer, int id)
{
u32_t color = 0;
char data[512];
CheckID(id);
if (m_Success)
{
if (GetXmlData(buffer, data, sizeof(data)))
{
if (strlen(data) == 6)
{
// Convert hex to decimal
char *endptr;
color = strtoul(data, &endptr, 16);
}
else
{
printf("Invalid XML color value \"%s\" = %s\n", m_Tag, data);
m_Success = false;
}
}
else
{
printf("Error parsing XML data: \"%s\"\n", m_Tag);
m_Success = false;
}
}
return (color);
}
char * XmlParser::ParseString(char **buffer, int id)
{
char data[512];
CheckID(id);
if (m_Success)
{
if (!GetXmlData(buffer, data, sizeof(data)))
{
printf("Error parsing XML data: \"%s\"\n", m_Tag);
m_Success = false;
}
}
return (DecodeXmlString(data));
}
bool XmlParser::CheckID(int id)
{
if (m_CurrentID != id)
{
printf("Unexpected XML tag: %s\n", m_Tag);
m_Success = false;
}
return (m_Success);
}
// This is a static member function so that it can be called without
// instantiating an XmlFile object.
// NOTE: The caller must delete the returned string!!
char *XmlParser::EncodeXmlString(char * str)
{
// Replaces ampersand, less than, and greater than symbols in a string
char *result = NULL;
int length = strlen(str) * 5 + 1; // make sure we have enough room to avoid buffer overflow
char *temp_string = new char[length];
if (temp_string)
{
temp_string[0] = 0;
char *p = str;
while (*p)
{
char c = *p;
if (c == '&')
{
strcat(temp_string, "&");
}
else if (c == '<')
{
strcat(temp_string, "<");
}
else if (c == '>')
{
strcat(temp_string, ">");
}
else
{
int index = strlen(temp_string);
temp_string[index++] = c;
temp_string[index] = 0;
}
p++;
}
result = new char[strlen(temp_string) + 1];
if (result)
{
strcpy(result, temp_string);
}
delete [] temp_string;
}
return (result);
}
// This is a static member function so that it can be called without
// instantiating an XmlFile object.
char *XmlParser::DecodeXmlString(char * str)
{
// Restores ampersand, less than, and greater than symbols in a string
char *result = NULL;
int length = strlen(str) * 5 + 1; // make sure we have enough room to avoid buffer overflow
char *temp_string = new char[length];
if (temp_string)
{
temp_string[0] = 0;
char *p = str;
while (*p)
{
if (strncmp(p, "&", 5) == 0)
{
strcat(temp_string, "&");
p += 5;
}
if (strncmp(p, "'", 6) == 0)
{
strcat(temp_string, "'");
p += 6;
}
else if (strncmp(p, "<", 4) == 0)
{
strcat(temp_string, "<");
p += 4;
}
else if (strncmp(p, ">", 4) == 0)
{
strcat(temp_string, ">");
p += 4;
}
else
{
int index = strlen(temp_string);
temp_string[index++] = *p;
temp_string[index] = 0;
p++;
}
}
result = new char[strlen(temp_string) + 1];
if (result)
{
strcpy(result, temp_string);
}
delete [] temp_string;
}
return (result);
}
bool XmlParser::ParseFloatArray(char *attrib_values, int count, float *array)
{
bool success = true; // assume we will succeed
char *p = strtok(attrib_values, ",");
for (int i = 0; i < count; i++)
{
if (!p)
{
// abort if we can't find a comma
success = false;
break;
}
array[i] = (float) atof(p);
p = strtok(NULL, ",");
}
return (success);
}
| [
"kyp@mailinator.com"
] | kyp@mailinator.com |
156e199215b8bac2f54ba3958d8404003e64e4e7 | 2d55772318e41fa471afedb4ba581da6f6ff3f87 | /API/WindowApiLib/src/Manager/Timer/Timer.h | 789e3df9e393a3f6b85b6e403c38882946fa08e4 | [] | no_license | zxwnstn/Kyungil | f5fef7ca2b1a789066d09743d2fa099463d2da16 | 27a5461efa423f411ae6264a1f84d07485541795 | refs/heads/master | 2020-12-01T23:56:10.284017 | 2020-02-03T10:52:54 | 2020-02-03T10:52:54 | 230,819,511 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 341 | h | #pragma once
#include "WindowApiLib/myWinApi.h"
class Timer
{
LARGE_INTEGER m_tSecond;
LARGE_INTEGER m_tTime;
float m_fDeltaTime;
float m_fFPS;
float m_fFPSTime;
int m_iFrameMax;
int m_iFrame;
public:
bool init();
void update();
float GetDeltaTime() const;
float GetFPS() const;
private:
DECLARE_SINGLE(Timer)
};
| [
"zxwnstn@naver.com"
] | zxwnstn@naver.com |
817418d857ebec9d6b61940191f2c4b9d1517f05 | 0209385b97dece016e4bc4df07b94ae23ae284e8 | /src/test.cpp | e8e76d5547bce458b0512694bef2addf3d211a7a | [] | no_license | andycate/acvalve | bb17d2907e0585fa8f00d6ed4edf930a3def8665 | c835535a74fdcee6b1bd07e22ef5c0ce72c2b004 | refs/heads/main | 2023-03-03T03:53:09.436088 | 2021-02-13T22:11:51 | 2021-02-13T22:11:51 | 336,736,808 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,439 | cpp | #include <Arduino.h>
#define STEP_PIN 25
#define DIR_PIN 24
#define RST_PIN 32
#define MIN_DELAY 75 // imperical data
#define RAMP_RATE 1000 // imperical
#define START_RATE 300
float pos;
float sp;
float freq;
float max_freq;
int step;
uint32_t last_time;
uint32_t last_c;
uint32_t de;
uint8_t state;
uint32_t d;
uint32_t steps;
uint32_t get_delay(uint32_t end) {
if(steps < RAMP_RATE - START_RATE) {
return (uint32_t) (MIN_DELAY * RAMP_RATE / (float) (steps + START_RATE));
} else if(steps > end - RAMP_RATE + START_RATE) {
return (uint32_t) (MIN_DELAY * RAMP_RATE / (float) (end - steps + START_RATE));
}
return MIN_DELAY;
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(STEP_PIN, OUTPUT);
pinMode(DIR_PIN, OUTPUT);
pinMode(RST_PIN, OUTPUT);
pos = 0.0;
sp = 10000.0;
max_freq = 15000.0;
freq = 100.0;
step = 1;
last_time = micros();
last_c = micros();
state = 0;
d = 50;
de = 5000;
steps = 0;
digitalWriteFast(RST_PIN, LOW);
digitalWriteFast(DIR_PIN, HIGH);
// analogWriteFrequency(STEP_PIN, freq);
// analogWrite(STEP_PIN, 127); // half duty cycle by default
// digitalWriteFast(STEP_PIN, HIGH);
pinMode(38, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWriteFast(RST_PIN, HIGH);
digitalWriteFast(DIR_PIN, LOW);
// if(Serial.available()) {
// float new_freq = Serial.readStringUntil('\n').toFloat();
// analogWriteFrequency(STEP_PIN, new_freq);
// }
// uint32_t curr_time = micros();
// if(curr_time - last_time > d) {
// state = state ? 0 : 1;
// digitalWriteFast(STEP_PIN, state);
// last_time = curr_time;
// }
// if(curr_time - last_c > de * (1000/d)) {
// if(d < 20) step = 1;
// if(d > 1000) step = -1;
// d += step;
// last_c = curr_time;
// }
// uint32_t curr_time = micros();
// pos += (float) (curr_time - last_time) * freq / 1000000.0;
// last_time = curr_time;
// freq = (sp - pos) * 1.2;
// analogWriteFrequency(STEP_PIN, min(abs(freq), max_freq));
// Serial.println(pos);
if(steps < (uint32_t) ((90.0 * 200.0 / 360.0) * 16.0 * 5.18)) {
digitalWriteFast(STEP_PIN, HIGH);
delayNanoseconds(1000);
digitalWriteFast(STEP_PIN, LOW);
delayMicroseconds(get_delay((uint32_t) ((90.0 * 200.0 / 360.0) * 16.0 * 5.18)));
steps++;
}
// Serial.println(analogRead(38) * 3.3 / 1024.0);
}
| [
"and164v@gmail.com"
] | and164v@gmail.com |
4f298234d092189fef22df44a89f089a994a7585 | 0a98538eace76af7e24ca5a60c2bfe18efe0a9c8 | /CDDS/CDDS_BinaryTree/BinaryTree.h | c7d189fe3ecdea24f840feb0250ec1c1632545b3 | [] | no_license | StaleC00kie/CDDS | ab3fd6c010db0eac54e368059337d9a00efdd517 | 7b8a44722f2906d89cae45cb0c222818b208e25a | refs/heads/main | 2023-06-12T09:06:47.107015 | 2021-07-11T23:33:44 | 2021-07-11T23:33:44 | 376,982,250 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 942 | h | /*----------------------------------------
Author: Richard Stern
Description: A simple binary search tree
Date: 17/4/2015
----------------------------------------*/
#ifndef _BINARYTREE_H_
#define _BINARYTREE_H_
class TreeNode;
class BinaryTree
{
public:
BinaryTree();
~BinaryTree();
bool IsEmpty() const;
bool Insert(int a_nValue);
bool Remove(int a_nValue);
TreeNode* Find(int a_nValue);
void PrintOrdered();
void PrintUnordered();
void Draw(TreeNode* selected = nullptr);
private:
//Find the node with the specified value.
bool FindNode(int a_nSearchValue, TreeNode*& pCurrent, TreeNode*& pParent);
//Used to recurse through the nodes in value order and print their values.
void PrintOrderedRecurse(TreeNode*);
void PrintUnorderedRecurse(TreeNode*);
void Draw(TreeNode*, int x, int y, int horizontalSpacing, TreeNode* selected = nullptr);
//The root node of the tree
TreeNode* m_pRoot;
};
#endif //_BINARYTREE_H_ | [
"jamesbakerpublic@gmail.com"
] | jamesbakerpublic@gmail.com |
fce8b880a5e1848ef95025bd7c656b61a8b9ff98 | 227085da2481055accfee2072727f2f8d94bc80d | /src/share/monitor/kextd_state_monitor.hpp | a71f8c6d2a821cb62dd1b2e5b90c6eb68b0ce47a | [
"Unlicense"
] | permissive | googleliyang/Karabiner-Elements | 6cd40a9c7ad24b964c29d987d87cbf3ca6a52431 | f3449eca9c26db648b63d0d8f532edaa26b80485 | refs/heads/master | 2020-06-21T04:54:26.947069 | 2019-07-16T14:55:06 | 2019-07-16T14:55:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,673 | hpp | #pragma once
// `krbn::kextd_state_monitor` can be used safely in a multi-threaded environment.
#include "constants.hpp"
#include "logger.hpp"
#include <fstream>
#include <libkern/OSKextLib.h>
#include <nod/nod.hpp>
#include <pqrs/filesystem.hpp>
#include <pqrs/json.hpp>
#include <pqrs/osx/file_monitor.hpp>
namespace krbn {
class kextd_state_monitor final : public pqrs::dispatcher::extra::dispatcher_client {
public:
// Signals (invoked from the shared dispatcher thread)
nod::signal<void(kern_return_t)> kext_load_result_changed;
// Methods
kextd_state_monitor(const kextd_state_monitor&) = delete;
kextd_state_monitor(const std::string& kextd_state_json_file_path) {
std::vector<std::string> targets = {
kextd_state_json_file_path,
};
file_monitor_ = std::make_unique<pqrs::osx::file_monitor>(weak_dispatcher_,
targets);
file_monitor_->file_changed.connect([this](auto&& changed_file_path,
auto&& changed_file_body) {
if (changed_file_body) {
try {
auto json = nlohmann::json::parse(*changed_file_body);
// json example
//
// {
// "kext_load_result": 27
// }
if (!json.is_object()) {
throw pqrs::json::unmarshal_error(fmt::format("json must be object, but is `{0}`", json.dump()));
}
for (const auto& [key, value] : json.items()) {
if (key == "kext_load_result") {
if (!value.is_number()) {
throw pqrs::json::unmarshal_error(fmt::format("`{0}` must be number, but is `{1}`", key, value.dump()));
}
auto v = value.template get<kern_return_t>();
if (last_kext_load_result_ != v) {
last_kext_load_result_ = v;
enqueue_to_dispatcher([this, v] {
kext_load_result_changed(v);
});
}
} else {
throw pqrs::json::unmarshal_error(fmt::format("unknown key `{0}` in `{1}`", key, json.dump()));
}
}
} catch (std::exception& e) {
logger::get_logger()->error("parse error in {0}: {1}", changed_file_path, e.what());
}
}
});
}
virtual ~kextd_state_monitor(void) {
detach_from_dispatcher([this] {
file_monitor_ = nullptr;
});
}
void async_start(void) {
file_monitor_->async_start();
}
private:
std::unique_ptr<pqrs::osx::file_monitor> file_monitor_;
std::optional<kern_return_t> last_kext_load_result_;
};
} // namespace krbn
| [
"tekezo@pqrs.org"
] | tekezo@pqrs.org |
aa8f19dc408c353f7ec98901dc9543f7885f210f | fb3c1e036f18193d6ffe59f443dad8323cb6e371 | /src/flash/AVMSWF/api/flash/media/AS3AVTagData.cpp | bcb7eae732017853126d610f95f6885c39c688a8 | [] | no_license | playbar/nstest | a61aed443af816fdc6e7beab65e935824dcd07b2 | d56141912bc2b0e22d1652aa7aff182e05142005 | refs/heads/master | 2021-06-03T21:56:17.779018 | 2016-08-01T03:17:39 | 2016-08-01T03:17:39 | 64,627,195 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,209 | cpp | #include "StdAfxflash.h"
#include "avmplus.h"
using namespace avmplus;
#include "AS3AVTagData.h"
namespace avmshell
{
AVTagDataClass::AVTagDataClass(VTable* cvtable):ClassClosure(cvtable)//EventClass(cvtable)
{
createVanillaPrototype();
//Add your construct code here...
};
ScriptObject* AVTagDataClass::createInstance(VTable *ivtable, ScriptObject* prototype)
{
return new (core()->GetGC(), ivtable->getExtraSize()) AVTagDataObject(ivtable, prototype, 0);
//AS3 'new' opt...Add your init code here...
}
AVTagDataObject::AVTagDataObject(VTable *vtable, ScriptObject* proto, int capacity): ScriptObject(vtable, proto, 0)
{
//Add your construct code here...
m_strData = NULL;
m_nLocalTime = 0;
}
//////////////////////////////////////////////////////////
Stringp AVTagDataObject::AS3_data_get()
{
//Add your construct code here...
//LOGWHERE();
return m_strData;//NULL;
}
double AVTagDataObject::AS3_localTime_get()
{
//Add your construct code here...
//LOGWHERE();
return m_nLocalTime;//0.0;
}
void AVTagDataObject::AS3_constructor(Stringp data, double localTime)
{
m_strData = data;
m_nLocalTime = localTime;
}
} | [
"hgl868@126.com"
] | hgl868@126.com |
fe0c62b43205dd3e043764a8c5dd574b225e3624 | 8cdff89a4f0815c1961b7ab1309a582dde56f601 | /Project1/implementation/utils.cpp | e18d7dd65f5f28d7731b8a32cd6fa998dcc4785b | [] | no_license | kirkzhang49/cs118 | fb434a54fb7acb628423a45c19d1c9e02a7b5e29 | ec31637604a2dbc1248069d0d793aa740bdbb4a3 | refs/heads/master | 2021-01-17T05:05:46.783006 | 2017-10-20T20:13:20 | 2017-10-20T20:13:20 | 83,080,956 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,907 | cpp | #include "utils.h"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <cstring>
#include <sys/stat.h>
#include <regex.h>
#include <algorithm>
#include "HttpProtocol.h"
using namespace std;
int getFileLength(char* filename) {
int length;
FILE * f = fopen(filename, "r");
fseek(f, 0L, SEEK_END);
length = (int) ftell(f);
fseek(f, 0L, SEEK_SET);
fclose(f);
return length;
}
char * readFileToCharArray(char* filename) {
char * buffer;
int length;
FILE * f = fopen(filename, "r");
fseek(f, 0L, SEEK_END);
length = (int) ftell(f);
fseek(f, 0L, SEEK_SET);
buffer = (char *) malloc(sizeof(char) * length);
if (buffer) {
fread(buffer, sizeof(char), length, f);
}
fclose(f);
return buffer;
}
HttpRequest getRequest(char* source) {
HttpRequest request;
// regex rgx("GET /(.+\\.(.+)) HTTP");
// smatch match;
string path;
string extension;
char * regexString = (char *)"GET /(.+\\.(.+)) HTTP";
size_t maxGroups = 3;
regex_t regexCompiled;
regmatch_t groupArray[maxGroups];
if (regcomp(®exCompiled, regexString, REG_EXTENDED)) {
printf("Could not compile regular expression.\n");
};
if (regexec(®exCompiled, source, maxGroups, groupArray, 0) == 0) {
unsigned int g = 0;
for (g = 1; g < maxGroups; g++) {
if (groupArray[g].rm_so == (size_t) -1)
break; // No more groups
char sourceCopy[strlen(source) + 1];
strcpy(sourceCopy, source);
sourceCopy[groupArray[g].rm_eo] = 0;
char buffer[50];
sprintf(buffer, "%s\n", sourceCopy + groupArray[g].rm_so);
if (g == 1) {
string str(buffer);
path = str;
}
if (g == 2) {
string str(buffer);
extension = str;
}
}
}
regfree(®exCompiled);
extension.erase(remove(extension.begin(), extension.end(), '\n'), extension.end());
path.erase(remove(path.begin(), path.end(), '\n'), path.end());
request.path = path;
if (extension.compare("html") == 0) {
request.type = html;
} else if (extension.compare("gif") == 0 || extension.compare("GIF") == 0) {
request.type = gif;
} else if (extension.compare("jpeg") == 0
|| extension.compare("JPEG") == 0) {
request.type = jpeg;
} else {
request.type = unknown;
}
return request;
}
string getRequestError(HttpRequest r) {
string errorMsg;
if (r.path.compare("") == 0) {
errorMsg = "Requested file path is empty.";
} else if (r.type == unknown) {
errorMsg = "Requested file type is not supported";
} else if (!fileExists(r.path)) {
errorMsg = "Requested file path does not exist.";
} else {
errorMsg = "";
}
return errorMsg;
}
char* buildErrorResponseContent(string error) {
string html = "";
html.append("<html>\n");
html.append("<head><title>404 Not Found</title></head>\n");
html.append("<body>\n");
html.append("<h1>404 Not Found</h1>\n");
html.append("<p>\n");
html.append(error);
html.append("</p>\n");
html.append("</body>\n");
html.append("</html>\n");
char *ret = new char[html.length() + 1];
strcpy(ret, html.c_str());
return ret;
}
char* buildHeader(ContentType t, int length, HttpResponseStatus status) {
string header;
switch (status) {
case OK:
header = "HTTP/1.1 200 OK\n";
break;
case NotFound:
header = "HTTP/1.1 404 Not Found\n";
break;
default:
header = "HTTP/1.1 200 OK\n";
break;
}
switch (t) {
case html:
header.append("Content-Type: text/html; charset=utf-8\n");
break;
case jpeg:
header.append("Content-Type: image/jpeg\n");
break;
case gif:
header.append("Content-Type: image/gif\n");
break;
default:
header.append("Content-Type: text/html; charset=utf-8\n");
break;
}
header.append("Connection: close\n");
header.append("Content-Length:");
header.append(to_string(length) + "\n\n");
char *ret = new char[header.length() + 1];
strcpy(ret, header.c_str());
return ret;
}
bool fileExists(string filename) {
struct stat buffer;
return (stat(filename.c_str(), &buffer) == 0);
}
| [
"kirkzhang49@gmail.com"
] | kirkzhang49@gmail.com |
a3bde824e993b9d9dcf5a56ed36274aaad610788 | cf942703345ac53729f9032b3b76181c9ac72fe0 | /011-LargestProductGrid.cpp | c94dfb878f2ff2e81c36fc96bc90e500265e9c3e | [] | no_license | dishadas168/Project-Euler | 1809505bffc5f0c0740a28cbceca1972957d8791 | 796116dbfa463b505bc3d2ddd9382aaa7a3a5539 | refs/heads/main | 2023-08-02T10:23:19.273685 | 2021-09-17T13:56:52 | 2021-09-17T13:56:52 | 404,790,506 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,610 | cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
long gridProduct(vector<vector<int>> grid){
long largest=0, prod;
for(int i=0; i< 20; i++){
for(int j=0; j< 20; j++){
//down
if(i<17){
prod=1;
for(int k=0; k < 4; k++)
prod *= grid[i+k][j];
if(prod >= largest) largest = prod;
}
//right
if(j<17){
prod=1;
for(int k=0; k < 4; k++)
prod *= grid[i][j+k];
if(prod >= largest) largest = prod;
}
//down-right
if(i<17 && j<17){
prod=1;
for(int k=0; k < 4; k++)
prod *= grid[i+k][j+k];
if(prod >= largest) largest = prod;
}
//down-left
if(i<17 && j > 2){
prod=1;
for(int k=0; k < 4; k++)
prod *= grid[i+k][j-k];
if(prod >= largest) largest = prod;
}
}
}
return largest;
}
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
vector<vector<int>> grid;
int num;
for(int i = 0; i < 20; i++){
vector<int> row;
for(int j= 0; j < 20; j++){
cin>>num;
row.push_back(num);
}
grid.push_back(row);
}
cout<<gridProduct(grid)<<endl;
return 0;
}
| [
"dishadas168@gmail.com"
] | dishadas168@gmail.com |
429700207bc89664a5ae9a7b79c0869895448b72 | d4758846ed057c9b9005afe41879245bba0b78cf | /Source/ShooterGame/Private/UI/Menu/ShooterMessageMenu.cpp | 484b905998e2abf75fd49b887342be4683eea59e | [] | no_license | Blubmin/unreal_shooter_sample | 8e57c5298b58bb7ef0c2003ec96c7e5f82790b25 | c5d54c26251e4d814ea094a7390a8778c0d6e227 | refs/heads/master | 2021-09-14T16:29:13.298273 | 2018-05-16T03:55:46 | 2018-05-16T03:55:46 | 109,689,331 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,436 | cpp | // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "ShooterGame.h"
#include "ShooterStyle.h"
#include "SShooterConfirmationDialog.h"
#include "ShooterMessageMenu.h"
#include "ShooterGameViewportClient.h"
#include "ShooterGameInstance.h"
#define LOCTEXT_NAMESPACE "ShooterGame.HUD.Menu"
void FShooterMessageMenu::Construct(TWeakObjectPtr<UShooterGameInstance> InGameInstance, TWeakObjectPtr<ULocalPlayer> InPlayerOwner, const FText& Message, const FText& OKButtonText, const FText& CancelButtonText, const FName& InPendingNextState)
{
GameInstance = InGameInstance;
PlayerOwner = InPlayerOwner;
PendingNextState = InPendingNextState;
if ( ensure( GameInstance.IsValid() ) )
{
UShooterGameViewportClient* ShooterViewport = Cast<UShooterGameViewportClient>( GameInstance->GetGameViewportClient() );
if ( ShooterViewport )
{
// Hide the previous dialog
ShooterViewport->HideDialog();
// Show the new one
ShooterViewport->ShowDialog(
PlayerOwner,
EShooterDialogType::Generic,
Message,
OKButtonText,
CancelButtonText,
FOnClicked::CreateRaw(this, &FShooterMessageMenu::OnClickedOK),
FOnClicked::CreateRaw(this, &FShooterMessageMenu::OnClickedCancel)
);
}
}
}
void FShooterMessageMenu::RemoveFromGameViewport()
{
if ( ensure( GameInstance.IsValid() ) )
{
UShooterGameViewportClient * ShooterViewport = Cast<UShooterGameViewportClient>( GameInstance->GetGameViewportClient() );
if ( ShooterViewport )
{
// Hide the previous dialog
ShooterViewport->HideDialog();
}
}
}
void FShooterMessageMenu::HideDialogAndGotoNextState()
{
RemoveFromGameViewport();
if ( ensure( GameInstance.IsValid() ) )
{
GameInstance->GotoState( PendingNextState );
}
};
FReply FShooterMessageMenu::OnClickedOK()
{
OKButtonDelegate.ExecuteIfBound();
HideDialogAndGotoNextState();
return FReply::Handled();
}
FReply FShooterMessageMenu::OnClickedCancel()
{
CancelButtonDelegate.ExecuteIfBound();
HideDialogAndGotoNextState();
return FReply::Handled();
}
void FShooterMessageMenu::SetOKClickedDelegate(FMessageMenuButtonClicked InButtonDelegate)
{
OKButtonDelegate = InButtonDelegate;
}
void FShooterMessageMenu::SetCancelClickedDelegate(FMessageMenuButtonClicked InButtonDelegate)
{
CancelButtonDelegate = InButtonDelegate;
}
#undef LOCTEXT_NAMESPACE
| [
"imeeder@cox.net"
] | imeeder@cox.net |
1960ed8ee0132293c6581464c10acad2231804c1 | 73e109c87c2db6bc1ff9cf19fe4e40dda98c7110 | /comparar 3 valores e ordenalos.cpp | c1e4183211ab2edf63c50f18e4a4e0e85ed8f283 | [] | no_license | professorjoaomoreira/C_mais_mais | d0bc0e1410c0ed586b9b0e61bcbee68f90e14ea7 | 722bd4cf1e8531d332ec7133160bc54fbd078c20 | refs/heads/master | 2016-09-12T17:34:32.114794 | 2016-04-25T07:08:46 | 2016-04-25T07:08:46 | 56,445,286 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 662 | cpp | #include<iostream.h>
#include<conio.h>
#include<dos.h>
/*Exercício 4 – Faça um programa onde o usuário entre com 3 valores inteiros que serão armazenados nas variáveis x, y, z
respectivamente, e o programa deverá ordenar esses valores de modo que o menor valor esteja em x, o valor
intermediário em y e o maior valor em z.*/
void main()
{
int x,y,z,troca;
cout<<"\nDigite os valores para x,y,z\t";
cin>>x>>y>>z;
if (x>y)
{
troca=y;
y=x;
x=troca;
}
if (y>z)
{
troca=z;
z=y;
y=troca;
}
if (x>y)
{
troca=y;
y=x;
x=troca;
}
cout<<"\nx="<<x<<"\ny="<<y<<"\nz="<<z;
getch();
}
| [
"professorjoaomoreira@gmail.com"
] | professorjoaomoreira@gmail.com |
8c784ca7f7c70b2478033412e2afa3db144c6ccc | 63c71060f36866bca4ac27304cef6d5755fdc35c | /src/UserMgmt/Tester/TestSuite.h | cfe52cc50a36b2465f1c35cbe07df88db9a7c2ca | [] | no_license | 15831944/barry_dev | bc8441cbfbd4b62fbb42bee3dcb79ff7f5fcaf8a | d4a83421458aa28ca293caa7a5567433e9358596 | refs/heads/master | 2022-03-24T07:00:26.810732 | 2015-12-22T07:19:58 | 2015-12-22T07:19:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,095 | h | //////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2005
// Packet Engineering, Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification is not permitted unless authorized in writing by a duly
// appointed officer of Packet Engineering, Inc. or its derivatives
//
// Description:
// This file is automatically generated by the TorturerGen facility.
//
// Modification History:
// 3/19/2007 Created by TorturerGen Facility
//////////////////////////////////////////////////////////////////////////
// 3/19/2007 Created by TorturerGen Facility
//////////////////////////////////////////////////////////////////////////
#ifndef Aos_UserMgmt_Tester_TestSuite_h
#define Aos_UserMgmt_Tester_TestSuite_h
#include "Tester/Ptrs.h"
#include "Tester/TestPkg.h"
#include "Util/String.h"
class AosUserMgmtTorturerTestSuite
{
private:
OmnTestSuitePtr mSuite;
public:
AosUserMgmtTorturerTestSuite();
~AosUserMgmtTorturerTestSuite();
static OmnTestSuitePtr getSuite();
};
#endif
| [
"barryniu@jimodb.com"
] | barryniu@jimodb.com |
89e3b5ec7bd754443857d52651d504c519763e55 | ee221bdc987082ff4dbd28647c8a89f23df1660b | /node_modules/gulp-sass/node_modules/node-sass/src/libsass/output.cpp | be833483ae1fbad6ed0cf65ef363f830a61e5668 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"BSL-1.0"
] | permissive | mbillard/grid-framework | 66e370cebae0e71aca4385bd53cf332a43520524 | 5a14c47191ad228c1e0ae1b2311ec5e7f35422a6 | refs/heads/master | 2020-12-11T04:02:26.338674 | 2015-05-14T02:15:40 | 2015-05-14T02:15:40 | 35,353,323 | 10 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,301 | cpp | #include "ast.hpp"
#include "output.hpp"
#include "to_string.hpp"
namespace Sass {
using namespace std;
Output::Output(Context* ctx)
: Inspect(Emitter(ctx)),
charset(""),
top_nodes(0)
{}
Output::~Output() { }
void Output::fallback_impl(AST_Node* n)
{
return n->perform(this);
}
void Output::operator()(Import* imp)
{
top_nodes.push_back(imp);
}
OutputBuffer Output::get_buffer(void)
{
Emitter emitter(ctx);
Inspect inspect(emitter);
size_t size_nodes = top_nodes.size();
for (size_t i = 0; i < size_nodes; i++) {
top_nodes[i]->perform(&inspect);
inspect.append_mandatory_linefeed();
}
// flush scheduled outputs
inspect.finalize();
// prepend buffer on top
prepend_output(inspect.output());
// make sure we end with a linefeed
if (!ends_with(wbuf.buffer, ctx->linefeed)) {
// if the output is not completely empty
if (!wbuf.buffer.empty()) append_string(ctx->linefeed);
}
// search for unicode char
for(const char& chr : wbuf.buffer) {
// skip all ascii chars
if (chr >= 0) continue;
// declare the charset
if (output_style() != COMPRESSED)
charset = "@charset \"UTF-8\";"
+ ctx->linefeed;
else charset = "\xEF\xBB\xBF";
// abort search
break;
}
// add charset as first line, before comments and imports
if (!charset.empty()) prepend_string(charset);
return wbuf;
}
void Output::operator()(Comment* c)
{
To_String to_string(ctx);
string txt = c->text()->perform(&to_string);
// if (indentation && txt == "/**/") return;
bool important = c->is_important();
if (output_style() != COMPRESSED || important) {
if (buffer().size() == 0) {
top_nodes.push_back(c);
} else {
in_comment = true;
append_indentation();
c->text()->perform(this);
in_comment = false;
if (indentation == 0) {
append_mandatory_linefeed();
} else {
append_optional_linefeed();
}
}
}
}
void Output::operator()(Ruleset* r)
{
Selector* s = r->selector();
Block* b = r->block();
bool decls = false;
// Filter out rulesets that aren't printable (process its children though)
if (!Util::isPrintable(r, output_style())) {
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
if (dynamic_cast<Has_Block*>(stm)) {
stm->perform(this);
}
}
return;
}
if (b->has_non_hoistable()) {
decls = true;
if (output_style() == NESTED) indentation += r->tabs();
if (ctx && ctx->source_comments) {
stringstream ss;
append_indentation();
ss << "/* line " << r->pstate().line+1 << ", " << r->pstate().path << " */";
append_string(ss.str());
append_optional_linefeed();
}
s->perform(this);
append_scope_opener(b);
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
bool bPrintExpression = true;
// Check print conditions
if (typeid(*stm) == typeid(Declaration)) {
Declaration* dec = static_cast<Declaration*>(stm);
if (dec->value()->concrete_type() == Expression::STRING) {
String_Constant* valConst = static_cast<String_Constant*>(dec->value());
string val(valConst->value());
if (dynamic_cast<String_Quoted*>(valConst)) {
if (!valConst->quote_mark() && val.empty()) {
bPrintExpression = false;
}
}
}
else if (dec->value()->concrete_type() == Expression::LIST) {
List* list = static_cast<List*>(dec->value());
bool all_invisible = true;
for (size_t list_i = 0, list_L = list->length(); list_i < list_L; ++list_i) {
Expression* item = (*list)[list_i];
if (!item->is_invisible()) all_invisible = false;
}
if (all_invisible) bPrintExpression = false;
}
}
// Print if OK
if (!stm->is_hoistable() && bPrintExpression) {
stm->perform(this);
}
}
if (output_style() == NESTED) indentation -= r->tabs();
append_scope_closer(b);
}
if (b->has_hoistable()) {
if (decls) ++indentation;
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
if (stm->is_hoistable()) {
stm->perform(this);
}
}
if (decls) --indentation;
}
}
void Output::operator()(Keyframe_Rule* r)
{
Block* b = r->block();
Selector* v = r->selector();
if (v) {
v->perform(this);
}
if (!b) {
append_colon_separator();
return;
}
append_scope_opener();
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
if (!stm->is_hoistable()) {
stm->perform(this);
if (i < L - 1) append_special_linefeed();
}
}
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
if (stm->is_hoistable()) {
stm->perform(this);
}
}
append_scope_closer();
}
void Output::operator()(Feature_Block* f)
{
if (f->is_invisible()) return;
Feature_Query* q = f->feature_queries();
Block* b = f->block();
// Filter out feature blocks that aren't printable (process its children though)
if (!Util::isPrintable(f, output_style())) {
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
if (dynamic_cast<Has_Block*>(stm)) {
stm->perform(this);
}
}
return;
}
if (output_style() == NESTED) indentation += f->tabs();
append_indentation();
append_token("@supports", f);
append_mandatory_space();
q->perform(this);
append_scope_opener();
Selector* e = f->selector();
if (e && b->has_non_hoistable()) {
// JMA - hoisted, output the non-hoistable in a nested block, followed by the hoistable
e->perform(this);
append_scope_opener();
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
if (!stm->is_hoistable()) {
stm->perform(this);
}
}
append_scope_closer();
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
if (stm->is_hoistable()) {
stm->perform(this);
}
}
}
else {
// JMA - not hoisted, just output in order
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
stm->perform(this);
if (i < L - 1) append_special_linefeed();
}
}
if (output_style() == NESTED) indentation -= f->tabs();
append_scope_closer();
}
void Output::operator()(Media_Block* m)
{
if (m->is_invisible()) return;
List* q = m->media_queries();
Block* b = m->block();
// Filter out media blocks that aren't printable (process its children though)
if (!Util::isPrintable(m, output_style())) {
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
if (dynamic_cast<Has_Block*>(stm)) {
stm->perform(this);
}
}
return;
}
if (output_style() == NESTED) indentation += m->tabs();
append_indentation();
append_token("@media", m);
append_mandatory_space();
in_media_block = true;
q->perform(this);
in_media_block = false;
append_scope_opener();
Selector* e = m->selector();
if (e && b->has_non_hoistable()) {
// JMA - hoisted, output the non-hoistable in a nested block, followed by the hoistable
e->perform(this);
append_scope_opener();
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
if (!stm->is_hoistable()) {
stm->perform(this);
}
}
append_scope_closer();
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
if (stm->is_hoistable()) {
stm->perform(this);
}
}
}
else {
// JMA - not hoisted, just output in order
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
stm->perform(this);
if (i < L - 1) append_special_linefeed();
}
}
if (output_style() == NESTED) indentation -= m->tabs();
append_scope_closer();
}
void Output::operator()(At_Rule* a)
{
string kwd = a->keyword();
Selector* s = a->selector();
Expression* v = a->value();
Block* b = a->block();
append_indentation();
append_token(kwd, a);
if (s) {
append_mandatory_space();
in_wrapped = true;
s->perform(this);
in_wrapped = false;
}
else if (v) {
append_mandatory_space();
v->perform(this);
}
if (!b) {
append_delimiter();
return;
}
if (b->is_invisible() || b->length() == 0) {
return append_string(" {}");
}
append_scope_opener();
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
if (!stm->is_hoistable()) {
stm->perform(this);
if (i < L - 1) append_special_linefeed();
}
}
for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement* stm = (*b)[i];
if (stm->is_hoistable()) {
stm->perform(this);
if (i < L - 1) append_special_linefeed();
}
}
append_scope_closer();
}
void Output::operator()(String_Quoted* s)
{
if (s->quote_mark()) {
append_token(quote(s->value(), s->quote_mark()), s);
} else if (!in_comment) {
append_token(string_to_output(s->value()), s);
} else {
append_token(s->value(), s);
}
}
void Output::operator()(String_Constant* s)
{
if (String_Quoted* quoted = dynamic_cast<String_Quoted*>(s)) {
return Output::operator()(quoted);
} else if (!in_comment) {
append_token(string_to_output(s->value()), s);
} else {
append_token(s->value(), s);
}
}
}
| [
"michel@mbillard.com"
] | michel@mbillard.com |
0fa2304f21357cb945e5fb27cb2b6af2c101d3c3 | 84dd2490c7b5dda1fa01ba4bd5530dca00b3e8e7 | /src/ui/map2d.cpp | 47730b07c013154fc5a7a3279b844d142999a29b | [] | no_license | eglrp/laser_slam | 2c6e58f7a8bbf5c94f7024d2aebae3eca69de4fa | 83e980848e029a6addd937956b6e524b6d89c632 | refs/heads/master | 2020-04-07T04:52:49.104644 | 2017-04-15T20:55:23 | 2017-04-15T20:55:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,272 | cpp | #include "map2d.h"
namespace{
const float little_tail = 0.0005;
const double std_pro = 0.3;
}
CMap2D::CMap2D(QWidget* parent){
default_init(); // init the map using default parameters
}
CMap2D::~CMap2D(){}
void CMap2D::default_init(){
initializeMap(2000,2000,400,300,0,0,0.05); // 5cm cell size
}
void CMap2D::initializeMap(int size_x, int size_y, int start_x, int start_y,float offset_x, float offset_y, double resolution)
{
m_size_x = size_x;
m_size_y = size_y;
m_center_x = start_x;
m_center_y = start_y;
m_offset_x = offset_x;
m_offset_y = offset_y;
m_resolution = resolution;
m_max_line_lens = 4*max(m_size_x,m_size_y);
m_maphit.resize(size_x, vector<float>(size_y) );
m_mapsum.resize(size_x, vector<float>(size_y) );
m_mapprob.resize(size_x, vector<float>(size_y));
/*m_maphit = (float**)malloc(size_x*size_y*sizeof(float*));
m_mapsum = (float**)malloc(size_x*size_y*sizeof(float*));
m_mapprob = (float**)malloc(size_x*size_y*sizeof(float*));
for(int i=0;i<size_x;i++)
for(int j=0;j<size_y;j++)
{
m_maphit[i*size_y + j] = 0;
m_mapsum[i*size_y + j] = 0;
m_mapprob[i*size_y + j] = 0;
}*/
}
void CMap2D::uninitMap(){}
// input the global cordinates of the scans and current pose
void CMap2D::updateMap(float* gx, float* gy, int n, float rx, float ry, float th)
{
static vector<ivector2d> line;
int cnt; // number of this line
int i, j, x, y;
ivector2d start, end;
// n == -1 indicate finishing sending the map info
if(n<0){
cout<<"Finally send PMAP!"<<endl;
computeProbsOfMap();
// draw this map
sendMap(this);
return;
}
// cout<<"$$$rece update map!"<<endl;
static int nframe = 0;
if(line.size()<=0) line.resize(m_max_line_lens);
// caculate start grid
mapPosfromPoint(Point2D(rx,ry),start);
for(int i=0;i<n;i++){
mapPosfromPoint(Point2D(*(gx+i),*(gy+i)),end);
if( end.x>=0 && end.x < m_size_x \
&& end.y>=0 && end.y < m_size_y){
m_maphit[end.x][end.y]++;
}
// line update model
grid_line( start, end, line, cnt );
for (int j=0;j<cnt/*line.size()*/;j++) {
x = line[j].x;
y = line[j].y;
if ( x>=0 && x<m_size_x &&
y>=0 && y<m_size_y ) {
if (j>/*line.size()*/cnt-2) {
m_maphit[x][y]++;
}
m_mapsum[x][y]++;
}
}
}
}
void CMap2D::mapPosfromPoint(Point2D point, ivector2d& pos)
{
if(point.x < m_offset_x){
pos.x = (int) (m_center_x+
((point.x-m_offset_x +little_tail )/(double)m_resolution)- 1);
}else{
pos.x = (int) (m_center_x +
((point.x-m_offset_x + little_tail)/(double)m_resolution));
}
if(point.y < m_offset_y){
pos.y = (int) (m_center_y+
((point.y-m_offset_y +little_tail )/(double)m_resolution)- 1);
}else{
pos.y = (int) (m_center_y +
((point.y-m_offset_y+little_tail)/(double)m_resolution));
}
}
// compute probability of each grid in this map
void CMap2D::computeProbsOfMap()
{
int x, y;
for (x=0;x<m_size_x;x++) {
for (y=0;y<m_size_y;y++) {
if (m_mapsum[x][y]>0) {
m_mapprob[x][y] =
( m_maphit[x][y] /
(double) ( /*m_maphit[x][y] +*/ m_mapsum[x][y] ) );
if(m_mapprob[x][y]>1.0) m_mapprob[x][y] = 1.0;
} else {
m_mapprob[x][y] = std_pro; // undetected points
/*settings.global_map_std_val*/;
}
}
}
}
| [
"hxzhang1@ualr.edu"
] | hxzhang1@ualr.edu |
eb703ed8457df0133cffd3f5de5b15f4a621e963 | 119e3839dc83d2f8fca8b8a78a687982cfe25104 | /prebuild/VTK-8.1.0.rc1/ThirdParty/vtkm/vtk-m/vtkm/rendering/raytracing/ChannelBufferOperations.h | 3c38a768dd560c1711dbf9605f62bd7787431d16 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | liulihuogyh/osgall | 30cdb5c8ca7d3f2c0863ef2da6ff6c1bafb357f1 | 310530672b69be6afac16f0b9b2f5bd9b3ec60d4 | refs/heads/master | 2023-04-14T13:01:04.085705 | 2021-04-24T19:53:50 | 2021-04-24T19:53:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,045 | h | //============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2015 UT-Battelle, LLC.
// Copyright 2015 Los Alamos National Security.
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtkm_rendering_raytracing_ChannelBuffer_Operations_h
#define vtkm_rendering_raytracing_ChannelBuffer_Operations_h
#include <vtkm/Types.h>
#include <vtkm/cont/ArrayHandleCast.h>
#include <vtkm/rendering/raytracing/ChannelBuffer.h>
#include <vtkm/rendering/raytracing/Worklets.h>
#include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/worklet/WorkletMapField.h>
namespace vtkm
{
namespace rendering
{
namespace raytracing
{
namespace detail
{
class CompactBuffer : public vtkm::worklet::WorkletMapField
{
protected:
const vtkm::Id NumChannels; // the number of channels in the buffer
public:
VTKM_CONT
CompactBuffer(const vtkm::Int32 numChannels)
: NumChannels(numChannels)
{
}
typedef void ControlSignature(FieldIn<>, WholeArrayIn<>, FieldIn<>, WholeArrayOut<>);
typedef void ExecutionSignature(_1, _2, _3, _4, WorkIndex);
template <typename InBufferPortalType, typename OutBufferPortalType>
VTKM_EXEC void operator()(const vtkm::UInt8& mask,
const InBufferPortalType& inBuffer,
const vtkm::Id& offset,
OutBufferPortalType& outBuffer,
const vtkm::Id& index) const
{
if (mask == 0)
{
return;
}
vtkm::Id inIndex = index * NumChannels;
vtkm::Id outIndex = offset * NumChannels;
for (vtkm::Int32 i = 0; i < NumChannels; ++i)
{
BOUNDS_CHECK(inBuffer, inIndex + i);
BOUNDS_CHECK(outBuffer, outIndex + i);
outBuffer.Set(outIndex + i, inBuffer.Get(inIndex + i));
}
}
}; //class Compact
class InitBuffer : public vtkm::worklet::WorkletMapField
{
protected:
vtkm::Int32 NumChannels;
public:
VTKM_CONT
InitBuffer(const vtkm::Int32 numChannels)
: NumChannels(numChannels)
{
}
typedef void ControlSignature(FieldOut<>, WholeArrayIn<>);
typedef void ExecutionSignature(_1, _2, WorkIndex);
template <typename ValueType, typename PortalType>
VTKM_EXEC void operator()(ValueType& outValue,
const PortalType& source,
const vtkm::Id& index) const
{
outValue = source.Get(index % NumChannels);
}
}; //class InitBuffer
} // namespace detail
class ChannelBufferOperations
{
public:
template <typename Device, typename Precision>
static void Compact(ChannelBuffer<Precision>& buffer,
vtkm::cont::ArrayHandle<UInt8>& masks,
const vtkm::Id& newSize,
Device)
{
vtkm::cont::ArrayHandle<vtkm::Id> offsets;
offsets.PrepareForOutput(buffer.Size, Device());
vtkm::cont::ArrayHandleCast<vtkm::Id, vtkm::cont::ArrayHandle<vtkm::UInt8>> castedMasks(masks);
vtkm::cont::DeviceAdapterAlgorithm<Device>::ScanExclusive(castedMasks, offsets);
vtkm::cont::ArrayHandle<Precision> compactedBuffer;
compactedBuffer.PrepareForOutput(newSize * buffer.NumChannels, Device());
vtkm::worklet::DispatcherMapField<detail::CompactBuffer, Device>(
detail::CompactBuffer(buffer.NumChannels))
.Invoke(masks, buffer.Buffer, offsets, compactedBuffer);
buffer.Buffer = compactedBuffer;
buffer.Size = newSize;
}
template <typename Device, typename Precision>
static void InitChannels(ChannelBuffer<Precision>& buffer,
vtkm::cont::ArrayHandle<Precision> sourceSignature,
Device)
{
if (sourceSignature.GetNumberOfValues() != buffer.NumChannels)
{
std::string msg = "ChannelBuffer: number of bins in sourse signature must match NumChannels";
throw vtkm::cont::ErrorBadValue(msg);
}
vtkm::worklet::DispatcherMapField<detail::InitBuffer, Device>(
detail::InitBuffer(buffer.NumChannels))
.Invoke(buffer.Buffer, sourceSignature);
}
template <typename Device, typename Precision>
static void InitConst(ChannelBuffer<Precision>& buffer, const Precision value, Device)
{
vtkm::worklet::DispatcherMapField<MemSet<Precision>, Device>(MemSet<Precision>(value))
.Invoke(buffer.Buffer);
}
};
}
}
} // namespace vtkm::rendering::raytracing
#endif
| [
"shell_tdf@126.com"
] | shell_tdf@126.com |
5d9918d0b22b4a82100e17bdc8afd9ebef71b0c7 | 6e170c8ae2eeb206c6e69a025206c29b2c5fa1db | /piLibs/src/libCamera/windows/ds/baseclasses/mtype.cpp | 043126c43db54fed90dcc5f1ec0b4afd5b784ec9 | [
"MIT",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | fossabot/arctic | d7276ab41fbb67559ad7adf62639005ffec5501e | f3f6e1051b7209020cdaec69ad1f1edbd1acb522 | refs/heads/master | 2021-04-03T05:11:46.728128 | 2018-03-08T20:22:58 | 2018-03-08T20:22:58 | 124,443,896 | 0 | 0 | MIT | 2018-03-08T20:22:57 | 2018-03-08T20:22:57 | null | UTF-8 | C++ | false | false | 12,199 | cpp | //------------------------------------------------------------------------------
// File: MType.cpp
//
// Desc: DirectShow base classes - implements a class that holds and
// manages media type information.
//
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
// helper class that derived pin objects can use to compare media
// types etc. Has same data members as the struct AM_MEDIA_TYPE defined
// in the streams IDL file, but also has (non-virtual) functions
#include "streams.h"
#include <mmreg.h>
CMediaType::~CMediaType(){
FreeMediaType(*this);
}
CMediaType::CMediaType()
{
InitMediaType();
}
CMediaType::CMediaType(const GUID * type)
{
InitMediaType();
majortype = *type;
}
// copy constructor does a deep copy of the format block
CMediaType::CMediaType(const AM_MEDIA_TYPE& rt, __out_opt HRESULT* phr)
{
HRESULT hr = CopyMediaType(this, &rt);
if (FAILED(hr) && (NULL != phr)) {
*phr = hr;
}
}
CMediaType::CMediaType(const CMediaType& rt, __out_opt HRESULT* phr)
{
HRESULT hr = CopyMediaType(this, &rt);
if (FAILED(hr) && (NULL != phr)) {
*phr = hr;
}
}
// this class inherits publicly from AM_MEDIA_TYPE so the compiler could generate
// the following assignment operator itself, however it could introduce some
// memory conflicts and leaks in the process because the structure contains
// a dynamically allocated block (pbFormat) which it will not copy correctly
CMediaType&
CMediaType::operator=(const AM_MEDIA_TYPE& rt)
{
Set(rt);
return *this;
}
CMediaType&
CMediaType::operator=(const CMediaType& rt)
{
*this = (AM_MEDIA_TYPE &) rt;
return *this;
}
BOOL
CMediaType::operator == (const CMediaType& rt) const
{
// I don't believe we need to check sample size or
// temporal compression flags, since I think these must
// be represented in the type, subtype and format somehow. They
// are pulled out as separate flags so that people who don't understand
// the particular format representation can still see them, but
// they should duplicate information in the format block.
return ((IsEqualGUID(majortype,rt.majortype) == TRUE) &&
(IsEqualGUID(subtype,rt.subtype) == TRUE) &&
(IsEqualGUID(formattype,rt.formattype) == TRUE) &&
(cbFormat == rt.cbFormat) &&
( (cbFormat == 0) ||
pbFormat != NULL && rt.pbFormat != NULL &&
(memcmp(pbFormat, rt.pbFormat, cbFormat) == 0)));
}
BOOL
CMediaType::operator != (const CMediaType& rt) const
{
/* Check to see if they are equal */
if (*this == rt) {
return FALSE;
}
return TRUE;
}
HRESULT
CMediaType::Set(const CMediaType& rt)
{
return Set((AM_MEDIA_TYPE &) rt);
}
HRESULT
CMediaType::Set(const AM_MEDIA_TYPE& rt)
{
if (&rt != this) {
FreeMediaType(*this);
HRESULT hr = CopyMediaType(this, &rt);
if (FAILED(hr)) {
return E_OUTOFMEMORY;
}
}
return S_OK;
}
BOOL
CMediaType::IsValid() const
{
return (!IsEqualGUID(majortype,GUID_NULL));
}
void
CMediaType::SetType(const GUID* ptype)
{
majortype = *ptype;
}
void
CMediaType::SetSubtype(const GUID* ptype)
{
subtype = *ptype;
}
ULONG
CMediaType::GetSampleSize() const {
if (IsFixedSize()) {
return lSampleSize;
} else {
return 0;
}
}
void
CMediaType::SetSampleSize(ULONG sz) {
if (sz == 0) {
SetVariableSize();
} else {
bFixedSizeSamples = TRUE;
lSampleSize = sz;
}
}
void
CMediaType::SetVariableSize() {
bFixedSizeSamples = FALSE;
}
void
CMediaType::SetTemporalCompression(BOOL bCompressed) {
bTemporalCompression = bCompressed;
}
BOOL
CMediaType::SetFormat(__in_bcount(cb) BYTE * pformat, ULONG cb)
{
if (NULL == AllocFormatBuffer(cb))
return(FALSE);
ASSERT(pbFormat);
memcpy(pbFormat, pformat, cb);
return(TRUE);
}
// set the type of the media type format block, this type defines what you
// will actually find in the format pointer. For example FORMAT_VideoInfo or
// FORMAT_WaveFormatEx. In the future this may be an interface pointer to a
// property set. Before sending out media types this should be filled in.
void
CMediaType::SetFormatType(const GUID *pformattype)
{
formattype = *pformattype;
}
// reset the format buffer
void CMediaType::ResetFormatBuffer()
{
if (cbFormat) {
CoTaskMemFree((PVOID)pbFormat);
}
cbFormat = 0;
pbFormat = NULL;
}
// allocate length bytes for the format and return a read/write pointer
// If we cannot allocate the new block of memory we return NULL leaving
// the original block of memory untouched (as does ReallocFormatBuffer)
BYTE*
CMediaType::AllocFormatBuffer(ULONG length)
{
ASSERT(length);
// do the types have the same buffer size
if (cbFormat == length) {
return pbFormat;
}
// allocate the new format buffer
BYTE *pNewFormat = (PBYTE)CoTaskMemAlloc(length);
if (pNewFormat == NULL) {
if (length <= cbFormat) return pbFormat; //reuse the old block anyway.
return NULL;
}
// delete the old format
if (cbFormat != 0) {
ASSERT(pbFormat);
CoTaskMemFree((PVOID)pbFormat);
}
cbFormat = length;
pbFormat = pNewFormat;
return pbFormat;
}
// reallocate length bytes for the format and return a read/write pointer
// to it. We keep as much information as we can given the new buffer size
// if this fails the original format buffer is left untouched. The caller
// is responsible for ensuring the size of memory required is non zero
BYTE*
CMediaType::ReallocFormatBuffer(ULONG length)
{
ASSERT(length);
// do the types have the same buffer size
if (cbFormat == length) {
return pbFormat;
}
// allocate the new format buffer
BYTE *pNewFormat = (PBYTE)CoTaskMemAlloc(length);
if (pNewFormat == NULL) {
if (length <= cbFormat) return pbFormat; //reuse the old block anyway.
return NULL;
}
// copy any previous format (or part of if new is smaller)
// delete the old format and replace with the new one
if (cbFormat != 0) {
ASSERT(pbFormat);
memcpy(pNewFormat,pbFormat,min(length,cbFormat));
CoTaskMemFree((PVOID)pbFormat);
}
cbFormat = length;
pbFormat = pNewFormat;
return pNewFormat;
}
// initialise a media type structure
void CMediaType::InitMediaType()
{
ZeroMemory((PVOID)this, sizeof(*this));
lSampleSize = 1;
bFixedSizeSamples = TRUE;
}
// a partially specified media type can be passed to IPin::Connect
// as a constraint on the media type used in the connection.
// the type, subtype or format type can be null.
BOOL
CMediaType::IsPartiallySpecified(void) const
{
if ((majortype == GUID_NULL) ||
(formattype == GUID_NULL)) {
return TRUE;
} else {
return FALSE;
}
}
BOOL
CMediaType::MatchesPartial(const CMediaType* ppartial) const
{
if ((ppartial->majortype != GUID_NULL) &&
(majortype != ppartial->majortype)) {
return FALSE;
}
if ((ppartial->subtype != GUID_NULL) &&
(subtype != ppartial->subtype)) {
return FALSE;
}
if (ppartial->formattype != GUID_NULL) {
// if the format block is specified then it must match exactly
if (formattype != ppartial->formattype) {
return FALSE;
}
if (cbFormat != ppartial->cbFormat) {
return FALSE;
}
if ((cbFormat != 0) &&
(memcmp(pbFormat, ppartial->pbFormat, cbFormat) != 0)) {
return FALSE;
}
}
return TRUE;
}
// general purpose function to delete a heap allocated AM_MEDIA_TYPE structure
// which is useful when calling IEnumMediaTypes::Next as the interface
// implementation allocates the structures which you must later delete
// the format block may also be a pointer to an interface to release
void WINAPI DeleteMediaType(__inout_opt AM_MEDIA_TYPE *pmt)
{
// allow NULL pointers for coding simplicity
if (pmt == NULL) {
return;
}
FreeMediaType(*pmt);
CoTaskMemFree((PVOID)pmt);
}
// this also comes in useful when using the IEnumMediaTypes interface so
// that you can copy a media type, you can do nearly the same by creating
// a CMediaType object but as soon as it goes out of scope the destructor
// will delete the memory it allocated (this takes a copy of the memory)
AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const *pSrc)
{
ASSERT(pSrc);
// Allocate a block of memory for the media type
AM_MEDIA_TYPE *pMediaType =
(AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
if (pMediaType == NULL) {
return NULL;
}
// Copy the variable length format block
HRESULT hr = CopyMediaType(pMediaType,pSrc);
if (FAILED(hr)) {
CoTaskMemFree((PVOID)pMediaType);
return NULL;
}
return pMediaType;
}
// Copy 1 media type to another
HRESULT WINAPI CopyMediaType(__out AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE *pmtSource)
{
// We'll leak if we copy onto one that already exists - there's one
// case we can check like that - copying to itself.
ASSERT(pmtSource != pmtTarget);
*pmtTarget = *pmtSource;
if (pmtSource->cbFormat != 0) {
ASSERT(pmtSource->pbFormat != NULL);
pmtTarget->pbFormat = (PBYTE)CoTaskMemAlloc(pmtSource->cbFormat);
if (pmtTarget->pbFormat == NULL) {
pmtTarget->cbFormat = 0;
return E_OUTOFMEMORY;
} else {
CopyMemory((PVOID)pmtTarget->pbFormat, (PVOID)pmtSource->pbFormat,
pmtTarget->cbFormat);
}
}
if (pmtTarget->pUnk != NULL) {
pmtTarget->pUnk->AddRef();
}
return S_OK;
}
// Free an existing media type (ie free resources it holds)
void WINAPI FreeMediaType(__inout AM_MEDIA_TYPE& mt)
{
if (mt.cbFormat != 0) {
CoTaskMemFree((PVOID)mt.pbFormat);
// Strictly unnecessary but tidier
mt.cbFormat = 0;
mt.pbFormat = NULL;
}
if (mt.pUnk != NULL) {
mt.pUnk->Release();
mt.pUnk = NULL;
}
}
// Initialize a media type from a WAVEFORMATEX
STDAPI CreateAudioMediaType(
const WAVEFORMATEX *pwfx,
__out AM_MEDIA_TYPE *pmt,
BOOL bSetFormat
)
{
pmt->majortype = MEDIATYPE_Audio;
if (pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE) {
pmt->subtype = ((PWAVEFORMATEXTENSIBLE)pwfx)->SubFormat;
} else {
pmt->subtype = FOURCCMap(pwfx->wFormatTag);
}
pmt->formattype = FORMAT_WaveFormatEx;
pmt->bFixedSizeSamples = TRUE;
pmt->bTemporalCompression = FALSE;
pmt->lSampleSize = pwfx->nBlockAlign;
pmt->pUnk = NULL;
if (bSetFormat) {
if (pwfx->wFormatTag == WAVE_FORMAT_PCM) {
pmt->cbFormat = sizeof(WAVEFORMATEX);
} else {
pmt->cbFormat = sizeof(WAVEFORMATEX) + pwfx->cbSize;
}
pmt->pbFormat = (PBYTE)CoTaskMemAlloc(pmt->cbFormat);
if (pmt->pbFormat == NULL) {
return E_OUTOFMEMORY;
}
if (pwfx->wFormatTag == WAVE_FORMAT_PCM) {
CopyMemory(pmt->pbFormat, pwfx, sizeof(PCMWAVEFORMAT));
((WAVEFORMATEX *)pmt->pbFormat)->cbSize = 0;
} else {
CopyMemory(pmt->pbFormat, pwfx, pmt->cbFormat);
}
}
return S_OK;
}
// eliminate very many spurious warnings from MS compiler
#pragma warning(disable:4514)
| [
"povelitel2003@gmail.com"
] | povelitel2003@gmail.com |
44cb9334694488c82d6049c9d39ea810e2d3317f | e162acd90d83a373fde0be6f6e97f5107e8d0188 | /841A. Generous Kefa.cpp | 37ebd89a4080b45cf5dc6de09c5d43eb2dedd8e4 | [] | no_license | Irfan995/Codeforces | 40532913017fd8ed9d65c36d859fe7e52deb6827 | fbd61ce99d5d28f5e57c1341337e423fbfa5e0a7 | refs/heads/master | 2021-05-15T15:42:47.765819 | 2020-05-14T06:18:00 | 2020-05-14T06:18:00 | 107,412,477 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 570 | cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,k;
int sz=0;
cin>>n>>k;
string s;
string a;
cin>>s;
map<char,int>mp;
for(int i=0;i<n;i++)
{
mp[s[i]]++;
if(mp[s[i]]==1)
{
a+=s[i];
sz++;
}
}
//cout<<sz;
int x;
int flag=0;
for(int i=0;i<sz;i++)
{
x=mp[a[i]];
if(x>k)
{
flag=1;
break;
}
}
if(flag==1)
{
cout<<"NO";
}
else
{
cout<<"YES";
}
}
| [
"fahimirfan70@gmail.com"
] | fahimirfan70@gmail.com |
fc12645462c0c0f9172fb794a00d82ddf894e51f | 44f04b8f2b6c0dba51f1e998985d3a9e8540715f | /UESTC/796/N.cpp | bd6790173b295f6e6292201d77aa5fb49e4740a1 | [] | no_license | GuessEver/ACMICPCSolutions | 2dd318a45939711eff1dd208cffc05a029b38130 | 909927778efd77ca9ec8e18aed3ff22c167d2a33 | refs/heads/master | 2020-05-18T20:52:32.359955 | 2015-11-04T08:31:43 | 2015-11-04T08:31:43 | 29,720,059 | 5 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 580 | cpp | #include <cstdio>
const int N = 50 + 10;
int n, a[N];
double dp[N][3000];
int main()
{
scanf("%d", &n);
for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
double res = 0;
dp[0][2047] = 1.0;
for(int i = 0; i < n; i++)
{
for(int j = 1; j <= 2047; j++)
{
int cnt = 0;
for(int k = 1; k <= n; k++) cnt += ((a[k] & j) == j);
if(cnt < i) continue;
dp[i+1][j] += (cnt - i) * (dp[i][j] / (n - i));
for(int k = 1; k <= n; k++) if((j & a[k]) != j)
dp[i+1][(j&a[k])] += dp[i][j] / (n - i);
}
res += dp[i+1][0] * (i + 1);
}
printf("%.3f\n", res);
return 0;
}
| [
"jiangzh777@163.com"
] | jiangzh777@163.com |
bd3f24dd9b8e871827ce835ec5cb03a127724a89 | 69593501ed5daa175d8b2bdac75c00ad157e701e | /Plugins/AdvancedSessions/AdvancedSessions/Intermediate/Build/Win64/UE4/Inc/AdvancedSessions/GetFriendsCallbackProxy.generated.h | 6dcccd47f7b23f05b6f1c282a69551e1afd9b22b | [
"MIT"
] | permissive | denfrost/FiveNightAtFreddys | 42e686b9841f7f2e08eb4f25c2d69e5619e7a93c | 95277618c129d9293d0cd85cf44d06fd7204bd05 | refs/heads/main | 2023-06-04T13:50:43.669006 | 2021-06-30T03:13:18 | 2021-06-30T03:13:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,319 | h | // Copyright Epic Games, Inc. All Rights Reserved.
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
===========================================================================*/
#include "UObject/ObjectMacros.h"
#include "UObject/ScriptMacros.h"
PRAGMA_DISABLE_DEPRECATION_WARNINGS
struct FBPFriendInfo;
class UObject;
class APlayerController;
class UGetFriendsCallbackProxy;
#ifdef ADVANCEDSESSIONS_GetFriendsCallbackProxy_generated_h
#error "GetFriendsCallbackProxy.generated.h already included, missing '#pragma once' in GetFriendsCallbackProxy.h"
#endif
#define ADVANCEDSESSIONS_GetFriendsCallbackProxy_generated_h
#define FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_11_DELEGATE \
struct _Script_AdvancedSessions_eventBlueprintGetFriendsListDelegate_Parms \
{ \
TArray<FBPFriendInfo> Results; \
}; \
static inline void FBlueprintGetFriendsListDelegate_DelegateWrapper(const FMulticastScriptDelegate& BlueprintGetFriendsListDelegate, TArray<FBPFriendInfo> const& Results) \
{ \
_Script_AdvancedSessions_eventBlueprintGetFriendsListDelegate_Parms Parms; \
Parms.Results=Results; \
BlueprintGetFriendsListDelegate.ProcessMulticastDelegate<UObject>(&Parms); \
}
#define FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_SPARSE_DATA
#define FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_RPC_WRAPPERS \
\
DECLARE_FUNCTION(execGetAndStoreFriendsList);
#define FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_RPC_WRAPPERS_NO_PURE_DECLS \
\
DECLARE_FUNCTION(execGetAndStoreFriendsList);
#define FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_INCLASS_NO_PURE_DECLS \
private: \
static void StaticRegisterNativesUGetFriendsCallbackProxy(); \
friend struct Z_Construct_UClass_UGetFriendsCallbackProxy_Statics; \
public: \
DECLARE_CLASS(UGetFriendsCallbackProxy, UOnlineBlueprintCallProxyBase, COMPILED_IN_FLAGS(0), CASTCLASS_None, TEXT("/Script/AdvancedSessions"), ADVANCEDSESSIONS_API) \
DECLARE_SERIALIZER(UGetFriendsCallbackProxy)
#define FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_INCLASS \
private: \
static void StaticRegisterNativesUGetFriendsCallbackProxy(); \
friend struct Z_Construct_UClass_UGetFriendsCallbackProxy_Statics; \
public: \
DECLARE_CLASS(UGetFriendsCallbackProxy, UOnlineBlueprintCallProxyBase, COMPILED_IN_FLAGS(0), CASTCLASS_None, TEXT("/Script/AdvancedSessions"), ADVANCEDSESSIONS_API) \
DECLARE_SERIALIZER(UGetFriendsCallbackProxy)
#define FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_STANDARD_CONSTRUCTORS \
/** Standard constructor, called after all reflected properties have been initialized */ \
ADVANCEDSESSIONS_API UGetFriendsCallbackProxy(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); \
DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL(UGetFriendsCallbackProxy) \
DECLARE_VTABLE_PTR_HELPER_CTOR(ADVANCEDSESSIONS_API, UGetFriendsCallbackProxy); \
DEFINE_VTABLE_PTR_HELPER_CTOR_CALLER(UGetFriendsCallbackProxy); \
private: \
/** Private move- and copy-constructors, should never be used */ \
ADVANCEDSESSIONS_API UGetFriendsCallbackProxy(UGetFriendsCallbackProxy&&); \
ADVANCEDSESSIONS_API UGetFriendsCallbackProxy(const UGetFriendsCallbackProxy&); \
public:
#define FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_ENHANCED_CONSTRUCTORS \
/** Standard constructor, called after all reflected properties have been initialized */ \
ADVANCEDSESSIONS_API UGetFriendsCallbackProxy(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()) : Super(ObjectInitializer) { }; \
private: \
/** Private move- and copy-constructors, should never be used */ \
ADVANCEDSESSIONS_API UGetFriendsCallbackProxy(UGetFriendsCallbackProxy&&); \
ADVANCEDSESSIONS_API UGetFriendsCallbackProxy(const UGetFriendsCallbackProxy&); \
public: \
DECLARE_VTABLE_PTR_HELPER_CTOR(ADVANCEDSESSIONS_API, UGetFriendsCallbackProxy); \
DEFINE_VTABLE_PTR_HELPER_CTOR_CALLER(UGetFriendsCallbackProxy); \
DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL(UGetFriendsCallbackProxy)
#define FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_PRIVATE_PROPERTY_OFFSET
#define FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_13_PROLOG
#define FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_GENERATED_BODY_LEGACY \
PRAGMA_DISABLE_DEPRECATION_WARNINGS \
public: \
FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_PRIVATE_PROPERTY_OFFSET \
FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_SPARSE_DATA \
FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_RPC_WRAPPERS \
FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_INCLASS \
FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_STANDARD_CONSTRUCTORS \
public: \
PRAGMA_ENABLE_DEPRECATION_WARNINGS
#define FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_GENERATED_BODY \
PRAGMA_DISABLE_DEPRECATION_WARNINGS \
public: \
FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_PRIVATE_PROPERTY_OFFSET \
FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_SPARSE_DATA \
FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_RPC_WRAPPERS_NO_PURE_DECLS \
FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_INCLASS_NO_PURE_DECLS \
FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h_16_ENHANCED_CONSTRUCTORS \
static_assert(false, "Unknown access specifier for GENERATED_BODY() macro in class GetFriendsCallbackProxy."); \
PRAGMA_ENABLE_DEPRECATION_WARNINGS
template<> ADVANCEDSESSIONS_API UClass* StaticClass<class UGetFriendsCallbackProxy>();
#undef CURRENT_FILE_ID
#define CURRENT_FILE_ID FiveNightAtFreddys_Plugins_AdvancedSessions_AdvancedSessions_Source_AdvancedSessions_Classes_GetFriendsCallbackProxy_h
PRAGMA_ENABLE_DEPRECATION_WARNINGS
| [
"nathan.cm77@gmail.com"
] | nathan.cm77@gmail.com |
83e19a64da9b4dd9162c4bf9f3503e742c35b6bd | 7b69361762fe1cc7894f2c4e23f111d0eacfd097 | /lib/error_helper.h | 8ee84f4ceaa86c61970aabb65a595a02774de823 | [
"Apache-2.0"
] | permissive | jneruda/p4c | 8c4eef23afabcd301d3bd933a96e2e47048074c3 | bbdb4bb72fc5c812c70747c8da862221bf88a11f | refs/heads/main | 2023-06-01T18:44:36.673715 | 2021-06-04T22:28:46 | 2021-06-04T22:28:46 | 362,465,967 | 0 | 0 | Apache-2.0 | 2021-04-28T12:51:17 | 2021-04-28T12:51:16 | null | UTF-8 | C++ | false | false | 15,423 | h | /*
Copyright 2013-present Barefoot Networks, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef _LIB_ERROR_HELPER_H_
#define _LIB_ERROR_HELPER_H_
#include <stdarg.h>
#include <map>
#include <set>
#include <type_traits>
#include <unordered_map>
#include <boost/format.hpp>
#include "lib/cstring.h"
#include "lib/source_file.h"
#include "lib/stringify.h"
// All these methods return std::string because this is the native format of boost::format
// Position is printed at the beginning.
static inline std::string error_helper(boost::format& f, std::string message,
std::string position, std::string tail, std::string suffix) {
std::string text = boost::str(f);
std::string result = position;
if (!position.empty())
result += ": ";
result += message + text + "\n" + tail + suffix;
return result;
}
template<class... Args>
std::string error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const char* t, Args... args);
template<class... Args>
std::string error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const cstring& t, Args... args);
template<class... Args>
std::string error_helper(boost::format& f, std::string message,
std::string position, std::string tail, std::string suffix,
const Util::SourceInfo &info, Args... args);
template<typename T, class... Args>
auto error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const T &t, Args... args) ->
typename std::enable_if<Util::HasToString<T>::value &&
!std::is_base_of<Util::IHasSourceInfo, T>::value, std::string>::type;
template<typename T, class... Args>
auto error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const T *t, Args... args) ->
typename std::enable_if<Util::HasToString<T>::value &&
!std::is_base_of<Util::IHasSourceInfo, T>::value, std::string>::type;
template<typename T, class... Args>
auto error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const T &t, Args... args) ->
typename std::enable_if<std::is_base_of<Util::IHasSourceInfo, T>::value, std::string>::type;
template<typename T, class... Args>
auto error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const T *t, Args... args) ->
typename std::enable_if<std::is_base_of<Util::IHasSourceInfo, T>::value, std::string>::type;
template<class... Args>
std::string error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const big_int *t, Args... args);
template<class... Args>
std::string error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const big_int &t, Args... args);
template<typename T, class... Args>
auto
error_helper(boost::format& f, std::string message,
std::string position, std::string tail, std::string suffix,
const T& t, Args... args) ->
typename std::enable_if<std::is_arithmetic<T>::value, std::string>::type;
// actual implementations
template<class... Args>
std::string error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const char* t, Args... args) {
return error_helper(f % t, message, position, tail, suffix, std::forward<Args>(args)...);
}
template<class... Args>
std::string error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const cstring& t, Args... args) {
return error_helper(f % t.c_str(), message, position, tail,
suffix, std::forward<Args>(args)...);
}
template<typename T, class... Args>
auto error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const T &t, Args... args) ->
typename std::enable_if<Util::HasToString<T>::value &&
!std::is_base_of<Util::IHasSourceInfo, T>::value, std::string>::type {
return error_helper(f % t.toString(), message, position, tail,
suffix, std::forward<Args>(args)...);
}
template<typename T, class... Args>
auto error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const T *t, Args... args) ->
typename std::enable_if<Util::HasToString<T>::value &&
!std::is_base_of<Util::IHasSourceInfo, T>::value, std::string>::type {
return error_helper(f % t->toString(), message, position, tail,
suffix, std::forward<Args>(args)...);
}
template<class... Args>
std::string error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const big_int *t, Args... args) {
return error_helper(f % t, message, position, tail, suffix, std::forward<Args>(args)...);
}
template<class... Args>
std::string error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const big_int &t, Args... args) {
return error_helper(f % t, message, position, tail, suffix, std::forward<Args>(args)...);
}
template<typename T, class... Args>
auto
error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const T& t, Args... args) ->
typename std::enable_if<std::is_arithmetic<T>::value, std::string>::type {
return error_helper(f % t, message, position, tail, suffix, std::forward<Args>(args)...);
}
template<class... Args>
std::string error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const Util::SourceInfo &info,
Args... args) {
cstring posString = info.toPositionString();
if (position.empty()) {
position = posString;
posString = "";
} else {
if (!posString.isNullOrEmpty())
posString += "\n";
}
return error_helper(f % "", message, position, tail + posString + info.toSourceFragment(),
suffix, std::forward<Args>(args)...);
}
template<typename T, class... Args>
auto error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const T *t, Args... args) ->
typename std::enable_if<std::is_base_of<Util::IHasSourceInfo, T>::value, std::string>::type {
cstring posString = t->getSourceInfo().toPositionString();
if (position.empty()) {
position = posString;
posString = "";
} else {
if (!posString.isNullOrEmpty())
posString += "\n";
}
return error_helper(f % t->toString(), message, position,
tail + posString + t->getSourceInfo().toSourceFragment(), suffix,
std::forward<Args>(args)...);
}
template<typename T, class... Args>
auto error_helper(boost::format& f, std::string message, std::string position,
std::string tail, std::string suffix, const T &t, Args... args) ->
typename std::enable_if<std::is_base_of<Util::IHasSourceInfo, T>::value, std::string>::type {
cstring posString = t.getSourceInfo().toPositionString();
if (position.empty()) {
position = posString;
posString = "";
} else {
if (!posString.isNullOrEmpty())
posString += "\n";
}
return error_helper(f % t.toString(), message, position,
tail + posString + t.getSourceInfo().toSourceFragment(), suffix,
std::forward<Args>(args)...);
}
/***********************************************************************************/
static inline std::string bug_helper(boost::format& f, std::string message,
std::string position, std::string tail) {
std::string text = boost::str(f);
std::string result = position;
if (!position.empty())
result += ": ";
result += message + text + "\n" + tail;
return result;
}
template<class... Args>
std::string bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const char* t, Args... args);
template<class... Args>
std::string bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const cstring& t, Args... args);
template<class... Args>
std::string bug_helper(boost::format& f, std::string message,
std::string position, std::string tail,
const Util::SourceInfo &info, Args... args);
template<typename T, class... Args>
auto bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const T &t, Args... args) ->
typename std::enable_if<std::is_base_of<Util::IHasSourceInfo, T>::value, std::string>::type;
template<typename T, class... Args>
auto bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const T *t, Args... args) ->
typename std::enable_if<std::is_base_of<Util::IHasSourceInfo, T>::value, std::string>::type;
template<typename T, class... Args>
auto bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const T *t, Args... args) ->
typename std::enable_if<!std::is_base_of<Util::IHasSourceInfo, T>::value, std::string>::type;
template<class... Args>
std::string bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const big_int *t, Args... args);
template<class... Args>
std::string bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const big_int &t, Args... args);
template<typename T, class... Args>
auto
bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const T& t, Args... args) ->
typename std::enable_if<!std::is_base_of<Util::IHasSourceInfo, T>::value,
std::string>::type;
// actual implementations
template<class... Args>
std::string bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const char* t, Args... args) {
return bug_helper(f % t, message, position, tail, std::forward<Args>(args)...);
}
template<class... Args>
std::string bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const cstring& t, Args... args) {
return bug_helper(f % t.c_str(), message, position, tail, std::forward<Args>(args)...);
}
template<typename T, class... Args>
auto bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const T *t, Args... args) ->
typename std::enable_if<!std::is_base_of<Util::IHasSourceInfo, T>::value,
std::string>::type {
std::stringstream str;
str << t;
return bug_helper(f % str.str(), message, position, tail, std::forward<Args>(args)...);
}
template<class... Args>
std::string bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const big_int *t, Args... args) {
return bug_helper(f % t, message, position, tail, std::forward<Args>(args)...);
}
template<class... Args>
std::string bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const big_int &t, Args... args) {
return bug_helper(f % t, message, position, tail, std::forward<Args>(args)...);
}
template<typename T, class... Args>
auto
bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const T& t, Args... args) ->
typename std::enable_if<!std::is_base_of<Util::IHasSourceInfo, T>::value,
std::string>::type {
return bug_helper(f % t, message, position, tail, std::forward<Args>(args)...);
}
template<class... Args>
std::string bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const Util::SourceInfo &info, Args... args) {
cstring posString = info.toPositionString();
if (position.empty()) {
position = posString;
posString = "";
} else {
if (!posString.isNullOrEmpty())
posString += "\n";
}
return bug_helper(f % "", message, position, tail + posString + info.toSourceFragment(),
std::forward<Args>(args)...);
}
template<typename T, class... Args>
auto bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const T *t, Args... args) ->
typename std::enable_if<std::is_base_of<Util::IHasSourceInfo, T>::value, std::string>::type {
if (t == nullptr) {
return bug_helper(f, message, position,
tail, std::forward<Args>(args)...);
}
cstring posString = t->getSourceInfo().toPositionString();
if (position.empty()) {
position = posString;
posString = "";
} else {
if (!posString.isNullOrEmpty())
posString += "\n";
}
std::stringstream str;
str << t;
return bug_helper(f % str.str(), message, position,
tail + posString + t->getSourceInfo().toSourceFragment(),
std::forward<Args>(args)...);
}
template<typename T, class... Args>
auto bug_helper(boost::format& f, std::string message, std::string position,
std::string tail, const T &t, Args... args) ->
typename std::enable_if<std::is_base_of<Util::IHasSourceInfo, T>::value, std::string>::type {
cstring posString = t.getSourceInfo().toPositionString();
if (position.empty()) {
position = posString;
posString = "";
} else {
if (!posString.isNullOrEmpty())
posString += "\n";
}
std::stringstream str;
str << t;
return bug_helper(f % str.str(), message, position,
tail + posString + t.getSourceInfo().toSourceFragment(),
std::forward<Args>(args)...);
}
#endif // _LIB_ERROR_HELPER_H_
| [
"noreply@github.com"
] | noreply@github.com |
814d614c548f7e727bafb1d11375b387d2f80f5e | 413152f28183be8116b665e58b048495e2cbb564 | /Programs/C++/CodeChef/GukiZ.cpp | 47f63254fe602092116c7b374b1fb84b3372778e | [] | no_license | avii-ahuja/Competitive-Programmming | a5340a7e3b0f46e6643b7251208557ed6453d80f | e2b9b1efa1ee60bf5375e84c5778af81e05daf28 | refs/heads/master | 2021-10-22T13:41:56.933137 | 2018-12-09T17:29:33 | 2018-12-09T17:29:33 | 162,143,800 | 1 | 0 | null | 2018-12-17T14:35:45 | 2018-12-17T14:35:44 | null | UTF-8 | C++ | false | false | 589 | cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t = 0, n = 0, z1 = 0, z2 = 0;
cin >> t;
while (t--)
{
cin >> n >> z1 >> z2;
int arr[n];
for (int i = 0; i < n; i++)
{
cin >> arr[n];
}
for (int i = 0; i < 10000000000; i++)
{
if (z1 == 0 || z2 == 0)
{
cout << 1;
}
else if (z1 < 0 || z2 = < 0)
{
cout << 2;
}
else
{
z
}
}
}
} | [
"salilgokhale03@gmail.com"
] | salilgokhale03@gmail.com |
c80451599df40fa2db98ee0afce4aae96cfe7b71 | dba99c936163ced1fdff7fb37a5f20a181636315 | /GM/GmDoc.h | 7ddf084df72f591c531db6404bf5af6c913d565e | [
"MIT"
] | permissive | BrentEaston/cbwindows | 4aab69b63bc0153f23b7e2d141cefbaf29a5ff71 | 51b44d2e71aec0c9fe41795bc8c99cc905668517 | refs/heads/master | 2023-02-04T18:26:25.657907 | 2020-11-22T19:32:27 | 2020-11-22T21:35:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,290 | h | // GmDoc.h : interface of the CGamDoc class
//
// Copyright (c) 1994-2020 By Dale L. Larson, All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
/////////////////////////////////////////////////////////////////////////////
#ifndef _GMDOC_H
#define _GMDOC_H
#ifndef _FONT_H
#include "Font.h"
#endif
#ifndef _TILE_H
#include "Tile.h"
#endif
#ifndef _BOARD_H
#include "Board.h"
#endif
#ifndef _PALTILE_H
#include "PalTile.h"
#endif
#ifndef _MAPSTRNG_H
#include "MapStrng.h"
#endif
//////////////////////////////////////////////////////////////////////
#define KEY_PASS_POSTFIX "BaDkArMa"
//////////////////////////////////////////////////////////////////////
// Hints for UpdateAllViews/OnUpdate
#define HINT_ALWAYSUPDATE 0 // Must be zero!
#define HINT_TILECREATED 1 // HIWORD = TileID
#define HINT_TILEMODIFIED 2 // HIWORD = TileID
#define HINT_TILEDELETED 3 // HIWORD = TileID
#define HINT_TILEGROUP 0x0F // Mask for all tile hints
#define HINT_BOARDDELETED 0x10 // pHint->m_pBoard;
#define HINT_TILESETDELETED 0x11 // pHint->m_nVal = tset num
#define HINT_PIECESETDELETED 0x12 // pHint->m_nVal = pset num
#define HINT_MARKSETDELETED 0x13 // pHint->m_nVal = mset num
#define HINT_PIECEDELETED 0x14
#define HINT_MARKERDELETED 0x15
#define HINT_DELETEGROUP 0x10 // Set if delete hint group
#define HINT_TILESETPROPCHANGE 0x20
#define HINT_BOARDPROPCHANGE 0x21 // pHint->m_pBoard
#define HINT_PIECESETPROPCHANGE 0x22
#define HINT_MARKERSETPROPCHANGE 0x23
#define HINT_FORCETILEUPDATE 0x40 // Used before a save is done
#define HINT_UPDATEPROJVIEW 0x0100 // Used to reload prject window
class CGmBoxHint : public CObject
{
DECLARE_DYNCREATE(CGmBoxHint);
public:
union
{
void* m_pVoid;
CBoard* m_pBoard;
int m_nVal;
};
};
//////////////////////////////////////////////////////////////////////
class CDib;
class CPieceManager;
class CMarkManager;
class CGamDoc : public CDocument
{
friend class CGbxProjView;
protected:
CGamDoc();
DECLARE_DYNCREATE(CGamDoc)
// Class Global Attributes
public:
static CFontTbl m_fontTbl;
static CFontTbl* GetFontManager() { return &m_fontTbl; }
// Current Tile Manager. Only valid when Serializing
static CTileManager* c_pTileMgr;
// Version of file being loaded
static int c_fileVersion;
// Attributes
public:
void ExportGamebox(LPCSTR pszPathName);
// Current Tile Manager. Only valid when Serializing
static CTileManager* GetCurrentTileManager() { return c_pTileMgr; }
static void SetLoadingVersion(int ver) { c_fileVersion = ver; }
static int GetLoadingVersion() { return c_fileVersion; }
// -------- //
DWORD GetGameBoxID() { return m_dwGameID; }
// -------- //
CBoardManager* GetBoardManager() { return m_pBMgr; }
CTileManager* GetTileManager() { return m_pTMgr; }
CPieceManager* GetPieceManager() { return m_pPMgr; }
CMarkManager* GetMarkManager() { return m_pMMgr; }
CTilePalette* GetTilePalWnd() { return &m_palTile; }
// -------- //
BOOL GetStickyDrawTools() { return m_bStickyDrawTools; }
// -------- //
void IncrMajorRevLevel();
DWORD IssueGameBoxID();
// If you need to pass a pointer to the views to be created,
// bracket the view can call the GetCreateParameter() method.
// It is only valid during the InitialUpdate() method.
LPVOID GetCreateParameter() { return m_lpvCreateParam; }
// Operations
public:
BOOL SetupBlankBoard();
BOOL CreateNewFrame(CDocTemplate* pTemplate, LPCSTR pszTitle,
LPVOID lpvCreateParam = NULL);
BOOL NotifyTileDatabaseChange(BOOL bPurgeScan = TRUE);
BOOL PurgeMissingTileIDs();
BOOL QueryTileInUse(TileID tid);
BOOL QueryAnyOfTheseTilesInUse(CWordArray& tbl);
TileID CreateTileFromDib(CDib* pDib, int nTSet);
CView* FindTileEditorView(TileID tid);
CView* FindBoardEditorView(CBoard* pBoard);
// Support for strings associated with game elements (pieces, markers)
CString GetGameElementString(GameElement gelem);
BOOL HasGameElementString(GameElement gelem);
BOOL DoBoardPropertyDialog(CBoard* pBoard);
void DoGbxProperties() { OnEditGbxProperties(); }
void DoCreateBoard() { OnEditCreateBoard(); }
void DoCreateTileGroup() { OnEditCreateTileGroup(); }
void DoCreatePieceGroup() { OnEditCreatePieceGroup(); }
void DoCreateMarkGroup() { OnEditCreateMarkGroup(); }
int GetCompressLevel() { return (int)m_wCompressLevel; }
void SetCompressLevel(int nCompressLevel) { m_wCompressLevel = (WORD)nCompressLevel; }
LPVOID GetCustomColors();
void SetCustomColors(LPVOID pCustColors);
CGameElementStringMap& GetGameStringMap() { return m_mapStrings; }
void ComputeGameboxPasskey(LPCTSTR pszPassword, LPBYTE pBfr);
void ClearGameboxPasskey();
void OnFileClose() { CDocument::OnFileClose(); } // Expose protected
// OnIdle is called by the App object to inform
// documents of idle condition. A flag indicates if
// this is the active document.
void OnIdle(BOOL bActive);
// Forced override of this (note not virtual)
void UpdateAllViews(CView* pSender, LPARAM lHint = 0L,
CObject* pHint = NULL);
// Implementation
protected:
BYTE m_abyteBoxID[16];// Special hashed UUID assigned to this gamebox.
WORD m_wReserved1; // For future need (set to 0)
WORD m_wReserved2; // For future need (set to 0)
WORD m_wReserved3; // For future need (set to 0)
WORD m_wReserved4; // For future need (set to 0)
WORD m_nBitsPerPixel;// Geometry of bitmaps (4bpp or 8bpp)
DWORD m_dwMajorRevs; // Major revisions (stuff was deleted)
DWORD m_dwMinorRevs; // Minor revisions (stuff was added)
DWORD m_dwGameID; // Unique autogened signature for gamebox
CString m_strAuthor; // Game box author (<= 32 chars)
CString m_strTitle; // Game box tile (<= 64 chars)
CString m_strDescr; // Game box description (<= 64 chars)
BYTE m_abytePass[16];// MD5 Hash of password and uuid based box ID
WORD m_wCompressLevel;// Amount of compression to apply to bitmaps and such
CGameElementStringMap m_mapStrings; // Mapping of pieces and markers to strings.
LPVOID m_pCustomColors; // Container for custom edit colors
CTileManager* m_pTMgr; // Tiles
CBoardManager* m_pBMgr; // Playing boards
CPieceManager* m_pPMgr; // Playing pieces
CMarkManager* m_pMMgr; // Annotation markers
BOOL m_bStickyDrawTools; // If TRUE, don't select the select tool after drawing
BOOL m_bMajorRevIncd;// Major rev number was increased.
CTilePalette m_palTile; // Tile palette child window is in document
LPVOID m_lpvCreateParam; // Used to pass parameters to new views
public:
virtual ~CGamDoc();
virtual void Serialize(CArchive& ar); // overridden for document i/o
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
virtual BOOL OnNewDocument();
virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
virtual BOOL OnSaveDocument(const char* pszPathName);
virtual void DeleteContents();
virtual void OnCloseDocument();
// Generated message map functions
protected:
afx_msg void OnEditGbxProperties();
afx_msg void OnEditCreateBoard();
afx_msg void OnEditCreateTileGroup();
afx_msg void OnEditCreatePieceGroup();
afx_msg void OnEditCreateMarkGroup();
afx_msg void OnProjectChangeFingerPrint();
afx_msg void OnStickyDrawTools();
afx_msg void OnUpdateStickyDrawTools(CCmdUI* pCmdUI);
afx_msg void OnDumpTileData();
afx_msg void OnBugFixDumpBadTiles();
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnExportGamebox();
};
#endif
| [
"dlarson42@gmail.com"
] | dlarson42@gmail.com |
d094f545871fe652fd4f2eb3a05b6371a2a73c89 | 407855515e60463898a699d4f5e04e8c6c8a479b | /src/testApp.h | 15805af57322c01c1b13ea2669f83cfc88a48368 | [] | no_license | roymacdonald/ofxSKT | 7d8a55fac6f3544bd54a9dd2a6eb3a29f75fbe55 | 389641cfd5f0e99b0097daba8ae0d2781b8dc5c7 | refs/heads/master | 2021-06-02T08:29:35.173578 | 2012-06-22T14:04:45 | 2012-06-22T14:04:45 | 4,751,676 | 2 | 1 | null | 2019-10-10T17:52:13 | 2012-06-22T13:58:25 | C++ | UTF-8 | C++ | false | false | 727 | h | #pragma once
//#include "ofMain.h"
#include "ofxSKT.h"
#include "opencv2/core/core_c.h"
#include "opencv2/core/core.hpp"
#include "glWarper.h"
class testApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
ofxSKT skt;
Mat imgRGB, imgMap, maskMap;
VideoCapture capture;
glWarper warper;
bool bWarpEnable;
bool cornersProc;
};
| [
"macdonald.roy@gmail.com"
] | macdonald.roy@gmail.com |
69d321b2b11f2770d23f6352bf0280122cd5f643 | 5da3f58e41179a5c849ad837d224cae8a015c354 | /Object-Oriented Programming/Lab5/ex1.h | d0be7cfa85039d4cbc462788f37453394c1ed71e | [] | no_license | Maghangordan/Academic-Work | b4638b7e0d8615238899ec0d2f0485ad923a0a03 | 036f961d2b67c250098d4c8169d42c6b2387d188 | refs/heads/master | 2023-08-28T22:36:05.343527 | 2021-10-27T15:49:37 | 2021-10-27T15:49:37 | 277,847,801 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 191 | h | #include <stdlib.h>
#ifndef ex1
#define ex1
template <typename T>
const T pi =T(3.1415926535897932385L);
template <typename T>
T inPiRange(T input)
{
return (input<pi<T>);
}
#endif | [
"noreply@github.com"
] | noreply@github.com |
ac0c5f3b1ca298f7777d8ed5095e2b3386cf8aae | 7d53464c0c04f464141f30f0c291f87a74c4a750 | /Sudoku1/mainwindow.h | bb1689e5a12e8aa70de5352ffe3665d9911ff8cf | [] | no_license | LLLLLayer/QT-Sudoku | 65c0a6dc4c47caca0f9fd50ccc2a790300c32373 | d60404a3c6afe6ab2e6a6826ef8cbaaf321db75b | refs/heads/master | 2020-06-30T09:59:34.549216 | 2020-01-09T12:31:21 | 2020-01-09T12:31:21 | 200,796,375 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 823 | h | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QPushButton>
#include <QSignalMapper>
#include <QAction>
#include "const.h"
#include "debug.h"
namespace Ui {
class MainWindow;
}
class Logic;
class MainWindow : public QMainWindow
{
Q_OBJECT
friend class Logic;
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void closeEvent(QCloseEvent *event);
void keyPressEvent(QKeyEvent *event);
bool eventFilter(QObject *obj, QEvent *event);
public slots:
void numberPressed(int);
private:
QPushButton *number[10];
QPushButton *grid[10][10];
QPushButton *test;
QAction *actionLevel[15];
enum{
size = 55,
padding = 10
};
Ui::MainWindow *ui;
QSignalMapper *mapper;
Logic *logic;
};
#endif // MAINWINDOW_H
| [
"859258277@qq.com"
] | 859258277@qq.com |
1ca1d9f5732287c688d4d5dce4d5cf260813da78 | 0908262cf80a627e6be8a6d7d700f27df5463baa | /tools/ssdb-bench.cpp | dc822bfdd1610070883eb17f884a8f7492010fcb | [
"BSD-3-Clause"
] | permissive | ezhangle/ssdb | 0fa3e64c59508a9eb039e19ee6a2556b8a83f336 | 45af322ea5aff2dd0deb3ebf355bc470252a55c2 | refs/heads/master | 2021-01-19T07:38:28.657663 | 2014-11-06T03:34:02 | 2014-11-06T03:34:02 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,715 | cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <string>
#include <vector>
#include <map>
#include "net/link.h"
#include "net/fde.h"
#include "util/log.h"
#include "version.h"
#include "../src/include.h"
struct Data
{
std::string key;
std::string val;
std::string num;
};
std::map<std::string, Data *> *ds;
Fdevents *fdes;
std::vector<Link *> *free_links;
void welcome(){
printf("ssdb-bench - SSDB benchmark tool, %s\n", SSDB_VERSION);
printf("Copyright (c) 2013-2014 ssdb.io\n");
printf("\n");
}
void usage(int argc, char **argv){
printf("Usage:\n");
printf(" %s [ip] [port] [requests] [clients]\n", argv[0]);
printf("\n");
printf("Options:\n");
printf(" ip server ip (default 127.0.0.1)\n");
printf(" port server port (default 8888)\n");
printf(" requests Total number of requests (default 10000)\n");
printf(" clients Number of parallel connections (default 50)\n");
printf("\n");
}
void init_data(int num){
srand(time(NULL));
ds = new std::map<std::string, Data *>();
while(ds->size() < num){
Data *d = new Data();
char buf[1024];
int n = rand();
snprintf(buf, sizeof(buf), "%d", n);
d->num = buf;
snprintf(buf, sizeof(buf), "k%010d", n);
d->key = buf;
snprintf(buf, sizeof(buf), "v%0100d", n);
d->val = buf;
ds->insert(make_pair(d->key, d));
}
}
void init_links(int num, const char *ip, int port){
fdes = new Fdevents();
free_links = new std::vector<Link *>();
for(int i=0; i<num; i++){
Link *link = Link::connect(ip, port);
if(!link){
fprintf(stderr, "connect error! %s\n", strerror(errno));
exit(0);
}
fdes->set(link->fd(), FDEVENT_IN, 0, link);
free_links->push_back(link);
}
}
void send_req(Link *link, const std::string &cmd, const Data *d){
if(cmd == "set"){
link->send(cmd, d->key, d->val);
}else if(cmd == "get"){
link->send(cmd, d->key);
}else if(cmd == "del"){
link->send(cmd, d->key);
}else if(cmd == "hset"){
link->send(cmd, "TEST", d->key, d->val);
}else if(cmd == "hget"){
link->send(cmd, "TEST", d->key);
}else if(cmd == "hdel"){
link->send(cmd, "TEST", d->key);
}else if(cmd == "zset"){
link->send(cmd, "TEST", d->key, d->num);
}else if(cmd == "zget"){
link->send(cmd, "TEST", d->key);
}else if(cmd == "zdel"){
link->send(cmd, "TEST", d->key);
}else if(cmd == "qpush"){
link->send(cmd, "TEST", d->key);
}else if(cmd == "qpop"){
link->send(cmd, "TEST");
}else{
log_error("bad command!");
exit(0);
}
link->flush();
}
void bench(std::string cmd){
int total = (int)ds->size();
int finished = 0;
int num_sent = 0;
printf("========== %s ==========\n", cmd.c_str());
std::map<std::string, Data *>::iterator it;
it = ds->begin();
double stime = millitime();
while(1){
while(!free_links->empty()){
if(num_sent == total){
break;
}
num_sent ++;
Link *link = free_links->back();
free_links->pop_back();
send_req(link, cmd, it->second);
it ++;
}
const Fdevents::events_t *events;
events = fdes->wait(50);
if(events == NULL){
log_error("events.wait error: %s", strerror(errno));
break;
}
for(int i=0; i<(int)events->size(); i++){
const Fdevent *fde = events->at(i);
Link *link = (Link *)fde->data.ptr;
int len = link->read();
if(len <= 0){
log_error("fd: %d, read: %d, delete link", link->fd(), len);
exit(0);
}
const std::vector<Bytes> *resp = link->recv();
if(resp == NULL){
log_error("error");
break;
}else if(resp->empty()){
continue;
}else{
if(resp->at(0) != "ok"){
log_error("bad response: %s", resp->at(0).String().c_str());
exit(0);
}
free_links->push_back(link);
finished ++;
if(finished == total){
double etime = millitime();
double ts = (stime == etime)? 1 : (etime - stime);
double speed = total / ts;
printf("qps: %d, time: %.3f s\n", (int)speed, ts);
return;
}
}
}
}
}
int main(int argc, char **argv){
const char *ip = "127.0.0.1";
int port = 8888;
int requests = 10000;
int clients = 50;
welcome();
usage(argc, argv);
for(int i=1; i<argc; i++){
if(strcmp("-v", argv[i]) == 0){
exit(0);
}
}
if(argc > 1){
ip = argv[1];
}
if(argc > 2){
port = atoi(argv[2]);
}
if(argc > 3){
requests = atoi(argv[3]);
}
if(argc > 4){
clients = atoi(argv[4]);
}
//printf("preparing data...\n");
init_data(requests);
//printf("preparing links...\n");
init_links(clients, ip, port);
bench("set");
bench("get");
bench("del");
bench("hset");
bench("hget");
bench("hdel");
bench("zset");
bench("zget");
bench("zdel");
bench("qpush");
bench("qpop");
printf("\n");
return 0;
}
| [
"ideawu@local"
] | ideawu@local |
20b43d96ec249ff7b458129b29db8fd952e6c474 | e960970912ed29e3d250e4d03271c312e73ae73e | /2017/20170901.cpp | d34c114d2530ab0b14693f18da15f64831a608fd | [
"MIT"
] | permissive | ququ0129/CSP_Contest | 13316bb4501f63eb8970585bdf05ec5fb60139b1 | 841b5895420e825bd301e05994f1724a76053894 | refs/heads/master | 2022-03-16T09:02:54.045628 | 2019-10-29T06:47:26 | 2019-10-29T06:47:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 223 | cpp | #include<iostream>
using namespace std;
int main(){
int m,b=0;
cin>>m;
if(m>=50){
b+=(m/50)*7;
m%=50;
}
if(m>=30){
b+=(m/30)*4;
m%=30;
}
if(m>=10){
b+=(m/10);
}
cout<<b;
return 0;
}
| [
"441983697@qq.com"
] | 441983697@qq.com |
5704e55adcddfa9100b5f71bc6addef12fc20022 | 31030f9c260a2befb67b85350f0a6adde5163f14 | /src/utiltime.cpp | 8797d819e5200720c64cf666d86a3434be98053c | [
"MIT"
] | permissive | shahripal/e-BlockCoin-Silver | 05322d716be0eb63b2d7a814abb20d7e2cd3c7c9 | 0f0522fce9c9fb2b8432bdbe13c7cf71263dce4b | refs/heads/master | 2020-04-11T02:23:45.562050 | 2018-11-05T09:29:07 | 2018-11-05T09:29:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,530 | cpp | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2016-2017 The eBlockCoin 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/eblockcoin-config.h"
#endif
#include "tinyformat.h"
#include "utiltime.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/thread.hpp>
using namespace std;
static int64_t nMockTime = 0; //! For unit testing
int64_t GetTime()
{
if (nMockTime) return nMockTime;
return time(NULL);
}
void SetMockTime(int64_t nMockTimeIn)
{
nMockTime = nMockTimeIn;
}
int64_t GetTimeMillis()
{
return (boost::posix_time::ptime(boost::posix_time::microsec_clock::universal_time()) -
boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1)))
.total_milliseconds();
}
int64_t GetTimeMicros()
{
return (boost::posix_time::ptime(boost::posix_time::microsec_clock::universal_time()) -
boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1)))
.total_microseconds();
}
void MilliSleep(int64_t n)
{
/**
* Boost's sleep_for was uninterruptable when backed by nanosleep from 1.50
* until fixed in 1.52. Use the deprecated sleep method for the broken case.
* See: https://svn.boost.org/trac/boost/ticket/7238
*/
#if defined(HAVE_WORKING_BOOST_SLEEP_FOR)
boost::this_thread::sleep_for(boost::chrono::milliseconds(n));
#elif defined(HAVE_WORKING_BOOST_SLEEP)
boost::this_thread::sleep(boost::posix_time::milliseconds(n));
#else
//should never get here
#error missing boost sleep implementation
#endif
}
std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime)
{
// std::locale takes ownership of the pointer
std::locale loc(std::locale::classic(), new boost::posix_time::time_facet(pszFormat));
std::stringstream ss;
ss.imbue(loc);
ss << boost::posix_time::from_time_t(nTime);
return ss.str();
}
std::string DurationToDHMS(int64_t nDurationTime)
{
int seconds = nDurationTime % 60;
nDurationTime /= 60;
int minutes = nDurationTime % 60;
nDurationTime /= 60;
int hours = nDurationTime % 24;
int days = nDurationTime / 24;
if (days)
return strprintf("%dd %02dh:%02dm:%02ds", days, hours, minutes, seconds);
if (hours)
return strprintf("%02dh:%02dm:%02ds", hours, minutes, seconds);
return strprintf("%02dm:%02ds", minutes, seconds);
}
| [
"44762973+eblockcoin7@users.noreply.github.com"
] | 44762973+eblockcoin7@users.noreply.github.com |
9058e669f2100b0e7beed3b9e4c8fc5449be2310 | e9f0f35ea8eeea204e915d82fd3d35960a403eef | /sources/include/cage-core/memoryAllocators.h | 15398a6f276374055289aa8dcd1625d352a1a030 | [
"MIT"
] | permissive | ucpu/cage | a0b03aa60f63b76f6170bf0a739480efbfd97a0b | 869966a5b47a987d52c6773b434fdd46ce80eeab | refs/heads/master | 2023-09-06T00:14:27.765940 | 2023-09-04T08:08:11 | 2023-09-04T18:35:11 | 125,400,355 | 32 | 4 | MIT | 2022-10-27T21:59:45 | 2018-03-15T17:03:57 | C++ | UTF-8 | C++ | false | false | 1,658 | h | #ifndef guard_memoryAllocators_h_1swf4glmnb9s
#define guard_memoryAllocators_h_1swf4glmnb9s
#include <cage-core/core.h>
namespace cage
{
// fastest memory allocator
// individual deallocations are forbidden
// always use flush to clear all allocations
// allocations can have any sizes and alignments (within the block size)
struct CAGE_CORE_API MemoryAllocatorLinearCreateConfig
{
uintPtr blockSize = 4 * 1024 * 1024;
};
CAGE_CORE_API Holder<MemoryArena> newMemoryAllocatorLinear(const MemoryAllocatorLinearCreateConfig &config);
// stream allocator with individual deallocations
// both individual deallocations (in any order) and flushing are available
// blocks are reused in fifo order and only after fully cleared
// allocations can have any sizes and alignments (within the block size)
struct CAGE_CORE_API MemoryAllocatorStreamCreateConfig
{
uintPtr blockSize = 4 * 1024 * 1024;
};
CAGE_CORE_API Holder<MemoryArena> newMemoryAllocatorStream(const MemoryAllocatorStreamCreateConfig &config);
// allocator facade for use in std containers
template<class T>
struct MemoryAllocatorStd
{
using value_type = T;
MemoryAllocatorStd() : a(systemMemory()) {}
explicit MemoryAllocatorStd(const MemoryArena &arena) : a(arena) {}
template<class TT>
explicit MemoryAllocatorStd(const MemoryAllocatorStd<TT> &other) : a(other.a)
{}
T *allocate(uintPtr cnt) { return (T *)a.allocate(cnt * sizeof(T), alignof(T)); }
void deallocate(T *ptr, uintPtr) { a.deallocate(ptr); }
private:
MemoryArena a;
template<class TT>
friend struct MemoryAllocatorStd;
};
}
#endif // guard_memoryAllocators_h_1swf4glmnb9s
| [
"malytomas@ucpu.cz"
] | malytomas@ucpu.cz |
87676f3804acfcbb862b2685b50892a65636de6b | 807a0d9125453c5a6efdd343bcbaeaef21fa6612 | /PDCursesSample/PDCursesSample.cpp | 270a5d43e04b81ff1bb844b9500d855c826c572e | [] | no_license | santakagawa/C_Last_report | 97dd83ae97dadbb2738f5b31a1ec94ae811368b6 | 15ac30987cda55e0187603d2b02d59363281c178 | refs/heads/master | 2023-06-22T08:32:35.018628 | 2021-07-16T14:00:41 | 2021-07-16T14:00:41 | 386,244,421 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,633 | cpp | // PDCursesSample.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <curses.h>
#include <Windows.h>
#include "sub.h"
#include "myMath.cpp"
int main(int argc, char* argv[])
{
iniRead();
char buf[BUFFSIZE];
int key; // 入力キー文字
int cnt = 0;
// 画面の初期化
initscr();
//キー設定
noecho();
cbreak();
keypad(stdscr, TRUE);
curs_set(0); // カーソルは表示しない
timeout(0); // キー入力は待たない
// 時計の表示
while (1) {
//画面の初期化
erase();
//現在時間取得
GetTimeStr(buf, BUFLEN, cnt);
//画面表示
mvaddstr(y - 14, x - 50, "World Clock");
mvaddstr(y - 11, x - 50, "press 'a' turn Left, press 'l' turn Right");
mvaddstr(y - 8, x - 50, "press 's' output location and time and close the application");
DrawClock(buf); // 時刻文字列を表示
cityPrint(cnt);
refresh();
//キー判定
key = getch();
//右にシフト(行きすぎたら左端に戻る)
if (key == 'l') {
if (cnt >= 0 && cnt < 4) {
cnt++;
}
else {
cnt = 0;
}
}
//左にシフト(行きすぎたら右端に戻る)
if (key == 'a') {
if (cnt > 0 && cnt <= 4) {
cnt--;
}
else {
cnt = 4;
}
}
//時刻を保存して終了
if (key == 's') {
preserve(buf, cnt);
break;
}
}
// 終了
endwin();
return (0);
}
| [
"75157069+santakagawa@users.noreply.github.com"
] | 75157069+santakagawa@users.noreply.github.com |
a66cc1b90e83b57e2dfce097087056427431fa8f | 61556230c7923916a9d61f68520a8d85827d46fd | /C++/reverse_solution.cpp | c13f07668af51098fdbf803f948208f895af893a | [] | no_license | user4194304/cubot | a8a229fcc889cecc16449d3b5e5b4a29af41f83e | ae199bf9994c46c0f8975e12d18efa87704abb8b | refs/heads/master | 2021-07-21T14:39:45.196624 | 2017-11-01T06:33:45 | 2017-11-01T06:33:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 352 | cpp | #include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main()
{
freopen("SOLUTION.txt","r",stdin);
freopen("after_reverse.txt","w",stdout);
string s,ans="";
cin>>s;
int len=s.length();
for(int i=0;i<len;i+=2)
{
ans+=s[len-1-i-1];
ans+='0'+'4'-s[len-1-i];
}
cout<<ans<<endl;
return 0;
}
| [
"apple@promote.cache-dns.local"
] | apple@promote.cache-dns.local |
68329afb47970df908b43aaefe6ac990bf26fe29 | 35b929181f587c81ad507c24103d172d004ee911 | /SrcLib/core/fwAtoms/test/tu/include/BooleanTest.hpp | 00b0b6fce3d9b83f22657724fae81b150989dcdd | [] | no_license | hamalawy/fw4spl | 7853aa46ed5f96660123e88d2ba8b0465bd3f58d | 680376662bf3fad54b9616d1e9d4c043d9d990df | refs/heads/master | 2021-01-10T11:33:53.571504 | 2015-07-23T08:01:59 | 2015-07-23T08:01:59 | 50,699,438 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 744 | hpp | /* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2013.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
#ifndef __FWATOMS_UT_BOOLEANTEST_HPP__
#define __FWATOMS_UT_BOOLEANTEST_HPP__
#include <cppunit/extensions/HelperMacros.h>
namespace fwAtoms
{
namespace ut
{
class BooleanTest : public CPPUNIT_NS::TestFixture
{
CPPUNIT_TEST_SUITE( BooleanTest );
CPPUNIT_TEST( conversion );
CPPUNIT_TEST_SUITE_END();
public:
// interface
void setUp();
void tearDown();
void conversion();
};
} // namespace ut
} // namespace fwAtoms
#endif // __FWATOMS_UT_BOOLEANTEST_HPP__
| [
"fbridault@IRCAD.FR"
] | fbridault@IRCAD.FR |
b7e6783c13c63793355c201cd20b48fa8720bd15 | 42e5582c11598d53d661ea45c084a7bede457761 | /SDK-GCC/include/Utils/UIDelegate.h | f149304f4187c9a7bab689500d9220a4be9a2a7c | [] | no_license | steezer/duilib | 24c17b795b6d577f2cc49befb3b6345b11c0e19a | babeff3b77d3590bcb987c7e5316cb9a194ae3ab | refs/heads/master | 2020-09-09T23:08:44.996337 | 2019-11-19T09:13:28 | 2019-11-19T09:13:28 | 221,592,249 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,181 | h | #ifndef __UIDELEGATE_H__
#define __UIDELEGATE_H__
#pragma once
namespace DuiLib {
class DUILIB_API CDelegateBase
{
public:
CDelegateBase(void* pObject, void* pFn);
CDelegateBase(const CDelegateBase& rhs);
virtual ~CDelegateBase();
bool Equals(const CDelegateBase& rhs) const;
bool operator() (void* param);
virtual CDelegateBase* Copy() const = 0; // add const for gcc
protected:
void* GetFn();
void* GetObject();
virtual bool Invoke(void* param) = 0;
private:
void* m_pObject;
void* m_pFn;
};
class CDelegateStatic: public CDelegateBase
{
typedef bool (*Fn)(void*);
public:
CDelegateStatic(Fn pFn) : CDelegateBase(NULL, *(void**)&pFn) { }
CDelegateStatic(const CDelegateStatic& rhs) : CDelegateBase(rhs) { }
virtual CDelegateBase* Copy() const { return new CDelegateStatic(*this); }
protected:
virtual bool Invoke(void* param)
{
Fn pFn = (Fn)GetFn();
return (*pFn)(param);
}
};
template <class O, class T>
class CDelegate : public CDelegateBase
{
typedef bool (T::* Fn)(void*);
public:
CDelegate(O* pObj, Fn pFn) : CDelegateBase(pObj, *(void**)&pFn) { }
CDelegate(const CDelegate& rhs) : CDelegateBase(rhs) { }
virtual CDelegateBase* Copy() const { return new CDelegate(*this); }
protected:
virtual bool Invoke(void* param)
{
O* pObject = (O*) GetObject();
union
{
void* ptr;
Fn fn;
} func = { GetFn() };
return (pObject->*func.fn)(param);
}
private:
Fn m_pFn;
};
template <class O, class T>
CDelegate<O, T> MakeDelegate(O* pObject, bool (T::* pFn)(void*))
{
return CDelegate<O, T>(pObject, pFn);
}
inline CDelegateStatic MakeDelegate(bool (*pFn)(void*))
{
return CDelegateStatic(pFn);
}
class DUILIB_API CEventSource
{
typedef bool (*FnType)(void*);
public:
~CEventSource();
operator bool();
void operator+= (const CDelegateBase& d); // add const for gcc
void operator+= (FnType pFn);
void operator-= (const CDelegateBase& d);
void operator-= (FnType pFn);
bool operator() (void* param);
protected:
CDuiPtrArray m_aDelegates;
};
} // namespace DuiLib
#endif // __UIDELEGATE_H__ | [
"spring.wind2006@163.com"
] | spring.wind2006@163.com |
b367dae93d798ffdb98d0680a5216b622dc32b2a | cff041c04f6c4306db161d714f5d7ed7a439615c | /Gabor00.cpp | afd1fd83ca1bc1f542847ef91d1ae8a63fc8dcc1 | [] | no_license | burnetz/wavelet | af30359c04a3c880483799b4e9988e331c8c64d3 | d6134f63315007a14ab9e09436fdc478607b7d1e | refs/heads/master | 2023-07-19T01:50:44.147393 | 2021-09-05T14:55:07 | 2021-09-05T14:55:07 | 383,527,728 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,347 | cpp | #include <stdio.h>
#include <math.h>
#include "Gabor00.h"
#define _PI 3.14159265358979323846264338327950288419716939937510
#define WIN_RATE 0.01
CGabor00::CGabor00()
{
for (int i = 0; i < 8; i++)
{
m_pWork[i] = NULL;
}
}
CGabor00::~CGabor00()
{
for (int i = 0; i < 8; i++)
{
if (m_pWork[i] != NULL)
{
delete m_pWork[i];
}
}
}
bool CGabor00::Prepare(double *input, int inputN)
{
m_pInput = input;
m_nInputN = inputN;
return true;
}
bool CGabor00::SetParameter(double sigma, double omega, double a){
bool ret = false;
for(int i = 0; i < 2; i++){
if(m_pWork[i] != NULL){
delete m_pWork[i];
}
m_pWork[i] = NULL;
}
if(sigma <= 0.0 || omega <= 0.0 || a <= 0.0){
return ret;
}
m_nGaborOffset = (int)(sqrt(-2.0*sigma*sigma*a*a*log(WIN_RATE)));
m_nGaborN = m_nGaborOffset*2 + 1;
int i;
for(i = 0; i < 2; i++){
m_pWork[i] = new double[m_nGaborN];
if(m_pWork[i] == NULL){
break;
}
}
if(i == 2){
m_pGaborR = m_pWork[0];
m_pGaborI = m_pWork[1];
ret = true;
}
if(ret == true){
for(i = 0 ; i < m_nGaborN; i++){
double x = (double)(i - m_nGaborOffset)/a;
double d = exp(-x*x/(2.0*sigma*sigma))/sqrt(2.0*_PI*sigma*sigma);
m_pGaborR[i] = d*cos(omega*x)/sqrt(a);
m_pGaborI[i] = d*sin(omega*x)/sqrt(a);
}
}
return ret;
}
double CGabor00::Gabor(int b){
if(m_pWork[0] == NULL){
return 0.0;
}
double dr = 0.0;
double di = 0.0;
double real2, imag2;
for(int i = -(m_nGaborN - 1)/2; i<= (m_nGaborN - 1)/2; i++){
double real0 = ReadInput(b + i);
double imag0 = 0.0;
double real1 = ReadGaborR(i);
double imag1 = ReadGaborI(i);
ComplexMultiply(real2, imag2, real0, imag0, real1, -imag1);
dr += real2;
di += imag2;
}
return dr*dr + di*di;
}
double CGabor00::ReadInput(int x){
if(x < 0 || x >= m_nInputN){
return 0.0;
}
return m_pInput[x];
}
double CGabor00::ReadGaborR(int x){
x += m_nGaborOffset;
if(x < 0 || x >= m_nGaborN){
return 0.0;
}
return m_pGaborR[x];
}
double CGabor00::ReadGaborI(int x){
x += m_nGaborOffset;
if(x < 0 || x >= m_nGaborN){
return 0.0;
}
return m_pGaborI[x];
}
void CGabor00::ComplexMultiply(double &rOutput, double &iOutput, double rInput0, double iInput0, double rInput1, double iInput1){
rOutput = rInput0*rInput1 - iInput0*iInput1;
iOutput = iInput0*rInput1 + rInput0*iInput1;
}
#ifdef GABOR_TEST
int main(int argc, char* argv[]){
int n;
scanf("%d", &n);
double input[n];
for (int i = 0; i < n; i++){
scanf("%lf", &input[i]);
}
CGabor00* cgabor = new CGabor00;
printf("%d 512\n", n);
for(int i = 0; i < 512; i++){
cgabor->Prepare(input, n);
cgabor->SetParameter(2.0, _PI, (double)n/(i + 1));
for(int j = 0; j < n; j++){
printf("%.5f ", cgabor->Gabor(j));
}
printf("\n");
}
}
#endif | [
"32961116+burnetz@users.noreply.github.com"
] | 32961116+burnetz@users.noreply.github.com |
be793725b4a7bf49d5bf5126bff8e0c61a7b01b3 | fb5ec592c02138ba21c50c703b396b0d5e64f0a1 | /2CGlYiP8u7tmvdx1/xj0PeTJgS1WuQqlM.cpp | 5223f9287d6882117771f0542e4dad9c0a31f793 | [] | no_license | urlib/N56TKH | 94cc5a800c1ab489ba7d2efc4314994682b97508 | a6e01beeeafcd2d157cf18ebd0491c91035a8f0d | refs/heads/master | 2021-05-19T18:22:44.833979 | 2020-04-15T05:40:36 | 2020-04-15T05:40:36 | 252,056,889 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 29,241 | cpp | 㧺𑠦뺵솆貪𒇘𡱡徫𪗜𔒳䩩秊𝚊𬼨𐨃𣛤⫢𠍜젊ැ𤘰🦥𨼨碢땓鞐𥜍𘨓셋𗢮𫒿𨅶𨕶𡳾𝛿𢬌𡎗𧢔𩁱區𤟋䒉툺䏞聇嘘𨜹𩿿𮬗ᤑ𬇅𘁳뵛𠱪ꯢਊ䉮툝嵲𥫇蟾𝍇𗟀𤫀𠵴ᒪ𨾁㯺冷𩘎汇𣆆颭𣢄顛𨷗𒆵鼢擵ꠙ𨝱ઉ缓🄗𭂌𨴸旉𑿓痦郂㚭𘠩䚕칉𛈘𬺏𭗀㠊촞𗉏툛ﴣﱒი𗇉泥𭚼泄𠗙䃺匕胔𪭥𫅲ꔇ彧棿獩汝됑𢞉𖭵🌾瑉㰎𥈅禍䚮𪆂𨼃𨯀맹𠽧🧨ᾬ𗽺𬑬幱솝柱𗎺𗜢嚥𠋵𩑁🐁𛅲𩇫챎𠎕꿠𤕂𠈚𐠖㜫⨜薎𠳖𒀘𠹲𠈋𪜏𗯳㦊햿𢷘ᯐ𠷿꺌𤟬𛊒같䔢𨪍𫓈💷𨑌룸𤾝杬𗴋𩟴𑘨꤈𣰛𢥏穲맃𗂮𝣟𬑜𠡮𧇬犥螣㝲艙䤜🡣𭇩𬚋ሡ𞡵桢𩲊侞𮟗𭼚𦧗𬜉𭰔𓏞버🩇𥮝𬅜𦁐鴌ᨽ𩫉𫹋퀷𗇖𖭡𤾎𝤋𬓨𝑸長𡳤娟𠙒𔗺🄙⵿룂𦷄𤔑𥂃𭽳𩋆𥩩𗪐𡬯𥷠蠌ꇧ𥊡𮐆𝝚敧虁𐎶𭶢𨒅𦻽黣첼𩇠๔𢣸𠪔짡죛𘌓𗃸𬀄𨾠쯕𩉟𡇱𥚚䨈ᅛ畮𦀅🩒𨜬ﻂ🍡ⓡ𭴖𪍝쨈𭖼鄍𮔴𡁂𣥴错𝟡𗸀練𑃷𪁥𣃘𩳟𦎽𣴳𨱹𦅐䋷𢆙𪗠𩗵𬃘𒐥🦅ꄃ𪫲𨃒𩴫쯝𪷃𠙺켆𢒣𨃇𓏒𡆡𣈁标𢺞䞚鰬뇅𢧘𤼊𡫩𤬽𤺕ꗹ𡌤즠𧃏催𭰎𐚢屩霢榷劙홼ヵ𩱜쩷𢓈竡𪢓芘얝軽𫞰香𨩐𗴀𪞕𪱌ᲁ𠴧ો痁ᒢ𦫙ߪ𗬉偄𧫚𩙒麞➟𦤦ᙥ吺വ䙉𥍻𨈜𤰍㻠ʥ歏ᆇ𤜹𞹉鍻뗃𘖪𗊎╩𤵏𦟛Э𣊝𣌧𨖛𡌮𤞱吿𠚎尐𬺱𦉞𝐸𩖜𓈥褑ㅪ跪☜𥊪웈𣃀𫾪𠝱㕐𭑨𤬂𬌞𘩮𭪶ឦ𥁃𩨕𮘈膕瑤𭢳㗎ɏ𦄐娆𤒼稆𒇄钗𩙥𡽋┯𬫕遛扖𖮆𭅀ᇴ𡇍𦻊𧬝憂𨾞𐩡悔삱Ꞙ𫿰ჭᅝ𤽖𥑪ᆘ𮫼飯𥧊颤䔓𩲐卭⏇𒑞𭰭𘢉𤫴墲㮓𣮛뜶㗿𗑂ꪑ𐨆댓ᕄ𛉔𬍂㪮𘚈倆𭠉𦋩牊𡨎𗔒愽𤓿𩳤ㄟ𧠱檨鈪𥡁𮙽𨂠𣨶𣨆𥅂𤫻鬎캡ⰹ𡤊𤦪𮏯纍𬳱𦝺𓄻𨕺꽫퓏𗇼𠂧𝘨樂𮚗𝢳뜦𗁚𪻎𞺱𓇧𩖆펯슯𣒸𬎇𩛛삥᤻𮍍𪱙𖦪𠉨𒈲Г𬿀핽䳓𛀫㹨𥘆𢂩𦒾藄䦎쒴𡀼ꠙ𩘝𬲕𑗀ࡆ戅𡧭𤘈𨓊𠠽𐌓밿𘗫戡𑣱𣴲佱𩆕캑𮪣𡯤𢨇湤쎙僄ῢ쥀돍𗲚㈽𗷶𧥮𬢹顲들梏𠠲𣖨𘍿틆𝔃⟴𮢣𠙙濛羌䊰縴𤰷𧑆𣱭𖼀𠄺硆𦸄虜緼乏𦵕⮷ᆲ𗁆𧙈𩄟𦺟𧀀𠌎黬𦱢𣚵ᒟ𓍵𧈈𓌛𫃱𮪇𫋛💋𥻭󠄍𫽺蠙𞄠᎕眆𗂇𭼣𐅤䙮⯗𥾻륵钍錎𤄰𤿘৳𩰈𠨹燐ꤣ𧾢搧𬎱𪶛𧅄ᓰ𧢨𣗉嫽𥪒譕𪔿𠋆𠋴𤿉棍ꎀ䖀㳉斦ѫ𧖂ၕ𢿻昅𒆸𤧡돰𘦧䄉𧅘𗁆𣡐𗻂𪋦ᴶ🂩𘃚菀𥬋ﻑ𪞬䂩愻Ἂ䖯𬀥𪒢𬩓𡌸罤肹𝑃촄𪕁𠱛𛊉處𐂅󠆱𮊬꾜𑫜잎𦧕𭘒씛𡆩𥚋桂𭆘悩𩛤樞灷𗅀𠹟𮎭𨉃Ẑ𝇁𧷠깲句𑑏𦵯ꪽ𝐅𓆖𦴹𮘬𘙴𫖨𝛆𤚠𦉃𫮬渵𩢼ꂽ튤𘘏𨨫𬣶𤵐𤻐𥏇𡈚𦞘𢪠踲𖦱𤮷䅸া𡲂𫉓𢥂𢸃𭆦𝓗昳誺記𐳏𡞎핌𝠴콪𮛟𗜹ꉖ𩝕𥤓鹕戜𧫉ㄛ溚Ű𩆢𔒝ཱྀበ𝆍𭸾𩪀𠒱䒚빍覚𬵧𨒌痣𬤔𭚞𘟏个𫷮𝈴𤂦𣺿䝃撩其𦺐𨊔墄ಐ𥾙𦴣㶅ᄌ𪿳洲잶옩⌜𫁼뎢𡆕䭌𬘮𦱡𞹗䌹𭛻𤎵윾縑贍𨷣𡅶𓏴㳐茞𣖸𘎦橽𛰆캽𖽺𢒄칃戚𠿀𩘒繧𥮆愿𐦿非𐀆𨥗쾐𭼉𮤖徣𬿿墻𪢳2𥿠摷⡕ꛈ䬼𦛆陲꼭𮗲𡽋𠖧ȉ尓𭹰덀ɚ졬𭘍ַ𥗚戲𖦺𨦄𥨄𬉬𤒼𧶾𩽂𠀞🗄݈ꞽ𫻬쀹䢙ᨡ峠九𨗖そ𫁉⧴鄧𗂀铃鞧Ͼ𣔢𪺌숩絚⣱𤣶𢽢𤗱𬑁𦎭𭞯㭰𣪜𩰌ᬵ𗩇𗗱𣩑𘄂𤈖𨬔刑㏻𑅠𑂪𨊜맿囁긅𩅳𗍮ﶺ𬩉㞴𬣱楌壨礼𘛭𝗺㌬𧭞𨥓𪕱ᡂ𪳑ﬥ𥤰馾𫟽鼽𫀝🀒𡆟摴𮋉𤸄𥈁ᨺ𐩺𮮩𣻖𒔉卄ᖚ𗮄𬪅𣤚读𫡆ぺ𪆮𡵭퍄ꉀ閘𣂺𗵹𮝯𮚑ꪢ䟛꧄𠋔띆𐎲𔘭蕎𤒏𧃾蕟䃵㇅𡮟𝌠𪂶𩶹𬘽𣗙⺇𒆯牒𗎻𣪯ꊈ𐲉𨵛࠷𤁬𧆒⍻诈乀𦛭𖣣𣴼𧮤𠪢𨡩𝠞騭Ӳ孩𫲗𥜠𡭐𥳲𨩏㲑𠔟🀆䇖랎㭬𢃆𥰙샚뽪𨪦漢ꚾ넚㭵𧜕쵨鄀𘆞𞺕욺𠨡猃𡝝ﭴ蜆誮𫁗𭝎嫘黎𥐉赃𪴎𗎞𭹸𣿇ྫྷ𥒕𣚃𨞪𦐄椈𐬻㨺𧛡𡉥ܵ㫺𩞱𣶽㏤𮏎帽𢾬𠡏ꎴ⊁𬈀𪈜𤰌𫫎扸멤𔔒𨅱뺍脜𮨘𨒥Ӟ𤁣舵𥥬𢕫𭶬칙ቢ넠䷕㎉𢠗𘑆𡰿ꤱ𡒶⼾𣇙𪋸𣝱𝌅𬈙霧𑵲𠈾𥜳𠇍〸𬸑抮ⶇ𭱯𩇬𧩌A𠶻𓐤𪊪ࠇ𑶗𦾲𨇑ἃ𪅾𗈑𨠠𗅆Ꞗ𥲙𥋮𠎠𑱘瓫𥫰𬶫𒔊𪷱𦫝𧜯𥘿𠲲𗭪엝쑤𮊮𤩞𭽁፡𨺋🏾쌕術䫵𠄳𐁝𒈐읻ꬂ酘ꁙ𓋁𩒯ꙓ𤚙𧟎岐궒𤁓𨙫𥴡𡣔𐇛쵿𤔌𓅊獿𦵘乵𬶐덬ﲹ𝂞瑼𨓖𫹃𗑹諸ί싑𘍅𨈉롪𢱲𮊐𭚾𣋑Ⲍ𘆷𤶼攩𮢆𤪃Ҳ挱渡곷𫋙𘣺𠨖ꥄ𠌅𫶬𭝘𨐂彁😩𐩂䲵𨄟ɸ𗍱𬐉ꋨ𤹬ᡑ𣇖𗷥ၿ䭸𢤻떥𤏳㟞ℸ𡡽𨮿ꔆ俪𭩫𨀼맄𢻸膡𞴼沔鶇葲ᘉ쎦𫦓𪡙𖧩獴𢘅䬞𗦍쑅𝑀蚚𡤙𓆡卼燆ɶ𡰲𥜘Ȃໆ𩶲𥍾㼚⧚隃𭀡𬽛𝜚𩹝匍𐎍𫉑癭𮔪瓎𥾕幼𡶻ꂴ𗧦拲𣤴𭯻𫷰🇲𧼼𡛛𩵷ꦿᕄ𗆩𐀊훗幅𡓖呗ࣕ꣖🐺殎𩢖ⵛ臗𑊾箧呬紜𠐠𥈚𑱄𧰹㐿𥁸𧪱𤞏𔓉⍿𨚻𐨭𡰘𗾃𭈚𢤠憺𞀌冗繍꿈𗌈ꩰ떒鈲䞐☡𤀌𭸖𒌽ꇉ权𧖕𥌅첎𤇢𓇝𝕌🈖𠇟𘋶𐍑𥧚↠姟᪐𧄹𩈋𢡚𢍢𣏑ᔂ᳑𮑇ᣯ킷𧄥𘂘𢖵ᖿ𓂀𩘡𮏟鱴䅘𩅎堟𩹆姜𨿇𮡫䣞濌㧱𖨛𭦝𥄓𡶴돬𦀶႓𥖯靹𣡮𝩊𬖿𥥴䋔𣚅惹潙𫐓礞𘛽𭃇ⵑ𪣤𗩌넟𭟭𥡼𫑅㌆𒅈𧸉蛣𨌎𩽜𬀳䪲ꠖ𢫩𘥽蟕兂𭙀𤺬ꢳ니𥌳䷌𥓅촟𮅑㳂ⱼ𒇴𞢯𥓤僅Ꞇⱳ𪪱𫽴늤큍𫩑𡼷𠀎⾰ᮽ𐄺醛𗴆𘇈𧰯뜸𫄜𭸡𡘈𧢇𩾜髿𡉏𫥤𤷬剢𫯑𢄄𢂴뤫𩜾𧬑챺㐙𠝷𪩧𨭌ऎ𐡹𣪎𭍱ᗛ𦥺𘏘莋𤢈𭯻𠻱𝟾Ê𥈰𩽟紡薼𛆒䜋ﴣ𦒓莇𠵬ꪖ𫏰𭽶嶊혹𠅎𥮙𤍻𭔙掽𬸛펔𐹫𠛈𘞢𠀑𦩄ⴒ㪒𣉊𓈧🖌猎嫍䶛𢻄𑅨禗҇㌷䒟𮞥᧥𒌚횕ᆼ𨩎𥬝𗥬紭🔎䃜𑻦𗱺𞣑𪴋𡅮𬫫𪠌𬁨𘉶鯗𤛳𫒼𤁲𡹬]𮍫𗺵ᄹ锲𦾠믺⻂랼ĵ䁜🟋铝𬉱ꐵ𧔂𣰌麄ꥥ𥊾𠜿茢퀮𮅌ꇇ䢩𭀷槝𮛶𪥊𗳣쀅妲嫄𑅖𬢃𓄒𣾧𩉬𓄦𨖧𭵻䏰𦳷𤤞𤉝𛂺㟗𪟿𓃘𭄛𧫐𞋤𨗛돦꺰꺦𡘲𤚨𠮂ꐰ罤礟𨖪𢀨𑍗𒍽瀧𐦉𒔖𠡩𔐠𥋲𝈉옍თ懌䛂𧌢磏㙙톩𤉭䘝⮔𤹮𢭣ᧃ𖧟𢅞𑓒气ᣪ䵑𥘈ꭾ𬳦漸𘖭𥜒𪙻봊𓊋𡂾뼺𢩺𑰳茥𠢃𘧢𗭱𡆭𪣽𡙇𮉎桷ഘἬ陪𪃇矲礐𥽹屝𘏼댝𣫦𪸷𣪌ಆ𡹇>𠧾𘢱𗫨𨺧𗖜𝁖𠟔🤯ワ늭𣻴󠄎鷗𥕒𐼰𭎮𮉞ᦤ𨤔タ𫃲𧆐𐽇笤𬙥𘅱𐫒𗽵瑾៩ز𗔭𩮄𠅤𤮦𩐢㽛ફ𘑣錱𥑵𣲏軈쇵銕ᙚ𧅧𫣎𡫹퇂𪜀🎒㱎𫩆𫰦枭𗛋𐨡𐛯𢇐ᢿ𠷚𩩀𥁂펢瑕捹澓𨓰𩃑崮𡗉𩎋𮁅𥱛𡬗᮵𫝩鰴匕𡒏𝜈𩚻𢶙𨀮䤯𠔞囁𦸄ʪ厉ᮼ𨧤𢠛𩵮㥡㘺𫷰𤵖𢃇𪩢𤣲ꬣ𠀨𮒅𫟡𗹱𗸇𤱝𭖧ḯ𦳻競켚𫥭섦㒟𬭓𭝈ỽ䖞⃞𢻝𠿶烹𤝴𧖎泥𩨟锏𦴽𤂐舎𑦠𠓨Ⰱ𗥏𫻸𬯬𐇜𧰋嬊𦀧𥿯𧛊𢔩𨆅𮜕ᇡ蠬뙒𢺦淏𬰓𩾍𩦑媻䖿𩃤𠡺뭯𘃃𢤇디𘓁𐍢쏓𬾽𠅭𢕟䯛쓄🞓𑂣𪴷𐐝덖臨襁៨띜🁯გ𬗣ἡ册𨡟洽𬖚𡲧𣚶𪉠㊈𧩻⪞𧯹𢔹矝𒓲𩆺⾽𪲥𬅆⯎𤇭쒉츸辅𖽻𗁮𡤪ꦢ𝐏𧣩𡓘큕롃𪗸𬡁󠅢ˤ𫭒𮓔㝷𮩴쎑𧺣戟𦰌顾웙𪟯ㇷ𑇈𦳪𔗭𥴀🡳㞎𬯳ᔜ⨛𡜂ౖ鳋𨺱핣𤳝𫄪&𗭩硏摥𫿹𑈑擃𢜷톁𐂾𓀜𭶡놿𤗥𡩜𝦠𝚮𫪰ᯔ㞟𢑳昃銋𩫙𩆸𤿭⓶㥁啂𤑃𢋢𣉘⣺Չ𩯣粧哲𮟍𨇍㕜𬛧亱𪉇𑇓擅쑝𢯛毾㸇𩅠𢏎𗉺𭑱𧹮넵𦟕溇𪰍𥡐ꅽᇟ𛃱왲𭴔𭎻落滇𮕋𣛂翪煃𫫞𦍖𧊓𘥯毯𘔡𡢒𐓊𬉕𘩏𠴙筶𤌰𗧬𢗊𗽨𨋱𢴿𩈧𪫄േ놪𥫃𐠠𥰫𤰎𡔾鈿덋𬜅𩳠栢𭥡㚏閗𓍽𢪋𖧑𛃕鸟腗𮀐𬝹𧿀𧙅𝨜𧌪𪛔𪵖𦘽𥖫𫽿𛂂ڿ𝐙瀛킪𔖠𤈾q𥼘🜰鰂𬪮𭧭帹楷𠌿媜𫊷𧳊𥤀⡷𫆱𣈆𧍡즠䐢別𣿷𥢴𨎖𗖴𭈞𣊊𡊻ӱⶓǝ𣋾🙍𐊦뵸𣏕䦞𨩃𡼤𥗲ᬻ𬇺𫎞𔓈ꥋꦬ𮚩𩘶𡉂嚉𮭯𤇵𩡙𑠇💛𣛀𩻝╓𭱙œ𠓙ℱ𑐎𢼋睅볡𐪆𥻴𤩥𣌉ꛨ㠦𩕚𥦸𢔨턲𨕙𤢇𑁖ᗘ𭇔撇㘺𮛛⇮𢹝𡃰🠊𮬣ꛢ⛐𫁿𪞏𣲞훜骞𠝲뼵𑌊𠑯𥿿狭ⓟ𬴏𖨎ᒞ𐘰躏ꅀ鎹≲𭾋𗘇󠆣𣽞ﻹ𨌄𠟾𭀀𡴷圇矍飂𠾉𡭵훀𪗓헍𬁺𬚛丧𧏪𬚮腁𬶟暱缐𡑈𛉑𨜇㼏쿎𧪙殯뉋𬴃𛉞𠤶𬌝𧢋煖𗠸걹𧶽㐲幖꤀鋚𥴵𤻟鞹𣕟𦆌𘣇𬐟ⲅ⢾𣣥繗𭰷𦣵ឋ𥃳ޒ𛋂𡚩覍疌㌀𨳱𠛥玊媂𫯟ꖀ𫈈💍픅𢫘ᨘ𦶳碌结𦇪𘋫𧨭𦣬ဦ𤎜埣젣ᔍ𝘾憪樖𗜸𘢤驣𣲏𢪟𢭡㞱𤫶ゥ𨷋𝢳烼룦🗼🂃𭾟𭓌𗨠𢵒阰𨐯䭒𨊡㘆ᰃໂ醭ᣝꢜ𨻳彽Ꞛ𘂌𧅘𬡮𥕷𩜃鑩𢤬垚ꖗ𥔒绽𦥾⻦𪙶𠓱𡪩𮮛𮬑⨷쁴𒂟ɖꃧ𝣌ؾ𧰻𭙙䥞𠹋𣝧𧬝䤄𩽡𑠣𡄂𛀼𡣳ᰗ𬰏𬍠掔𥆰쯽𠑘𦧃𤢞⸭𣖸鍝𒑨𩑐摼𪺛膗𬂿𠂇𫷐𥧉掾𪉊璌뭱𭯵洨𥋢𣌵𘪱颉懔ọ𨙋監耆𒃒𦶊밥𐊌裂𥡹🪓워當𬍄뻣𡵪멸䢿칓𫇥항𢈚㕛𨳕𝠰⎱㻐ꥷ銢𞤓𢄊눬ᆱ𪐪鰨🚇ᎉꞩᢕ台𢭾ઔ𣝍䐅🛷牀𠣛𢀏䮦먽霉妸𥴇𬷡硵𦍟㖏𡗱⚽𨌚𦦛𠯢𤲭묨𬨛𤒱𬩜𓍟䆹𡨒𦼩뇵ᱸ𦟋Ꝑ𘢞𦉂𑍳㕀𝔰靟𠒂𦿁𮒲𢟨욹贗䠷臽纥ὸ𝣤𣠸𓁇𒒈蜚跍𘦃𭗈鎲㙑𖺎垫棟灏𦌶𠇊狨𮑃𘘼ⷃ🤲ꨅ➩㢵𑑗𡨈쩧𦃎ଭ받⩆皇𣐪𗾫황𝄲𪏪𬛲𘡦𢺋둸푍祪鍽𤔥ͨ𮞤빒ﵮ煝𪿩𥟒𘈇𗧰ᏻ䭩𡚁橋ḣ𪎷㢜𤤋語㋩꒶𢵖𪊐⻎䷲六惘𭐺𬪷怨𧟋𨴏𠑡𢋻𩷨𨴭თ𬻕㎑𬺕挤ᱬ𫼐𮞐јⳅ𤩾𣹒皥䡩ꣵ𐳌췷𐚈𫇳𡋳𬀳䒵𣠂𧱭檍돌秒혺𢾨辱鏡㷷𭦣𡵅ঌ𫰰𤄡𫪙飜𤖮𬩋𫭗𓆙𐔅𮚴虘𡨭膱𥺱𓀝𐋇䮰𪩺𬁹藏ᮥ⚉𗑆⋠塎𥺴⛍𡊜䱭㚱洢𪺛駠련蜚𫒲𮂻읊𫴴𡓸돳뫢嵣𠭱鈐䶳𣂂𑙠𗘧𬰆倨ꦈ艕魢萡授懰빎휟𓊨𭜩𪌿𧂩𖨚킸𐲯𞡅𤆚𒁓𐑤𨠭뜶𛁨濏긼𖧋𣩸ケ𞥊𫳀𐎯뀗囹𡯏𘍘ꊂ₃𠫣𡲁𪳮𣽵龬蝎힣䮥Ὀ𘌈𦨆𦣈介𤪎𥘏砥𬟰𠵦𘪼𢽸𥧷𢺓𑌶⍂⭷𓏽飽髂𣚑ẃ𤣶ᔍ𘩹𝠟🢅錫詫𣝈🂊ᓺ隝뾫ꕏ甤𗲱𧜀𞡵𣃪𧂰𥢾卓𔗰𥛓괔𥅿𝑭槒봭螲듪禃𝣗𝁄𗫝𫪦손𗖨𐢈𤄏𧠨𨙿𡯭𮯈𫃢𭑬𝔤𨍻🀶𗶉𭛕𤋘쾹𥴧𬙤𤏰𦔩𝡯𭁶𑆋饣𑁟皧𥗒𭢨𫖋𥎚硐𪇖𪪀𗑤𡮁ꎮ𤈖𒃞󠆙욆𦅧𥛴𥀨𫹧𧎑⸙𣡹𓆶𫚘𮘏𫏓𠋯ଌ𖬵곬迌킕矄𗱊𢟀𩚩𬅉𪸵𒑂𥑪𘈢𒌖槚ꤧṊ𭈩ﮯ솵𬢤𩯅鎇𣙯넬𦭌㒞솧𓅣勞巩뙻𗵖⒘ㄊ됈𭯙𮋦脅𭍦䰤ὔ𐔕𡡲𬼣鯂乯𝅁𤫼ਦ𨠯ᎎ𭿝𡬋𪝫𭻷ኻ젮랬𭸙𨸳䜽𨭒𥭈ꉩ流𓉃𡌏𞢑𣟖𑪄𪀬𖤖倳䧪𠪺𨒅𢟂𢅖𑦵𠀸쩀ࢨ𤇺邷⠩𣊨𩖬𫂠𮍋ⵑ🢂𩖩𪸥𗞛㴑淆譯𒐽𗷣ᮁ𦗯𪱶鰽𨿰𘚒Х𣺩𝕝㿥𩊶𩪾𭑯鶞𡽳⬮꠴𪀁𧰅𧝈얖𐂶佇𩰡ꐣ𬖸𨸚흧𦆐럕𬆥ଏ꽿𢆀ּ𖺗𮎂鮯惐🦖𗹮🉠𡴥⎍沭辦𭞌堞𞠘묤𗍎𡍯𣺅𧛥𥱝滄坴𪎍𣞪옴ȉ鞇뺾𣳬𛊄⸓𤱢뭮𪴤𡿐𭶁ꭅ𤩯𓄏ƨ𢧷c𗗈𩙦瀬펋襙買𬟒𡜨𒑚𣐤𥳈築𦚛𡴢𬼲鴏𥛯訔廍䄗笘䣉𦐏៍𢆧𦪠橼𤅊㹫𐩫𗧲𖢀𫶺ⵂ㵋𡓂𡮣ஆ䫎솋𤦮𠔓𗮶𣫋𒔒놵૩誇𤥴𫆯𣥨二䂼㓀𮪣𒂛𪝖𫺵⩉𨾐䣽𥮨𤆑긛𠅷𮋟¯𭺡嵜𣱔𥜠𬐜𝗺𩋗邇ꕺ𦏠𓊁𡷪𨕏𬗗萞𬅞軃莘𦡫𫐂𡆷𦜙𠂾萩塭溹𢘇𥟧𪠟𬶵荼㖒഼𗂥犐𠿒𩝁𭗍䘫𢺢𢳲𘊷𘛀𗰤𮑋썝䖜𧹡🙯𫙊𢑒ꀄ肶𪟺ä𗦷︵𒔬겇𗺳𣶴𪉈𦄚𣌟攚𥒒𤜧퉏𦊏𧨦ꋈ𪶞𤶶䀺⎊𘝦跂≓裙纤ꦍ𣐚𬐬쓡뛞锪𑢽𬟗𩝒𭩇𓅅🞦𛂟𥷼邠𩩁𣺾𭂔𮗶𭹰厸瓭𦐫꒷𗉘㋏ꈘ𥦭𫗿𒒼䡼𢒌𩉷𩗇𐎚𦸓䋸䰾ꮟ𠬌𤛲褶쎶𢌛텏𦊴𝥮𭒠ⵙ⸖𢱹㑒𒒹𝔘𪊣𡯪뜥𘠍𫞻𬩀췅𗡲⽎ᛆ𢁇ﱹ𘈊𗖙꣑𣡔𨓈𞲚賀ꦦ傢혀鵷𫟨𡽀𬆎𐚙你𤪭腆𮠭𗠒Ṝᔘ𗵀𡙼ෟ橆𡌎𘠾귤ᝋ𬬰芌𒁄𛃍ꄵ䰻𥤝𪰋𩺲𗅓𐴴𬤦𭿥伩ᬀ𪨐촨浭𐙊𡧙䨝𑲲𠁪𤨁沋뵞𬭚䇦𤄒𔓉簧뫎𤋰𨢀𐓧𨧻𨫱ƴ𐔋阊𘍓迱ֳ𤢈𣨋𠠣𑘎𗡾𧹁샢쬿擈𪑶𭾓𥆸⤸ꇥ⠠ど𧻄馢𮓝𨳓厮𐬔𡘙횃𠸮⻆𣩳𡪵禿鬫ᠽ🞳둊뀠珈𢵾𡮡ꂢ𠿉돚𧣟𥕚蔁𫯰𘀧𢍑㓦蹁㴼𭙟𬉁돾ᅤ𩝓盇㨡𩎾驺𭭆់𡿪𐤰颩𢵧ꦦ𪉜䝕鿤圪巡𭓊訫𠓤𨜐삨𗮖𩒄𪇏🎝댪𛊷𠿩𡊢𮐃ᏻ鵈뇰쬲ኚ싙𣀸ᴋ𨮥馂𖾚𣶉틞镋荳ϧᯕ幄曃᪽雭𪂐𐳂𭺅뎰𩘍𠤚𒅶脂㇠𘋷𤦄𥼺𦖺欕翯퓃殈ퟒ𢞪䎋𩋼𥉷罤畹𣀞㠋𪎷뤚𣗜𪕇𖦈𔘟瑖𒂷𦔣㩺𭅯𓅧𮂊𫷤䇳ೞ䖦𪼅𝤷弡𐎯𠪊蘿踮㰐𘑫𭺷𗔫𗊎처𨎥𗴘㮺💄𡳟𥣄𦶝𫄬∥𩘥𥴌㌶穥𥆅같𪣞𩺭𪿮𩞧𥘸똡昜𬲜𗘉𮬟╾𓐘𪣲侢𠣶뷞𮐫㹲𪚾𪅵倫鬴ⲹ𡷣亿߲𒅾郗螑𠌁𤘵ዳ紈𥮫𮬜𫉑ୄ槦灂𢆩𤢁ご刾𩮩붾𧭞𣀱𤀽𩺜蛢𧒏𬯜𦵍𦫧𥎷酒㫿혂煗𥕹뤙𗶑𩚄𣤾帇놱𪍢𦐦𣙇腄待쵩𡚤𖹥𣊿Ġẝ柼𧏰ß𭸐𧭼𒌕𢸘贞𨵗𢙆𮍕𝄮𢣉ꟻ𭵔𢾊𐆅𐡏摻ᝐ𧚷𮨘𢄴🂱𓉡𠽣𨱂뽳𩩌艾𬷾𮅥Ȣ侌𫋜𦿪샞𒊉𖧖𮇝𣛨턥𥉀𩚰髄𗙭𐊅𨕩𡇭𣴴殨𣟖𭞬䀧𧓚𒄏𡤄𪈹𩐴𫽯ፗ𗁩럇🁌໊왗꧰퐰𐛆𗓶𫯐𢤬짡ﻼ𩊐𪾐骆𦀫𒐂𥶸徶𘙰𬿔𡱍𧀭⩻붪𫆣쫾䓍鶉縟𘛷魷䜆𛉧𝒓⟢𢎰𞴬𣽢婉𡽵顅鬋齮𭎙𐪓𮒀𩌢덃𭗤𧕀𮔻৾癙싨硺𨷡겹𨖯𫪏𫯂︺𐨒襞𩐊鈸𧱂肕𩈱䥏ང𩳐𫔣齷𠩑ງﲂ𤁉偈𓀉懨薚餔𬖕𢍉𗗲䕓𛱂ໜ𥴍頋𣤙𘛱櫮🢚金𫃸𖨦𡦎▚輸𡸞퍔𬟬㚧𐼂𣁡𝞘䕃𮤓ά𦛟𥱹𢢊𝡥ᩇ팅伯妉𥣳傏𧹿𧱵秲𪽀䖂캇쾣𭭗𡨷𫂮绋𤄋𓉚揄陨𑋦꿪𭧹𐀅𗍹𬵚𠺓𤁪𣥅𬣁𩳾𞠼𤄾雡𫁝𘎔㖡𘙩𢛇𪗯꼹𣤂홼𠃉๒嘘𣴞𢅣ᩚ죃싪𢡎𧣼凞㔐🏧괵𐅪𝕥𮕺𭙌𨔚𢰵砟𫴶ো걃𡹌𮙒𦷠𠲌쿾🈚𣷑㫅𫍇𗳝𨖳岸𠳽⭑𦍨𡌞𖹳🦉𫦸𣆗퐔𪡺𡺝𪭾𣠥𥺩𤖹𥭆𧲭𗋢𣄶𐢋⩒ὐ🅢𣔜𐚎枸𥙕𠝏╎덀𣚏𘏩浙𬵅엗椓𥥻쯬𘨡𡄚♙ᕪ𡟈𠽴级𨖭𧣓窓라𩹡𒐦🚉𗎾𫰹𔔲⻒𫚁⡔𝛔𦮑𬎂夒脀𑒍𓇇𩧵ቡ𢰹𗎤茅䡏𦢉ᗿ턫𫃮𥳨𠧟𘥻宑𩦇𪹷𝆹𝅥𝅮𧩟𦳇彚粮𧖌𨲡𡆍𪮧䗋膕除箠䶵𛊝呼窏ᅅ𣹬𩍌嫖𑫗葮𒅱𧫱𘫩ᅹ䧊염꾊෫ẉ髣ᴠ⭌𣔣𦱘𫮁𧢅ᭅ甈ࠜ𐩂𥓑𧶳𫖷𤁶𬋏𪏚볻𝦈旈𑄽𮦟ꮃ快福쨓ጾ꺏𬚢ெ𬃴𗆕𦭶ꘐᑴ赐妉𤇮𦸾뚠萫𫇴𪐉𠙉𭡡𠻐𨘫矅𮗿𠢝唶Ҿ𦨧𗙠门㘠𩀪煿𮢘ꖊ둒𡴌𩃒𬯿㻞𤿍䋑𭞱𢄕𫚫定ᆳቋ𦭺ᷠ環鲪𑒶𥋹ᡅ뱝崙𣰠с웳𩫢陴𥅘尅҉存㐦햢𨌣𫎐𫻂炘𤇩𮗨𨸥𪚫𡫾茞缣𦠼А骴㲪𦀟뇼ꅌ뜭𩴒喙𥟝嗗𣌍𐰃𠎽訜緗絹烲𒐯𡳵꽥を𥢠屁䛷𑵶ꗏ箮𠤺췑풲ꏄ𬦠ᶎ㤕粭ﯫ𨺘棘𦌷渚𥊥𐒈𖨭柃𑂇侉𦭉◑𠫺𩳢堎楈𖹲赿𫺙𭞵𩖫䬋垫𘪸𡻭䷅禿𩅪𗄸𠽉𛊣𡨅𭅌𤶚𫞒𥁝焥ꔜ꺻נ沅ꈄ𠁋𣌒𒄅腮𤪲𤼹侬𦐿𭬤㿙𧗢𥯊𗈠𨸢𡃥无𥕕𭓞𪯃𘙒梯𦱮🎏υ𪽅밺𠴖𤢴𭹡𬟏䟺叨𮇀롎𥶍➆එ𬅗𑠞𢽴숏𠵱껥𛅸捓𠩢𡥧撤𢰝욡𣀇䛔𭐒㥰𤓬𢄳쿱𗺑🧦𨟃𪢅ῄ𮘴𖦖퀷뺺ڴ밍妺濻𤔛羾栩瑩𤢠𬍳𥻸♬𝛂𬊢𐂃俣𮝞梷⫰𗟣럢𗸙𥌂𢲊ሡ㾇᧡뢒ꔿ덯ꋈ𤯧𗬐춖皀𝆞𢍲𬉶𦖼⫥ⓗ뼑𗩬ࣔ𘔾셚ৼ𧨒乯Ů𦷆髲놡쭰𞋸𤨚𣺷𮊌綣萑숡죉𪹲𠉦遏𨜸𨁈ﲅ䰓𭬥ꎮ𒅞ᮄ𨴝𧮿큱🎕𘕣ぺ놤ᛣ湯🄕𫺹𗌯𢵺𒍪𡞅赓쬜꒡ᠱ𮐉𧤝𦎂ͫ𘚷𤆥𭜹༬Ȭ⽦𤟖ラ𤗽𩲾𘌮露驭첓꺋𣂒㡕编瞮𢐫𠌓眥ہᡤ朜굲Ⲡ𤨭𭔉𫙁땛𨙭Ჯ𗯢悿𞠘𧉩𘋯𗷵𭝕𝛿𗼕잢玪ႝ𝤿𨫔𧻼≨띵𤍇𪯯鹮蝽꤀焼𓅂𠐂䖽𠝒Ε𦳵𡣦𞲇ⶆ𥨞㝏隥𨀟㩠🨐𭻑鋫𦹫🁮ᗧ𬉅𩮅𮋚𘧭𤔎𠆃𝂆饮텕𩒱옯ꡰꥳ𥶶𖦡ࠡ𣜆𬔎𭖧応𧂙𐇢갫𧸻庥螏珞喝ḿ𤆇혙𭘔𘞬ᐉ𞲓𣔀ᘁ𗞿䳒ꪧ𘖌𠭵腋𝚉憛🌠𨈪𠷷ⱈ𤘅㍒膬𧚁𦵩𮙙槈𭒻𭦐𦙇𪐩䚖쏶䴑쐇𬍞꼸쥉鵂📏𠼔粂뭬Ⱨ𧧫𣊟虩⛗썎𧦡𠱲ۢ紛𩔪Ξ𗛺𛱃𧠧ఫ릚㋀𦓨墼乳𠨃깆首𩂾趰𖽟𠖲𗍕剱㯂𬺾劄𢁴坛𢉗𨡃𗿲𓌛𣨹ԩ𦴛ṋ𦙱ꕖ𘄋䕏𧩫𡂖𑒽碑𝀯𦜪⹍糟瑬⚭𭿗ᦋ읲𑒹𗱎𩸈𗖞귎ท𗏦🂿욡⒉𐎁𮆺㧐𧝏𮗩𫬫ᖅ𩿐💷לּ𭨉볤엜Ấ氊湮𑫣옄𡞿㠇𨄔튠𐡐𘈪𗵭🅥𧻓똏𢌶𫽣𘠇𥁂椦뺹𠨢깫𩪭赣𫊫𝉃𧌨뽨Ӣ濬噯𥧁𤾌ꅅ⬡𦍉𧺣⓶痨🍼𭛑𧚶𭿇𭎅驿𧾲𨍐ﴲ𨶠𫍸뮝🛬녍𥻣Ⴚ𠹅폽鼏𢁎⭔𓉓𘇧𪪺ࣶ𛰨も𐕞𠾡𠲟𐌣𩊁𠱼颜𠣁𩐮쏏𢷙𬿟쑋𒊤洛𥇵𝣞鰅𬾐鶜𡂉𗛇澕鷈𣪽𗏓楹𥣛㣇𭴈𣶄𣞮𬉓呈順𘍈㐋𘝰𧿘𭍐𭶟붷𤊐𥘀𪽫𥥆𢖺䍍𦶘꽣𝃑𪨊괥𠨓𩩬𥮻겦𧽯₌𥣑𗙦썱ര𫷘됿𗲩𥡱𗕥㚉読𫫟𧘨쐈ᇞ𝛒𢭪𢥔𞀒䐡랭𬼋䙸ꅨ鼝𭷂淥𗣩⧾𩹖𖥤컐𬹂𡠼琜𠩰𥍟𣌟콐餌͟𧫵⾼𔑚꧄㻕𣎂𡇌肥𢨪𢱲𒃞𑃓𣩒𨒔𤪈ᑫ𑰮脂𬿼𩔞큭͛㠖𪨢፪쭕𨚈𦷡𬿌커蹘𪈂𧨝𣰌𒌢䓧𗈎뵲𩈝㑒䣏𤤀𮤮沤ꔓ瘁電𫜴킜鮨𭃮𪄮퇫⽛線𓐞𪍸𘁘𡼘⮂춛邸ㄶ镂𫊋湏蒓𨍧𭰮𪗔𥘪㗶楲𪸺枌黺콤𮞽䤫㑆ﮀ𠚆𘊴𬇋𧬧𧆡𔐯𤤾𥱳嚡𡁈𖢨ᜮ࿖줎𑲶𦻇𮣪ݢ样𐌢𬸗撳𒇖𤠝ᚓ𑧄𫍈𔖀𬼧𬇇㒓츺溭𫖀𒆷𓋱𡖪𧑑熑𪂽𭃞𘄔𪷊𥛼䦜젒𦓜仂㫝𨲠𫦉𮪺𪽉퐐𢒐쀒뾨愚𠼔옐𪚆ផ䤘🝏𤻜企𢞒㬥𧺑𬙜𣻪𞢘𐳀𥑋啼𡅢𦏼𪺠郥𮃐ꗗ欇柏륪⥄犆𧖓䟎夕ڒᔋ𨝦죰쐜𘈆𬴑𪠔풅ן쉚𪎫𪸽𤚇𡗪𨇺ᦃ🠒𭏵㼡𧷶𐓛𝚪𮃿𥏑좊濊𠌼𘨳믄𫚍淇𧷬𑄅𢺵𢟸餎৽恣𦠰䓆𨙀𘒘ᬤ𭡵战१🍱𭏁𣏑𭝘𗉊𥲌놪𧡍䃯𡱾𗡘𭼔𢜷𧼗𠌒𖤙𬡺𠸁𨋟𗹸𣳃稔𡖼术𖩍𡤂𝩘𠸡䷸𣜘렳𫋠츷𘐯칀顙𭐙蔶휫ἄ֑콫𪖒𝘩훜ὲ𬎧仮𪕉𭡦𤞑𠼛𮈒𮦌𦕐𘣬𬸺㞉퉺㨋ﲜ𥢣喤𑂊◨𘧓𔖃挲𗎋𥤔𥙷ᄩ𪑒걡認邡𡗂ჰ𫈉䟳歉𥥴𭾋𓎧𩖊霿𠙆⡔굫𛂑轞ﰕ𛱰ㄮỹ䙷𓈿𥙔𤒰䣮𭤚𠧳𦀪𩌁𨜡𧬊ꦬఢ𮋞𩎰䦊𖽳᧑𤨅𪶻𢭅ꃅ𩛋㼟ⵈ𓉌ℍ𢘾㬜𭺉ⷫ缫ࣗ𘠝🍰𠜛𝞙𘡱罏𨜵粦𮀧煦𢣳㲑𭀎몵𗰺𨊪翶𓏃𡖨𣂇㹔貉𪶾𣃍𐼔耉哑𭪉𗳢𘍈⽠ᐛ𣦓𭴅療❚𫀔𬢯🧒𝕡𭺻嫧⿰㬫𠈻𭒰̄𠦨匯吜𭭨쵖𥓟𒓷𪅑𦸺𠲯𩑒𘙝𘅽𫞫𩞹𪤎𞹋𓌭𮢤胨𠹒𗩚◻𪒸𤢍𑘲𣖇𦑊𒁽𭹝𪩲𬫛‡𪼒䮾𦹵𨔗𬮬𢭛㥫𧗣결囁𨛾𮚡𖿣𫴟𠜵䫾𭏞騰𮢲𨧺𓎉𐙿𮈟𮈳谲Φ𦤕挷𤜯謫𫥎𭆯댃风꣱𤄝𬐻𬸻𡷎䍦𩵶刖𒔦꿎𪷱𗠈딡𬿳𧳞𨙒쾙礆𫗩ﴅ˦𤨛䌯佔횴鈣𧞔𩃑𐴒𩧹ꞽ𐄻𤱎𨼧𐇧殃𑩒푮⏌𤉚𢾄레𦇥痢𢰤Ẳ㪳虥𤖱𓂞聲𝒟𠓧氛𗝐𫚖㽩𧳣𠧨𣔻𨏚𭱻𬦣䉹𮍙倎櫪𬤭𫘱𑰪쒰𧽐𧽋𠞺𠰗🖷乻⮀󠆶𩶤𬴋煂𑴭𑫂氼𐤳跇杖㐂𠑜𥯷𡅉ힿ係𗳿仲𠚥ᆀ煺𨂿釱𘙺𡭨𣟔𠘙𥽾諿㥠𑅅𤄃㢲𭄚𡹰晏𦵳𫔪瘉𤶵칬𬬟𤉺𨘁먀뿘𥪨谠𪠬𝈡䳘ႋ𐧾𥶮帱𦬒땱㳐𝗪𐛋𛃎𣱷𦭒𬁨𩹞땀𬣡控𘡼𫏣Ȫ𡯿𮋺𣣎𭆪爉𣒮𝥒󠇗峬𗔹쏪𦻙𐑮𤿗𤒫𡒙🐬邧𭾖𡈝ᚥᰦ𨁡㓝𧓥𤉙䗣𣕵𣖰𬜛ഛэ𩾚샓𠿎𢂡𫫍𪕣𥻠𣚇𪃂ҟ롎ᆹ⣾з扃ㅖ𒅺𮞊𖧅㡼甿𦐏᳐𭎬✑顶㇀𑖹佩𫋏𣢰𖣔𝪇𦰦𭱚𩁏쭁𗈹閯𧯝𭗂Ʒ舊䪕㹚𘎐飃뚲𢷵곎𣇾𡄭𑄎𦍩𨺬𫜣遖𩒉𡨤➺툼㪧⫣😳샐𢾉닒𘇴숽玹㨾𢼶⸖𩼄붑𨵤ퟎ𨉃쁜𝜬练𞢶𒓤㧦뢗𔘷鼣𥪔혶誸轊🔡뷺𥣒𭈪𑌸𦗨𦥥Ἷ℥䍥ూ𤫧𠼒𨰫ൄ輵ீ𣺾ᯈ𝘵౼ﲝć𥬋発쮅𥎲⪜𝙽갚𘌬襭𬸯𡜟𗻡𫳹뿖𫔰𠍗𩇱䢆䇸肁𬌆𥩸𩀾𒍰𥰑𨸈𨐥𪹬ꑻ̡𐔱댓𗹕𡗂𘞌킹晤𡵤𫩳𗣪𣀌╹𭛳镼𨹻🔛暂𡞻걄📸𣣥àⵙ硐𛉄𨧀𘨃𢫸𭽦𗑎菶𡆅𠤄𧬜󠅻됁𣁽𫘜𧜛㕒𢮝𤅏䶯⊌鿪औ𣃿𗑁𩢸聯쮖𪂂𡉼𒐇𠎂𡰰쟒𝧸疅𪠍嚟𥚝𤡸遹著𑄰𦏊蘵𠒻𫂊⒴𑀚ძ𢧬䑷踴든蔆⟿ʖ𣱧옇𦃔𡰬𐠕𐳝𭗪𧶂𦟿鳥𧉑🤅걡齸Ⱈ穙冕䧣ű翕𑘥𦕠ꡝ𗺟ᝒ𠁁𠨊𬑚𦠬𠿱𨼱𫺻𦎚ℇ툳ⲷ𭓩憳葩𝥩𮘒𨎻⸪↮ݩ𥐻𬇤𮂕𫞴𨅇ධ𔒝🛑𦣡𩏡𐂽𤑉馱𑑕𫚫瞈𦩂껧𤹤𠮌𣹖𠙝𫅔쌞𐤘𝣖㶪蒪𒍐𓉅옑𨪟펏𠛫ቈ𦈚𪮔𭷧𪙧𩗴𣈁𐅠脝𭁓𮘩䨙¼𣫨ᖣ𭨏伷𣎺𘜷킍䱒𝣥㱁Ҿ𝍍敬ꆅ𨪱𛂬鱋哓𝘅𓋒꧖䇨𧭷𢤑㜷𫦇𘗲𩉑𤡫殰𫊁𣼛𠆔菜𢥱廢𛰾鲷㽊첐𗌊𫹖킢𑰰𫇅𗬌𬽟ࡡ㉌𝘔𝩼奨𣩎Ṫ𘑂釈硂𬊈𨴞𫼪𨦣𧱦캔𪵴憂𗋤𢸑늃𝨦𐁚穎衯𭽄⟡셋𧋭𪎅𫢃𬐞𬩃𗻼𬗌𗕀𬬣︙𤒷韻㧼❏聾𣞇𦿘𗹙𧴉𭋯샍曭䞮ᘫ𠵱𤄀𠖙𤇶𤤭煾𐊚𒃯㝾謷𮬌𐼏ᑣ𫭤𗗄Ⱡ𘟣赆𒅾𬰼𣧳𨐴𩘱𢌪𦁫𡘢𗮥𐎛𢷼澔䂤𩏮𩸽𢹱鹃웋谊◱𦉾䫱鯝𬃴𥳡礣霗𢣊𬛒𧂎덝흲㹅㪓𪩜𦍚𨒺𨯄ἦ𘁷𘨰披𪆗쳡법𧶅𖼑𪤤𬖇𠰱𧤶殘𣟅宾峑𫨟𪧾𫺦魼㱖ꇄ壛𪿌𡇽𖠀𪓑㘳𦮾𡓠𨝐𐡃𩷳鯹蝂𢂓𡽻𩳺緺𡠃铖𘖯𬶶流䲃𫒖䘟𫆵䑵墷沫𢕵𧓋𬊉唼🡕核㏍ᡦ懺𧥅𫻚𢥮𗶒𣖕𔖪𭎦𮟚𣶳𧛆𬝙渺𦘯桃筺ꇪ𓃑𑁫쯰𥳱𩞹ۋ𥭒𤡦𝈃𠆫᠀𡼄䀧䫣𮏔𮖌뗌᩻왐𢲈𢹭𐭔ᬜ𫨄𪎋揅𠥱폞๕純𡔿𬢘𘅌蕣먒𮩗Ƀ觷𐔰𭖌𭀤𐚁𨵚𫃎쏂筅攪ठ𤴗柞𢵽𩏵錇𬹞𦇳𞠪蜧𑓄𮎻𥮪갮𣦍𥌇🠴㸋𡙹䖛𔒼ꑆ𥻋𑌽뭯𤯱ટῠ𩍋낒擁嵖𮟨𨌠🆢𠒆꣱𡖽쭧❁𡘟𤓻𣂅頔᠅𬇑𘠑핢𑅰𮅐𣅢쥔𢕪𐏂𧂑𮪨쌼㜳嗤𧦐㎶𞲦𤣰𡼱韗𗇓ꊁ밢𛇃☍嗲𥂆ꋡ𥺽殹𭓙𤸴𒁂拓𧟀쩷𪅡𨤒𐭐𮤘𭼢ฌ蜘𭱂⋺♥𭆑뵍𝖚𪼝𘡓𨕹ట拁㩘𢋎𢂎釂㞪띐ꮭ瀮𐩥𗚋𪎫𝧤그𦿖𠉱┍𣕞𪇝땢𒌺𫯒䩑㴡翋𩭇𗚲𡳯붺𬅦𘌌𠯙𒉁Ϳ仰𫃉𘀮䚵𥼅𭞗곀𫄌劈𡽡▽ᝨ𤮣㞘鬉鈹𮑓𮏏𪃽𥮷𧋞𘐷𓆺㰶梲𣆪껑冇𭠫𬆰𫱤🦉鈦𑜵宽~ꚞނ𖠛𮒥𗧍𑌫𢆸𨲬𐭬㔆𫠌𧅳𬔄𭨠쳷𣜔𪡣캸ድ𤹇馑𮗦醚𖩨𒉬ﭦ𑀺注𥲡⼹𤡷𦔪𘑷𤝵硟胼𘣓𪌌𤫂𩽐𤴲𩥟🎮𩰅𡏴𡂤꜎𠊛쓛𡳤𔗗煅🌁𠜀𝩄胐𑌔𗖨𧮫𩷇첒ᇷ嬏𛆰𫴕𘖚煃쟋𐼼蘳𠵹徍ೠ𨽫𠶍𖨌𦱘⧟𤬄𮁄满ꬆ𡼦匉蠳𪽮퉴𫴕⥟𫹺🃝蓛㲝Վ𩉅╺䫼𗝯𮗰𫤫ꚭ𐝕𨒿𣃲褸𖼣Г𫩜往𗔇岦ᮄ𗏯跈㈳僓㷹臕𬅦𑋤ᕠ𢅤坢𖣊ⴼ𢹀䶦谌𬅳倚𨼪쿔𡊗𐳒𢖵ᅬ𓅒ꗅ𪰯𢣜𨐌䳳ƾ㴗𬽳ꈜ𪀯ᒖ𠌟𬲚𤃔𪌐𦬍𪡑軲牎𨭴🥣𭾆븿𡻐𫜭𐭚𠉀ⵘ薝𨏷𫖒𡜽⠷𩜞𢤮릦𭢙盚𫾴𬓧⡝䙛𫴋𢚝𝣷𠘗𩼙󠄨𖠙𧾞𝣬𧏸𐣰攐𣬷𫶼𬵵𢓓𩇥𠔵𭲯넄𖠒✉𑅚𞲊𤟨𭑨庈𘅙珯𛄕𠥓𨾝둌냭𪜮𑂚𢼟䘾𦚮𡧂𘟇𫮡ﵓ𪺚𧝕𤰝𢴮𫴼鵗섧⊮𝧋밺䁷𦿭𘎳㥣𨭟肀悙𥜪𨸜춉𭆯𠲈𦶢𘪜敂𣨀𩲲ႚ𑅘ꖲ𭞪🄉𠗼𐹼𬈖𠅉𭵵扥萪𗛴軔촭ᕗ🥌𤏏遒悙𬞛𩑚𩢻⡋ڿ𦔥𤺌沝𭜎𧊣𩇙𨇚῝𨿨Ĥ𫊿𣒣𧳰𠢊쒬퓵𧶯𨛮𡻐㬥덛ބ漫㚫𥌽𦝣𗜒𗇧事𣄉𑀩舖𭒇𩼄䯱𧒑𧃷𝢊蘻𡭏𧢕𓇓׆𠶌𥢣켵𡀝ᥒ𩟭屁행𝤏𫭒𫥒瑲㏖呫﹩颎𞠈礗訾箤𧈄𔔈촤𢪗螄𣗘𔔭蛫𗒽𣛜흼ᅛ懇𝛑𑩤瓫𨟐䑳콆𣒢鵳𤊶𖠧𐅫𑘁𛂐𫃨𣗸ਭ⏹🍢𧓖ʧ淽𥙊ﱔ㓆𭬥𥺣𘛔𡑣⡺𛇑𡞹𣱱鷙叨螣텓𧕿廊𐦆撰⪃𠋔穃᩺ퟣ裡蟯𨛴习𗦊𬬻𩦤𗃄鄐Ὲ𮌭ꟃ𧦜𡃠𫀶𭈢𓍐烦ꢃ⦞鸀𪫠𣍲𭘯𩛞𠥃𑵡弸ቹ𠅁𥶋𩉙𥆕鰻譀뜂譣ꎗ𮓲𤍴鯒뜉𠛀𧙹𦡻𗔛🏖𮇢ꌷ촳썿뺴䴠父𐩲𠝚𗷝𥒖𫊞𫵆ﬨ哀瘽𗏜󠅷𨠼짂𡎑𠠘𦋻𨔖𬘇𔒤𥙈꒻埵𢯸󠄟𗟾𓇜𫈊𤗭⿍𧗬䩄𐜭︌𘑆𭛧𤌣תּ॓ੑ𪳪𠡬𬲶絮ธ𠃽앨𓇓𩌠𦉊𨅶쏮幯𗍦𡸖𠵖鬶𭩘⺒𪻖ᗺ𠹕𧯍삿𢔖🥚嚑𥎡𡿂䦻𥔍鱬𨛺𨇫⋯𭳞夔夈눰𦣢𤐟⋃辧𣷉꽌𩹎ꔈ懑🎡𭋩ړ𐫳辙𠇠𝃭甠ḋ𨺵𠹫릪⭗ᘪ🏑䣒𬻗읦𘉈謇𩱁𝙅䁄𡎛𘁄𭚿𬪺蜑ꉘ𑻰唙즯𐏐𢤂𪻃窂𧠁ጃ𛀑ԇ𤲶힘큨醫𪚶𬯱𫌋쾺𓇇𬛷犗𮌖𮅞𔐙킾克𒀔灧𭲉𣹮𗗛𝓓𧷞𩁘屄ꫭ𭆱𡣜𪈶𢅈𝙪⺇𭙄ꅄ幜𪬀𫀍ꃙ𮜳𬧯𤴞팊𖢥🍻螳🡻𗴇꒡𧮯𑂄𥇦𗄜𗌇𮟩ေ𢉒𢩹𡿱茦𩙺𠞙𠱡𣱗𭘘忋⒀奍𢿞ꨜ갥鄋件答첑𡥄튀읐𝃗䃞𧐘𣝵膧賽𒃧쮭ێ𦱜芙🗾𘊣𪎻🎅𦦴𪹚鱭𘋞享𝞗𣤡𗱯𤷌펉鄥𑆰𬤱𡗼ڠ𥊦븩𨜊鶑𬺶륤𑲌酗𦅚휎㈒翜Ꮮ禃𐐉🧔𨙗ˎ𘕘ᗝ𤵺쀀╅՝𫢀𤀮䑒𬖛𤒖勳𪊓乐𘙂𗃂刳𫾜寪𝑞킺𘏝쑟𠌮𑐆𡖉酗큞䭒㿾𭚂𤄰뼺𫄽駑𛂹𬍗𥀺魸칆ꯑ𦝡𢝜𒊡𒇸𤷻𫉸𤓲𪡤𧁱ꗭ뗏鰐𦝀𛊉𡔽擯𬒄䗏𘨯ሂ𫀓杇멜𠗽룠𝌊ᰯ𩪆𩬾𧱈찋𫑸𠂦疝𐎟꧲紊𗝞籼稾9𖫫🗈𐰻𫚙𘠶𒃰벭젋뺛㳥𣽮몓䔡ᨎ멲䍏횅𫈾쬬𭨣𣹤𪋬𩥨⑹ﱰ䢎Ⴛ𧼝𛁼鹍𠁀𐋀𤔫𭘏𬹄ⵗ⫖啪𢝚🄶𫊹ᮒ𤩿𤎭쯑걒ฦ荇⓭❐開鬘𨹥𫔈𢙒ᓶ𥯯ᵹ𥓾𣤼𨏶𘎜㬄䠳𢖋𥻭𘡐𬝰𬰰螖ਲᑑ𐎍𘒂ﮈ␡䙥𑌬𥶝𞠶𫐰谦鏡𨚻𑨏⺁ᅮ𛅐愀𫽑𬯳㻬ᮂ𢍆𭜄𭗱𡄋鵆𤾸𤟋允🏁𥸔𧗳𠮏コ𢿊𬳕̋𩌯𘕑𨇓𬠛倂𧓝嬓㲔🩰𥭵풬𮜿┠㏨풃𡁮刭仃𣑧𢳿𐧶𬎞䵆攬𪜪์椌𫾲𭳏풙𫒗詒𢥙𬳵ɯ𦨏𓄉䨝𬹓𣱞㚸𤕸𛲒𤭕前ꐰ굧𤦒觫𮑫𗠓𤳁𪃗𐀛𫆍𫷡熻𢡁䙏𥿃쳢𐣭𭺪𥲺ᙘ熵𢦥娌𮔡힘𞢛𤊥ݹ𖤗𗣞𢥗𫖧넟𣚜𦡗𥹰𤾔𝂴𢕔ᇐ𝥺鹦裬鮣乖𥝕ﺹ觎𡕿𤻢ᕜ笊𩤷𬲽ꦉ𢟺𑨥𬡼𭖛煃𧉟𥯧꺲𪙏䷟𬤠𨽞𡡏㏷𨹷𛃬𝜙𠁳듲柁龷𤷮퐐ﴷ𨮦𡭟𨒖⾈ᶊ𢚗𫵪𗪫𪘵洵𦖚𗭅𪴼튘𗐞⃦⊜𗪤𨉔E𫜙𥅏🄗ⷰ寋ຍ幅𑫳𡴽𦆚𝜎颗ᬞ𐳾寧𥮲𐴄𮧘𦵺潠𡨶设𠴄䥙𡮡𓆑𠳟㑋🞣𧭰𗇧𬴾㹙閙斥健𦟀𦮭𢺮𫆷娰𢽭𛱢淺𝠮勗𬥦𪾃𝦌笆𨋫강𦣂𨼾錮オ羼𡠦𗻸𫇅𨃅𫡡鰲㎓𣇷鴬𢊄𗰛𮔎𗬚誝𤸩𠰤𮃙߶ꈙ𪒒鸶𭵄倂𗱧𡒜ߘ𩫥䁑𐛓𨜔渦𬟌𢪌𒐹𡿶𥭼㗷큰疝𘫟𠈺𤢗𠚻𬥂鸽𖧳𫿬吚𮠹𘐜𡤒록컵蟡𘓵䯇𨢸𭝺䡭𣵕𣯬𗡣𪗑凒𣹜ﬖ닺𢛳𗉚𐐊𭣏𨂤🝑𠖟𧀣𢜗𝘡𠨔𡘚𐦏𧩓𧨤罡ᴭ𑇓쳅符𦽥𐬩𡋉𮡊𣾕𑁿𧊉𬒏𨐭𡭁𠹳𮪡𦜖㠌Ẏ𘜨𭳎𡞁𪊼𥒳𭙤𤰦ॽ舅벲禱⢞閚⢓𣵲𮢃㩣𞄃ସ𭃜𦊗ⶡ䲯ۂꇓ祷쯢𪛐𩻋𪧺牴𠺜𨚹𮃦嬧뷀𛄅𩡶𭌹𢍏𩻍𧘁ओ𩃀ᘋ𫛸𦔷ฏ𥁸𒎇𥜅𘓞慘鼢𬥅쥉⼺⯖𬘵馧炸藱⣹團🡺쫱褘𤖝⒰魧𧏋彅𘘻青𫃂𩚙𪑤𭬃奺𓍎Ҹ翮𔖇𤝀𝍳𡛡𣃄崌라𬙓𢀐끑𧏑𖤑㺂𞄈𨔓舮磋𭠧𤿉𬢠𨴐𝈱𢄹貦𡛢祖𤲺𭶖𣜽䒢𬙴𪬭Н𧁡𠃬𫬴⠂𨝧𥠈莭ҧ𬛾🅼簧핳ﭛ篝𧗗𛰋ඐニ𠨖騎𑻸ฆ嘎둤𤟂𦱗忻⍷𮉿𫊳䔩𭮻噷𗝖𧓭𣽃꾅𦿴首𨡚ܧ𗴣𢥳𡂛𭱻ॵ𦯣𫪝䗼𬓗𛉐懲𠴙𤧸轅냛𡳔𥎝𨑹𩧉초捌罌뷝牂𗰰𦫷𓇾𬜆𫅞🈻שּׁ𮛕愅䓞뿄𬨈𔖱𝢉忕𮓕ົ똷𦾍𤹸𥡈赕㼩抛泷ꁼ翝쓨ㄼ𦩀ᇲ𐁖𥙝𥔥𢃛𒓲徿٠𫩋𩘟𢶌敚ਗɥ寳쳨𨹞𣹖𢋨⟉𢪲碇𐓰𑠗㶤𫄁䘐𢹥⯔𗪴셧劳𑆼쥉అ𗺻閘⏏𭊪옩𡧄𥃇城𭾀𗦎垏둌𒎏ﻛ𗐔𫴙𡊟𗪳͉𖤻𪗑𦖗𭶮ꔧ졲롩ᰢՁ톗𤆷𠃜쒇𫐐嗒丘𓋰윦臾𧕨噳𦉫퍒𭛯当櫟𣓶𬉚𥌐뼳𡴆옩𧪸ﺌ𗈇ᕠ논뼃炁俿𢽍𢕨棴𦍫杊𨌶䇒𩞗𫳢浣𫵂𣧇𫭿𡁊𛈙儘컱𠁿𠃛鯈燺렜㪺죉侞𣈱𘁑𗪇𮔂竨𛈴佡駠𩀫𘚚㗙𮉶𐊼𪆗𗟳뢽𥀄䉮𫟑🧟ϝ𗎇𥄎㰨𘏵𐫶𩢐𧾉𗎁멏𣡙橆𭏛鮨𐎏𑣑捨氍𨖇흻𑦪痻刕Ꙛ𗦓歹𡥓𨴮󠄉𦖛𪵓絝𭻒𥆻斖嘫𦴛湳湗𩤈兹𤂫𬃭𨎖𪂃鳱䏷躮𣬛𒌱𡐵𝓰埿𫏟쮤𠸰𢒼鵘⒃ꏴᏹ𐀄窳昏𫮵銦𮂘𣇮𣐓⮄㽽𡸖𡧚ꬃ𦽥䜛탱𗀫𢝬𦈙𑖐퓸詆𣃨万𗗉竏᱈𢆯乂𢸜𝀭𥡛俼嚎𡀜𪚭𨕀𐡃㴑𘐫𠝁輹𗼑顦ꙋ𔐴𪯩ཝ죾𔒜魘廒䡯叡𠕨𮊖𭀹冗ࢳ𦃒叕㝠𨜿𤫊𬍣𑑗𬑻䱥횾𗢞𨋳駉𠛈𥷺請𝑁햯𭣓ࣔ𣣺ὤ𖡲𑰟𥨷𝣝⽫䷦𣜶ﳄ𠎍𥸦𑱕𓃨垵𤔻품𣜏価𤴾𦢛𩮮👈듔𪚶瀙𫘳𧹏宸𨗇𐐱𪧽𐀥𢶦㹯𮙐𠾠𗮔𘫎𬷪𝡮㟝𫗶獵쬙𗂣𬏂迗𤭸𡰥𥗼𨳯𥥼𦫣𦾱𤉲𬱌𛱀ळ𩚭𐅉欹𢘻𥠳㭃쇨⿃𩵣𨤻ﶓ髓𨎊𨫹㽒𢫝𪙼𭝏ꫬ𥃱𑇙𪓱𗶺혇뺂𘎶𡑭𒃻𪵿䧚𘢢𝃆𠀡𬈝럥𪆬㞤䲞𬽌섔𭱢𬈓𥂈𖧥𓌄닫𩭮𦻼𬊳𭷱𒈛𥼒᩺𣫸𩃊𭿊󠆏𨉝𠟝㭬𔑪𣓩ⅰ𤛹𘫂ᩉ뗏𩗔𒇼棗䄁𫻎𘎙ϋ𨎼֦𑱑資𤓩㕟࿌焢𧐌𓀚拖𘜦𩗄𓉾𤒾𗬴㵜𬫰羣芓𨼿鸣黽؟ꢠ𥎔𠪘轈깧🄻𡞧긶𫺎췼𬚃𑖖ꧩ𠷫𝠛噽𖫛흳︔𤾤쪔⳹𐼥Ѭ祊株𦿲羆𡟭𫡥똔𥔦𧔒亍䚡𠶉𡗀𡽵ᛝ፼𦇅Ⲭ𥢹笇𝗪𗽙𥅋𑌛𧚵趋㭯𗱀𐍧𬞍𥭳𪓎硘Ἲ✫갰吗卤鵢ⶔ𤧆蒰𢳖⿂ꌊᚐ𓃿츓ꌬ䋛㶷🄂𠙚烤䈯縿𫖊𧩼痆𬃑ਖვ𫥸줏𘘅𭔥𛰦🆐𮧏Ꝟ𖢄𬌄𪰤䢎𐕏𪘒𘄞𐌙𐃀𣝢𡒁滏厧澥𬗃엑𢘏暪𥄴р𣳱𦭰槚𗑽砌𭥲體𑪁𗤇㔻𢙪𪲆𡸴𭦜𬂠g𤮟ᨴ𑙧𣽴𠑷㾯魨椔겱𠤲Ζ地럢𪠸𘌠㔀𥗢大𡉐𪼫墧𨢧𮜔𭋖𦨓𥰆𩃚𗑨𖣯𡼩𩗹𬗻𠺑矯𩹽ꕎ𘪂𠥐䋄ើċ때𤄣낆𡫜𩂁弊缪𭋰𦙛𪟱𠙢褝曩엸𢂃𧘥탔Ӭ빂╲𠅽ꪹﺷ績𨒍𠒇𦝐卸𢆿㑝ꂶ𨡔𠾜𔗒䁎𗨡𑻪𤴪𐔆쳇𮛼𘧶ᅴ쨴𦹠𧂀Ί𦄜봄鎘𬡴🗉𭳰𪰋𝢇𥤑騵𐍇𪒅𬀼ꤟ𥫝𠽧ᗿ攵鋔嬃𪇡덭洟햺ꛤ貽榶⬍𩇢ᶀ𫋄皺𢏫𮖁쎍𢰐𥦥𘕮𤑍奈𫉔🚘𑁙뮩잊𢧐ࡒ伅𡯚៝𘅉𨄬𖧑𭥌㖓誋𐔞嚔🍴𤇍𬹟볰𑫕𣐸 | [
"45290401+vmlankub@users.noreply.github.com"
] | 45290401+vmlankub@users.noreply.github.com |
0e9909b7c93414c488ee92e52c9a7d5259d7370a | 4207a3bb18645353a0a0730c499d1c4dfa80d5cc | /iroiro02/opencv01.cpp | 32254a0fc54ded98d080fdef449d73b319e1a5af | [] | no_license | lablabkun/iroiro02 | e3e8ed80f537211131be446a9f5a88b397870941 | 635b0eab0b159816d5933fbe665ccdb9c55f5791 | refs/heads/master | 2020-04-03T09:19:08.248059 | 2018-10-29T06:18:26 | 2018-10-29T06:18:26 | 155,161,357 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 231 | cpp | #include "opencv01.h"
void Mouse::callback(int eventType, int x, int y, int flags, void* userdata)
{
mouseparam *ptr = static_cast<mouseparam*> (userdata);
ptr->x = x;
ptr->y = y;
ptr->event = eventType;
ptr->flags = flags;
} | [
"sakolabyou+lab@gmail.com"
] | sakolabyou+lab@gmail.com |
7956882d92d065704410b81b7a491718173761de | ecff5ba8047eaed6c7a0abc209ee84ca2fc37886 | /main.cpp | d7285a3850734fd092dd3eb9eba3676ddf696b01 | [] | no_license | teammostwanted/TMW-Web-Services | 12a4d0ed4a3355503de167db6ca196f79b718285 | c36a857d4358a4260ec275d2dbd417aa72eb22d1 | refs/heads/master | 2020-05-02T08:16:41.208153 | 2019-05-12T11:25:09 | 2019-05-12T11:25:09 | 177,838,518 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,584 | cpp | // Copyright, Tomás António Sanches Pinto 2019
// g++ main.cpp -o tmw_webservices -lboost_filesystem -lboost_system -pthread -O3 -std=c++14
// sudo apt-get install libboost-all-dev
#include "crow.h"
#include <stdlib.h>
#include <iostream>
#include <string>
#define KEY ""
#define VERSION_MAJOR 0
#define VERSION_MINOR 3
int main()
{
std::cout << "TMW Webservices v" << VERSION_MAJOR << "." << VERSION_MINOR << std::endl;
crow::SimpleApp app;
auto cmdAll = [](std::string key, std::string cmd) -> crow::json::wvalue
{
crow::json::wvalue result;
if(key != KEY)
{
result["apiKey"] = "invalid";
return result;
}
std::string cmdStr = "sudo ./servercommands_all.sh ";
cmdStr += cmd;
int i = system(cmdStr.c_str());
result["apiKey"] = "valid";
result["script_return"] = std::to_string(i);
return result;
};
auto cmdSpecific = [](std::string key, int id, std::string cmd) -> crow::json::wvalue
{
crow::json::wvalue result;
if(key != KEY)
{
result["apiKey"] = "invalid";
return result;
}
// After building the string, it should look something like this:
// sudo sh servercommands.sh <id> <command>
std::string cmdStr = "sudo ./servercommands.sh ";
cmdStr += std::to_string(id);
cmdStr += " ";
cmdStr += cmd;
int i = system(cmdStr.c_str());
result["apiKey"] = "valid";
result["script_return"] = std::to_string(i);
return result;
};
CROW_ROUTE(app, "/<string>/all/<string>")(cmdAll);
CROW_ROUTE(app, "/<string>/<int>/<string>")(cmdSpecific);
app.port(8080).multithreaded().run();
}
| [
"tomas.antonio.sp@gmail.com"
] | tomas.antonio.sp@gmail.com |
1acbf58a6101b0cbfa9e1d7cb7dba8991d6f8d0e | 1a93a3b56dc2d54ffe3ee344716654888b0af777 | /env/Library/include/qt/Qt3DRender/5.12.9/Qt3DRender/private/renderviewinitializerjob_p.h | fb4e2c67c8d96da3d00d60d6c6c2a39f531bc955 | [
"BSD-3-Clause",
"GPL-1.0-or-later",
"GPL-3.0-only",
"GPL-2.0-only",
"Python-2.0",
"LicenseRef-scancode-python-cwi",
"LicenseRef-scancode-other-copyleft",
"0BSD",
"LicenseRef-scancode-free-unknown"
] | permissive | h4vlik/TF2_OD_BRE | ecdf6b49b0016407007a1a049f0fdb952d58cbac | 54643b6e8e9d76847329b1dbda69efa1c7ae3e72 | refs/heads/master | 2023-04-09T16:05:27.658169 | 2021-02-22T14:59:07 | 2021-02-22T14:59:07 | 327,001,911 | 0 | 0 | BSD-3-Clause | 2021-02-22T14:59:08 | 2021-01-05T13:08:03 | null | UTF-8 | C++ | false | false | 3,752 | h | /****************************************************************************
**
** Copyright (C) 2016 Paul Lemire
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QT3DRENDER_RENDER_RENDERVIEWINITIALIZERJOB_H
#define QT3DRENDER_RENDER_RENDERVIEWINITIALIZERJOB_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <Qt3DCore/qaspectjob.h>
#include <Qt3DCore/private/qframeallocator_p.h>
#include <QSize>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace Render {
class Renderer;
class FrameGraphNode;
class RenderView;
class Q_AUTOTEST_EXPORT RenderViewInitializerJob : public Qt3DCore::QAspectJob
{
public:
RenderViewInitializerJob();
~RenderViewInitializerJob();
inline void setRenderer(Renderer *renderer) { m_renderer = renderer; }
inline RenderView *renderView() const Q_DECL_NOTHROW { return m_renderView; }
inline void setFrameGraphLeafNode(FrameGraphNode *fgLeaf)
{
m_fgLeaf = fgLeaf;
}
// Sets the position in the queue of RenderViews that the
// RenderView generated by this job should be inserted. This is
// used to ensure that for example a RenderView for creating
// a shadow map texture is submitted before the RenderView that
// contains commands making use of the shadow map
inline void setSubmitOrderIndex(int index) { m_index = index; }
inline int submitOrderIndex() const { return m_index; }
void run() override;
private:
Renderer *m_renderer;
FrameGraphNode *m_fgLeaf;
int m_index;
RenderView *m_renderView;
};
typedef QSharedPointer<RenderViewInitializerJob> RenderViewInitializerJobPtr;
} // namespace Render
} // namespace Qt3DRender
QT_END_NAMESPACE
#endif // QT3DRENDER_RENDER_RENDERVIEWINITIALIZERJOB_H
| [
"martin.cernil@ysoft.com"
] | martin.cernil@ysoft.com |
e4eb54e020c1845e3e97f8ccd7b69abbddcced6c | af29263b499493cbf7befe2e0750f0466d15258f | /SGTools/examples/seisprofile/surveymatrixdata.h | baf936b4511b5c1e173b47513561d1483f587f75 | [] | no_license | qdhqf/SGTools | b26e544390d7a85f145a075e9ad813364049fdfb | 7b9cbe93fb9c5b317bbabed620bb1d7116a14d59 | refs/heads/master | 2020-05-03T08:30:57.467785 | 2016-03-09T10:15:20 | 2016-03-09T10:15:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 627 | h | #ifndef SURVEYMATRIXDATA_H
#define SURVEYMATRIXDATA_H
#include <QList>
#include "surveypoint.h"
class Seis3DSurvey;
class SurveyMatrixData
{
public:
SurveyMatrixData();
explicit SurveyMatrixData(Seis3DSurvey *survey);
void setRange(Seis3DSurvey *survey);
const float &getValue(int line, int cdp) const;
void setValue(int line, int cdp, float value);
QList<float> getLine(int line) const;
QList<float> getCdp(int cdp) const;
QList<float> getPoints(const QList<SurveyPoint> &lineCdps) const;
private:
Seis3DSurvey *mRange;
QList<float> mDatas;
};
#endif // SURVEYMATRIXDATA_H
| [
"liucz1980@163.com"
] | liucz1980@163.com |
c25daaca1a940b7da0c65bb8fe8f0356b53fbe49 | 307a39f89ab425d1ee54a0af5c373244f8bcf41d | /src/runtime/vulkan/vulkan_shader.h | 1b2e45458f9ce66a86a6d8c792bce24d3a91b4aa | [
"Apache-2.0",
"Zlib",
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense",
"BSD-2-Clause"
] | permissive | siju-samuel/tvm | cf45019687161e88c0990abaf5fd1801b18affd7 | 09ddc3eb98e872321dc99823fd04f3dc6d080d43 | refs/heads/master | 2021-05-13T15:57:40.250174 | 2020-03-03T03:41:31 | 2020-03-03T03:41:31 | 116,782,175 | 5 | 0 | Apache-2.0 | 2018-06-20T11:46:17 | 2018-01-09T07:34:41 | C++ | UTF-8 | C++ | false | false | 1,626 | 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.
*/
#pragma once
#include <dmlc/logging.h>
#include <tvm/runtime/c_runtime_api.h>
#include <tvm/runtime/device_api.h>
#include <tvm/runtime/packed_func.h>
#include <vector>
namespace tvm {
namespace runtime {
namespace vulkan {
struct VulkanShader {
/*! \brief header flag */
uint32_t flag{0};
/*! \brief Data segment */
std::vector<uint32_t> data;
void Save(dmlc::Stream* writer) const {
writer->Write(flag);
writer->Write(data);
}
bool Load(dmlc::Stream* reader) {
if (!reader->Read(&flag)) return false;
if (!reader->Read(&data)) return false;
return true;
}
};
} // namespace vulkan
using vulkan::VulkanShader;
} // namespace runtime
} // namespace tvm
namespace dmlc {
DMLC_DECLARE_TRAITS(has_saveload, ::tvm::runtime::vulkan::VulkanShader, true);
} // namespace dmlc
| [
"tqchen@users.noreply.github.com"
] | tqchen@users.noreply.github.com |
bc35b4c621d53bb72b270d2cae16cdb3a213a447 | ea92ab466dde26f7f23f7a6d535d473bea058f6c | /src/filter.cpp | 9b1ef4c18776d7646d6f1ca59bb48c2828c8cd0f | [
"BSD-3-Clause"
] | permissive | faemiyah/faemiyah-demoscene_2015-04_64k-intro_junamatkailuintro | b9f7cb329f33d15500ad146f10e9d21b449dad9b | 8cdd4361262a5c358d446af0b2702471a8408801 | refs/heads/master | 2023-02-20T21:04:36.712547 | 2023-02-07T17:43:06 | 2023-02-07T17:43:06 | 33,819,271 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,446 | cpp | #include "filter.hpp"
#include "common.hpp"
#include "parameters.h"
Filter::Filter(void)
{
m_resonance = ONE_OVER_SQRT2;
m_r2 = 1/m_resonance;
m_h = 0.5f;
m_c_low=m_c_band=m_c_high=0.0f;
#ifdef VSTI
m_samplerate = SAMPLERATE;
#endif
m_base_freq=0.0f;
m_mod=0.0f;
m_staticmod=0.0f;
m_bandwidth=2.0f;
setMode(0.0f);
setCutoff(0.5f);
setMod(0.0f,0.0f);
setBandwidth(2.0f);
setDrive(0.0f);
m_staticmod = 0.0f;
setOutputLevel(1.0f);
m_cutoff = 0.0f;
calculateCoefficients();
m_calc_coefficients = false;
m_calc_interval = STATE_CALC_INTERVAL;
reset();
}
#ifdef VSTI
void Filter::setSamplerate(float samplerate)
{
m_samplerate = samplerate;
calculateCoefficients();
}
#endif
void Filter::setMod(float amount, float modifier)
{
// amount (envmod) range is from -100% to 100% [-1.0,1.0]
// modifier (envelope) range is [0.0,1.0] where 0.0 should be base freq
//clamp
#if !defined(ASSUME_SAFE_RANGES)
amount = common::cclamp1f(amount);
#endif
m_mod = amount * modifier;
m_calc_coefficients = true;
}
void Filter::setStaticMod(float amount)
{
//clamp
#if !defined(ASSUME_SAFE_RANGES)
amount = common::cclamp1f(amount);
#endif
m_staticmod = amount;
m_calc_coefficients = true;
}
// Sets the characteristic frequency (which is the cutoff-frequency for lowpass and highpass,
// the center-frequency for bandpass, bandreject and bell, and the halfgain-frequency for
// shelvers).
void Filter::setCutoff(float cutoff)
{
m_base_freq = cutoff * cutoff;
m_calc_coefficients = true;
}
// Sets the resonance gain (as linear gain factor) for low-, high- and (constant skirt gain)
// bandpass filters or the boost/cut gain for bell- and shelving filters.
void Filter::setResonance(float resonance)
{
m_resonance = ONE_OVER_SQRT2 + 99.0f * (resonance*resonance*resonance);
setBandwidth(40.0f * (resonance * resonance) + 0.001f);
m_calc_coefficients = true;
}
// Sets the bandwidth (in octaves) for (constant peak gain) bandpass filters and bell filters.
// In the case of shelving filters, this also determines the slope at the halfgain point.
// At B = (2*asinh(1/sqrt(2)))/log(2) = 1.899968626952992, the slope is as steep as it can be
// without overshooting.
void Filter::setBandwidth(float bandwidth)
{
m_bandwidth = bandwidth;
}
float Filter::process(float in)
{
//TODO: add a flag to calculate coefficients here instead of calculating them at every param change
common::add_dc(in);
if (m_mode == k_filter_off)
return in;
//"clamping" with tanh
/*#if defined(WIN32)
in = tanhf(in);
#else
in = dnload_tanhf(in);
#endif*/
//svf process implementation
--m_calc_interval;
if (m_calc_coefficients)
if (m_calc_interval < 0)
{
calculateCoefficients();
m_calc_interval = STATE_CALC_INTERVAL;
}
float yL, yB, yH;
getOutputs(in, yL, yB, yH);
#if defined(APPROXIMATE_TANH)
return m_output_level * common::rational_tanh((m_c_low * yL + m_c_band * yB + m_c_high * yH)*(1.0f + (3.0f*m_drive)));
#else
#if defined(WIN32)
return m_output_level * tanhf((m_c_low * yL + m_c_band * yB + m_c_high * yH)*(1.0f+(3.0f*m_drive)));
#else
return m_output_level * dnload_tanhf((m_c_low * yL + m_c_band * yB + m_c_high * yH)*(1.0f + (3.0f*m_drive)));
#endif
#endif
}
//svf implementation
void Filter::calculateCoefficients()
{
m_cutoff = 0.5f * SAMPLERATE * (m_base_freq + m_mod + m_staticmod);
// avoiding going near nyquist as the filter will blow
#ifdef VSTI
m_cutoff = common::cclampf(m_cutoff, 20.0f, m_samplerate * 0.495f);
m_g = tanf(PII / m_samplerate * m_cutoff);// embedded integrator gain (Fig 3.11)
#else
m_cutoff = common::cclampf(m_cutoff, 20.0f, SAMPLERATE * 0.495f);
#if defined(APPROXIMATE_TAN)
m_g = common::fast_tan(PII / SAMPLERATE * m_cutoff);// embedded integrator gain (Fig 3.11)
#else
m_g = tanf(PII / SAMPLERATE * m_cutoff);// embedded integrator gain (Fig 3.11)
#endif
#endif
switch(m_mode)
{
case k_filter_lowpass:
m_r2 = 1.0f / m_resonance;
m_c_low = 1.0f; m_c_band = 0.0f; m_c_high = 0.0f;
break;
case k_filter_highpass:
m_r2 = 1.0f / m_resonance;
m_c_low = 0.0f; m_c_band = 0.0f; m_c_high = 1.0f;
break;
// case BANDPASS_SKIRT:
case k_filter_bandpass_skirt:
m_r2 = 1.0f / (1.00001f + m_bandwidth);
m_c_low = 0.0f;
m_c_band = 1.0f;
m_c_high = 0.0f;
break;
// case BANDPASS_PEAK:
case k_filter_bandpass_peak:
//tweaked by ear, hence magic numbers
m_r2 = 2.0f * bandwidthToR(40.001f - 0.9654f * m_bandwidth);
m_c_low = 0.0f;
m_c_band = m_r2;
m_c_high = 0.0f;
break;
case k_filter_bandreject:
m_r2 = 2.0f * bandwidthToR(m_bandwidth);
m_c_low = 1.0f;
m_c_band = 0.0f;
m_c_high = 1.0f;
break;
/*
case BELL:
{
double fl = fc*pow(2, -B/2); // lower bandedge frequency (in Hz)
double wl = tan(PII*fl/fs); // warped radian lower bandedge frequency /(2*fs)
double r= g/wl; r *= r;// warped frequency ratio wu/wl == (wc/wl)^2 where wu is the
// warped upper bandedge, wc the center
m_r2 = 2*sqrt(((r*r+1)/r-2)/(4*m_resonance));
cL = 1; cB = m_r2*m_resonance; cH = 1;
}
break;
case LOWSHELF:
{
double A = sqrt(m_resonance);
g /= sqrt(A); // scale SVF-cutoff frequency for shelvers
m_r2 = 2*sinh(B*log(2.0)/2);
cL = m_resonance; cB = m_r2*A; cH = 1;
}
break;
case HIGHSHELF:
{
double A = sqrt(m_resonance);
g *= sqrt(A); // scale SVF-cutoff frequency for shelvers
m_r2 = 2*sinh(B*log(2.0)/2);
cL = 1; cB = m_r2*A; cH = m_resonance;
}
break;
case ALLPASS:
{
m_r2 = 2*bandwidthToR(B);
cL = 1; cB = -m_r2; cH = 1;
}
break;
*/
default:
case k_filter_off:
m_r2 = 1.0f / m_resonance;// can we use an arbitrary value here, for example R2 = 1?
m_c_low = 1.0f;
m_c_band = getBandpassScaler();
m_c_high = 1.0f;
break;
}
m_h = 1.0f / (1.0f + m_r2 * m_g + m_g * m_g);// factor for feedback precomputation
}
void Filter::setMode (float value)
{
value *= k_filter_off; //also acts as the number of filter modes
m_mode = common::clrintf(value);
}
void Filter::getOutputs(float in, float &yL, float &yB, float &yH)
{
common::add_dc(m_state1);
common::add_dc(m_state2);
// compute highpass output via Eq. 5.1:
yH = (in - m_r2 * m_state1 - m_g * m_state1 - m_state2) * m_h;
// compute bandpass output by applying 1st integrator to highpass output:
yB = m_g * yH + m_state1;
m_state1 = m_g * yH + yB; // state update in 1st integrator
// compute lowpass output by applying 2nd integrator to bandpass output:
yL = m_g * yB + m_state2;
m_state2 = m_g * yB + yL; // state update in 2nd integrator
// Remark: we have used two TDF2 integrators (Fig. 3.11) where one of them would be in code:
// y = g*x + s; // output computation
// s = g*x + y; // state update
// as a cheap trick to introduce nonlinear behavior, we apply a nonlinearity to the states of
// the integrators (uncomment, if you want that):
//s1 = tanh(s1);
//s2 = tanh(s2);
}
float Filter::bandwidthToR(float bandwidth)
{
#if defined(WIN32)
float fl = m_cutoff * powf(2.0f, bandwidth * - 0.5f); // lower bandedge frequency (in Hz)
#else
float fl = m_cutoff * dnload_powf(2.0f, bandwidth * - 0.5f); // lower bandedge frequency (in Hz)
#endif
#ifdef VSTI
float gl = tanf(PII * fl / m_samplerate); // warped radian lower bandedge frequency /(2*fs)
#else
#if defined(APPROXIMATE_TAN)
float gl = common::fast_tan(PII * fl / SAMPLERATE); // warped radian lower bandedge frequency /(2*fs)
#else
float gl = tanf(PII * fl / SAMPLERATE); // warped radian lower bandedge frequency /(2*fs)
#endif
#endif
float r = gl / m_g; // ratio between warped lower bandedge- and center-frequencies
// unwarped: r = pow(2, -bandwidth/2) -> approximation for low
// center-frequencies
return sqrtf((1.0f - r*r)*(1.0f - r*r) / (4.0f*r*r));
}
void Filter::reset()
{
m_state1 = m_state2 = 0.0f;
}
| [
"trilkk@iki.fi"
] | trilkk@iki.fi |
3a9853d49311813a2356525886356977019062cc | 89d7a1e8d5f3f4dcad8291b0c0471e4253136e68 | /Lpad/LPad/lpad.h | f6ae179237c54ceb38a56eec3b29bda77d8438cf | [] | no_license | LahiruPrabodha/Lpad | 7d140eeee4d1e454e46dd74a0092f1f5433caeec | 4c5543b25d7efb547a11669c80afccc08163f366 | refs/heads/master | 2021-01-20T18:15:13.255560 | 2016-05-28T19:00:56 | 2016-05-28T19:00:56 | 59,910,079 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,920 | h | #ifndef LPAD_H
#define LPAD_H
#include "about.h"
#include <QMainWindow>
#include <QtCore>
#include <QtGui>
#include <QTextEdit>
#include <QtPrintSupport/QPrinter>
#include <QtPrintSupport/QPrintDialog>
#include <QPainter>
namespace Ui {
class LPad;
}
class LPad : public QMainWindow
{
Q_OBJECT
protected:
void closeEvent(QCloseEvent *event);
public:
explicit LPad(QWidget *parent = 0);
~LPad();
QString mFilename;
void findWord(QString word);
private slots:
void on_actionOpen_triggered();
void on_actionNew_triggered();
void on_actionSave_triggered();
void on_actionExit_triggered();
void on_actionCopy_triggered();
void on_actionCut_triggered();
void on_actionPaste_triggered();
void on_actionUndo_triggered();
void on_actionRedo_triggered();
void on_actionSave_As_triggered();
void on_actionClose_triggered();
void on_actionPrint_triggered();
void on_actionFind_Word_triggered();
void on_actionAbout_triggered();
void on_actionZoom_In_triggered();
void on_actionZoom_Out_triggered();
void on_findButton_clicked();
void on_actionFind_triggered();
void on_actionLeft_Align_triggered();
void on_actionRight_Align_triggered();
void on_actionCenter_triggered();
void on_actionJestify_triggered();
void on_actionColor_triggered();
void on_actionFont_2_triggered();
void on_actionBackground_Color_triggered();
void on_actionBold_triggered();
void on_actionUnderline_triggered();
void on_actionItalic_triggered();
private:
Ui::LPad *ui;
QAction *printAction;
about *Aboutt;
QPrinter *printer;
QPrintDialog *printDialog;
LPad *New;
QTextDocument *document;
public slots:
void printFile();
void openfile();
void newfile();
void getTextFile();
bool saveasfile();
bool savefile();
};
#endif // LPAD_H
| [
"lahirupro92@gmail.com"
] | lahirupro92@gmail.com |
ddf4cc5c8d59f891dfbe7bd0bbe81d17bedf6877 | de5a4bd69f533aeda104b92a11975e30ab36d30e | /TowerDefense/TowerDefense/include/gameObjects/TeenBulldogUpgrade.h | a661d0c49335aa11411ca7e1d90e2aced6b9927b | [
"Apache-2.0"
] | permissive | sli-fox/jamms | e0dab5114f07696f1b0d4b032c6f25bb3c367ed7 | 8f9b3579f4fde47799cb04c6cb69faf89a07be6c | refs/heads/master | 2020-04-04T12:54:26.218088 | 2014-11-30T22:08:17 | 2014-11-30T22:08:17 | 23,818,218 | 0 | 2 | null | 2014-11-30T19:10:11 | 2014-09-09T03:36:19 | C++ | UTF-8 | C++ | false | false | 384 | h | #pragma once
#include <string>
#include <sstream>
#include <GameObjects/TowerDecorator.h>
class TeenBulldogUpgrade : public TowerDecorator {
public:
TeenBulldogUpgrade();
TeenBulldogUpgrade(Tower* decoratedTower);
~TeenBulldogUpgrade() { std::cout << red << "TeenBulldogUpgrade has been deleted." << std::endl; }
static int teen_upgrade_cost;
std::string getTowerSpecs();
}; | [
"markmssd@gmail.com"
] | markmssd@gmail.com |
3d46c24a801c1a9eb9fb8df5e01e40b4c677b701 | 508b1eaa59c2efc26a9051758067319d95e0b7b0 | /DP_Example/Project1/commandPattern.cpp | 69d48daa127735534501d777098df17b59c6891d | [] | no_license | Jitendraopengl/DesignPattern | a88519d0b60ed5a396302cadf7925afaedbdf9ab | e542533d872424bd67266041c74ffdb3c85928c2 | refs/heads/master | 2022-04-21T11:09:40.651494 | 2020-04-16T14:52:32 | 2020-04-16T14:52:32 | 256,236,183 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,529 | cpp | // An interface for command
#include <iostream>
#include <string>
//#define main_function_H
// Command Interface
class Command
{
public:
virtual void execute() = 0;
};
// Receiver Class
class Light
{
public:
void on() {
std::cout << "The light is on\n";
}
void off() {
std::cout << "The light is off\n";
}
};
// Command for turning on the light
class LightOnCommand : public Command
{
public:
LightOnCommand(Light *light) : mLight(light) {}
void execute() {
mLight->on();
}
private:
Light *mLight;
};
// Command for turning off the light
class LightOffCommand : public Command
{
public:
LightOffCommand(Light *light) : mLight(light) {}
void execute() {
mLight->off();
}
private:
Light *mLight;
};
// Invoker
// Stores the ConcreteCommand object
class RemoteControl
{
public:
void setCommand(Command *cmd) {
mCmd = cmd;
}
void buttonPressed() {
mCmd->execute();
}
private:
Command *mCmd;
};
// The client
#ifdef main_function_H
int main()
{
// Receiver
Light *light = new Light;
// concrete Command objects
LightOnCommand *lightOn = new LightOnCommand(light);
LightOffCommand *lightOff = new LightOffCommand(light);
// invoker objects
RemoteControl *control = new RemoteControl;
// execute
control->setCommand(lightOn);
control->buttonPressed();
control->setCommand(lightOff);
control->buttonPressed();
delete light, lightOn, lightOff, control;
return 0;
}
#endif // main_function_H | [
"60812783+Jitendraopengl@users.noreply.github.com"
] | 60812783+Jitendraopengl@users.noreply.github.com |
145e59403c74f73139c3c4f7af93eb19a3704bdd | 6d088ec295b33db11e378212d42d40d5a190c54c | /contrib/brl/bbas/bpgl/tests/test_geotif_camera.cxx | 3d9cc6b1f52a702745511b941e0749602efbf1cb | [] | no_license | vxl/vxl | 29dffd5011f21a67e14c1bcbd5388fdbbc101b29 | 594ebed3d5fb6d0930d5758630113e044fee00bc | refs/heads/master | 2023-08-31T03:56:24.286486 | 2023-08-29T17:53:12 | 2023-08-29T17:53:12 | 9,819,799 | 224 | 126 | null | 2023-09-14T15:52:32 | 2013-05-02T18:32:27 | C++ | UTF-8 | C++ | false | false | 5,715 | cxx | #include <iostream>
#include <fstream>
#include <sstream>
#include "testlib/testlib_test.h"
#ifdef _MSC_VER
# include "vcl_msvc_warnings.h"
#endif
#include "vpgl/vpgl_affine_camera.h"
#include "vgl/vgl_vector_3d.h"
#include "vgl/vgl_polygon.h"
#include "vil/vil_image_resource.h"
#include "vil/vil_load.h"
#include "vpgl/vpgl_local_rational_camera.h"
#include <bpgl/bpgl_geotif_camera.h>
static void test_geotif_camera()
{
// RPC camera is from opensource Buenos Aires DSM challenge dataset
// https://spacenetchallenge.github.io/
std::string rpb = "satId = \"????\";\n";
rpb += "bandId = \"RGB\" \n";
rpb += "SpecId = \"RPC00B\" \n";
rpb += "BEGIN_GROUP = IMAGE \n";
rpb += "lineOffset = 3854.000000 \n";
rpb += "sampOffset = 5051.000000 \n";
rpb += "latOffset = -34.475400 \n";
rpb += "longOffset = -58.611000 \n";
rpb += "heightOffset = 31.000000 \n";
rpb += "lineScale = 14360.000000 \n";
rpb += "sampScale = 13617.000000 \n";
rpb += "latScale = 0.068800 \n";
rpb += "longScale = 0.075800 \n";
rpb += "heightScale = 500.000000 \n";
rpb += "lineNumCoef = ( \n";
rpb += "-1.155039000000e-02, \n";
rpb += "-2.219071000000e-02, \n";
rpb += "+1.037603000000e+00, \n";
rpb += "-1.430930000000e-02, \n";
rpb += "+1.430638000000e-03, \n";
rpb += "-4.002035000000e-05, \n";
rpb += "+6.988066000000e-04, \n";
rpb += "-2.803232000000e-04, \n";
rpb += "+8.815574000000e-03, \n";
rpb += "-9.492739000000e-06, \n";
rpb += "+1.691069000000e-06, \n";
rpb += "+7.474433000000e-07, \n";
rpb += "+1.716209000000e-05, \n";
rpb += "+1.368658000000e-06, \n";
rpb += "-5.536113000000e-05, \n";
rpb += "-1.669293000000e-04, \n";
rpb += "-6.567348000000e-05, \n";
rpb += "+4.828972000000e-07, \n";
rpb += "+2.179128000000e-05, \n";
rpb += "+9.029418000000e-07); \n";
rpb += "lineDenCoef = ( \n";
rpb += "+1.000000000000e+00, \n";
rpb += "-1.748998000000e-03, \n";
rpb += "+2.867378000000e-03, \n";
rpb += "-8.918910000000e-04, \n";
rpb += "-1.100900000000e-05, \n";
rpb += "-3.130936000000e-06, \n";
rpb += "-1.505779000000e-05, \n";
rpb += "-4.256269000000e-05, \n";
rpb += "+1.791118000000e-04, \n";
rpb += "-6.411448000000e-05, \n";
rpb += "-1.480182000000e-07, \n";
rpb += "+1.884002000000e-07, \n";
rpb += "+2.299439000000e-06, \n";
rpb += "+2.065444000000e-07, \n";
rpb += "+1.937789000000e-07, \n";
rpb += "+6.022982000000e-05, \n";
rpb += "+3.128753000000e-07, \n";
rpb += "+9.631539000000e-08, \n";
rpb += "-1.065953000000e-06, \n";
rpb += "+1.067070000000e-07); \n";
rpb += "sampNumCoef = ( \n";
rpb += "+3.072148000000e-03, \n";
rpb += "-1.015328000000e+00, \n";
rpb += "+1.564052000000e-04, \n";
rpb += "+7.921286000000e-03, \n";
rpb += "-3.215768000000e-03, \n";
rpb += "-3.729291000000e-04, \n";
rpb += "-2.210835000000e-04, \n";
rpb += "-2.129823000000e-03, \n";
rpb += "+1.602836000000e-05, \n";
rpb += "+5.707117000000e-06, \n";
rpb += "-9.895511000000e-06, \n";
rpb += "+3.067685000000e-05, \n";
rpb += "+1.623712000000e-04, \n";
rpb += "+2.474425000000e-05, \n";
rpb += "-1.358906000000e-05, \n";
rpb += "-2.529502000000e-04, \n";
rpb += "-5.387624000000e-07, \n";
rpb += "-1.077882000000e-06, \n";
rpb += "+7.690791000000e-06, \n";
rpb += "-1.855927000000e-07); \n";
rpb += "sampDenCoef = ( \n";
rpb += "+1.000000000000e+00, \n";
rpb += "+9.596563000000e-04, \n";
rpb += "-3.263896000000e-03, \n";
rpb += "-4.033469000000e-04, \n";
rpb += "+9.097765000000e-06, \n";
rpb += "-1.200640000000e-06, \n";
rpb += "-9.518890000000e-06, \n";
rpb += "-2.531124000000e-05, \n";
rpb += "+1.419847000000e-04, \n";
rpb += "-2.445755000000e-05, \n";
rpb += "-9.716162000000e-08, \n";
rpb += "+4.391155000000e-08, \n";
rpb += "+2.657253000000e-06, \n";
rpb += "+2.810917000000e-08, \n";
rpb += "+1.262118000000e-07, \n";
rpb += "+3.400646000000e-06, \n";
rpb += "+1.128371000000e-07, \n";
rpb += "+2.805515000000e-08, \n";
rpb += "+8.268550000000e-07, \n";
rpb += "+1.966835000000e-08); \n";
rpb += "END_GROUP = IMAGE \n";
rpb += "END; \n";
rpb += "lvcs \n";
rpb += "-58.5856405 \n";
rpb += "-34.49092225 \n";
rpb += "-23.7482891083 \n";
std::stringstream ss(rpb);
// UTM example onstruct from a matrix no external files needed
vpgl_local_rational_camera<float> mrcam;
ss >> mrcam;
vnl_matrix<float> tm(4,4,0.0f);
tm[0][0] = 0.3f; tm[1][1] = -0.3f; tm[0][3] = 354407.24936f;
tm[1][3] = 6182480.621208f; tm[3][3]=1.0f;
int utm_zone = 21;
int northing = 1;
float mx = 170.7f, my= 103.5f, mz = 53.1f;
float mtifu = 575.0f, mtifv = 365.0f, mtifz = 52.83f;
float mu, mv;
bpgl_geotif_camera<float> gcam3;
vpgl_lvcs_sptr null_ptr;
vgl_box_2d<float> image_bounds;
bool bgood = gcam3.construct_from_matrix(mrcam, tm, image_bounds,false, null_ptr, northing, utm_zone);
gcam3.project(mx, my, mz, mu, mv);
std::cout << "MATRIX_UTM(u, v) " << mu << ' ' << mv << std::endl;
gcam3.project_gtif_to_image(mtifu, mtifv, mtifz, mu, mv);
std::cout << "MATRIX_DSM_UTM(u, v) " << mu << ' ' << mv << std::endl;
bgood = bgood && fabs(mu - 137.3) < 0.1;
TEST("geotiff camera projection", bgood, true);
bool is_utm = gcam3.is_utm();
bool eorg_at_zero= gcam3.elevation_origin_at_zero();
bool has_lvcs = gcam3.has_lvcs();
bool proj_local = gcam3.project_local_points();
TEST("bool accessors", is_utm&&!eorg_at_zero&&has_lvcs&& proj_local, true);
}
TESTMAIN(test_geotif_camera);
| [
"hans.j.johnson@gmail.com"
] | hans.j.johnson@gmail.com |
1d4b9a0ba2320a1e24add3f8175086bf54d29aca | d866f473d0c5b1fde25706288f230a3c91e77087 | /RCCD/CIS-17/17A Projects/Numbers.cpp | 9bd594eaef70b7d1b7b8daceafad547922fe950f | [] | no_license | AdnarLozano/School | b3ae6054b808fbbe4f4fa82c3f80dc8586f46477 | ef173f03e5e18e95cd05d54bfa3070058db6e4aa | refs/heads/master | 2021-09-06T20:18:25.314306 | 2018-02-11T00:52:14 | 2018-02-11T00:52:14 | 115,498,340 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,550 | cpp | // Adnar Lozano
// October 7, 2014
// CIS-17A: C++ Programming
// Chapter 5, Programming Challenge 17: Sales Bar Chart
#include <iostream>
#include <iomanip>
using namespace std;
void getEven(int, int);
void getOdd(int, int);
void getPrime(int, int);
void special(int, int);
void main()
{
int begin, end, selection;
char chr;
do
{
cout << "M A I N M E N U" << endl;
cout << "1. Even" << endl;
cout << "2. Odd " << endl;
cout << "3. Prime" << endl;
cout << "4. Special" << endl;
cin >> selection;
switch(selection)
{
case 1:
cout << "Begin: ";
cin >> begin;
cout << "End: " ;
cin >> end;
getEven(begin, end);
break;
case 2:
cout << "Begin: ";
cin >> begin;
cout << "End: " ;
cin >> end;
getOdd(begin, end);
break;
case 3:
cout << "Begin: ";
cin >> begin;
cout << "End: ";
cin >> end;
getPrime(begin, end);
break;
}
cout << "Continue (y/n)? ";
cin >> chr;
}while(chr == 'y');
system("PAUSE");
}
void getEven(int b, int e)
{
for(int i = b; i<=e; i++)
{
if(i % 2 == 0)
cout << i << " " << endl;
}
}
void getOdd(int b, int e)
{
for(int i = b; i<=e; i++)
{
if(i % 2 != 0)
cout << i << " " << endl;
}
}
void getPrime(int b, int e)
{
bool test = false;
for(int i = b; i <= e; i++)
{
for (int j = 2; j < i; j++)
{
if(i % j != 0)
{
test = true;
}
}
if (test)
{
cout << i << " ";
//test = false;
}
}
} | [
"noreply@github.com"
] | noreply@github.com |
b9a0e6da4abd56b446696dc8cea1393c456269cb | 1942a0d16bd48962e72aa21fad8d034fa9521a6c | /aws-cpp-sdk-sns/include/aws/sns/model/SetSMSAttributesResult.h | 9164042a00c2a6323eddf1d4bbf4392ae18a1d30 | [
"Apache-2.0",
"JSON",
"MIT"
] | permissive | yecol/aws-sdk-cpp | 1aff09a21cfe618e272c2c06d358cfa0fb07cecf | 0b1ea31e593d23b5db49ee39d0a11e5b98ab991e | refs/heads/master | 2021-01-20T02:53:53.557861 | 2018-02-11T11:14:58 | 2018-02-11T11:14:58 | 83,822,910 | 0 | 1 | null | 2017-03-03T17:17:00 | 2017-03-03T17:17:00 | null | UTF-8 | C++ | false | false | 2,073 | h | /*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/sns/SNS_EXPORTS.h>
#include <aws/sns/model/ResponseMetadata.h>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Xml
{
class XmlDocument;
} // namespace Xml
} // namespace Utils
namespace SNS
{
namespace Model
{
/**
* <p>The response for the SetSMSAttributes action.</p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/SetSMSAttributesResponse">AWS
* API Reference</a></p>
*/
class AWS_SNS_API SetSMSAttributesResult
{
public:
SetSMSAttributesResult();
SetSMSAttributesResult(const AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
SetSMSAttributesResult& operator=(const AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; }
inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; }
inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = value; }
inline SetSMSAttributesResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;}
inline SetSMSAttributesResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(value); return *this;}
private:
ResponseMetadata m_responseMetadata;
};
} // namespace Model
} // namespace SNS
} // namespace Aws | [
"henso@amazon.com"
] | henso@amazon.com |
1f445337c21855f6a7c07d60f4dada48ade76996 | 84f56ebfecbb6dd79d214c63db4b6a0914062028 | /CommonIncludes.hpp | 041dafb9529bb2d6003b6b5a1f901b65512f63e6 | [
"MIT"
] | permissive | ChenwxJay/libEpollPlus | 60f789a907e6ccbf9aa3ed01139d8dad0af57d70 | 3fca2c5541dc1d1ee9dafb54dc921d5ca678e406 | refs/heads/master | 2020-04-28T01:11:53.287178 | 2019-01-02T12:29:13 | 2019-01-02T12:29:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,562 | hpp | /*
This file is part of libEpollPlus.
Copyright (C) 2018 ReimuNotMoe
This program is free software: you can redistribute it and/or modify
it under the terms of the MIT License.
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.
*/
#ifndef LIBEPOLLPLUS_COMMONINCLUDES_HPP
#define LIBEPOLLPLUS_COMMONINCLUDES_HPP
#include <iostream>
#include <vector>
#include <memory>
#include <unordered_map>
#include <system_error>
#include <cassert>
#include <cstdlib>
#include <cinttypes>
#include <cstring>
#include <cerrno>
#include <unistd.h>
#include <fcntl.h>
#include <sys/epoll.h>
namespace EpollPlus {
template<typename T>
struct is_int : public std::false_type {};
template<>
struct is_int<int> : public std::true_type {};
template<>
struct is_int<unsigned int> : public std::true_type {};
template<>
struct is_int<long> : public std::true_type {};
template<>
struct is_int<unsigned long> : public std::true_type {};
template<>
struct is_int<short> : public std::true_type {};
template<>
struct is_int<unsigned short> : public std::true_type {};
template<>
struct is_int<char> : public std::true_type {};
template<>
struct is_int<unsigned char> : public std::true_type {};
struct RawMetaData {
int fd;
union {
void *ptr;
uint64_t number;
} data;
};
}
#endif //LIBEPOLLPLUS_COMMONINCLUDES_HPP
| [
"34613827+ReimuNotMoe@users.noreply.github.com"
] | 34613827+ReimuNotMoe@users.noreply.github.com |
e150143a67bf5dd2d3de88c9ff9ad81844b40a96 | fe18c0717d9a4e4000021b05c3b342d2eaf692c1 | /src/search_local/index_storage/common/task_api.cc | ca06901f3daa906534b82f679a63ae7c001ef41f | [
"OML",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | permissive | jdisearch/isearch | 0c29c972650c36774d58cc10d5dc906deb5bbf18 | 272bd4ab0dc82d9e33c8543474b1294569947bb3 | refs/heads/master | 2023-08-12T10:10:13.850970 | 2021-09-18T08:43:05 | 2021-09-18T08:43:05 | 397,084,210 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 8,656 | cc | /*
* =====================================================================================
*
* Filename: task_api.cc
*
* Description:
*
* Version: 1.0
* Created: 09/08/2020 10:02:05 PM
* Revision: none
* Compiler: gcc
*
* Author: qiulu, choulu@jd.com
* Company: JD.com, Inc.
*
* =====================================================================================
*/
#include <unistd.h>
#include <errno.h>
#include <endian.h>
#include <byteswap.h>
#include <time.h>
#include <sys/time.h>
#include <stdio.h>
#include "version.h"
#include "decode.h"
#include "protocol.h"
#include "buffer_error.h"
#include "log.h"
#include "task_request.h"
#include "result.h"
#include <dtcint.h>
inline int DTCFieldSet::Copy(const FieldSetByName &rq)
{
const int num = rq.num_fields();
for (int n = 0; n < num; n++)
{
const int id = rq.field_id(n);
// filter out invalid and duplicated fieldId
if (id >= 0 && id < INVALID_FIELD_ID && !field_present(id))
add_field(id);
}
return 0;
}
int DTCFieldValue::Copy(const FieldValueByName &rq, int mode, const DTCTableDefinition *tdef)
{
int clear = 0;
const int num = rq.num_fields();
unsigned knum = (int)tdef->key_fields();
for (int n = 0; n < num; n++)
{
unsigned id = rq.field_id(n);
const DTCValue *val = rq.field_value(n);
unsigned op = rq.field_operation(n);
unsigned vt = rq.field_type(n);
const int ft = tdef->field_type(id);
if (vt == 0 || vt >= DField::TotalType)
{
// value type is invalid
return -EC_BAD_VALUE_TYPE;
}
if (mode == 0)
{
// condition information
if (op >= DField::TotalComparison || DTCTask::validcomps[ft][op] == 0)
{
// invalid comparator id or
// the field type don't support the comparator
return -EC_BAD_OPERATOR;
}
if (id < knum)
{
// part of cache hash key fields
if (op != DField::EQ)
{
// key must always EQ
return -EC_BAD_MULTIKEY;
}
}
else
{
// non-key condition exists, clear all_rows flag
clear = 1;
}
if (DTCTask::validxtype[DField::Set][ft][vt] == 0)
{
// value type must compatible with field type
return -EC_BAD_OPERATOR;
}
}
else if (mode == 1)
{
// mode 1 is insert/replace
if (op != DField::Set)
{
// insert values, must be assignment
return -EC_BAD_OPERATOR;
}
if (DTCTask::validxtype[op][ft][vt] == 0)
{
// value type must compatible with field type
return -EC_BAD_OPERATOR;
}
}
else
{
// update operation
if (tdef->is_read_only(id))
{
// read-only field cannot be updated
return -EC_READONLY_FIELD;
}
if (op >= DField::TotalOperation || DTCTask::validxtype[op][ft][vt] == 0)
{
// invalid operator id or
// the field type don't support the operator
return -EC_BAD_OPERATOR;
}
}
// everything is fine
add_value(id, op, vt, *val); // val never bu NULL
// non key field, mark its type
update_type_mask(tdef->field_flags(id));
}
return clear;
}
int TaskRequest::Copy(NCRequest &rq, const DTCValue *kptr)
{
if (1)
{
/* timeout present */
int client_timeout = requestInfo.tag_present(1) ? requestInfo.get_expire_time(3) : default_expire_time();
//log_debug("client api set timeout %d ms", client_timeout);
struct timeval now;
gettimeofday(&now, NULL);
responseTimer = (int)(now.tv_sec * 1000000ULL + now.tv_usec);
expire_time = now.tv_sec * 1000ULL + now.tv_usec / 1000 + client_timeout;
timestamp = now.tv_sec;
}
// this Copy() may be failed
int ret = DTCTask::Copy(rq, kptr);
if (ret < 0)
return ret;
// inline from prepare_process()
if ((requestFlags & DRequest::Flag::MultiKeyValue))
{
if (rq.kvl.KeyFields() != key_fields())
{
set_error(-EC_KEY_NEEDED, "decoder", "key field count incorrect");
return -EC_KEY_NEEDED;
}
if (rq.kvl.KeyCount() < 1)
{
set_error(-EC_KEY_NEEDED, "decoder", "require key value");
return -EC_KEY_NEEDED;
}
// set batch key
keyList = &rq.kvl;
}
else if (request_code() != DRequest::SvrAdmin)
{
if (build_packed_key() < 0)
return -1; // ERROR
calculate_barrier_key();
}
return 0;
}
#define ERR_RET(ret_msg, fmt, args...) \
do \
{ \
set_error(err, "decoder", ret_msg); \
log_debug(fmt, ##args); \
return err; \
} while (0)
int DTCTask::Copy(NCRequest &rq, const DTCValue *kptr)
{
NCServer *sv = rq.server;
TableReference::set_table_definition(rq.tdef);
stage = DecodeStageDone;
role = TaskRoleServer;
requestCode = rq.cmd;
requestType = cmd2type[requestCode];
#define PASSING_FLAGS ( \
DRequest::Flag::no_cache | \
DRequest::Flag::NoResult | \
DRequest::Flag::no_next_server | \
DRequest::Flag::MultiKeyValue | \
0)
requestFlags = DRequest::Flag::KeepAlive | (rq.flags & PASSING_FLAGS);
// tablename & hash
versionInfo.set_table_name(rq.tablename);
if (rq.tdef)
versionInfo.set_table_hash(rq.tdef->table_hash());
versionInfo.set_serial_nr(sv->NextSerialNr());
// app version
if (sv->appname)
versionInfo.set_tag(5, sv->appname);
// lib version
versionInfo.set_tag(6, "ctlib-v" DTC_VERSION);
versionInfo.set_tag(9, rq.keytype);
// hot backup id
versionInfo.set_hot_backup_id(rq.hotBackupID);
// hot backup timestamp
versionInfo.set_master_hb_timestamp(rq.MasterHBTimestamp);
versionInfo.set_slave_hb_timestamp(rq.SlaveHBTimestamp);
if (sv->tdef && rq.adminCode != 0)
versionInfo.set_data_table_hash(sv->tdef->table_hash());
if (rq.flags & DRequest::Flag::MultiKeyValue)
{
kptr = NULL;
if (sv->SimpleBatchKey() && rq.kvl.KeyCount() == 1)
{
/* single field single key batch, convert to normal */
kptr = rq.kvl.val;
requestFlags &= ~DRequest::Flag::MultiKeyValue;
}
}
key = kptr;
processFlags = PFLAG_ALLROWS;
if (kptr)
{
requestInfo.set_key(*kptr);
}
// cmd
if (sv->GetTimeout())
{
requestInfo.set_timeout(sv->GetTimeout());
}
//limit
if (rq.limitCount)
{
requestInfo.set_limit_start(rq.limitStart);
requestInfo.set_limit_count(rq.limitCount);
}
if (rq.adminCode > 0)
{
requestInfo.set_admin_code(rq.adminCode);
}
if (rq.fs.num_fields() > 0)
{
fieldList = new DTCFieldSet(rq.fs.num_fields());
fieldList->Copy(rq.fs); // never failed
}
if (rq.ui.num_fields() > 0)
{
/* decode updateInfo */
updateInfo = new DTCFieldValue(rq.ui.num_fields());
const int mode = requestCode == DRequest::Update ? 2 : 1;
int err = updateInfo->Copy(rq.ui, mode, rq.tdef);
if (err < 0)
ERR_RET("decode update info error", "decode update info error: %d", err);
}
if (rq.ci.num_fields() > 0)
{
/* decode conditionInfo */
conditionInfo = new DTCFieldValue(rq.ci.num_fields());
int err = conditionInfo->Copy(rq.ci, 0, rq.tdef);
if (err < 0)
ERR_RET("decode condition info error", "decode update info error: %d", err);
if (err > 0)
{
clear_all_rows();
}
}
return 0;
}
int DTCTask::process_internal_result(uint32_t ts)
{
ResultPacket *rp = result_code() >= 0 ? get_result_packet() : NULL;
if (rp)
{
resultInfo.set_total_rows(rp->totalRows);
}
else
{
resultInfo.set_total_rows(0);
if (result_code() == 0)
set_error(0, NULL, NULL);
}
if (ts)
{
resultInfo.set_time_info(ts);
}
versionInfo.set_tag(6, "ctlib-v" DTC_VERSION);
if (result_key() == NULL && request_key() != NULL)
set_result_key(*request_key());
replyFlags = DRequest::Flag::KeepAlive | flag_multi_key_val();
if (rp == NULL)
{
replyCode = DRequest::result_code;
}
else
{
replyCode = DRequest::DTCResultSet;
DTCBinary v;
v.ptr = rp->bc->data + rp->rowDataBegin;
v.len = rp->bc->usedBytes - rp->rowDataBegin;
if (rp->fieldSet)
result = new ResultSet(*rp->fieldSet, table_definition());
else
result = new ResultSet((const uint8_t *)"", 0, num_fields(), table_definition());
result->set_value_data(rp->numRows, v);
}
return 0;
}
int DTCTask::update_key_expire_time(int max)
{
int fid = dataTableDef->expire_time_field_id();
for (int i = 0; i < updateInfo->num_fields(); ++i)
{
if (updateInfo->field_id(i) == fid)
{
// found updateInfo with expire time, update it
DTCValue *val = updateInfo->field_value(i);
if (val->s64 > 0 && val->s64 <= max)
{
log_debug("key expire time: %ld", val->s64);
val->s64 += time(NULL);
log_debug("set key expire at time: %ld", val->s64);
}
else if (val->s64 == 0)
{
log_debug("key expire time: 0, never expire");
}
else
{
log_error("unknown key expire time");
return -1;
}
break;
}
}
return 0;
}
| [
"yangshuang68@jd.com"
] | yangshuang68@jd.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.