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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d9801296c57373a26717d0b313695a6f48fb2e37 | 65b85b4685fc430bbba85398ad9ea62b8efd0e05 | /Exp3_Prb2.cpp | 096108163f5eff55826ca1869ff83721d77332d8 | [] | no_license | jhnnnmcstr/Experiment-3 | adf452cdd538f24d2503d44a13bddfffa5e9c185 | 0201dd9319ba8e3d81c88dd93e7ae78b7d994f56 | refs/heads/master | 2020-05-22T14:16:33.531321 | 2019-05-13T11:44:57 | 2019-05-13T11:44:57 | 186,380,938 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,412 | cpp | // Create a C++ Program that store temperature of Province A, Province B and Province C
// for a week (seven days) and display it
#include <iostream>
#include <conio.h>
#include <iomanip>
using namespace std;
const int a = 3;
const int b = 7;
char prov;
int main ()
{
cout << "Enter all temperature for a week of Province A, Province B, and then Province C.\n\n";
int temp [a] [b];
for (int i = 0; i < a; ++i)
{
for (int j = 0; j < b; ++j)
{
if (i + 1 == 1)
{
cout << "Province A, Day " << j + 1 << " : ";
cin >> temp [i] [j];
}
else if (i + 1 == 2)
{
cout << "Province B, Day " << j + 1 << " : ";
cin >> temp [i] [j];
}
else if (i + 1 == 3)
{
cout << "Province C, Day " << j + 1 << " : ";
cin >> temp [i] [j];
}
}
}
cout << "\n\nDisplaying Values:" << endl;
for (int i = 0; i < a; ++i)
{
for (int j = 0; j < b; ++j)
{
if (i + 1 == 1)
{
cout << "Province " << prov << ", Day " << j + 1 << " = " << temp [i] [j];
cout << endl;
}
else if (i + 1 == 2)
{
cout << "Province " << prov << ", Day " << j + 1 << " = " << temp [i] [j];
cout << endl;
}
else if (i + 1 == 3)
{
cout << "Province " << prov << ", Day " << j + 1 << " = " << temp [i] [j];
cout << endl;
}
}
}
getch();
return 0;
}
| [
"[email protected]"
] | |
fb75f1c451e3bd42d0b2e4c2d45d4005967971b8 | 226e99aac4bdd36b1e3fd10f15bfc6bc271e69f9 | /Modules/LogicServer/WrapDirect3dvolume9.h | daa8a6eb790c116dbb6ee2efa5228bff0534c9d2 | [
"Apache-2.0"
] | permissive | zhangq49/sharerender | 908b7ffb5e43eb4ba0f61df06345848b3f1c6c23 | 9819ff9c543cf52bfac16655d1d30417291b5d4c | refs/heads/master | 2020-04-25T09:28:19.181632 | 2017-07-28T03:45:33 | 2017-07-28T03:45:33 | 172,676,610 | 1 | 0 | null | 2019-02-26T09:09:33 | 2019-02-26T09:09:33 | null | UTF-8 | C++ | false | false | 1,516 | h | #ifndef __WRAP_DIRECT3DVOLUME9__
#define __WRAP_DIRECT3DVOLUME9__
#include "GameServer.h"
class WrapperDirect3DVolume9 : public IDirect3DVolume9
#ifdef MULTI_CLIENTS
, public IdentifierBase
#endif
{
private:
IDirect3DVolume9 * m_d3dvolume;
static HashSet m_list;
public:
static int ins_count;
WrapperDirect3DVolume9(IDirect3DVolume9 *ptr, int _id);
static WrapperDirect3DVolume9* GetWrapperDirect3DVolume9(IDirect3DVolume9 *ptr);
IDirect3DVolume9 * GetIDirect3DVolume9();
#ifdef MULTI_CLIENTS
virtual int checkCreation(void *ctx);
virtual int sendCreation(void * ctx);
virtual int checkUpdate(void *ctx);
virtual int sendUpdate(void * ctx);
#endif
/*** IUnknown methods ***/
COM_METHOD(HRESULT, QueryInterface)(THIS_ REFIID riid, void** ppvObj);
COM_METHOD(ULONG,AddRef)(THIS);
COM_METHOD(ULONG,Release)(THIS);
/*** IDirect3DVolume9 methods ***/
COM_METHOD(HRESULT, GetDevice)(THIS_ IDirect3DDevice9** ppDevice);
COM_METHOD(HRESULT, SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags);
COM_METHOD(HRESULT, GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData);
COM_METHOD(HRESULT, FreePrivateData)(THIS_ REFGUID refguid);
COM_METHOD(HRESULT, GetContainer)(THIS_ REFIID riid,void** ppContainer);
COM_METHOD(HRESULT, GetDesc)(THIS_ D3DVOLUME_DESC *pDesc);
COM_METHOD(HRESULT, LockBox)(THIS_ D3DLOCKED_BOX * pLockedVolume,CONST D3DBOX* pBox,DWORD Flags);
COM_METHOD(HRESULT, UnlockBox)(THIS);
};
#endif | [
"[email protected]"
] | |
6df508c91a60f6421b0abe30ff730c3020d87c6c | 4cd58cde4255972da4ccdc8c42685d6e970f0f22 | /Decoder.h | f3145fa23084afe1a8dd1f7b85174664eb65d1d9 | [] | no_license | wyh12/ReMux-ScreenCut | d540fd8a2bff8b769c36701bb062064ac0e50ddf | 82a68786c2adf8a9d3276d1b702e9ce703229fc6 | refs/heads/master | 2022-04-11T09:00:54.709902 | 2020-04-01T01:59:54 | 2020-04-01T01:59:54 | 250,301,675 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,099 | h | #pragma once
#include <string>
#include <iostream>
#include <array>
extern "C" {
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/time.h>
#include <libavutil/channel_layout.h>
};
class Decoder
{
public:
Decoder();
virtual ~Decoder();
virtual int init_decoder(const std::string url);
void uninit_decoder();
virtual int decoderStream() = 0;
virtual int stopStream() = 0;
static int64_t getDecodeTime() {
static int64_t time = av_gettime();
return time;
}
protected:
virtual void setOpenOption(void);
virtual void setInterruptCallback() {} // ffmpeg interrupt callback
virtual int init_videoDec();
virtual int init_audioDec();
protected:
AVFormatContext* formatContext;
AVCodecContext* video_codecCtx;
AVCodecContext* audio_codecCtx;
AVDictionary* dict;
int video_index;
int audio_index;
int64_t start_time; // record ffmpeg IO require time for caculate timeout
int64_t dec_time; // start decode time
std::string inputUrl;
private:
};
| [
"[email protected]"
] | |
1c8e4e08b62cb38bbc445704be331fc543c792dc | 41f155c72225983ba64cc8a343600d7b552c7196 | /563.cpp | 6ce5144bfe8418e028ef5cdc3be90c3adc643fa1 | [] | no_license | Jane11111/leetcode | e2c90f2ed0a7c7d1e55b2a47013158467dd567c7 | 81e1ab8061ff7c7f27671496f0b79a2cb3fb5834 | refs/heads/master | 2021-05-10T11:00:34.097762 | 2018-09-23T12:56:15 | 2018-09-23T12:56:15 | 118,399,192 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,003 | cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
struct TreeNode{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x): val(x),left(NULL),right(NULL){}
};
int findTilt(TreeNode* root);
int RecFindTilt(TreeNode* root);
int main() {
TreeNode *p1=new TreeNode(1);
TreeNode *p2=new TreeNode(2);
TreeNode *p3=new TreeNode(3);
TreeNode *p4=new TreeNode(4);
TreeNode *p5=new TreeNode(5);
p1->left=p2;
p2->left=p3;
p3->left=p4;
p4->left=p5;
int res=findTilt(p1);
cout<<res<<endl;
}
int RecFindTile(TreeNode* root){
if(!root)
return 0;
int t1=RecFindTile(root->left);
int t2=RecFindTile(root->right);
int n1=0;int n2=0;
if(root->left)
n1=root->left->val;
if(root->right)
n2=root->right->val;
root->val=n1+n2+root->val;
return abs(n1-n2)+t1+t2;
}
int findTilt(TreeNode* root) {
if(root==NULL)
return 0;
int res=RecFindTile(root);
return res;
} | [
"[email protected]"
] | |
2f68220cf97bb34808b857a7b1f7646123cd4ec3 | fb90f1b966522b0b24b87fd8cf424e3b994ae909 | /src/core/ext/filters/client_channel/health/health_check_client.cc | 400d99b07c496d18571418dcba0c5c2e0da8b5f1 | [
"Apache-2.0"
] | permissive | weidk/grpc | 6f1db0121c12605a5149b9d7a74f0f3771bef3ea | 4139ff895fd413c730c4383d24d13a17bbeaea90 | refs/heads/master | 2020-04-02T16:29:07.661956 | 2018-10-25T01:47:56 | 2018-10-25T01:47:56 | 154,614,101 | 1 | 0 | Apache-2.0 | 2018-10-25T05:19:25 | 2018-10-25T05:19:25 | null | UTF-8 | C++ | false | false | 25,497 | cc | /*
*
* Copyright 2018 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <grpc/support/port_platform.h>
#include <stdint.h>
#include "src/core/ext/filters/client_channel/health/health_check_client.h"
#include "pb_decode.h"
#include "pb_encode.h"
#include "src/core/ext/filters/client_channel/health/health.pb.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/mutex_lock.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/error_utils.h"
#include "src/core/lib/transport/status_metadata.h"
#define HEALTH_CHECK_INITIAL_CONNECT_BACKOFF_SECONDS 1
#define HEALTH_CHECK_RECONNECT_BACKOFF_MULTIPLIER 1.6
#define HEALTH_CHECK_RECONNECT_MAX_BACKOFF_SECONDS 120
#define HEALTH_CHECK_RECONNECT_JITTER 0.2
grpc_core::TraceFlag grpc_health_check_client_trace(false,
"health_check_client");
namespace grpc_core {
//
// HealthCheckClient
//
HealthCheckClient::HealthCheckClient(
const char* service_name,
RefCountedPtr<ConnectedSubchannel> connected_subchannel,
grpc_pollset_set* interested_parties,
grpc_core::RefCountedPtr<grpc_core::channelz::SubchannelNode> channelz_node)
: InternallyRefCountedWithTracing<HealthCheckClient>(
&grpc_health_check_client_trace),
service_name_(service_name),
connected_subchannel_(std::move(connected_subchannel)),
interested_parties_(interested_parties),
channelz_node_(std::move(channelz_node)),
retry_backoff_(
BackOff::Options()
.set_initial_backoff(
HEALTH_CHECK_INITIAL_CONNECT_BACKOFF_SECONDS * 1000)
.set_multiplier(HEALTH_CHECK_RECONNECT_BACKOFF_MULTIPLIER)
.set_jitter(HEALTH_CHECK_RECONNECT_JITTER)
.set_max_backoff(HEALTH_CHECK_RECONNECT_MAX_BACKOFF_SECONDS *
1000)) {
if (grpc_health_check_client_trace.enabled()) {
gpr_log(GPR_INFO, "created HealthCheckClient %p", this);
}
GRPC_CLOSURE_INIT(&retry_timer_callback_, OnRetryTimer, this,
grpc_schedule_on_exec_ctx);
gpr_mu_init(&mu_);
StartCall();
}
HealthCheckClient::~HealthCheckClient() {
if (grpc_health_check_client_trace.enabled()) {
gpr_log(GPR_INFO, "destroying HealthCheckClient %p", this);
}
GRPC_ERROR_UNREF(error_);
gpr_mu_destroy(&mu_);
}
void HealthCheckClient::NotifyOnHealthChange(grpc_connectivity_state* state,
grpc_closure* closure) {
MutexLock lock(&mu_);
GPR_ASSERT(notify_state_ == nullptr);
if (*state != state_) {
*state = state_;
GRPC_CLOSURE_SCHED(closure, GRPC_ERROR_REF(error_));
return;
}
notify_state_ = state;
on_health_changed_ = closure;
}
void HealthCheckClient::SetHealthStatus(grpc_connectivity_state state,
grpc_error* error) {
MutexLock lock(&mu_);
SetHealthStatusLocked(state, error);
}
void HealthCheckClient::SetHealthStatusLocked(grpc_connectivity_state state,
grpc_error* error) {
if (grpc_health_check_client_trace.enabled()) {
gpr_log(GPR_INFO, "HealthCheckClient %p: setting state=%d error=%s", this,
state, grpc_error_string(error));
}
if (notify_state_ != nullptr && *notify_state_ != state) {
*notify_state_ = state;
notify_state_ = nullptr;
GRPC_CLOSURE_SCHED(on_health_changed_, GRPC_ERROR_REF(error));
on_health_changed_ = nullptr;
}
state_ = state;
GRPC_ERROR_UNREF(error_);
error_ = error;
}
void HealthCheckClient::Orphan() {
if (grpc_health_check_client_trace.enabled()) {
gpr_log(GPR_INFO, "HealthCheckClient %p: shutting down", this);
}
{
MutexLock lock(&mu_);
if (on_health_changed_ != nullptr) {
*notify_state_ = GRPC_CHANNEL_SHUTDOWN;
notify_state_ = nullptr;
GRPC_CLOSURE_SCHED(on_health_changed_, GRPC_ERROR_NONE);
on_health_changed_ = nullptr;
}
shutting_down_ = true;
call_state_.reset();
if (retry_timer_callback_pending_) {
grpc_timer_cancel(&retry_timer_);
}
}
Unref(DEBUG_LOCATION, "orphan");
}
void HealthCheckClient::StartCall() {
MutexLock lock(&mu_);
StartCallLocked();
}
void HealthCheckClient::StartCallLocked() {
if (shutting_down_) return;
GPR_ASSERT(call_state_ == nullptr);
SetHealthStatusLocked(GRPC_CHANNEL_CONNECTING, GRPC_ERROR_NONE);
call_state_ = MakeOrphanable<CallState>(Ref(), interested_parties_);
if (grpc_health_check_client_trace.enabled()) {
gpr_log(GPR_INFO, "HealthCheckClient %p: created CallState %p", this,
call_state_.get());
}
call_state_->StartCall();
}
void HealthCheckClient::StartRetryTimer() {
MutexLock lock(&mu_);
SetHealthStatusLocked(
GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"health check call failed; will retry after backoff"));
grpc_millis next_try = retry_backoff_.NextAttemptTime();
if (grpc_health_check_client_trace.enabled()) {
gpr_log(GPR_INFO, "HealthCheckClient %p: health check call lost...", this);
grpc_millis timeout = next_try - ExecCtx::Get()->Now();
if (timeout > 0) {
gpr_log(GPR_INFO,
"HealthCheckClient %p: ... will retry in %" PRId64 "ms.", this,
timeout);
} else {
gpr_log(GPR_INFO, "HealthCheckClient %p: ... retrying immediately.",
this);
}
}
// Ref for callback, tracked manually.
Ref(DEBUG_LOCATION, "health_retry_timer").release();
retry_timer_callback_pending_ = true;
grpc_timer_init(&retry_timer_, next_try, &retry_timer_callback_);
}
void HealthCheckClient::OnRetryTimer(void* arg, grpc_error* error) {
HealthCheckClient* self = static_cast<HealthCheckClient*>(arg);
{
MutexLock lock(&self->mu_);
self->retry_timer_callback_pending_ = false;
if (!self->shutting_down_ && error == GRPC_ERROR_NONE &&
self->call_state_ == nullptr) {
if (grpc_health_check_client_trace.enabled()) {
gpr_log(GPR_INFO, "HealthCheckClient %p: restarting health check call",
self);
}
self->StartCallLocked();
}
}
self->Unref(DEBUG_LOCATION, "health_retry_timer");
}
//
// protobuf helpers
//
namespace {
void EncodeRequest(const char* service_name,
ManualConstructor<SliceBufferByteStream>* send_message) {
grpc_health_v1_HealthCheckRequest request_struct;
request_struct.has_service = true;
snprintf(request_struct.service, sizeof(request_struct.service), "%s",
service_name);
pb_ostream_t ostream;
memset(&ostream, 0, sizeof(ostream));
pb_encode(&ostream, grpc_health_v1_HealthCheckRequest_fields,
&request_struct);
grpc_slice request_slice = GRPC_SLICE_MALLOC(ostream.bytes_written);
ostream = pb_ostream_from_buffer(GRPC_SLICE_START_PTR(request_slice),
GRPC_SLICE_LENGTH(request_slice));
GPR_ASSERT(pb_encode(&ostream, grpc_health_v1_HealthCheckRequest_fields,
&request_struct) != 0);
grpc_slice_buffer slice_buffer;
grpc_slice_buffer_init(&slice_buffer);
grpc_slice_buffer_add(&slice_buffer, request_slice);
send_message->Init(&slice_buffer, 0);
grpc_slice_buffer_destroy_internal(&slice_buffer);
}
// Returns true if healthy.
// If there was an error parsing the response, sets *error and returns false.
bool DecodeResponse(grpc_slice_buffer* slice_buffer, grpc_error** error) {
// If message is empty, assume unhealthy.
if (slice_buffer->length == 0) {
*error =
GRPC_ERROR_CREATE_FROM_STATIC_STRING("health check response was empty");
return false;
}
// Concatenate the slices to form a single string.
UniquePtr<uint8_t> recv_message_deleter;
uint8_t* recv_message;
if (slice_buffer->count == 1) {
recv_message = GRPC_SLICE_START_PTR(slice_buffer->slices[0]);
} else {
recv_message = static_cast<uint8_t*>(gpr_malloc(slice_buffer->length));
recv_message_deleter.reset(recv_message);
size_t offset = 0;
for (size_t i = 0; i < slice_buffer->count; ++i) {
memcpy(recv_message + offset,
GRPC_SLICE_START_PTR(slice_buffer->slices[i]),
GRPC_SLICE_LENGTH(slice_buffer->slices[i]));
offset += GRPC_SLICE_LENGTH(slice_buffer->slices[i]);
}
}
// Deserialize message.
grpc_health_v1_HealthCheckResponse response_struct;
pb_istream_t istream =
pb_istream_from_buffer(recv_message, slice_buffer->length);
if (!pb_decode(&istream, grpc_health_v1_HealthCheckResponse_fields,
&response_struct)) {
// Can't parse message; assume unhealthy.
*error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"cannot parse health check response");
return false;
}
if (!response_struct.has_status) {
// Field not present; assume unhealthy.
*error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"status field not present in health check response");
return false;
}
return response_struct.status ==
grpc_health_v1_HealthCheckResponse_ServingStatus_SERVING;
}
} // namespace
//
// HealthCheckClient::CallState
//
HealthCheckClient::CallState::CallState(
RefCountedPtr<HealthCheckClient> health_check_client,
grpc_pollset_set* interested_parties)
: InternallyRefCountedWithTracing<CallState>(
&grpc_health_check_client_trace),
health_check_client_(std::move(health_check_client)),
pollent_(grpc_polling_entity_create_from_pollset_set(interested_parties)),
arena_(gpr_arena_create(health_check_client_->connected_subchannel_
->GetInitialCallSizeEstimate(0))) {
memset(&call_combiner_, 0, sizeof(call_combiner_));
grpc_call_combiner_init(&call_combiner_);
memset(context_, 0, sizeof(context_));
gpr_atm_rel_store(&seen_response_, static_cast<gpr_atm>(0));
}
HealthCheckClient::CallState::~CallState() {
if (grpc_health_check_client_trace.enabled()) {
gpr_log(GPR_INFO, "HealthCheckClient %p: destroying CallState %p",
health_check_client_.get(), this);
}
if (call_ != nullptr) GRPC_SUBCHANNEL_CALL_UNREF(call_, "call_ended");
// Unset the call combiner cancellation closure. This has the
// effect of scheduling the previously set cancellation closure, if
// any, so that it can release any internal references it may be
// holding to the call stack. Also flush the closures on exec_ctx so that
// filters that schedule cancel notification closures on exec_ctx do not
// need to take a ref of the call stack to guarantee closure liveness.
grpc_call_combiner_set_notify_on_cancel(&call_combiner_, nullptr);
grpc_core::ExecCtx::Get()->Flush();
grpc_call_combiner_destroy(&call_combiner_);
gpr_arena_destroy(arena_);
}
void HealthCheckClient::CallState::Orphan() {
grpc_call_combiner_cancel(&call_combiner_, GRPC_ERROR_CANCELLED);
Cancel();
}
void HealthCheckClient::CallState::StartCall() {
ConnectedSubchannel::CallArgs args = {
&pollent_,
GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH,
gpr_now(GPR_CLOCK_MONOTONIC), // start_time
GRPC_MILLIS_INF_FUTURE, // deadline
arena_,
context_,
&call_combiner_,
0, // parent_data_size
};
grpc_error* error =
health_check_client_->connected_subchannel_->CreateCall(args, &call_);
if (error != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR,
"HealthCheckClient %p CallState %p: error creating health "
"checking call on subchannel (%s); will retry",
health_check_client_.get(), this, grpc_error_string(error));
GRPC_ERROR_UNREF(error);
// Schedule instead of running directly, since we must not be
// holding health_check_client_->mu_ when CallEnded() is called.
Ref(DEBUG_LOCATION, "call_end_closure").release();
GRPC_CLOSURE_SCHED(
GRPC_CLOSURE_INIT(&batch_.handler_private.closure, CallEndedRetry, this,
grpc_schedule_on_exec_ctx),
GRPC_ERROR_NONE);
return;
}
// Initialize payload and batch.
memset(&batch_, 0, sizeof(batch_));
batch_.payload = &payload_;
// on_complete callback takes ref, handled manually.
Ref(DEBUG_LOCATION, "on_complete").release();
batch_.on_complete = GRPC_CLOSURE_INIT(&on_complete_, OnComplete, this,
grpc_schedule_on_exec_ctx);
// Add send_initial_metadata op.
grpc_metadata_batch_init(&send_initial_metadata_);
error = grpc_metadata_batch_add_head(
&send_initial_metadata_, &path_metadata_storage_,
grpc_mdelem_from_slices(
GRPC_MDSTR_PATH,
GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH));
GPR_ASSERT(error == GRPC_ERROR_NONE);
payload_.send_initial_metadata.send_initial_metadata =
&send_initial_metadata_;
payload_.send_initial_metadata.send_initial_metadata_flags = 0;
payload_.send_initial_metadata.peer_string = nullptr;
batch_.send_initial_metadata = true;
// Add send_message op.
EncodeRequest(health_check_client_->service_name_, &send_message_);
payload_.send_message.send_message.reset(send_message_.get());
batch_.send_message = true;
// Add send_trailing_metadata op.
grpc_metadata_batch_init(&send_trailing_metadata_);
payload_.send_trailing_metadata.send_trailing_metadata =
&send_trailing_metadata_;
batch_.send_trailing_metadata = true;
// Add recv_initial_metadata op.
grpc_metadata_batch_init(&recv_initial_metadata_);
payload_.recv_initial_metadata.recv_initial_metadata =
&recv_initial_metadata_;
payload_.recv_initial_metadata.recv_flags = nullptr;
payload_.recv_initial_metadata.trailing_metadata_available = nullptr;
payload_.recv_initial_metadata.peer_string = nullptr;
// recv_initial_metadata_ready callback takes ref, handled manually.
Ref(DEBUG_LOCATION, "recv_initial_metadata_ready").release();
payload_.recv_initial_metadata.recv_initial_metadata_ready =
GRPC_CLOSURE_INIT(&recv_initial_metadata_ready_, RecvInitialMetadataReady,
this, grpc_schedule_on_exec_ctx);
batch_.recv_initial_metadata = true;
// Add recv_message op.
payload_.recv_message.recv_message = &recv_message_;
// recv_message callback takes ref, handled manually.
Ref(DEBUG_LOCATION, "recv_message_ready").release();
payload_.recv_message.recv_message_ready = GRPC_CLOSURE_INIT(
&recv_message_ready_, RecvMessageReady, this, grpc_schedule_on_exec_ctx);
batch_.recv_message = true;
// Start batch.
StartBatch(&batch_);
// Initialize recv_trailing_metadata batch.
memset(&recv_trailing_metadata_batch_, 0,
sizeof(recv_trailing_metadata_batch_));
recv_trailing_metadata_batch_.payload = &payload_;
// Add recv_trailing_metadata op.
grpc_metadata_batch_init(&recv_trailing_metadata_);
payload_.recv_trailing_metadata.recv_trailing_metadata =
&recv_trailing_metadata_;
payload_.recv_trailing_metadata.collect_stats = &collect_stats_;
// This callback signals the end of the call, so it relies on the
// initial ref instead of taking a new ref. When it's invoked, the
// initial ref is released.
payload_.recv_trailing_metadata.recv_trailing_metadata_ready =
GRPC_CLOSURE_INIT(&recv_trailing_metadata_ready_,
RecvTrailingMetadataReady, this,
grpc_schedule_on_exec_ctx);
recv_trailing_metadata_batch_.recv_trailing_metadata = true;
// Start recv_trailing_metadata batch.
StartBatch(&recv_trailing_metadata_batch_);
}
void HealthCheckClient::CallState::StartBatchInCallCombiner(void* arg,
grpc_error* error) {
grpc_transport_stream_op_batch* batch =
static_cast<grpc_transport_stream_op_batch*>(arg);
grpc_subchannel_call* call =
static_cast<grpc_subchannel_call*>(batch->handler_private.extra_arg);
grpc_subchannel_call_process_op(call, batch);
}
void HealthCheckClient::CallState::StartBatch(
grpc_transport_stream_op_batch* batch) {
batch->handler_private.extra_arg = call_;
GRPC_CLOSURE_INIT(&batch->handler_private.closure, StartBatchInCallCombiner,
batch, grpc_schedule_on_exec_ctx);
GRPC_CALL_COMBINER_START(&call_combiner_, &batch->handler_private.closure,
GRPC_ERROR_NONE, "start_subchannel_batch");
}
void HealthCheckClient::CallState::OnCancelComplete(void* arg,
grpc_error* error) {
HealthCheckClient::CallState* self =
static_cast<HealthCheckClient::CallState*>(arg);
GRPC_CALL_COMBINER_STOP(&self->call_combiner_, "health_cancel");
self->Unref(DEBUG_LOCATION, "cancel");
}
void HealthCheckClient::CallState::StartCancel(void* arg, grpc_error* error) {
HealthCheckClient::CallState* self =
static_cast<HealthCheckClient::CallState*>(arg);
auto* batch = grpc_make_transport_stream_op(
GRPC_CLOSURE_CREATE(OnCancelComplete, self, grpc_schedule_on_exec_ctx));
batch->cancel_stream = true;
batch->payload->cancel_stream.cancel_error = GRPC_ERROR_CANCELLED;
grpc_subchannel_call_process_op(self->call_, batch);
}
void HealthCheckClient::CallState::Cancel() {
if (call_ != nullptr) {
Ref(DEBUG_LOCATION, "cancel").release();
GRPC_CALL_COMBINER_START(
&call_combiner_,
GRPC_CLOSURE_CREATE(StartCancel, this, grpc_schedule_on_exec_ctx),
GRPC_ERROR_NONE, "health_cancel");
}
}
void HealthCheckClient::CallState::OnComplete(void* arg, grpc_error* error) {
HealthCheckClient::CallState* self =
static_cast<HealthCheckClient::CallState*>(arg);
GRPC_CALL_COMBINER_STOP(&self->call_combiner_, "on_complete");
grpc_metadata_batch_destroy(&self->send_initial_metadata_);
grpc_metadata_batch_destroy(&self->send_trailing_metadata_);
self->Unref(DEBUG_LOCATION, "on_complete");
}
void HealthCheckClient::CallState::RecvInitialMetadataReady(void* arg,
grpc_error* error) {
HealthCheckClient::CallState* self =
static_cast<HealthCheckClient::CallState*>(arg);
GRPC_CALL_COMBINER_STOP(&self->call_combiner_, "recv_initial_metadata_ready");
grpc_metadata_batch_destroy(&self->recv_initial_metadata_);
self->Unref(DEBUG_LOCATION, "recv_initial_metadata_ready");
}
void HealthCheckClient::CallState::DoneReadingRecvMessage(grpc_error* error) {
recv_message_.reset();
if (error != GRPC_ERROR_NONE) {
GRPC_ERROR_UNREF(error);
Cancel();
grpc_slice_buffer_destroy_internal(&recv_message_buffer_);
Unref(DEBUG_LOCATION, "recv_message_ready");
return;
}
const bool healthy = DecodeResponse(&recv_message_buffer_, &error);
const grpc_connectivity_state state =
healthy ? GRPC_CHANNEL_READY : GRPC_CHANNEL_TRANSIENT_FAILURE;
if (error == GRPC_ERROR_NONE && !healthy) {
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("backend unhealthy");
}
health_check_client_->SetHealthStatus(state, error);
gpr_atm_rel_store(&seen_response_, static_cast<gpr_atm>(1));
grpc_slice_buffer_destroy_internal(&recv_message_buffer_);
// Start another recv_message batch.
// This re-uses the ref we're holding.
// Note: Can't just reuse batch_ here, since we don't know that all
// callbacks from the original batch have completed yet.
memset(&recv_message_batch_, 0, sizeof(recv_message_batch_));
recv_message_batch_.payload = &payload_;
payload_.recv_message.recv_message = &recv_message_;
payload_.recv_message.recv_message_ready = GRPC_CLOSURE_INIT(
&recv_message_ready_, RecvMessageReady, this, grpc_schedule_on_exec_ctx);
recv_message_batch_.recv_message = true;
StartBatch(&recv_message_batch_);
}
grpc_error* HealthCheckClient::CallState::PullSliceFromRecvMessage() {
grpc_slice slice;
grpc_error* error = recv_message_->Pull(&slice);
if (error == GRPC_ERROR_NONE) {
grpc_slice_buffer_add(&recv_message_buffer_, slice);
}
return error;
}
void HealthCheckClient::CallState::ContinueReadingRecvMessage() {
while (recv_message_->Next(SIZE_MAX, &recv_message_ready_)) {
grpc_error* error = PullSliceFromRecvMessage();
if (error != GRPC_ERROR_NONE) {
DoneReadingRecvMessage(error);
return;
}
if (recv_message_buffer_.length == recv_message_->length()) {
DoneReadingRecvMessage(GRPC_ERROR_NONE);
break;
}
}
}
void HealthCheckClient::CallState::OnByteStreamNext(void* arg,
grpc_error* error) {
HealthCheckClient::CallState* self =
static_cast<HealthCheckClient::CallState*>(arg);
if (error != GRPC_ERROR_NONE) {
self->DoneReadingRecvMessage(GRPC_ERROR_REF(error));
return;
}
error = self->PullSliceFromRecvMessage();
if (error != GRPC_ERROR_NONE) {
self->DoneReadingRecvMessage(error);
return;
}
if (self->recv_message_buffer_.length == self->recv_message_->length()) {
self->DoneReadingRecvMessage(GRPC_ERROR_NONE);
} else {
self->ContinueReadingRecvMessage();
}
}
void HealthCheckClient::CallState::RecvMessageReady(void* arg,
grpc_error* error) {
HealthCheckClient::CallState* self =
static_cast<HealthCheckClient::CallState*>(arg);
GRPC_CALL_COMBINER_STOP(&self->call_combiner_, "recv_message_ready");
if (self->recv_message_ == nullptr) {
self->Unref(DEBUG_LOCATION, "recv_message_ready");
return;
}
grpc_slice_buffer_init(&self->recv_message_buffer_);
GRPC_CLOSURE_INIT(&self->recv_message_ready_, OnByteStreamNext, self,
grpc_schedule_on_exec_ctx);
self->ContinueReadingRecvMessage();
// Ref will continue to be held until we finish draining the byte stream.
}
void HealthCheckClient::CallState::RecvTrailingMetadataReady(
void* arg, grpc_error* error) {
HealthCheckClient::CallState* self =
static_cast<HealthCheckClient::CallState*>(arg);
GRPC_CALL_COMBINER_STOP(&self->call_combiner_,
"recv_trailing_metadata_ready");
// Get call status.
grpc_status_code status = GRPC_STATUS_UNKNOWN;
if (error != GRPC_ERROR_NONE) {
grpc_error_get_status(error, GRPC_MILLIS_INF_FUTURE, &status,
nullptr /* slice */, nullptr /* http_error */,
nullptr /* error_string */);
} else if (self->recv_trailing_metadata_.idx.named.grpc_status != nullptr) {
status = grpc_get_status_code_from_metadata(
self->recv_trailing_metadata_.idx.named.grpc_status->md);
}
if (grpc_health_check_client_trace.enabled()) {
gpr_log(GPR_INFO,
"HealthCheckClient %p CallState %p: health watch failed with "
"status %d",
self->health_check_client_.get(), self, status);
}
// Clean up.
grpc_metadata_batch_destroy(&self->recv_trailing_metadata_);
// For status UNIMPLEMENTED, give up and assume always healthy.
bool retry = true;
if (status == GRPC_STATUS_UNIMPLEMENTED) {
static const char kErrorMessage[] =
"health checking Watch method returned UNIMPLEMENTED; "
"disabling health checks but assuming server is healthy";
gpr_log(GPR_ERROR, kErrorMessage);
if (self->health_check_client_->channelz_node_ != nullptr) {
self->health_check_client_->channelz_node_->AddTraceEvent(
channelz::ChannelTrace::Error,
grpc_slice_from_static_string(kErrorMessage));
}
self->health_check_client_->SetHealthStatus(GRPC_CHANNEL_READY,
GRPC_ERROR_NONE);
retry = false;
}
self->CallEnded(retry);
}
void HealthCheckClient::CallState::CallEndedRetry(void* arg,
grpc_error* error) {
HealthCheckClient::CallState* self =
static_cast<HealthCheckClient::CallState*>(arg);
self->CallEnded(true /* retry */);
self->Unref(DEBUG_LOCATION, "call_end_closure");
}
void HealthCheckClient::CallState::CallEnded(bool retry) {
// If this CallState is still in use, this call ended because of a failure,
// so we need to stop using it and optionally create a new one.
// Otherwise, we have deliberately ended this call, and no further action
// is required.
if (this == health_check_client_->call_state_.get()) {
health_check_client_->call_state_.reset();
if (retry) {
GPR_ASSERT(!health_check_client_->shutting_down_);
if (static_cast<bool>(gpr_atm_acq_load(&seen_response_))) {
// If the call fails after we've gotten a successful response, reset
// the backoff and restart the call immediately.
health_check_client_->retry_backoff_.Reset();
health_check_client_->StartCall();
} else {
// If the call failed without receiving any messages, retry later.
health_check_client_->StartRetryTimer();
}
}
}
Unref(DEBUG_LOCATION, "call_ended");
}
} // namespace grpc_core
| [
"[email protected]"
] | |
d9e05ca78a8f601fad0b4ad2bcc0e832e8d395cd | 0846ce5bc067f8375746875f0a1499e9af69f589 | /cpp/perspective/src/cpp/gnode.cpp | bc4f90bdc2fb08139f6e1e7f33080fbf3a1b118c | [
"Apache-2.0"
] | permissive | sighttviewliu/perspective | ff1b7364cf76fd36d3c9ec2f68b2fcb0bddd777e | a0c9da8579072442587e73274e7ac1cacf1655c2 | refs/heads/master | 2020-04-25T23:04:49.175527 | 2019-02-27T22:21:25 | 2019-02-27T22:21:25 | 173,132,581 | 2 | 0 | null | 2019-02-28T15:02:35 | 2019-02-28T15:02:34 | null | UTF-8 | C++ | false | false | 43,706 | cpp | /******************************************************************************
*
* Copyright (c) 2017, the Perspective Authors.
*
* This file is part of the Perspective library, distributed under the terms of
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/
#include <perspective/first.h>
#include <perspective/context_one.h>
#include <perspective/context_two.h>
#include <perspective/context_zero.h>
#include <perspective/context_grouped_pkey.h>
#include <perspective/gnode.h>
#include <perspective/gnode_state.h>
#include <perspective/mask.h>
#include <perspective/tracing.h>
#include <perspective/env_vars.h>
#include <perspective/logtime.h>
#include <perspective/utils.h>
namespace perspective {
t_tscalar
calc_delta(t_value_transition trans, t_tscalar oval, t_tscalar nval) {
return nval.difference(oval);
}
t_tscalar
calc_newer(t_value_transition trans, t_tscalar oval, t_tscalar nval) {
if (nval.is_valid())
return nval;
return oval;
}
t_tscalar
calc_negate(t_tscalar val) {
return val.negate();
}
t_gnode::t_gnode(const t_gnode_recipe& recipe)
: m_mode(recipe.m_mode)
, m_tblschema(recipe.m_tblschema)
, m_init(false)
, m_id(0)
, m_pool_cleanup([]() {}) {
PSP_TRACE_SENTINEL();
LOG_CONSTRUCTOR("t_gnode");
PSP_VERBOSE_ASSERT(recipe.m_mode == NODE_PROCESSING_SIMPLE_DATAFLOW,
"Only simple dataflows supported currently");
for (const auto& s : recipe.m_ischemas) {
m_ischemas.push_back(t_schema(s));
}
PSP_VERBOSE_ASSERT(m_ischemas.size() == 1, "Single input port supported currently");
for (const auto& s : recipe.m_oschemas) {
m_oschemas.push_back(t_schema(s));
}
for (const auto& cc : recipe.m_custom_columns) {
m_custom_columns.push_back(t_custom_column(cc));
}
m_epoch = std::chrono::high_resolution_clock::now();
for (const auto& ccol : m_custom_columns) {
for (const auto& icol : ccol.get_icols()) {
m_expr_icols.insert(icol);
}
}
}
t_gnode::t_gnode(const t_gnode_options& options)
: m_mode(NODE_PROCESSING_SIMPLE_DATAFLOW)
, m_gnode_type(options.m_gnode_type)
, m_tblschema(options.m_port_schema.drop({"psp_op", "psp_pkey"}))
, m_init(false)
, m_id(0)
, m_pool_cleanup([]() {}) {
PSP_TRACE_SENTINEL();
LOG_CONSTRUCTOR("t_gnode");
std::vector<t_dtype> trans_types(m_tblschema.size());
for (t_uindex idx = 0; idx < trans_types.size(); ++idx) {
trans_types[idx] = DTYPE_UINT8;
}
t_schema port_schema(options.m_port_schema);
if (m_gnode_type == GNODE_TYPE_IMPLICIT_PKEYED) {
// Make sure that gnode type is consistent with input schema
if (port_schema.is_pkey()) {
PSP_COMPLAIN_AND_ABORT("gnode type specified as implicit pkey, however input "
"schema has psp_pkey column.");
}
port_schema
= t_schema{{"psp_op", "psp_pkey"}, {DTYPE_UINT8, DTYPE_INT64}} + port_schema;
} else {
if (!(port_schema.is_pkey())) {
PSP_COMPLAIN_AND_ABORT("gnode type specified as explicit pkey, however input "
"schema is missing required columns.");
}
}
t_schema trans_schema(m_tblschema.columns(), trans_types);
t_schema existed_schema(
std::vector<std::string>{"psp_existed"}, std::vector<t_dtype>{DTYPE_BOOL});
m_ischemas = std::vector<t_schema>{port_schema};
m_oschemas = std::vector<t_schema>{
port_schema, m_tblschema, m_tblschema, m_tblschema, trans_schema, existed_schema};
m_epoch = std::chrono::high_resolution_clock::now();
}
std::shared_ptr<t_gnode>
t_gnode::build(const t_gnode_options& options) {
auto rv = std::make_shared<t_gnode>(options);
rv->init();
return rv;
}
t_gnode::t_gnode(const t_schema& tblschema, const t_schema& portschema)
: m_mode(NODE_PROCESSING_SIMPLE_DATAFLOW)
, m_gnode_type(GNODE_TYPE_PKEYED)
, m_tblschema(tblschema)
, m_ischemas(std::vector<t_schema>{portschema})
, m_init(false)
, m_id(0)
, m_pool_cleanup([]() {}) {
PSP_TRACE_SENTINEL();
LOG_CONSTRUCTOR("t_gnode");
std::vector<t_dtype> trans_types(m_tblschema.size());
for (t_uindex idx = 0; idx < trans_types.size(); ++idx) {
trans_types[idx] = DTYPE_UINT8;
}
t_schema trans_schema(m_tblschema.columns(), trans_types);
t_schema existed_schema(
std::vector<std::string>{"psp_existed"}, std::vector<t_dtype>{DTYPE_BOOL});
m_oschemas = std::vector<t_schema>{
portschema, m_tblschema, m_tblschema, m_tblschema, trans_schema, existed_schema};
m_epoch = std::chrono::high_resolution_clock::now();
}
t_gnode::t_gnode(t_gnode_processing_mode mode, const t_schema& tblschema,
const std::vector<t_schema>& ischemas, const std::vector<t_schema>& oschemas,
const std::vector<t_custom_column>& custom_columns)
: m_mode(mode)
, m_gnode_type(GNODE_TYPE_PKEYED)
, m_tblschema(tblschema)
, m_ischemas(ischemas)
, m_oschemas(oschemas)
, m_init(false)
, m_id(0)
, m_custom_columns(custom_columns)
, m_pool_cleanup([]() {}) {
PSP_TRACE_SENTINEL();
LOG_CONSTRUCTOR("t_gnode");
PSP_VERBOSE_ASSERT(
mode == NODE_PROCESSING_SIMPLE_DATAFLOW, "Only simple dataflows supported currently");
PSP_VERBOSE_ASSERT(m_ischemas.size() == 1, "Single input port supported currently");
m_epoch = std::chrono::high_resolution_clock::now();
for (const auto& ccol : custom_columns) {
for (const auto& icol : ccol.get_icols()) {
m_expr_icols.insert(icol);
}
}
}
t_gnode::~t_gnode() {
PSP_TRACE_SENTINEL();
LOG_DESTRUCTOR("t_gnode");
m_pool_cleanup();
}
void
t_gnode::init() {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_ischemas.size() == 1, "Single input port supported currently");
m_state = std::make_shared<t_gstate>(m_tblschema, m_ischemas[0]);
m_state->init();
for (t_uindex idx = 0, loop_end = m_ischemas.size(); idx < loop_end; ++idx) {
std::shared_ptr<t_port> port
= std::make_shared<t_port>(PORT_MODE_PKEYED, m_ischemas[idx]);
port->init();
m_iports.push_back(port);
}
for (t_uindex idx = 0, loop_end = m_oschemas.size(); idx < loop_end; ++idx) {
t_port_mode mode = idx == 0 ? PORT_MODE_PKEYED : PORT_MODE_RAW;
std::shared_ptr<t_port> port = std::make_shared<t_port>(mode, m_oschemas[idx]);
port->init();
m_oports.push_back(port);
}
std::shared_ptr<t_port>& iport = m_iports[0];
std::shared_ptr<t_table> flattened = iport->get_table()->flatten();
m_init = true;
}
std::string
t_gnode::repr() const {
std::stringstream ss;
ss << "t_gnode<" << this << ">";
return ss.str();
}
void
t_gnode::_send(t_uindex portid, const t_table& fragments) {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
PSP_VERBOSE_ASSERT(portid == 0, "Only simple dataflows supported currently");
std::shared_ptr<t_port>& iport = m_iports[portid];
iport->send(fragments);
}
void
t_gnode::_send_and_process(const t_table& fragments) {
_send(0, fragments);
_process();
}
t_value_transition
t_gnode::calc_transition(bool prev_existed, bool row_pre_existed, bool exists, bool prev_valid,
bool cur_valid, bool prev_cur_eq, bool prev_pkey_eq) {
t_value_transition trans = VALUE_TRANSITION_EQ_FF;
if (!row_pre_existed && !cur_valid && !t_env::backout_invalid_neq_ft()) {
trans = VALUE_TRANSITION_NEQ_FT;
} else if (row_pre_existed && !prev_valid && !cur_valid
&& !t_env::backout_eq_invalid_invalid()) {
trans = VALUE_TRANSITION_EQ_TT;
} else if (!prev_existed && !exists) {
trans = VALUE_TRANSITION_EQ_FF;
} else if (row_pre_existed && exists && !prev_valid && cur_valid
&& !t_env::backout_nveq_ft()) {
trans = VALUE_TRANSITION_NVEQ_FT;
} else if (prev_existed && exists && prev_cur_eq) {
trans = VALUE_TRANSITION_EQ_TT;
} else if (!prev_existed && exists) {
trans = VALUE_TRANSITION_NEQ_FT;
} else if (prev_existed && !exists) {
trans = VALUE_TRANSITION_NEQ_TF;
}
else if (prev_existed && exists && !prev_cur_eq) {
trans = VALUE_TRANSITION_NEQ_TT;
} else if (prev_pkey_eq) {
// prev op must have been a delete
trans = VALUE_TRANSITION_NEQ_TDT;
} else {
PSP_COMPLAIN_AND_ABORT("Hit unexpected condition");
}
return trans;
}
void
t_gnode::populate_icols_in_flattened(
const std::vector<t_rlookup>& lkup, std::shared_ptr<t_table>& flat) const {
PSP_VERBOSE_ASSERT(lkup.size() == flat->size(), "Mismatched sizes encountered");
t_uindex nrows = lkup.size();
t_uindex ncols = m_expr_icols.size();
std::vector<const t_column*> icols(ncols);
std::vector<t_column*> ocols(ncols);
std::vector<std::string> cnames(ncols);
t_uindex count = 0;
const t_table* stable = get_table();
for (const auto& cname : m_expr_icols) {
icols[count] = stable->get_const_column(cname).get();
ocols[count] = flat->get_column(cname).get();
cnames[count] = cname;
++count;
}
#ifdef PSP_PARALLEL_FOR
PSP_PFOR(0, int(ncols), 1,
[&lkup, &icols, &ocols, nrows](int colidx)
#else
for (t_uindex colidx = 0; colidx < ncols; ++colidx)
#endif
{
auto icol = icols[colidx];
auto ocol = ocols[colidx];
for (t_uindex ridx = 0; ridx < nrows; ++ridx) {
const auto& lk = lkup[ridx];
if (!ocol->is_valid(ridx) && lk.m_exists) {
ocol->set_scalar(ridx, icol->get_scalar(lk.m_idx));
}
}
}
#ifdef PSP_PARALLEL_FOR
);
#endif
}
void
t_gnode::clear_deltas() {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
for (auto& kv : m_contexts) {
switch (kv.second.m_ctx_type) {
case TWO_SIDED_CONTEXT: {
static_cast<t_ctx2*>(kv.second.m_ctx)->clear_deltas();
} break;
case ONE_SIDED_CONTEXT: {
static_cast<t_ctx1*>(kv.second.m_ctx)->clear_deltas();
} break;
case ZERO_SIDED_CONTEXT: {
static_cast<t_ctx0*>(kv.second.m_ctx)->clear_deltas();
} break;
case GROUPED_PKEY_CONTEXT: {
static_cast<t_ctx_grouped_pkey*>(kv.second.m_ctx)->clear_deltas();
} break;
default: { PSP_COMPLAIN_AND_ABORT("Unexpected context type"); } break;
}
}
}
void
t_gnode::_process() {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
m_was_updated = false;
PSP_VERBOSE_ASSERT(
m_mode == NODE_PROCESSING_SIMPLE_DATAFLOW, "Only simple dataflows supported currently");
psp_log_time(repr() + " _process.enter");
auto t1 = std::chrono::high_resolution_clock::now();
std::shared_ptr<t_port>& iport = m_iports[0];
if (iport->get_table()->size() == 0) {
return;
}
m_was_updated = true;
if (m_gnode_type == GNODE_TYPE_IMPLICIT_PKEYED) {
auto tbl = iport->get_table();
auto op_col = tbl->add_column("psp_op", DTYPE_UINT8, false);
op_col->raw_fill<std::uint8_t>(OP_INSERT);
auto key_col = tbl->add_column("psp_pkey", DTYPE_INT64, true);
std::int64_t start = get_table()->size();
for (t_uindex ridx = 0; ridx < tbl->size(); ++ridx) {
key_col->set_nth<std::int64_t>(ridx, start + ridx);
}
}
std::shared_ptr<t_table> flattened(iport->get_table()->flatten());
PSP_GNODE_VERIFY_TABLE(flattened);
PSP_GNODE_VERIFY_TABLE(get_table());
psp_log_time(repr() + " _process.post_flatten");
if (t_env::log_data_gnode_flattened()) {
std::cout << repr() << "gnode_process_flattened" << std::endl;
flattened->pprint();
}
if (t_env::log_schema_gnode_flattened()) {
std::cout << repr() << "gnode_schema_flattened" << std::endl;
std::cout << flattened->get_schema();
}
if (m_state->mapping_size() == 0) {
psp_log_time(repr() + " _process.init_path.post_fill_expr");
m_state->update_history(flattened.get());
psp_log_time(repr() + " _process.init_path.post_update_history");
_update_contexts_from_state(*flattened);
psp_log_time(repr() + " _process.init_path.post_update_contexts_from_state");
m_oports[PSP_PORT_FLATTENED]->set_table(flattened);
release_inputs();
psp_log_time(repr() + " _process.init_path.post_release_inputs");
release_outputs();
psp_log_time(repr() + " _process.init_path.exit");
#ifdef PSP_GNODE_VERIFY
auto stable = get_table();
PSP_GNODE_VERIFY_TABLE(stable);
#endif
return;
}
for (t_uindex idx = 0, loop_end = m_iports.size(); idx < loop_end; ++idx) {
m_iports[idx]->release_or_clear();
}
t_uindex fnrows = flattened->num_rows();
std::shared_ptr<t_table> delta = m_oports[PSP_PORT_DELTA]->get_table();
delta->clear();
delta->reserve(fnrows);
std::shared_ptr<t_table> prev = m_oports[PSP_PORT_PREV]->get_table();
prev->clear();
prev->reserve(fnrows);
std::shared_ptr<t_table> current = m_oports[PSP_PORT_CURRENT]->get_table();
current->clear();
current->reserve(fnrows);
std::shared_ptr<t_table> transitions = m_oports[PSP_PORT_TRANSITIONS]->get_table();
transitions->clear();
transitions->reserve(fnrows);
std::shared_ptr<t_table> existed = m_oports[PSP_PORT_EXISTED]->get_table();
existed->clear();
existed->reserve(fnrows);
existed->set_size(fnrows);
const t_schema& fschema = flattened->get_schema();
std::shared_ptr<t_column> pkey_col_sptr = flattened->get_column("psp_pkey");
std::shared_ptr<t_column> op_col_sptr = flattened->get_column("psp_op");
t_column* pkey_col = pkey_col_sptr.get();
t_column* op_col = op_col_sptr.get();
t_table* stable = get_table();
PSP_GNODE_VERIFY_TABLE(stable);
const t_schema& sschema = m_state->get_schema();
std::vector<const t_column*> fcolumns(flattened->num_columns());
t_uindex ncols = sschema.get_num_columns();
std::vector<const t_column*> scolumns(ncols);
std::vector<t_column*> dcolumns(ncols);
std::vector<t_column*> pcolumns(ncols);
std::vector<t_column*> ccolumns(ncols);
std::vector<t_column*> tcolumns(ncols);
std::vector<t_uindex> col_translation(stable->num_columns());
t_uindex count = 0;
std::string opname("psp_op");
std::string pkeyname("psp_pkey");
for (t_uindex idx = 0, loop_end = fschema.size(); idx < loop_end; ++idx) {
const std::string& cname = fschema.m_columns[idx];
if (cname != opname && cname != pkeyname) {
col_translation[count] = idx;
fcolumns[idx] = flattened->get_column(cname).get();
++count;
}
}
for (t_uindex idx = 0, loop_end = sschema.size(); idx < loop_end; ++idx) {
const std::string& cname = sschema.m_columns[idx];
scolumns[idx] = stable->get_column(cname).get();
pcolumns[idx] = prev->get_column(cname).get();
ccolumns[idx] = current->get_column(cname).get();
dcolumns[idx] = delta->get_column(cname).get();
tcolumns[idx] = transitions->get_column(cname).get();
}
t_column* ecolumn = existed->get_column("psp_existed").get();
t_tscalar prev_pkey;
prev_pkey.clear();
const t_gstate& cstate = *(m_state.get());
std::vector<t_tscalar> existing_insert_pkeys;
t_mask mask(fnrows);
t_uindex added_count = 0;
std::uint8_t* op_base = op_col->get_nth<std::uint8_t>(0);
std::vector<t_uindex> added_offset(fnrows);
std::vector<t_rlookup> lkup(fnrows);
std::vector<bool> prev_pkey_eq_vec(fnrows);
for (t_uindex idx = 0; idx < fnrows; ++idx) {
t_tscalar pkey = pkey_col->get_scalar(idx);
std::uint8_t op_ = op_base[idx];
t_op op = static_cast<t_op>(op_);
lkup[idx] = cstate.lookup(pkey);
bool row_pre_existed = lkup[idx].m_exists;
prev_pkey_eq_vec[idx] = pkey == prev_pkey;
added_offset[idx] = added_count;
switch (op) {
case OP_INSERT: {
row_pre_existed = row_pre_existed && !prev_pkey_eq_vec[idx];
mask.set(idx, true);
ecolumn->set_nth(added_count, row_pre_existed);
++added_count;
} break;
case OP_DELETE: {
if (row_pre_existed) {
mask.set(idx, true);
ecolumn->set_nth(added_count, row_pre_existed);
++added_count;
} else {
mask.set(idx, false);
}
} break;
default: { PSP_COMPLAIN_AND_ABORT("Unknown OP"); }
}
prev_pkey = pkey;
}
auto mask_count = mask.count();
PSP_VERBOSE_ASSERT(mask_count == added_count, "Expected equality");
delta->set_size(mask_count);
prev->set_size(mask_count);
current->set_size(mask_count);
transitions->set_size(mask_count);
existed->set_size(mask_count);
psp_log_time(repr() + " _process.noinit_path.post_rlkup_loop");
if (!m_expr_icols.empty()) {
populate_icols_in_flattened(lkup, flattened);
}
#ifdef PSP_PARALLEL_FOR
PSP_PFOR(0, int(ncols), 1,
[&fcolumns, &scolumns, &dcolumns, &pcolumns, &ccolumns, &tcolumns, &col_translation,
&op_base, &lkup, &prev_pkey_eq_vec, &added_offset, this](int colidx)
#else
for (t_uindex colidx = 0; colidx < ncols; ++colidx)
#endif
{
auto fcolumn = fcolumns[col_translation[colidx]];
auto scolumn = scolumns[colidx];
auto dcolumn = dcolumns[colidx];
auto pcolumn = pcolumns[colidx];
auto ccolumn = ccolumns[colidx];
auto tcolumn = tcolumns[colidx];
t_dtype col_dtype = fcolumn->get_dtype();
switch (col_dtype) {
case DTYPE_INT64: {
_process_helper<std::int64_t>(fcolumn, scolumn, dcolumn, pcolumn, ccolumn,
tcolumn, op_base, lkup, prev_pkey_eq_vec, added_offset);
} break;
case DTYPE_INT32: {
_process_helper<std::int32_t>(fcolumn, scolumn, dcolumn, pcolumn, ccolumn,
tcolumn, op_base, lkup, prev_pkey_eq_vec, added_offset);
} break;
case DTYPE_INT16: {
_process_helper<std::int16_t>(fcolumn, scolumn, dcolumn, pcolumn, ccolumn,
tcolumn, op_base, lkup, prev_pkey_eq_vec, added_offset);
} break;
case DTYPE_INT8: {
_process_helper<std::int8_t>(fcolumn, scolumn, dcolumn, pcolumn, ccolumn,
tcolumn, op_base, lkup, prev_pkey_eq_vec, added_offset);
} break;
case DTYPE_UINT64: {
_process_helper<std::uint64_t>(fcolumn, scolumn, dcolumn, pcolumn, ccolumn,
tcolumn, op_base, lkup, prev_pkey_eq_vec, added_offset);
} break;
case DTYPE_UINT32: {
_process_helper<std::uint32_t>(fcolumn, scolumn, dcolumn, pcolumn, ccolumn,
tcolumn, op_base, lkup, prev_pkey_eq_vec, added_offset);
} break;
case DTYPE_UINT16: {
_process_helper<std::uint16_t>(fcolumn, scolumn, dcolumn, pcolumn, ccolumn,
tcolumn, op_base, lkup, prev_pkey_eq_vec, added_offset);
} break;
case DTYPE_UINT8: {
_process_helper<std::uint8_t>(fcolumn, scolumn, dcolumn, pcolumn, ccolumn,
tcolumn, op_base, lkup, prev_pkey_eq_vec, added_offset);
} break;
case DTYPE_FLOAT64: {
_process_helper<double>(fcolumn, scolumn, dcolumn, pcolumn, ccolumn,
tcolumn, op_base, lkup, prev_pkey_eq_vec, added_offset);
} break;
case DTYPE_FLOAT32: {
_process_helper<float>(fcolumn, scolumn, dcolumn, pcolumn, ccolumn, tcolumn,
op_base, lkup, prev_pkey_eq_vec, added_offset);
} break;
case DTYPE_BOOL: {
_process_helper<std::uint8_t>(fcolumn, scolumn, dcolumn, pcolumn, ccolumn,
tcolumn, op_base, lkup, prev_pkey_eq_vec, added_offset);
} break;
case DTYPE_TIME: {
_process_helper<std::int64_t>(fcolumn, scolumn, dcolumn, pcolumn, ccolumn,
tcolumn, op_base, lkup, prev_pkey_eq_vec, added_offset);
} break;
case DTYPE_DATE: {
_process_helper<std::uint32_t>(fcolumn, scolumn, dcolumn, pcolumn, ccolumn,
tcolumn, op_base, lkup, prev_pkey_eq_vec, added_offset);
} break;
case DTYPE_STR: {
_process_helper<std::string>(fcolumn, scolumn, dcolumn, pcolumn, ccolumn,
tcolumn, op_base, lkup, prev_pkey_eq_vec, added_offset);
} break;
default: { PSP_COMPLAIN_AND_ABORT("Unsupported column dtype"); }
}
}
#ifdef PSP_PARALLEL_FOR
);
#endif
psp_log_time(repr() + " _process.noinit_path.post_process_helper");
std::shared_ptr<t_table> flattened_masked
= mask.count() == flattened->size() ? flattened : flattened->clone(mask);
PSP_GNODE_VERIFY_TABLE(flattened_masked);
#ifdef PSP_GNODE_VERIFY
{
auto updated_table = get_table();
PSP_GNODE_VERIFY_TABLE(updated_table);
}
#endif
m_state->update_history(flattened_masked.get());
#ifdef PSP_GNODE_VERIFY
{
auto updated_table = get_table();
PSP_GNODE_VERIFY_TABLE(updated_table);
}
#endif
psp_log_time(repr() + " _process.noinit_path.post_update_history");
m_oports[PSP_PORT_FLATTENED]->set_table(flattened_masked);
if (t_env::log_data_gnode_flattened()) {
std::cout << repr() << "gnode_process_flattened_mask" << std::endl;
flattened_masked->pprint();
}
if (t_env::log_data_gnode_delta()) {
std::cout << repr() << "gnode_process_delta" << std::endl;
delta->pprint();
}
if (t_env::log_data_gnode_prev()) {
std::cout << repr() << "gnode_process_prev" << std::endl;
prev->pprint();
}
if (t_env::log_data_gnode_current()) {
std::cout << repr() << "gnode_process_current" << std::endl;
current->pprint();
}
if (t_env::log_data_gnode_transitions()) {
std::cout << repr() << "gnode_process_transitions" << std::endl;
transitions->pprint();
}
if (t_env::log_data_gnode_existed()) {
std::cout << repr() << "gnode_process_existed" << std::endl;
existed->pprint();
}
if (t_env::log_time_gnode_process()) {
auto t2 = std::chrono::high_resolution_clock::now();
std::cout << repr() << " gnode_process_time "
<< std::chrono::duration_cast<std::chrono::milliseconds>(t2 - t1).count()
<< std::endl;
std::cout << repr() << "gnode_process_time since begin=> "
<< std::chrono::duration_cast<std::chrono::milliseconds>(t2 - m_epoch).count()
<< std::endl;
}
notify_contexts(*flattened_masked);
psp_log_time(repr() + " _process.noinit_path.exit");
}
t_table*
t_gnode::_get_otable(t_uindex portidx) {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
PSP_VERBOSE_ASSERT(portidx < m_oports.size(), "Invalid port number");
return m_oports[portidx]->get_table().get();
}
t_table*
t_gnode::_get_itable(t_uindex portidx) {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
PSP_VERBOSE_ASSERT(portidx < m_iports.size(), "Invalid port number");
return m_iports[portidx]->get_table().get();
}
t_table*
t_gnode::get_table() {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
return m_state->get_table().get();
}
const t_table*
t_gnode::get_table() const {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
return m_state->get_table().get();
}
void
t_gnode::pprint() const {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
m_state->pprint();
}
template <typename CTX_T>
void
t_gnode::set_ctx_state(void* ptr) {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
CTX_T* ctx = static_cast<CTX_T*>(ptr);
ctx->set_state(m_state);
}
void
t_gnode::_update_contexts_from_state(const t_table& tbl) {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
for (auto& kv : m_contexts) {
auto& ctxh = kv.second;
switch (ctxh.m_ctx_type) {
case TWO_SIDED_CONTEXT: {
auto ctx = static_cast<t_ctx2*>(ctxh.m_ctx);
ctx->reset();
update_context_from_state<t_ctx2>(ctx, tbl);
} break;
case ONE_SIDED_CONTEXT: {
auto ctx = static_cast<t_ctx1*>(ctxh.m_ctx);
ctx->reset();
update_context_from_state<t_ctx1>(ctx, tbl);
} break;
case ZERO_SIDED_CONTEXT: {
auto ctx = static_cast<t_ctx0*>(ctxh.m_ctx);
ctx->reset();
update_context_from_state<t_ctx0>(ctx, tbl);
} break;
case GROUPED_PKEY_CONTEXT: {
auto ctx = static_cast<t_ctx_grouped_pkey*>(ctxh.m_ctx);
ctx->reset();
update_context_from_state<t_ctx_grouped_pkey>(ctx, tbl);
} break;
default: { PSP_COMPLAIN_AND_ABORT("Unexpected context type"); } break;
}
}
}
std::vector<std::string>
t_gnode::get_registered_contexts() const {
std::vector<std::string> rval;
for (const auto& kv : m_contexts) {
std::stringstream ss;
const auto& ctxh = kv.second;
ss << "(ctx_name => " << kv.first << ", ";
switch (ctxh.m_ctx_type) {
case TWO_SIDED_CONTEXT: {
auto ctx = static_cast<const t_ctx2*>(ctxh.m_ctx);
ss << ctx->repr() << ")";
} break;
case ONE_SIDED_CONTEXT: {
auto ctx = static_cast<const t_ctx1*>(ctxh.m_ctx);
ss << ctx->repr() << ")";
} break;
case ZERO_SIDED_CONTEXT: {
auto ctx = static_cast<const t_ctx0*>(ctxh.m_ctx);
ss << ctx->repr() << ")";
} break;
case GROUPED_PKEY_CONTEXT: {
auto ctx = static_cast<const t_ctx_grouped_pkey*>(ctxh.m_ctx);
ss << ctx->repr() << ")";
} break;
default: { PSP_COMPLAIN_AND_ABORT("Unexpected context type"); } break;
}
rval.push_back(ss.str());
}
return rval;
}
void
t_gnode::_update_contexts_from_state() {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
auto flattened = m_state->get_pkeyed_table();
_update_contexts_from_state(*flattened);
}
void
t_gnode::_register_context(const std::string& name, t_ctx_type type, std::int64_t ptr) {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
void* ptr_ = reinterpret_cast<void*>(ptr);
t_ctx_handle ch(ptr_, type);
m_contexts[name] = ch;
bool should_update = m_state->mapping_size() > 0;
std::shared_ptr<t_table> flattened;
if (should_update) {
flattened = m_state->get_pkeyed_table();
}
auto pkeyed_tblcontext = m_state->get_port_schema().get_table_context();
auto non_pkeyed_tblcontext = m_state->get_table()->get_schema().get_table_context();
switch (type) {
case TWO_SIDED_CONTEXT: {
set_ctx_state<t_ctx2>(ptr_);
t_ctx2* ctx = static_cast<t_ctx2*>(ptr_);
if (t_env::log_progress()) {
std::cout << repr() << " << gnode.register_context: "
<< " name => " << name << " type => " << type << " ctx => "
<< ctx->repr() << std::endl;
}
ctx->reset();
if (should_update)
update_context_from_state<t_ctx2>(ctx, *flattened);
} break;
case ONE_SIDED_CONTEXT: {
set_ctx_state<t_ctx1>(ptr_);
t_ctx1* ctx = static_cast<t_ctx1*>(ptr_);
if (t_env::log_progress()) {
std::cout << repr() << " << gnode.register_context: "
<< " name => " << name << " type => " << type << " ctx => "
<< ctx->repr() << std::endl;
}
ctx->reset();
if (should_update)
update_context_from_state<t_ctx1>(ctx, *flattened);
} break;
case ZERO_SIDED_CONTEXT: {
set_ctx_state<t_ctx0>(ptr_);
t_ctx0* ctx = static_cast<t_ctx0*>(ptr_);
if (t_env::log_progress()) {
std::cout << repr() << " << gnode.register_context: "
<< " name => " << name << " type => " << type << " ctx => "
<< ctx->repr() << std::endl;
}
ctx->reset();
if (should_update)
update_context_from_state<t_ctx0>(ctx, *flattened);
} break;
case GROUPED_PKEY_CONTEXT: {
set_ctx_state<t_ctx0>(ptr_);
auto ctx = static_cast<t_ctx_grouped_pkey*>(ptr_);
if (t_env::log_progress()) {
std::cout << repr() << " << gnode.register_context: "
<< " name => " << name << " type => " << type << " ctx => "
<< ctx->repr() << std::endl;
}
ctx->reset();
if (should_update)
update_context_from_state<t_ctx_grouped_pkey>(ctx, *flattened);
} break;
default: { PSP_COMPLAIN_AND_ABORT("Unexpected context type"); } break;
}
}
void
t_gnode::_unregister_context(const std::string& name) {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
if ((m_contexts.find(name) == m_contexts.end()))
return;
PSP_VERBOSE_ASSERT(m_contexts.find(name) != m_contexts.end(), "Context not found.");
m_contexts.erase(name);
}
void
t_gnode::notify_contexts(const t_table& flattened) {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
psp_log_time(repr() + "notify_contexts.enter");
t_index num_ctx = m_contexts.size();
t_sctxhvec ctxhvec(num_ctx);
t_index ctxh_count = 0;
for (t_sctxhmap::const_iterator iter = m_contexts.begin(); iter != m_contexts.end();
++iter) {
ctxhvec[ctxh_count] = iter->second;
ctxh_count++;
}
auto notify_context_helper = [this, &ctxhvec, &flattened](t_index ctxidx) {
const t_ctx_handle& ctxh = ctxhvec[ctxidx];
switch (ctxh.get_type()) {
case TWO_SIDED_CONTEXT: {
notify_context<t_ctx2>(flattened, ctxh);
} break;
case ONE_SIDED_CONTEXT: {
notify_context<t_ctx1>(flattened, ctxh);
} break;
case ZERO_SIDED_CONTEXT: {
notify_context<t_ctx0>(flattened, ctxh);
} break;
case GROUPED_PKEY_CONTEXT: {
notify_context<t_ctx_grouped_pkey>(flattened, ctxh);
} break;
default: { PSP_COMPLAIN_AND_ABORT("Unexpected context type"); } break;
}
};
if (has_python_dep()) {
for (t_index ctxidx = 0; ctxidx < num_ctx; ++ctxidx) {
notify_context_helper(ctxidx);
}
} else {
#ifdef PSP_PARALLEL_FOR
PSP_PFOR(0, int(num_ctx), 1,
[¬ify_context_helper](int ctxidx)
#else
for (t_index ctxidx = 0; ctxidx < num_ctx; ++ctxidx)
#endif
{ notify_context_helper(ctxidx); }
#ifdef PSP_PARALLEL_FOR
);
#endif
}
psp_log_time(repr() + "notify_contexts.exit");
}
std::vector<t_pivot>
t_gnode::get_pivots() const {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
std::vector<t_pivot> rval;
for (t_sctxhmap::const_iterator iter = m_contexts.begin(); iter != m_contexts.end();
++iter) {
auto ctxh = iter->second;
switch (ctxh.m_ctx_type) {
case TWO_SIDED_CONTEXT: {
const t_ctx2* ctx = static_cast<const t_ctx2*>(ctxh.m_ctx);
auto pivots = ctx->get_pivots();
rval.insert(std::end(rval), std::begin(pivots), std::end(pivots));
} break;
case ONE_SIDED_CONTEXT: {
const t_ctx1* ctx = static_cast<const t_ctx1*>(ctxh.m_ctx);
auto pivots = ctx->get_pivots();
rval.insert(std::end(rval), std::begin(pivots), std::end(pivots));
} break;
case ZERO_SIDED_CONTEXT:
case GROUPED_PKEY_CONTEXT: {
// no pivots
} break;
default: { PSP_COMPLAIN_AND_ABORT("Unexpected context type"); } break;
}
}
return rval;
}
t_schema
t_gnode::get_tblschema() const {
return m_tblschema;
}
std::vector<t_stree*>
t_gnode::get_trees() {
PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
std::vector<t_stree*> rval;
for (const auto& kv : m_contexts) {
auto& ctxh = kv.second;
switch (ctxh.m_ctx_type) {
case TWO_SIDED_CONTEXT: {
auto ctx = reinterpret_cast<t_ctx2*>(ctxh.m_ctx);
auto trees = ctx->get_trees();
rval.insert(rval.end(), std::begin(trees), std::end(trees));
} break;
case ONE_SIDED_CONTEXT: {
auto ctx = reinterpret_cast<t_ctx1*>(ctxh.m_ctx);
auto trees = ctx->get_trees();
rval.insert(rval.end(), std::begin(trees), std::end(trees));
} break;
case ZERO_SIDED_CONTEXT: {
auto ctx = reinterpret_cast<t_ctx0*>(ctxh.m_ctx);
auto trees = ctx->get_trees();
rval.insert(rval.end(), std::begin(trees), std::end(trees));
} break;
case GROUPED_PKEY_CONTEXT: {
auto ctx = reinterpret_cast<t_ctx_grouped_pkey*>(ctxh.m_ctx);
auto trees = ctx->get_trees();
rval.insert(rval.end(), std::begin(trees), std::end(trees));
} break;
default: { PSP_COMPLAIN_AND_ABORT("Unexpected context type"); } break;
}
}
return rval;
}
void
t_gnode::set_id(t_uindex id) {
m_id = id;
}
t_uindex
t_gnode::get_id() const {
return m_id;
}
void
t_gnode::release_inputs() {
for (const auto& p : m_iports) {
p->release();
}
}
void
t_gnode::release_outputs() {
for (const auto& p : m_oports) {
p->release();
}
}
std::vector<std::string>
t_gnode::get_contexts_last_updated() const {
std::vector<std::string> rval;
for (const auto& kv : m_contexts) {
auto ctxh = kv.second;
switch (ctxh.m_ctx_type) {
case TWO_SIDED_CONTEXT: {
auto ctx = reinterpret_cast<t_ctx2*>(ctxh.m_ctx);
if (ctx->has_deltas()) {
rval.push_back(kv.first);
}
} break;
case ONE_SIDED_CONTEXT: {
auto ctx = reinterpret_cast<t_ctx1*>(ctxh.m_ctx);
if (ctx->has_deltas()) {
rval.push_back(kv.first);
}
} break;
case ZERO_SIDED_CONTEXT: {
auto ctx = reinterpret_cast<t_ctx0*>(ctxh.m_ctx);
if (ctx->has_deltas()) {
rval.push_back(kv.first);
}
} break;
case GROUPED_PKEY_CONTEXT: {
auto ctx = reinterpret_cast<t_ctx_grouped_pkey*>(ctxh.m_ctx);
if (ctx->has_deltas()) {
rval.push_back(kv.first);
}
} break;
default: { PSP_COMPLAIN_AND_ABORT("Unexpected context type"); } break;
}
}
if (t_env::log_progress()) {
std::cout << "get_contexts_last_updated<" << std::endl;
for (const auto& s : rval) {
std::cout << "\t" << s << std::endl;
}
std::cout << ">\n";
}
return rval;
}
std::vector<t_tscalar>
t_gnode::get_row_data_pkeys(const std::vector<t_tscalar>& pkeys) const {
return m_state->get_row_data_pkeys(pkeys);
}
std::vector<t_tscalar>
t_gnode::has_pkeys(const std::vector<t_tscalar>& pkeys) const {
return m_state->has_pkeys(pkeys);
}
std::vector<t_tscalar>
t_gnode::get_pkeys() const {
return m_state->get_pkeys();
}
void
t_gnode::reset() {
std::vector<std::string> rval;
for (const auto& kv : m_contexts) {
auto ctxh = kv.second;
switch (ctxh.m_ctx_type) {
case TWO_SIDED_CONTEXT: {
auto ctx = reinterpret_cast<t_ctx2*>(ctxh.m_ctx);
ctx->reset();
} break;
case ONE_SIDED_CONTEXT: {
auto ctx = reinterpret_cast<t_ctx1*>(ctxh.m_ctx);
ctx->reset();
} break;
case ZERO_SIDED_CONTEXT: {
auto ctx = reinterpret_cast<t_ctx0*>(ctxh.m_ctx);
ctx->reset();
} break;
case GROUPED_PKEY_CONTEXT: {
auto ctx = reinterpret_cast<t_ctx_grouped_pkey*>(ctxh.m_ctx);
ctx->reset();
} break;
default: { PSP_COMPLAIN_AND_ABORT("Unexpected context type"); } break;
}
}
m_state->reset();
}
void
t_gnode::clear_input_ports() {
for (t_uindex idx = 0, loop_end = m_oports.size(); idx < loop_end; ++idx) {
m_iports[idx]->get_table()->clear();
}
}
void
t_gnode::clear_output_ports() {
for (t_uindex idx = 0, loop_end = m_oports.size(); idx < loop_end; ++idx) {
m_oports[idx]->get_table()->clear();
}
}
template <>
void
t_gnode::_process_helper<std::string>(const t_column* fcolumn, const t_column* scolumn,
t_column* dcolumn, t_column* pcolumn, t_column* ccolumn, t_column* tcolumn,
const std::uint8_t* op_base, std::vector<t_rlookup>& lkup,
std::vector<bool>& prev_pkey_eq_vec, std::vector<t_uindex>& added_vec) {
pcolumn->borrow_vocabulary(*scolumn);
for (t_uindex idx = 0, loop_end = fcolumn->size(); idx < loop_end; ++idx) {
std::uint8_t op_ = op_base[idx];
t_op op = static_cast<t_op>(op_);
t_uindex added_count = added_vec[idx];
const t_rlookup& rlookup = lkup[idx];
bool row_pre_existed = rlookup.m_exists;
switch (op) {
case OP_INSERT: {
row_pre_existed = row_pre_existed && !prev_pkey_eq_vec[idx];
const char* prev_value = 0;
bool prev_valid = false;
auto cur_value = fcolumn->get_nth<const char>(idx);
std::string curs(cur_value);
bool cur_valid = fcolumn->is_valid(idx);
if (row_pre_existed) {
prev_value = scolumn->get_nth<const char>(rlookup.m_idx);
prev_valid = scolumn->is_valid(rlookup.m_idx);
}
bool exists = cur_valid;
bool prev_existed = row_pre_existed && prev_valid;
bool prev_cur_eq
= prev_value && cur_value && strcmp(prev_value, cur_value) == 0;
auto trans = calc_transition(prev_existed, row_pre_existed, exists, prev_valid,
cur_valid, prev_cur_eq, prev_pkey_eq_vec[idx]);
if (prev_valid) {
pcolumn->set_nth<t_uindex>(
added_count, *(scolumn->get_nth<t_uindex>(rlookup.m_idx)));
}
pcolumn->set_valid(added_count, prev_valid);
if (cur_valid) {
ccolumn->set_nth<const char*>(added_count, cur_value);
}
if (!cur_valid && prev_valid) {
ccolumn->set_nth<const char*>(added_count, prev_value);
}
ccolumn->set_valid(added_count, cur_valid ? cur_valid : prev_valid);
tcolumn->set_nth<std::uint8_t>(idx, trans);
} break;
case OP_DELETE: {
if (row_pre_existed) {
auto prev_value = scolumn->get_nth<const char>(rlookup.m_idx);
bool prev_valid = scolumn->is_valid(rlookup.m_idx);
pcolumn->set_nth<const char*>(added_count, prev_value);
pcolumn->set_valid(added_count, prev_valid);
ccolumn->set_nth<const char*>(added_count, prev_value);
ccolumn->set_valid(added_count, prev_valid);
tcolumn->set_nth<std::uint8_t>(added_count, VALUE_TRANSITION_NEQ_TDF);
}
} break;
default: { PSP_COMPLAIN_AND_ABORT("Unknown OP"); }
}
}
}
t_table*
t_gnode::_get_pkeyed_table() const {
return m_state->_get_pkeyed_table();
}
std::vector<t_custom_column>
t_gnode::get_custom_columns() const {
return m_custom_columns;
}
t_gnode_recipe
t_gnode::get_recipe() const {
t_gnode_recipe rv;
rv.m_mode = m_mode;
rv.m_tblschema = m_tblschema.get_recipe();
for (const auto& s : m_ischemas) {
rv.m_ischemas.push_back(s.get_recipe());
}
for (const auto& s : m_oschemas) {
rv.m_oschemas.push_back(s.get_recipe());
}
for (const auto& cc : m_custom_columns) {
rv.m_custom_columns.push_back(cc.get_recipe());
}
return rv;
}
bool
t_gnode::has_python_dep() const {
return !m_custom_columns.empty();
}
void
t_gnode::set_pool_cleanup(std::function<void()> cleanup) {
m_pool_cleanup = cleanup;
}
const t_schema&
t_gnode::get_port_schema() const {
return m_state->get_port_schema();
}
bool
t_gnode::was_updated() const {
return m_was_updated;
}
void
t_gnode::clear_updated() {
m_was_updated = false;
}
std::shared_ptr<t_table>
t_gnode::get_sorted_pkeyed_table() const {
return m_state->get_sorted_pkeyed_table();
}
void
t_gnode::register_context(const std::string& name, std::shared_ptr<t_ctx0> ctx) {
_register_context(name, ZERO_SIDED_CONTEXT, reinterpret_cast<std::int64_t>(ctx.get()));
}
void
t_gnode::register_context(const std::string& name, std::shared_ptr<t_ctx1> ctx) {
_register_context(name, ONE_SIDED_CONTEXT, reinterpret_cast<std::int64_t>(ctx.get()));
}
void
t_gnode::register_context(const std::string& name, std::shared_ptr<t_ctx2> ctx) {
_register_context(name, TWO_SIDED_CONTEXT, reinterpret_cast<std::int64_t>(ctx.get()));
}
void
t_gnode::register_context(const std::string& name, std::shared_ptr<t_ctx_grouped_pkey> ctx) {
_register_context(name, GROUPED_PKEY_CONTEXT, reinterpret_cast<std::int64_t>(ctx.get()));
}
} // end namespace perspective
| [
"[email protected]"
] | |
9fdc64d69aef5122cee7c79bf0fc0af14dcf0d95 | f6eef853828a7db1aed3904fd00f05f831db7f7a | /Code/Engine/Resources/Shaders/Program.hpp | cd41f820eb6022bdfbb6c48dc18763c2c025bebd | [] | no_license | adrianiusca/CleverProject | 85e7106ba61c139f3996add72104aa40cfbc80eb | 42e62cdcde4d16471d81a63e9ee9c82c5cf6ebc3 | refs/heads/master | 2021-05-14T15:29:04.620435 | 2018-01-09T19:54:06 | 2018-01-09T19:54:06 | 115,994,022 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,047 | hpp | #pragma once
#include "Shader.hpp"
#include "ShaderUniforms.hpp"
#include "Engine/Resources/DynamicResource.hpp"
#include "Engine/Resources/Meshes/VertexAttributes.hpp"
namespace cp
{
typedef map<ShaderUniforms, i32> Uniforms;
typedef map<VertexAttributes, i32> Attributes;
typedef vector<shared_ptr<Shader>> Shaders;
class Program : public DynamicResource
{
public:
explicit Program(int id);
void add_shader(shared_ptr<Shader> shader);
void add_shaders(const Shaders& shaders);
void remove_shader(int type);
void add_uniform(ShaderUniforms uniform, const string& name);
void add_attribute(VertexAttributes attribute, const string& name);
void set_mat4(ShaderUniforms uniform, const mat4& matrix) const;
void set_mat3(ShaderUniforms uniform, const mat3& matrix) const;
void set_vec4(ShaderUniforms uniform, const vec4& vec) const;
void set_vec3(ShaderUniforms uniform, const vec3& vec) const;
void set_vec2(ShaderUniforms uniform, const vec2& vec) const;
void set_float(ShaderUniforms uniform, float value) const;
void set_int(ShaderUniforms uniform, int value) const;
const Uniforms& get_uniforms() const;
const Attributes& get_attributes() const;
const Shaders& get_shaders() const;
int get_uniform(ShaderUniforms uniform) const;
int get_attribute(VertexAttributes attribute) const;
int get_program_id() const;
void use() const;
private:
void attach_shader(shared_ptr<Shader> shader) const;
void detach_shader(shared_ptr<Shader> shader) const;
int get_attribute_location(const string& name);
int get_uniform_location(const string& name);
bool create() override;
bool release() override;
bool linking_status() const;
void link() const;
private:
Shaders m_shaders;
Uniforms m_uniforms;
Attributes m_attributes;
int m_program_id;
};
} | [
"[email protected]"
] | |
98bdefa612ebf9216df5168bd9e4aa1389f51732 | 8010df1fef10ddfd83bf07966cbf7e2e4b0d7ee9 | /include/winsdk/shared/TraceLoggingActivity.h | fc249a048d4e2324d5a31795af25197d51f1703b | [] | no_license | light-tech/MSCpp | a23ab987b7e12329ab2d418b06b6b8055bde5ca2 | 012631b58c402ceec73c73d2bda443078bc151ef | refs/heads/master | 2022-12-26T23:51:21.686396 | 2020-10-15T13:40:34 | 2020-10-15T13:40:34 | 188,921,341 | 6 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 29,955 | h | /* ++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
TraceLoggingActivity.h
Abstract:
TraceLogging activity logging helper classes and macros for C++ for
utilizing ETW activity ids.
Environment:
User mode.
--*/
#pragma once
#ifndef RC_INVOKED
#include "TraceLoggingProvider.h"
/*
Quick start:
#include <windows.h>
#include <TraceLoggingProvider.h>
#include <TraceLoggingActivity.h>
#include <winmeta.h> // optional, used here for WINEVENT_LEVEL_ERROR
TRACELOGGING_DEFINE_PROVIDER(
g_hProvider,
"MyProvider",
(0xb3864c38, 0x4273, 0x58c5, 0x54, 0x5b, 0x8b, 0x36, 0x08, 0x34, 0x34, 0x71));
int main(int argc, char* argv[])
{
const ULONGLONG MyKeywordValue = 0x10;
TraceLoggingRegister(g_hProvider);
// Declare a local activity variable.
// Use the default (0 = none) for the activity's keyword.
// Use the default (5 = verbose) for the activity's level.
TraceLoggingActivity<g_hProvider> parentActivity;
// Write the activity's START event. Note that you must not specify keyword
// or level for START and STOP events because they always use the activity's
// keyword and level.
TraceLoggingWriteStart(
parentActivity,
"ParentActivity", // The name of the start event is used as the activity name.
TraceLoggingValue(argc, "SampleField1"));
{
// Declare a local (nested) activity variable, with explicit keyword and level:
TraceLoggingActivity<g_hProvider, MyKeywordValue, WINEVENT_LEVEL_ERROR> nestedActivity;
// Connect the nested activity to the parent:
nestedActivity.SetRelatedActivity(parentActivity);
// Write the activity's START event.
TraceLoggingWriteStart(nestedActivity, "NestedActivity");
// TraceLoggingWriteTagged writes an event that is tagged with an activity
// ID. Note that TraceLoggingWriteTagged is just like TraceLoggingWrite
// except that the first parameter is an activity (not a provider) and the
// resulting event is explicitly tagged with the activity ID. In particular,
// TraceLoggingWriteTagged does NOT use the activity's level and keyword --
// they are specified just as they would be for a TraceLoggingWrite event.
TraceLoggingWriteTagged(
nestedActivity,
"NestedActivityIdTaggedEvent",
TraceLoggingValue(argc, "SampleField2"),
TraceLoggingKeyword(MyKeywordValue));
// Write the activity's STOP event.
TraceLoggingWriteStop(nestedActivity, "NestedActivity");
// Note that if the activity is destroyed without being stopped, a default
// "ActivityStoppedAutomatically" event will be written by the destructor.
}
TraceLoggingWriteStop(parentActivity, "ParentActivity");
TraceLoggingUnregister(g_hProvider);
return 0;
}
*/
#pragma region Public Interface
/*
Classes:
- TraceLoggingActivity: General purpose activity class.
- TraceLoggingThreadActivity: Automatic activity class. (Desktop apps only.)
- TraceLoggingThreadActivityIdSetter: Helper for controlling the thread-local
activity ID. (Desktop apps only.)
Macros:
- TraceLoggingWriteStart: Writes an activity START event.
- TraceLoggingWriteStop: Writes an activity STOP event.
- TraceLoggingWriteTagged: Writes an event explicitly tagged with an activity ID.
- TraceLoggingWriteTaggedIfStarted: TraceLoggingWriteTagged if the activity was
started.
- TraceLoggingFunction: Creates a TraceLoggingThreadActivity and writes a START
event with the current function's name. (Desktop apps only.)
Basic usage:
1. Create an instance of TraceLoggingActivity or TraceLoggingThreadActivity.
2. Call TraceLoggingWriteStart to write the activity's START event.
3. Call TraceLoggingWriteTagged to write events associated with the activity.
4. Call TraceLoggingWriteStop to write the activity's STOP event.
*/
/*
TraceLoggingActivity implements general-purpose activity support. It supports
nesting via an explicit childActivity.SetRelatedActivity(parentActivity) method.
Events associated with the activity can then be written using
TraceLoggingWriteTagged.
Activities can be nested by calling childActivity.SetRelatedActivity(parentActivity)
before calling TraceLoggingWriteStart(childActivity, ...).
Use TraceLoggingWriteStart to generate a unique activity ID and write the START
event for the activity.
Use TraceLoggingWriteTagged to write events that are associated with the activity.
Use TraceLoggingWriteStop to write the STOP event for the activity.
If the activity is destroyed without being stopped, it will log a default STOP
event.
*/
template<
TraceLoggingHProvider const& provider,
UINT64 keyword = 0, // defaults to 0 = none
UINT8 level = 5, // defaults to 5 = WINEVENT_LEVEL_VERBOSE
typename TlgReflectorTag = _TlgReflectorTag_Param0IsHProvider> // helps TlgReflector understand that this is a wrapper type
class TraceLoggingActivity;
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
/*
TraceLoggingThreadActivity implements automatic activities using a thread-local
CurrentActivityId variable. Each new activity is automatically nested within the
activity that previously set the CurrentActivityId variable, and all events
written using TraceLoggingWrite are automatically associated with the
CurrentActivityId. This automatic behavior can be convenient in some cases, but it
only works correctly when the activities nest precisely and do not cross thread
boundaries. In addition, TraceLoggingThreadActivity is not available on the
Windows Runtime (i.e. this class cannot be used for Windows Store or Windows Phone
apps).
PLEASE NOTE: use TraceLoggingThreadActivity only when you can guarantee that
lifetimes of all activities of this type on the thread fully nest in all cases, i.e.
a parent activity will not end before a child activity, even in error or exceptional
cases. Activities defined in function-local scopes typically meet this criteria.
Use TraceLoggingWriteStart to generate a unique activity ID and write the START
event for the activity.
Use TraceLoggingWrite to write events that are automatically associated with the
activity.
Use TraceLoggingWriteTagged to write events that are explicitly associated with the
activity.
Use TraceLoggingWriteStop to write the STOP event for the activity.
If the activity is destroyed without being stopped, it will log a default STOP
event.
*/
template<
TraceLoggingHProvider const& provider,
UINT64 keyword = 0, // defaults to 0 = none
UINT8 level = 5, // defaults to 5 = WINEVENT_LEVEL_VERBOSE
typename TlgReflectorTag = _TlgReflectorTag_Param0IsHProvider> // helps TlgReflector understand that this is a wrapper type
class TraceLoggingThreadActivity;
/*
TraceLoggingThreadActivityIdSetter is a helper class that sets the thread-local
CurrentActivity variable during construction and saves the original value. It then
restores the original value during destruction. This class is not available on the
Windows Runtime (i.e. it cannot be used for Windows Store or Windows Phone apps).
As with thread activities, lifetime of an instance of this class should
be carefully managed to avoid imperfect nesting.
*/
class TraceLoggingThreadActivityIdSetter;
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
/*
Macro TraceLoggingWriteStart(activity, "EventName", args...):
Invoke this macro to start an activity and log the start event.
The event name must be a string literal (not a variable) and must not contain
any '\0' characters.
Each arg must be a wrapper macro such as TraceLoggingValue, TraceLoggingInt32,
etc.
Do not specify TraceLoggingKeyword or TraceLoggingLevel as args for this macro.
The START and STOP events always use the activity's keyword and level.
*/
#define TraceLoggingWriteStart(activity, name, ...) \
__pragma(warning(push)) __pragma(warning(disable:4127)) \
do { \
_tlgActivityDecl(activity) \
static const UINT64 _tlgActivity_Keyword = _tlgActivityRef(activity).Keyword;\
static const UINT8 _tlgActivity_Level = _tlgActivityRef(activity).Level;\
static_assert( \
_tlgActivity_Keyword == (_tlgActivity_Keyword _tlg_FOREACH(_tlgKeywordVal, __VA_ARGS__)), \
"Do not use TraceLoggingKeyword in TraceLoggingWriteStart. Keywords for START events are " \
"specified in the activity type, e.g. TraceLoggingActivity<Provider,Keyword,Level>."); \
static_assert( \
_tlgActivity_Level == (_tlgActivity_Level _tlg_FOREACH(_tlgLevelVal, __VA_ARGS__)), \
"Do not use TraceLoggingLevel in TraceLoggingWriteStart. The Level for START events is " \
"specified in the activity type, e.g. TraceLoggingActivity<Provider,Keyword,Level>."); \
_tlgActivityRef(activity).zInternalStart(); \
TraceLoggingWriteActivity( \
_tlgActivityRef(activity).Provider(), \
(name), \
_tlgActivityRef(activity).Id(), \
_tlgActivityRef(activity).zInternalRelatedId(), \
TraceLoggingOpcode(1 /* WINEVENT_OPCODE_START */), \
TraceLoggingKeyword(_tlgActivity_Keyword), \
TraceLoggingLevel(_tlgActivity_Level), \
TraceLoggingDescription("~^" _tlg_LSTRINGIZE(activity) L"^~"), \
__VA_ARGS__); \
} while(0) \
__pragma(warning(pop)) \
/*
Macro TraceLoggingWriteStop(activity, "EventName", args...):
Invoke this macro to stop an activity and log the stop event.
The event name must be a string literal (not a variable) and must not contain
any '\0' characters.
Each arg must be a wrapper macro such as TraceLoggingValue, TraceLoggingInt32,
etc.
Do not specify TraceLoggingKeyword or TraceLoggingLevel as args for this macro.
The START and STOP events always use the activity's keyword and level.
If an activity is started and is destroyed before it is stopped, a default
event will be logged from the destructor.
*/
#define TraceLoggingWriteStop(activity, name, ...) \
__pragma(warning(push)) __pragma(warning(disable:4127)) \
do { \
_tlgActivityDecl(activity) \
static const UINT64 _tlgActivity_Keyword = _tlgActivityRef(activity).Keyword;\
static const UINT8 _tlgActivity_Level = _tlgActivityRef(activity).Level;\
static_assert( \
_tlgActivity_Keyword == (_tlgActivity_Keyword _tlg_FOREACH(_tlgKeywordVal, __VA_ARGS__)), \
"Do not use TraceLoggingKeyword in TraceLoggingWriteStop. Keywords for STOP events are " \
"specified in the activity type, e.g. TraceLoggingActivity<Provider,Keyword,Level>."); \
static_assert( \
_tlgActivity_Level == (_tlgActivity_Level _tlg_FOREACH(_tlgLevelVal, __VA_ARGS__)), \
"Do not use TraceLoggingLevel in TraceLoggingWriteStop. The Level for STOP events is " \
"specified in the activity type, e.g. TraceLoggingActivity<Provider,Keyword,Level>."); \
_tlgActivityRef(activity).zInternalStop(); \
TraceLoggingWriteActivity( \
_tlgActivityRef(activity).Provider(), \
(name), \
_tlgActivityRef(activity).Id(), \
NULL, \
TraceLoggingOpcode(2 /* WINEVENT_OPCODE_STOP */),\
TraceLoggingKeyword(_tlgActivity_Keyword),\
TraceLoggingLevel(_tlgActivity_Level),\
TraceLoggingDescription("~^" _tlg_LSTRINGIZE(activity) L"^~"),\
__VA_ARGS__); \
} while(0) \
__pragma(warning(pop)) \
/*
Macro TraceLoggingWriteTagged(activity, "EventName", args...):
Invoke this macro to log an event that is explicitly tagged with the activity id
of the specified activity.
The event name must be a string literal (not a variable) and must not contain
any '\0' characters.
Each arg must be a wrapper macro such as TraceLoggingValue, TraceLoggingInt32,
etc.
Note that events written with this macro do NOT use the activity's keyword and
level. If the level is not specified via TraceLoggingLevel, the level will default
to verbose (5). If the keyword is not specified via TraceLoggingKeyword, the keyword
will default to none (0).
*/
#define TraceLoggingWriteTagged(activity, name, ...) \
__pragma(warning(push)) __pragma(warning(disable:4127)) \
do { \
_tlgActivityDecl(activity) \
TraceLoggingWriteActivity( \
_tlgActivityRef(activity).Provider(), \
(name), \
_tlgActivityRef(activity).Id(), \
NULL, \
__VA_ARGS__); \
} while(0) \
__pragma(warning(pop)) \
/*
Macro TraceLoggingWriteTaggedIfStarted(activity, "EventName", args...):
Invoke this macro to log an event that is explicitly tagged with the activity id
of the specified activity. This macro logs the event only if the activity is
started.
The event name must be a string literal (not a variable) and must not contain
any '\0' characters.
Each arg must be a wrapper macro such as TraceLoggingValue, TraceLoggingInt32,
etc.
Note that events written with this macro do NOT use the activity's keyword and
level. If the level is not specified via TraceLoggingLevel, the level will default
to verbose (5). If the keyword is not specified via TraceLoggingKeyword, the keyword
will default to none (0).
*/
#define TraceLoggingWriteTaggedIfStarted(activity, name, ...) \
__pragma(warning(push)) __pragma(warning(disable:4127)) \
do { \
_tlgActivityDecl(activity) \
if (_tlgActivityRef(activity).IsStarted()) { \
TraceLoggingWriteActivity( \
_tlgActivityRef(activity).Provider(), \
(name), \
_tlgActivityRef(activity).Id(), \
NULL, \
__VA_ARGS__); \
} \
} while(0) \
__pragma(warning(pop)) \
/*
Macro TraceLoggingFunction(hProvider, args...):
Invoke this macro at the beginning of a function to define an activity and
start it. This will log a start event with the name of the function. When
the function exits, the activity class will log an automatically-generated
stop event.
Each arg must be a wrapper macro such as TraceLoggingValue, TraceLoggingInt32,
etc.
Since this macro uses a thread activity, please read the description for
TraceLoggingThreadActivity and ensure the function call or other thread
activities started within perfectly nest within each other even in cases of
errors and exceptions.
*/
#define TraceLoggingFunction(providerHandle, ...)\
TraceLoggingThreadActivity< \
providerHandle, \
0 _tlg_FOREACH(_tlgKeywordVal, __VA_ARGS__), \
5 _tlg_FOREACH(_tlgLevelVal, __VA_ARGS__)> \
_tlgFnActivity; \
TraceLoggingWriteStart(_tlgFnActivity, _tlgThisFunctionName, __VA_ARGS__)
#pragma endregion
#pragma region Implementation
/*
Private implementation macros. For internal use only.
Avoid IntelliSense errors about __FUNCTION__ only being valid within a function.
*/
#ifdef __INTELLISENSE__
#define _tlgThisFunctionName "ThisFunctionName"
#else
#define _tlgThisFunctionName __FUNCTION__
#endif
/*
Private implementation macros. For internal use only.
If the auto keyword is available, we can avoid referencing the activity
parameter more than once.
*/
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
#define _tlgActivityDecl(activity) auto& _tlgActivity(activity);
#define _tlgActivityRef(activity) _tlgActivity
#else
#define _tlgActivityDecl(activity)
#define _tlgActivityRef(activity) (activity)
#endif
/*
Private implementation function. For internal use only.
Separate function to minimize code bloat by consolidating the auto-stop events.
*/
template<UINT64 keyword, UINT8 level>
void _tlgWriteActivityAutoStop(
TraceLoggingHProvider provider,
_In_ GUID const* pActivityId)
{
TraceLoggingWriteActivity(
provider,
"ActivityStoppedAutomatically",
pActivityId,
NULL,
TraceLoggingOpcode(2 /* WINEVENT_OPCODE_STOP */),
TraceLoggingKeyword(keyword),
TraceLoggingLevel(level));
}
/*
Private implementation function. For internal use only.
*/
inline bool _tlgGuidIsZero(GUID const& g)
{
INT32 const* p = reinterpret_cast<INT32 const*>(&g);
return
p[0] == 0 &&
p[1] == 0 &&
p[2] == 0 &&
p[3] == 0;
}
/*
Private implementation function. For internal use only.
*/
inline bool _tlgGuidEqual(GUID const& g1, GUID const& g2)
{
INT32 const* p1 = reinterpret_cast<INT32 const*>(&g1);
INT32 const* p2 = reinterpret_cast<INT32 const*>(&g2);
return
p1[0] == p2[0] &&
p1[1] == p2[1] &&
p1[2] == p2[2] &&
p1[3] == p2[3];
}
/*
Private implementation class. For internal use only.
*/
template<
typename DerivedTy, // DerivedTy must define Provider(), OnStarted(), OnStopped().
UINT64 keyword,
UINT8 level>
class _TlgActivityBase
{
_TlgActivityBase(const _TlgActivityBase&); // = delete
_TlgActivityBase& operator=(const _TlgActivityBase&); // = delete
void Reset()
{
m_State = Created;
m_HasRelatedId = false;
}
enum State
{
Created,
Started,
Stopped,
Destroyed
};
State m_State;
bool m_HasRelatedId;
GUID m_Id;
GUID m_CapturedRelatedId;
protected:
~_TlgActivityBase()
{
if (m_State == Started)
{
zInternalStop();
_tlgWriteActivityAutoStop<keyword, level>(
static_cast<DerivedTy*>(this)->Provider(),
&m_Id);
}
m_State = Destroyed;
}
_TlgActivityBase()
{
Reset();
}
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
_TlgActivityBase(_TlgActivityBase&& rhs)
{
Reset();
*this = static_cast<_TlgActivityBase&&>(rhs);
}
_TlgActivityBase& operator=(_TlgActivityBase&& rhs)
{
_tlg_ASSERT(m_State == Created, "Move-assign to newly created activities only");
m_State = rhs.m_State;
m_HasRelatedId = rhs.m_HasRelatedId;
m_Id = rhs.m_Id;
m_CapturedRelatedId = rhs.m_CapturedRelatedId;
rhs.Reset();
return *this;
}
#endif // _MSC_VER >= 1600
/*
Should be called during activity setup (before activity starts).
If this is used, do NOT use PushThreadActivityId or PopThreadActivityId.
*/
void SetRelatedId(const GUID& relatedActivityId)
{
_tlg_ASSERT(m_State == Created, "_TlgActivityBase::SetRelatedId called from invalid state.");
_tlg_ASSERT(!m_HasRelatedId, "_TlgActivityBase::RelatedActivity was already set.");
m_CapturedRelatedId = relatedActivityId;
m_HasRelatedId = true;
}
/*
Should be called at an appropriate point in activity setup, after SetRelatedId() is called.
Returns the related activity Id, if there is one.
Returns NULL if the related activity Id has not been set or if it is GUID_NULL.
*/
_Ret_opt_ const GUID* GetRelatedId() const
{
return m_HasRelatedId && !_tlgGuidIsZero(m_CapturedRelatedId) ? &m_CapturedRelatedId : NULL;
}
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
/*
Should be called from OnStarted if applicable.
If this is used, do NOT use SetRelatedId.
*/
void PushThreadActivityId()
{
_tlg_ASSERT(m_State == Created, "_TlgActivityBase::PushThreadActivityId called from invalid state.");
_tlg_ASSERT(!m_HasRelatedId, "_TlgActivityBase::RelatedActivity was already set.");
m_CapturedRelatedId = m_Id;
::EventActivityIdControl(EVENT_ACTIVITY_CTRL_GET_SET_ID, &m_CapturedRelatedId);
m_HasRelatedId = true;
}
/*
Should be called from OnStopped if applicable.
If this is used, do NOT use SetRelatedId.
*/
void PopThreadActivityId()
{
_tlg_ASSERT(m_State == Started, "_TlgActivityBase::PopThreadActivityId called from invalid state.");
if (m_HasRelatedId)
{
::EventActivityIdControl(EVENT_ACTIVITY_CTRL_GET_SET_ID, &m_CapturedRelatedId);
/*
If this assertion fails, it means that your thread activity's ID was corrupted.
For example:
TraceLoggingWriteStart(activity1, ...); // Saves activity1.SavedId = thread.ActivityId, sets thread.ActivityId = activity1.Id().
DoWork();
TraceLoggingWrite(...); // Uses thread.ActivityId.
TraceLoggingWriteStop(activity1, ...); // Verifies that thread.ActivityId == activity1.Id(), restores thread.ActivityId = activity1.SavedId.
If DoWork() leaves thread.ActivityId unchanged, or if it properly restores
thread.ActivityId to its original value before returning, then everything
will work as expected. If DoWork changes thread.ActivityId to its own value
and does not restore it before returning, the TraceLoggingWrite call will
use the activity ID set by DoWork instead of using activity1.Id(). The
assertion fires to warn you about this situation.
The following are possible solutions for this issue:
1. If you can change the DoWork() code: Fix the DoWork() code to correctly
restore the activity ID before returning. Note that the activity ID should
be restored even in cases where DoWork() exits via exception.
2. If you cannot change the DoWork() code: Save the activity ID before
calling DoWork(), then restore the activity ID after DoWork() returns. You
can use the EventActivityIdControl function to save and restore the
activity ID.
3. Use TraceLoggingActivity instead of TraceLoggingThreadActivity so that you
are not impacted by code that incorrectly manages thread.ActivityId. In
this case, you will also need to switch from TraceLoggingWrite to
TraceLoggingWriteTagged.
Example of solution 2:
GUID savedActivityId;
EventActivityIdControl(EVENT_ACTIVITY_CTRL_GET_ID, &savedActivityId);
CodeThatDoesNotRestoreActivityId();
EventActivityIdControl(EVENT_ACTIVITY_CTRL_SET_ID, &savedActivityId);
Note that this example solution is sufficient only in cases where
the code in question does not throw exceptions.
*/
_tlg_ASSERT(_tlgGuidEqual(m_Id, m_CapturedRelatedId), "_TlgActivityBase: current id does not match set id!");
}
}
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
public:
/*
The activity's Keyword, which is used as the keyword for the START and STOP events.
*/
static const UINT64 Keyword = keyword;
/*
The activity's Level, which is used as the level for the START and STOP events.
*/
static const UINT8 Level = level;
/*
Returns the activity Id.
*/
_Ret_ const GUID* Id() const
{
_tlg_ASSERT(m_State >= Started, "TraceLoggingActivity::Id() called from invalid state");
_tlg_ASSERT(m_State != Destroyed, "TraceLoggingActivity::Id() called after destruction");
return &m_Id;
}
/*
Returns true if the activity has been started and has not yet been stopped.
*/
bool IsStarted() const
{
return m_State == Started;
}
/*
Private implementation method. For internal use only.
Called by TraceLoggingWriteStart. Do not call directly.
Returns the related activity Id, if there is one.
Returns NULL if the related activity Id has not been set or if it is GUID_NULL.
*/
_Ret_opt_ const GUID* zInternalRelatedId() const
{
_tlg_ASSERT(m_State == Started, "TraceLoggingWriteStart race condition");
return GetRelatedId();
}
/*
Private implementation method. For internal use only.
Called by TraceLoggingWriteStart. Do not call directly.
*/
void zInternalStart()
{
_tlg_ASSERT(m_State == Created, "TraceLoggingWriteStart called from invalid state.");
DerivedTy* pDerived = static_cast<DerivedTy*>(this);
if (TraceLoggingProviderEnabled(pDerived->Provider(), level, keyword))
{
CreateActivityId(0, pDerived, m_Id);
pDerived->OnStarted();
}
else
{
// Zero the activity id in case we end up logging the stop.
ZeroMemory(&m_Id, sizeof(m_Id));
}
m_State = Started;
}
/*
Private implementation method. For internal use only.
Called by TraceLoggingWriteStop. Do not call directly.
*/
void zInternalStop()
{
_tlg_ASSERT(m_State == Started, "TraceLoggingWriteStop called from invalid state");
DerivedTy* pDerived = static_cast<DerivedTy*>(this);
pDerived->OnStopped();
m_State = Stopped;
}
private:
// SFINAE dispatching on presence of DerivedTy::CreateActivityId
template<typename _DerivedTy>
static auto CreateActivityId(int, _In_ _DerivedTy* Derived, _Out_ GUID& ChildActivityId) ->
decltype(Derived->CreateActivityId(ChildActivityId), void(0))
{
Derived->CreateActivityId(ChildActivityId);
}
template<typename _DerivedTy>
static auto CreateActivityId(long, _In_ _DerivedTy* Derived, _Out_ GUID& ChildActivityId) ->
void
{
(void)Derived;
::EventActivityIdControl(EVENT_ACTIVITY_CTRL_CREATE_ID, &ChildActivityId);
}
};
template<
TraceLoggingHProvider const& provider,
UINT64 keyword,
UINT8 level,
typename TlgReflectorTag>
class TraceLoggingActivity
: public _TlgActivityBase<TraceLoggingActivity<provider, keyword, level, TlgReflectorTag>, keyword, level>
{
typedef
_TlgActivityBase<TraceLoggingActivity<provider, keyword, level, TlgReflectorTag>, keyword, level>
BaseTy;
friend BaseTy;
void OnStarted()
{
}
void OnStopped()
{
}
public:
TraceLoggingActivity()
{
}
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
TraceLoggingActivity(TraceLoggingActivity&& rhs)
: BaseTy(static_cast<TraceLoggingActivity&&>(rhs))
{
}
TraceLoggingActivity& operator=(TraceLoggingActivity&& rhs)
{
BaseTy::operator=(static_cast<TraceLoggingActivity&&>(rhs));
return *this;
}
#endif // _MSC_VER >= 1600
/*
Returns a handle to the TraceLogging provider associated with this activity.
*/
TraceLoggingHProvider Provider() const
{
return provider;
}
/*
Sets the related (parent) activity.
May only be called once. Must be called before starting the activity.
*/
template<typename ActivityTy>
void SetRelatedActivity(_In_ const ActivityTy& relatedActivity)
{
BaseTy::SetRelatedId(*relatedActivity.Id());
}
/*
Sets the related (parent) activity.
May only be called once. Must be called before starting the activity.
*/
void SetRelatedActivityId(_In_ const GUID& relatedActivityId)
{
BaseTy::SetRelatedId(relatedActivityId);
}
/*
Sets the related (parent) activity.
May only be called once. Must be called before starting the activity.
*/
void SetRelatedActivityId(_In_ const GUID* relatedActivityId)
{
_tlg_ASSERT(relatedActivityId != NULL, "TraceLoggingActivity SetRelatedActivity called with NULL id.");
BaseTy::SetRelatedId(*relatedActivityId);
}
};
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
template<
TraceLoggingHProvider const& provider,
UINT64 keyword,
UINT8 level,
typename TlgReflectorTag>
class TraceLoggingThreadActivity
: public _TlgActivityBase<TraceLoggingThreadActivity<provider, keyword, level, TlgReflectorTag>, keyword, level>
{
typedef
_TlgActivityBase<TraceLoggingThreadActivity<provider, keyword, level, TlgReflectorTag>, keyword, level>
BaseTy;
friend BaseTy;
void OnStarted()
{
BaseTy::PushThreadActivityId();
}
void OnStopped()
{
BaseTy::PopThreadActivityId();
}
public:
TraceLoggingThreadActivity()
{
}
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
TraceLoggingThreadActivity(TraceLoggingThreadActivity&& rhs)
: BaseTy(static_cast<TraceLoggingThreadActivity&&>(rhs))
{
}
TraceLoggingThreadActivity& operator=(TraceLoggingThreadActivity&& rhs)
{
BaseTy::operator=(static_cast<TraceLoggingThreadActivity&&>(rhs));
return *this;
}
#endif // _MSC_VER >= 1600
/*
Returns a handle to the TraceLogging provider associated with this activity.
*/
TraceLoggingHProvider Provider() const
{
return provider;
}
};
class TraceLoggingThreadActivityIdSetter
{
GUID m_ActivityId;
GUID m_SavedActivityId;
TraceLoggingThreadActivityIdSetter(const TraceLoggingThreadActivityIdSetter&); // = delete
const TraceLoggingThreadActivityIdSetter& operator=(const TraceLoggingThreadActivityIdSetter&); // = delete
public:
explicit TraceLoggingThreadActivityIdSetter(_In_ const GUID& activityId)
: m_ActivityId(activityId)
, m_SavedActivityId(activityId)
{
::EventActivityIdControl(EVENT_ACTIVITY_CTRL_GET_SET_ID, &m_SavedActivityId);
}
explicit TraceLoggingThreadActivityIdSetter(_In_ const GUID* activityId)
: m_ActivityId(*activityId)
, m_SavedActivityId(*activityId)
{
::EventActivityIdControl(EVENT_ACTIVITY_CTRL_GET_SET_ID, &m_SavedActivityId);
}
~TraceLoggingThreadActivityIdSetter()
{
::EventActivityIdControl(EVENT_ACTIVITY_CTRL_GET_SET_ID, &m_SavedActivityId);
_tlg_ASSERT(_tlgGuidEqual(m_ActivityId, m_SavedActivityId), "TraceLoggingThreadActivityIdSetter current id does not match set id!");
}
};
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#pragma endregion
#endif // RC_INVOKED
| [
"[email protected]"
] | |
ab8ff8d2172a2f0c77ba4f99f815d59edbd0781c | 4a34f4ffda4039415c1105aa2d90487b7a67ca6e | /src/qt/test/uritests.h | 70c6a5885b566e0a7b0b63ea589d672ae61ed8f2 | [
"MIT"
] | permissive | fast-bitcoin/FastBitcoin | 017f77b7c6bf766bf4ee6666c55bdfef71432e8f | f2cc12d1ff8521e103d1290c0c1d9c3ec09b4472 | refs/heads/master | 2020-06-29T00:52:32.317049 | 2019-09-11T05:32:59 | 2019-09-11T05:32:59 | 200,390,215 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 446 | h | // Copyright (c) 2009-2015 The Fastbitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef FASTBITCOIN_QT_TEST_URITESTS_H
#define FASTBITCOIN_QT_TEST_URITESTS_H
#include <QObject>
#include <QTest>
class URITests : public QObject
{
Q_OBJECT
private Q_SLOTS:
void uriTests();
};
#endif // FASTBITCOIN_QT_TEST_URITESTS_H
| [
"[email protected]"
] | |
45c78d86d2759805cca6b216ddaabc1bd1cd8199 | c702357d201235f5a76deb90133dbc3a13c64736 | /llvm/tools/clang/lib/Analysis/.svn/text-base/SValuator.cpp.svn-base | ac727b0ac696ca446a00282a94cf2e7d60599754 | [
"NCSA"
] | permissive | aaasz/SHP | ab77e5be297c2e23a462c385b9e7332e38765a14 | c03ee7a26a93b2396b7c4f9179b1b2deb81951d3 | refs/heads/master | 2021-01-18T11:00:14.367480 | 2010-01-17T23:10:18 | 2010-01-17T23:10:18 | 549,107 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,490 | // SValuator.cpp - Basic class for all SValuator implementations --*- C++ -*--//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines SValuator, the base class for all (complete) SValuator
// implementations.
//
//===----------------------------------------------------------------------===//
#include "clang/Analysis/PathSensitive/SValuator.h"
#include "clang/Analysis/PathSensitive/GRState.h"
using namespace clang;
SVal SValuator::EvalBinOp(const GRState *ST, BinaryOperator::Opcode Op,
SVal L, SVal R, QualType T) {
if (L.isUndef() || R.isUndef())
return UndefinedVal();
if (L.isUnknown() || R.isUnknown())
return UnknownVal();
if (isa<Loc>(L)) {
if (isa<Loc>(R))
return EvalBinOpLL(Op, cast<Loc>(L), cast<Loc>(R), T);
return EvalBinOpLN(ST, Op, cast<Loc>(L), cast<NonLoc>(R), T);
}
if (isa<Loc>(R)) {
// Support pointer arithmetic where the increment/decrement operand
// is on the left and the pointer on the right.
assert(Op == BinaryOperator::Add || Op == BinaryOperator::Sub);
// Commute the operands.
return EvalBinOpLN(ST, Op, cast<Loc>(R), cast<NonLoc>(L), T);
}
return EvalBinOpNN(ST, Op, cast<NonLoc>(L), cast<NonLoc>(R), T);
}
DefinedOrUnknownSVal SValuator::EvalEQ(const GRState *ST,
DefinedOrUnknownSVal L,
DefinedOrUnknownSVal R) {
return cast<DefinedOrUnknownSVal>(EvalBinOp(ST, BinaryOperator::EQ, L, R,
ValMgr.getContext().IntTy));
}
SValuator::CastResult SValuator::EvalCast(SVal val, const GRState *state,
QualType castTy, QualType originalTy){
if (val.isUnknownOrUndef() || castTy == originalTy)
return CastResult(state, val);
ASTContext &C = ValMgr.getContext();
// For const casts, just propagate the value.
if (C.hasSameUnqualifiedType(castTy, originalTy))
return CastResult(state, val);
// Check for casts from pointers to integers.
if (castTy->isIntegerType() && Loc::IsLocType(originalTy))
return CastResult(state, EvalCastL(cast<Loc>(val), castTy));
// Check for casts from integers to pointers.
if (Loc::IsLocType(castTy) && originalTy->isIntegerType()) {
if (nonloc::LocAsInteger *LV = dyn_cast<nonloc::LocAsInteger>(&val)) {
// Just unpackage the lval and return it.
return CastResult(state, LV->getLoc());
}
goto DispatchCast;
}
// Just pass through function and block pointers.
if (originalTy->isBlockPointerType() || originalTy->isFunctionPointerType()) {
assert(Loc::IsLocType(castTy));
return CastResult(state, val);
}
// Check for casts from array type to another type.
if (originalTy->isArrayType()) {
// We will always decay to a pointer.
val = ValMgr.getStateManager().ArrayToPointer(cast<Loc>(val));
// Are we casting from an array to a pointer? If so just pass on
// the decayed value.
if (castTy->isPointerType())
return CastResult(state, val);
// Are we casting from an array to an integer? If so, cast the decayed
// pointer value to an integer.
assert(castTy->isIntegerType());
// FIXME: Keep these here for now in case we decide soon that we
// need the original decayed type.
// QualType elemTy = cast<ArrayType>(originalTy)->getElementType();
// QualType pointerTy = C.getPointerType(elemTy);
return CastResult(state, EvalCastL(cast<Loc>(val), castTy));
}
// Check for casts from a region to a specific type.
if (const MemRegion *R = val.getAsRegion()) {
// FIXME: We should handle the case where we strip off view layers to get
// to a desugared type.
assert(Loc::IsLocType(castTy));
// We get a symbolic function pointer for a dereference of a function
// pointer, but it is of function type. Example:
// struct FPRec {
// void (*my_func)(int * x);
// };
//
// int bar(int x);
//
// int f1_a(struct FPRec* foo) {
// int x;
// (*foo->my_func)(&x);
// return bar(x)+1; // no-warning
// }
assert(Loc::IsLocType(originalTy) || originalTy->isFunctionType() ||
originalTy->isBlockPointerType());
StoreManager &storeMgr = ValMgr.getStateManager().getStoreManager();
// Delegate to store manager to get the result of casting a region to a
// different type. If the MemRegion* returned is NULL, this expression
// evaluates to UnknownVal.
R = storeMgr.CastRegion(R, castTy);
if (R)
return CastResult(state, loc::MemRegionVal(R));
return CastResult(state, UnknownVal());
}
// All other cases.
DispatchCast:
return CastResult(state,
isa<Loc>(val) ? EvalCastL(cast<Loc>(val), castTy)
: EvalCastNL(cast<NonLoc>(val), castTy));
}
SValuator::DefinedOrUnknownCastResult
SValuator::EvalCast(DefinedOrUnknownSVal V, const GRState *ST,
QualType castTy, QualType originalType) {
SValuator::CastResult X = EvalCast((SVal) V, ST, castTy, originalType);
return DefinedOrUnknownCastResult(X.getState(),
cast<DefinedOrUnknownSVal>(X.getSVal()));
}
| [
"[email protected]"
] | ||
bdf0db4fe5fa1d113496f71baf0646fbc4d2d4aa | 4f7cb5c8da05065c32f7b8c39e0ff7b92e242c58 | /thispointer.cpp | db12d75d23b5b363a0c86f6f5a5e276ea3705dfe | [] | no_license | SathvikSat/c-plus-plus | 5280e0bfa06d464f926c9da486b38a09f60c6704 | abecb4852885a6f19f90c540827d83e2c74851a2 | refs/heads/C++-Practice | 2021-07-15T22:53:23.306380 | 2020-05-18T12:31:18 | 2020-05-18T12:31:18 | 151,201,940 | 1 | 0 | null | 2020-05-18T12:30:56 | 2018-10-02T04:52:29 | C++ | UTF-8 | C++ | false | false | 314 | cpp | #include<iostream>
using namespace std;
class test{
public:
int x;
void setX(int x){
this-> x = x;
}
void print(){
cout<<"x ="<<x<<endl<<this;
}
};
int main(){
test obj;
int y =20;
obj.setX(y);
obj.print();
cout<<endl<<&y<<endl;
return 0;
} | [
"[email protected]"
] | |
7e62da9f0b6cac0a12e1f5c659d1a14a950a12a7 | 94064820a761226ffc8a0da1e1b0d562cc6852d6 | /Embryon/game/src/GUI/GameMenu.cpp | 72d48d8a999aa5222278d6cdd01646d8b35d39d7 | [] | no_license | T4g1/Embryon | 71757246f25e07c88d077660cf77c5921a54c157 | 0dd8df13b66af10e9866106285e869a14f635e79 | refs/heads/master | 2020-05-27T20:19:28.471694 | 2012-10-10T18:48:25 | 2012-10-10T18:48:25 | 3,391,124 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 826 | cpp | /** \file GameMenu.cpp
* \brief Implémente la classe GameMenu
*/
#include "GameMenu.h"
/**
* Constructeur de GameMenu
*/
GameMenu::GameMenu(Core* core) :
GUIPage(core)
{
setId(IN_GAME);
}
/**
* Destructeur de GameMenu
*/
GameMenu::~GameMenu()
{
//dtor
}
/**
* Crée la page du menu
*/
irr::gui::IGUIElement* GameMenu::createPage(irr::gui::IGUIEnvironment* guienv)
{
irr::gui::IGUIElement* parent = new irr::gui::IGUIElement(
irr::gui::EGUIET_ELEMENT, guienv, guienv->getRootGUIElement(), -1,
guienv->getRootGUIElement()->getAbsolutePosition()
);
parent->setVisible(false);
return parent;
}
// Callback
/**
* Action lors de l'appuit sur escape
*/
void GameMenu::onEscape()
{
core->setMenuState(IN_PAUSE_MENU);
core->setPartieEnPause(true);
}
| [
"[email protected]"
] | |
8db5f3fec190408b899b293e09534bdfbf392e3d | 7e9bda7dee4a0371da36910eac0a2113337090ed | /Lumos/src/Core/OS/Memory.cpp | b84a57044e6968320769bba8ad103260ba5e7fa0 | [
"MIT",
"LicenseRef-scancode-public-domain"
] | permissive | sysujack/Lumos | c685651452176185f187caaf3c8a0d5d462ce5ca | 0859d92393262af67b0491f3ba1caa513b03c7a6 | refs/heads/master | 2020-12-04T10:37:22.270870 | 2019-12-05T18:45:54 | 2019-12-05T18:45:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,587 | cpp | #include "lmpch.h"
#include "Memory.h"
#include "Allocators/BinAllocator.h"
#include "Allocators/DefaultAllocator.h"
#include "Allocators/StbAllocator.h"
namespace Lumos
{
Allocator* const Memory::MemoryAllocator = new DefaultAllocator();
void* Memory::AlignedAlloc(size_t size, size_t alignment)
{
void *data = nullptr;
#if defined(LUMOS_PLATFORM_WINDOWS)
data = _aligned_malloc(size, alignment);
#else
int res = posix_memalign(&data, alignment, size);
if (res != 0)
data = nullptr;
#endif
return data;
}
void Memory::AlignedFree(void* data)
{
#if defined(LUMOS_PLATFORM_WINDOWS)
_aligned_free(data);
#else
free(data);
#endif
}
void* Memory::NewFunc(std::size_t size, const char *file, int line)
{
if (MemoryAllocator)
return MemoryAllocator->Malloc(size, file, line);
else
return malloc(size);
}
void Memory::DeleteFunc(void* p)
{
if (MemoryAllocator)
return MemoryAllocator->Free(p);
else
return free(p);
}
void Memory::LogMemoryInformation()
{
if (MemoryAllocator)
return MemoryAllocator->Print();
}
}
#ifdef CUSTOM_MEMORY_ALLOCATOR
void* operator new(std::size_t size)
{
void* result = Lumos::Memory::NewFunc(size, __FILE__, __LINE__);
if (result == nullptr)
{
throw std::bad_alloc();
}
return result;
}
void* operator new(std::size_t size, const char *file, int line)
{
void* result = Lumos::Memory::NewFunc(size, file, line);
if (result == nullptr)
{
throw std::bad_alloc();
}
return result;
}
void* operator new[](std::size_t size, const char *file, int line)
{
void* result = Lumos::Memory::NewFunc(size, file, line);
if (result == nullptr)
{
throw std::bad_alloc();
}
return result;
}
void* operator new (std::size_t size, const std::nothrow_t& nothrow_value) noexcept
{
return Lumos::Memory::NewFunc(size, __FILE__, __LINE__);
}
void operator delete(void * p) throw()
{
Lumos::Memory::DeleteFunc(p);
}
void* operator new[](std::size_t size)
{
void* result = Lumos::Memory::NewFunc(size, __FILE__, __LINE__);
if (result == nullptr)
{
throw std::bad_alloc();
}
return result;
}
void operator delete[](void *p) throw()
{
Lumos::Memory::DeleteFunc(p);
}
void operator delete(void* block, const char* file, int line)
{
Lumos::Memory::DeleteFunc(block);
}
void operator delete[](void* block, const char* file, int line)
{
Lumos::Memory::DeleteFunc(block);
}
#endif
| [
"[email protected]"
] | |
c51577ac9b2d8ac08d2cb3bcbe00c40dfc4e0d70 | bf2e5b32db429a652c7f056ed5eb81db67c6832f | /ads/week11/3.cpp | 186419cfc8e0e84f63363cb891b6cdb09cff48f4 | [] | no_license | Beisenbek/kbtu-2018-fall-lecture-samples | 6238ea274c669d9ec225ca98141ddde449649787 | d51e72fa9e87d5152f9eb1352726c4f93d7b3259 | refs/heads/master | 2020-03-27T12:57:08.400510 | 2018-11-21T03:54:21 | 2018-11-21T03:54:21 | 146,580,401 | 3 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 250 | cpp | #include<iostream>
using namespace std;
int f(string s){
int sum = 0;
for(int i = 0; i < s.size(); ++i){
sum += int(s[i]);
}
return sum;
}
int main(){
string s;
cin >> s;
cout << f(s) << endl;
return 0;
} | [
"[email protected]"
] | |
4489a7cd6d8e4ded7afaa710a8e8e0e30b0b175c | d051c3294a2b178e701d2c96a61e8b924b04162d | /HashTableL/Node.h | 8d2fe1f7ef3da0f40e884733a87de40403d06152 | [] | no_license | baklazhen/Polinom | bdd7aea65b72511e03e087119c936a58737a43e3 | d856aa51305537294720b526cb5731cc45eb3f77 | refs/heads/master | 2021-01-25T09:08:40.600640 | 2017-06-08T18:49:54 | 2017-06-08T18:49:54 | 93,781,585 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,692 | h | #ifndef _NODE_H_
#define _NODE_H_
#include <iostream>
#include <fstream>
using namespace std;
template <class KEY, class DATA>
class Node
{
protected:
KEY k;
DATA val;
Node *Next;
public:
Node ();
Node (KEY k_, DATA val_);
Node (const Node &nd);
Node& operator=(const Node& nd);
KEY GetKey();
DATA GetData();
void SetKey(KEY k_);
void SetVal(DATA val_);
Node *GetNext ();
void SetNext (Node *nd);
void PrintList();
};
template <class KEY, class DATA>
Node<KEY, DATA>::Node()
{
k = 0;
val = 0;
Next = 0;
}
template <class KEY, class DATA>
Node<KEY, DATA>::Node(KEY k_, DATA val_)
{
k = k_;
val = val_;
Next = 0;
}
template <class KEY, class DATA>
Node <KEY, DATA>::Node(const Node &nd)
{
k = nd.k;
val = nd.val;
Next = nd.Next;
}
template <class KEY, class DATA>
Node<KEY, DATA> & Node <KEY, DATA>::operator=(const Node& nd)
{
k = nd.k;
val = nd.val;
Next = nd.Next;
return *this;
}
template <class KEY, class DATA>
KEY Node<KEY, DATA>::GetKey()
{
return k;
}
template <class KEY, class DATA>
DATA Node<KEY, DATA>::GetData()
{
return (*this).val;
}
template <class KEY, class DATA>
void Node<KEY, DATA>::SetKey(KEY k_)
{
k = k_;
}
template <class KEY, class DATA>
void Node<KEY, DATA>::SetVal(DATA val_)
{
val = val_;
}
template <class KEY, class DATA>
Node <KEY, DATA> * Node <KEY, DATA>::GetNext ()
{
Node *tmp = (*this).Next;
return tmp;
}
template <class KEY, class DATA>
void Node <KEY, DATA>::SetNext (Node *nd)
{
(*this).Next = nd;
}
template <class KEY, class DATA>
void Node <KEY, DATA>::PrintList()
{
Node * tmp;
tmp = this;
while (tmp != 0)
{
cout << tmp->k << " " << tmp->val << '\n';
tmp = tmp->Next;
}
}
#endif | [
"[email protected]"
] | |
a802a184afca98ab1a37b9fec41e707acb2588af | 82f9296652c12389cf560ca2cd408382f51e431b | /src/net.cpp | 97572cf6345047847e024ff73d5a5f27510f8d96 | [
"MIT"
] | permissive | SchoolCoin/YoCoin | d15418ecfc21519850bd35a14eefa7dc5e441c43 | 50a534685492e81e64b849264f989e1a15bfcdd5 | refs/heads/master | 2021-03-12T22:38:55.571155 | 2014-10-20T12:54:07 | 2014-10-20T12:54:07 | 25,466,771 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 64,264 | cpp | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "db.h"
#include "net.h"
#include "init.h"
#include "addrman.h"
#include "ui_interface.h"
#include "script.h"
#ifdef WIN32
#include <string.h>
#endif
#ifdef USE_UPNP
#include <miniupnpc/miniwget.h>
#include <miniupnpc/miniupnpc.h>
#include <miniupnpc/upnpcommands.h>
#include <miniupnpc/upnperrors.h>
#endif
// Dump addresses to peers.dat every 15 minutes (900s)
#define DUMP_ADDRESSES_INTERVAL 900
using namespace std;
using namespace boost;
static const int MAX_OUTBOUND_CONNECTIONS = 8;
bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOutbound = NULL, const char *strDest = NULL, bool fOneShot = false);
struct LocalServiceInfo {
int nScore;
int nPort;
};
//
// Global state variables
//
bool fDiscover = true;
uint64 nLocalServices = NODE_NETWORK;
static CCriticalSection cs_mapLocalHost;
static map<CNetAddr, LocalServiceInfo> mapLocalHost;
static bool vfReachable[NET_MAX] = {};
static bool vfLimited[NET_MAX] = {};
static CNode* pnodeLocalHost = NULL;
static CNode* pnodeSync = NULL;
uint64 nLocalHostNonce = 0;
static std::vector<SOCKET> vhListenSocket;
CAddrMan addrman;
int nMaxConnections = 125;
vector<CNode*> vNodes;
CCriticalSection cs_vNodes;
map<CInv, CDataStream> mapRelay;
deque<pair<int64, CInv> > vRelayExpiration;
CCriticalSection cs_mapRelay;
limitedmap<CInv, int64> mapAlreadyAskedFor(MAX_INV_SZ);
static deque<string> vOneShots;
CCriticalSection cs_vOneShots;
set<CNetAddr> setservAddNodeAddresses;
CCriticalSection cs_setservAddNodeAddresses;
vector<std::string> vAddedNodes;
CCriticalSection cs_vAddedNodes;
static CSemaphore *semOutbound = NULL;
void AddOneShot(string strDest)
{
LOCK(cs_vOneShots);
vOneShots.push_back(strDest);
}
unsigned short GetListenPort()
{
return (unsigned short)(GetArg("-port", GetDefaultPort()));
}
void CNode::PushGetBlocks(CBlockIndex* pindexBegin, uint256 hashEnd)
{
// Filter out duplicate requests
if (pindexBegin == pindexLastGetBlocksBegin && hashEnd == hashLastGetBlocksEnd)
return;
pindexLastGetBlocksBegin = pindexBegin;
hashLastGetBlocksEnd = hashEnd;
PushMessage("getblocks", CBlockLocator(pindexBegin), hashEnd);
}
// find 'best' local address for a particular peer
bool GetLocal(CService& addr, const CNetAddr *paddrPeer)
{
if (fNoListen)
return false;
int nBestScore = -1;
int nBestReachability = -1;
{
LOCK(cs_mapLocalHost);
for (map<CNetAddr, LocalServiceInfo>::iterator it = mapLocalHost.begin(); it != mapLocalHost.end(); it++)
{
int nScore = (*it).second.nScore;
int nReachability = (*it).first.GetReachabilityFrom(paddrPeer);
if (nReachability > nBestReachability || (nReachability == nBestReachability && nScore > nBestScore))
{
addr = CService((*it).first, (*it).second.nPort);
nBestReachability = nReachability;
nBestScore = nScore;
}
}
}
return nBestScore >= 0;
}
// get best local address for a particular peer as a CAddress
CAddress GetLocalAddress(const CNetAddr *paddrPeer)
{
CAddress ret(CService("0.0.0.0",0),0);
CService addr;
if (GetLocal(addr, paddrPeer))
{
ret = CAddress(addr);
ret.nServices = nLocalServices;
ret.nTime = GetAdjustedTime();
}
return ret;
}
bool RecvLine(SOCKET hSocket, string& strLine)
{
strLine = "";
loop
{
char c;
int nBytes = recv(hSocket, &c, 1, 0);
if (nBytes > 0)
{
if (c == '\n')
continue;
if (c == '\r')
return true;
strLine += c;
if (strLine.size() >= 9000)
return true;
}
else if (nBytes <= 0)
{
boost::this_thread::interruption_point();
if (nBytes < 0)
{
int nErr = WSAGetLastError();
if (nErr == WSAEMSGSIZE)
continue;
if (nErr == WSAEWOULDBLOCK || nErr == WSAEINTR || nErr == WSAEINPROGRESS)
{
MilliSleep(10);
continue;
}
}
if (!strLine.empty())
return true;
if (nBytes == 0)
{
// socket closed
printf("socket closed\n");
return false;
}
else
{
// socket error
int nErr = WSAGetLastError();
printf("recv failed: %d\n", nErr);
return false;
}
}
}
}
// used when scores of local addresses may have changed
// pushes better local address to peers
void static AdvertizeLocal()
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{
if (pnode->fSuccessfullyConnected)
{
CAddress addrLocal = GetLocalAddress(&pnode->addr);
if (addrLocal.IsRoutable() && (CService)addrLocal != (CService)pnode->addrLocal)
{
pnode->PushAddress(addrLocal);
pnode->addrLocal = addrLocal;
}
}
}
}
void SetReachable(enum Network net, bool fFlag)
{
LOCK(cs_mapLocalHost);
vfReachable[net] = fFlag;
if (net == NET_IPV6 && fFlag)
vfReachable[NET_IPV4] = true;
}
// learn a new local address
bool AddLocal(const CService& addr, int nScore)
{
if (!addr.IsRoutable())
return false;
if (!fDiscover && nScore < LOCAL_MANUAL)
return false;
if (IsLimited(addr))
return false;
printf("AddLocal(%s,%i)\n", addr.ToString().c_str(), nScore);
{
LOCK(cs_mapLocalHost);
bool fAlready = mapLocalHost.count(addr) > 0;
LocalServiceInfo &info = mapLocalHost[addr];
if (!fAlready || nScore >= info.nScore) {
info.nScore = nScore + (fAlready ? 1 : 0);
info.nPort = addr.GetPort();
}
SetReachable(addr.GetNetwork());
}
AdvertizeLocal();
return true;
}
bool AddLocal(const CNetAddr &addr, int nScore)
{
return AddLocal(CService(addr, GetListenPort()), nScore);
}
/** Make a particular network entirely off-limits (no automatic connects to it) */
void SetLimited(enum Network net, bool fLimited)
{
if (net == NET_UNROUTABLE)
return;
LOCK(cs_mapLocalHost);
vfLimited[net] = fLimited;
}
bool IsLimited(enum Network net)
{
LOCK(cs_mapLocalHost);
return vfLimited[net];
}
bool IsLimited(const CNetAddr &addr)
{
return IsLimited(addr.GetNetwork());
}
/** vote for a local address */
bool SeenLocal(const CService& addr)
{
{
LOCK(cs_mapLocalHost);
if (mapLocalHost.count(addr) == 0)
return false;
mapLocalHost[addr].nScore++;
}
AdvertizeLocal();
return true;
}
/** check whether a given address is potentially local */
bool IsLocal(const CService& addr)
{
LOCK(cs_mapLocalHost);
return mapLocalHost.count(addr) > 0;
}
/** check whether a given address is in a network we can probably connect to */
bool IsReachable(const CNetAddr& addr)
{
LOCK(cs_mapLocalHost);
enum Network net = addr.GetNetwork();
return vfReachable[net] && !vfLimited[net];
}
bool GetMyExternalIP2(const CService& addrConnect, const char* pszGet, const char* pszKeyword, CNetAddr& ipRet)
{
SOCKET hSocket;
if (!ConnectSocket(addrConnect, hSocket))
return error("GetMyExternalIP() : connection to %s failed", addrConnect.ToString().c_str());
send(hSocket, pszGet, strlen(pszGet), MSG_NOSIGNAL);
string strLine;
while (RecvLine(hSocket, strLine))
{
if (strLine.empty()) // HTTP response is separated from headers by blank line
{
loop
{
if (!RecvLine(hSocket, strLine))
{
closesocket(hSocket);
return false;
}
if (pszKeyword == NULL)
break;
if (strLine.find(pszKeyword) != string::npos)
{
strLine = strLine.substr(strLine.find(pszKeyword) + strlen(pszKeyword));
break;
}
}
closesocket(hSocket);
if (strLine.find("<") != string::npos)
strLine = strLine.substr(0, strLine.find("<"));
strLine = strLine.substr(strspn(strLine.c_str(), " \t\n\r"));
while (strLine.size() > 0 && isspace(strLine[strLine.size()-1]))
strLine.resize(strLine.size()-1);
CService addr(strLine,0,true);
printf("GetMyExternalIP() received [%s] %s\n", strLine.c_str(), addr.ToString().c_str());
if (!addr.IsValid() || !addr.IsRoutable())
return false;
ipRet.SetIP(addr);
return true;
}
}
closesocket(hSocket);
return error("GetMyExternalIP() : connection closed");
}
bool GetMyExternalIP(CNetAddr& ipRet)
{
CService addrConnect;
const char* pszGet;
const char* pszKeyword;
for (int nLookup = 0; nLookup <= 1; nLookup++)
for (int nHost = 1; nHost <= 1; nHost++)
{
// We should be phasing out our use of sites like these. If we need
// replacements, we should ask for volunteers to put this simple
// php file on their web server that prints the client IP:
// <?php echo $_SERVER["REMOTE_ADDR"]; ?>
if (nHost == 1)
{
addrConnect = CService("91.198.22.70", 80); // checkip.dyndns.org
if (nLookup == 1)
{
CService addrIP("checkip.dyndns.org", 80, true);
if (addrIP.IsValid())
addrConnect = addrIP;
}
pszGet = "GET / HTTP/1.1\r\n"
"Host: checkip.dyndns.org\r\n"
"User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n"
"Connection: close\r\n"
"\r\n";
pszKeyword = "Address:";
}
if (GetMyExternalIP2(addrConnect, pszGet, pszKeyword, ipRet))
return true;
}
return false;
}
void ThreadGetMyExternalIP(void* parg)
{
// Make this thread recognisable as the external IP detection thread
RenameThread("bitcoin-ext-ip");
CNetAddr addrLocalHost;
if (GetMyExternalIP(addrLocalHost))
{
printf("GetMyExternalIP() returned %s\n", addrLocalHost.ToStringIP().c_str());
AddLocal(addrLocalHost, LOCAL_HTTP);
}
}
void AddressCurrentlyConnected(const CService& addr)
{
addrman.Connected(addr);
}
CNode* FindNode(const CNetAddr& ip)
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
if ((CNetAddr)pnode->addr == ip)
return (pnode);
return NULL;
}
CNode* FindNode(std::string addrName)
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
if (pnode->addrName == addrName)
return (pnode);
return NULL;
}
CNode* FindNode(const CService& addr)
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
if ((CService)pnode->addr == addr)
return (pnode);
return NULL;
}
CNode* ConnectNode(CAddress addrConnect, const char *pszDest)
{
if (pszDest == NULL) {
if (IsLocal(addrConnect))
return NULL;
// Look for an existing connection
CNode* pnode = FindNode((CService)addrConnect);
if (pnode)
{
pnode->AddRef();
return pnode;
}
}
/// debug print
printf("trying connection %s lastseen=%.1fhrs\n",
pszDest ? pszDest : addrConnect.ToString().c_str(),
pszDest ? 0 : (double)(GetAdjustedTime() - addrConnect.nTime)/3600.0);
// Connect
SOCKET hSocket;
if (pszDest ? ConnectSocketByName(addrConnect, hSocket, pszDest, GetDefaultPort()) : ConnectSocket(addrConnect, hSocket))
{
addrman.Attempt(addrConnect);
/// debug print
printf("connected %s\n", pszDest ? pszDest : addrConnect.ToString().c_str());
// Set to non-blocking
#ifdef WIN32
u_long nOne = 1;
if (ioctlsocket(hSocket, FIONBIO, &nOne) == SOCKET_ERROR)
printf("ConnectSocket() : ioctlsocket non-blocking setting failed, error %d\n", WSAGetLastError());
#else
if (fcntl(hSocket, F_SETFL, O_NONBLOCK) == SOCKET_ERROR)
printf("ConnectSocket() : fcntl non-blocking setting failed, error %d\n", errno);
#endif
// Add node
CNode* pnode = new CNode(hSocket, addrConnect, pszDest ? pszDest : "", false);
pnode->AddRef();
{
LOCK(cs_vNodes);
vNodes.push_back(pnode);
}
pnode->nTimeConnected = GetTime();
return pnode;
}
else
{
return NULL;
}
}
void CNode::CloseSocketDisconnect()
{
fDisconnect = true;
if (hSocket != INVALID_SOCKET)
{
printf("disconnecting node %s\n", addrName.c_str());
closesocket(hSocket);
hSocket = INVALID_SOCKET;
}
// in case this fails, we'll empty the recv buffer when the CNode is deleted
TRY_LOCK(cs_vRecvMsg, lockRecv);
if (lockRecv)
vRecvMsg.clear();
// if this was the sync node, we'll need a new one
if (this == pnodeSync)
pnodeSync = NULL;
}
void CNode::Cleanup()
{
}
void CNode::PushVersion()
{
/// when NTP implemented, change to just nTime = GetAdjustedTime()
int64 nTime = (fInbound ? GetAdjustedTime() : GetTime());
CAddress addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService("0.0.0.0",0)));
CAddress addrMe = GetLocalAddress(&addr);
RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
printf("send version message: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString().c_str(), addrYou.ToString().c_str(), addr.ToString().c_str());
PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector<string>()), nBestHeight);
}
std::map<CNetAddr, int64> CNode::setBanned;
CCriticalSection CNode::cs_setBanned;
void CNode::ClearBanned()
{
setBanned.clear();
}
bool CNode::IsBanned(CNetAddr ip)
{
bool fResult = false;
{
LOCK(cs_setBanned);
std::map<CNetAddr, int64>::iterator i = setBanned.find(ip);
if (i != setBanned.end())
{
int64 t = (*i).second;
if (GetTime() < t)
fResult = true;
}
}
return fResult;
}
bool CNode::Misbehaving(int howmuch)
{
if (addr.IsLocal())
{
printf("Warning: Local node %s misbehaving (delta: %d)!\n", addrName.c_str(), howmuch);
return false;
}
nMisbehavior += howmuch;
if (nMisbehavior >= GetArg("-banscore", 100))
{
int64 banTime = GetTime()+GetArg("-bantime", 60*60*24); // Default 24-hour ban
printf("Misbehaving: %s (%d -> %d) DISCONNECTING\n", addr.ToString().c_str(), nMisbehavior-howmuch, nMisbehavior);
{
LOCK(cs_setBanned);
if (setBanned[addr] < banTime)
setBanned[addr] = banTime;
}
CloseSocketDisconnect();
return true;
} else
printf("Misbehaving: %s (%d -> %d)\n", addr.ToString().c_str(), nMisbehavior-howmuch, nMisbehavior);
return false;
}
#undef X
#define X(name) stats.name = name
void CNode::copyStats(CNodeStats &stats)
{
X(nServices);
X(nLastSend);
X(nLastRecv);
X(nTimeConnected);
X(addrName);
X(nVersion);
X(cleanSubVer);
X(fInbound);
X(nStartingHeight);
X(nMisbehavior);
X(nSendBytes);
X(nRecvBytes);
X(nBlocksRequested);
stats.fSyncNode = (this == pnodeSync);
}
#undef X
// requires LOCK(cs_vRecvMsg)
bool CNode::ReceiveMsgBytes(const char *pch, unsigned int nBytes)
{
while (nBytes > 0) {
// get current incomplete message, or create a new one
if (vRecvMsg.empty() ||
vRecvMsg.back().complete())
vRecvMsg.push_back(CNetMessage(SER_NETWORK, nRecvVersion));
CNetMessage& msg = vRecvMsg.back();
// absorb network data
int handled;
if (!msg.in_data)
handled = msg.readHeader(pch, nBytes);
else
handled = msg.readData(pch, nBytes);
if (handled < 0)
return false;
pch += handled;
nBytes -= handled;
}
return true;
}
int CNetMessage::readHeader(const char *pch, unsigned int nBytes)
{
// copy data to temporary parsing buffer
unsigned int nRemaining = 24 - nHdrPos;
unsigned int nCopy = std::min(nRemaining, nBytes);
memcpy(&hdrbuf[nHdrPos], pch, nCopy);
nHdrPos += nCopy;
// if header incomplete, exit
if (nHdrPos < 24)
return nCopy;
// deserialize to CMessageHeader
try {
hdrbuf >> hdr;
}
catch (std::exception &e) {
return -1;
}
// reject messages larger than MAX_SIZE
if (hdr.nMessageSize > MAX_SIZE)
return -1;
// switch state to reading message data
in_data = true;
vRecv.resize(hdr.nMessageSize);
return nCopy;
}
int CNetMessage::readData(const char *pch, unsigned int nBytes)
{
unsigned int nRemaining = hdr.nMessageSize - nDataPos;
unsigned int nCopy = std::min(nRemaining, nBytes);
memcpy(&vRecv[nDataPos], pch, nCopy);
nDataPos += nCopy;
return nCopy;
}
// requires LOCK(cs_vSend)
void SocketSendData(CNode *pnode)
{
std::deque<CSerializeData>::iterator it = pnode->vSendMsg.begin();
while (it != pnode->vSendMsg.end()) {
const CSerializeData &data = *it;
assert(data.size() > pnode->nSendOffset);
int nBytes = send(pnode->hSocket, &data[pnode->nSendOffset], data.size() - pnode->nSendOffset, MSG_NOSIGNAL | MSG_DONTWAIT);
if (nBytes > 0) {
pnode->nLastSend = GetTime();
pnode->nSendBytes += nBytes;
pnode->nSendOffset += nBytes;
if (pnode->nSendOffset == data.size()) {
pnode->nSendOffset = 0;
pnode->nSendSize -= data.size();
it++;
} else {
// could not send full message; stop sending more
break;
}
} else {
if (nBytes < 0) {
// error
int nErr = WSAGetLastError();
if (nErr != WSAEWOULDBLOCK && nErr != WSAEMSGSIZE && nErr != WSAEINTR && nErr != WSAEINPROGRESS)
{
printf("socket send error %d\n", nErr);
pnode->CloseSocketDisconnect();
}
}
// couldn't send anything at all
break;
}
}
if (it == pnode->vSendMsg.end()) {
assert(pnode->nSendOffset == 0);
assert(pnode->nSendSize == 0);
}
pnode->vSendMsg.erase(pnode->vSendMsg.begin(), it);
}
static list<CNode*> vNodesDisconnected;
void ThreadSocketHandler()
{
unsigned int nPrevNodeCount = 0;
loop
{
//
// Disconnect nodes
//
{
LOCK(cs_vNodes);
// Disconnect unused nodes
vector<CNode*> vNodesCopy = vNodes;
BOOST_FOREACH(CNode* pnode, vNodesCopy)
{
if (pnode->fDisconnect ||
(pnode->GetRefCount() <= 0 && pnode->vRecvMsg.empty() && pnode->nSendSize == 0 && pnode->ssSend.empty()))
{
// remove from vNodes
vNodes.erase(remove(vNodes.begin(), vNodes.end(), pnode), vNodes.end());
// release outbound grant (if any)
pnode->grantOutbound.Release();
// close socket and cleanup
pnode->CloseSocketDisconnect();
pnode->Cleanup();
// hold in disconnected pool until all refs are released
if (pnode->fNetworkNode || pnode->fInbound)
pnode->Release();
vNodesDisconnected.push_back(pnode);
}
}
// Delete disconnected nodes
list<CNode*> vNodesDisconnectedCopy = vNodesDisconnected;
BOOST_FOREACH(CNode* pnode, vNodesDisconnectedCopy)
{
// wait until threads are done using it
if (pnode->GetRefCount() <= 0)
{
bool fDelete = false;
{
TRY_LOCK(pnode->cs_vSend, lockSend);
if (lockSend)
{
TRY_LOCK(pnode->cs_vRecvMsg, lockRecv);
if (lockRecv)
{
TRY_LOCK(pnode->cs_inventory, lockInv);
if (lockInv)
fDelete = true;
}
}
}
if (fDelete)
{
vNodesDisconnected.remove(pnode);
delete pnode;
}
}
}
}
if (vNodes.size() != nPrevNodeCount)
{
nPrevNodeCount = vNodes.size();
uiInterface.NotifyNumConnectionsChanged(vNodes.size());
}
//
// Find which sockets have data to receive
//
struct timeval timeout;
timeout.tv_sec = 0;
timeout.tv_usec = 50000; // frequency to poll pnode->vSend
fd_set fdsetRecv;
fd_set fdsetSend;
fd_set fdsetError;
FD_ZERO(&fdsetRecv);
FD_ZERO(&fdsetSend);
FD_ZERO(&fdsetError);
SOCKET hSocketMax = 0;
bool have_fds = false;
BOOST_FOREACH(SOCKET hListenSocket, vhListenSocket) {
FD_SET(hListenSocket, &fdsetRecv);
hSocketMax = max(hSocketMax, hListenSocket);
have_fds = true;
}
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{
if (pnode->hSocket == INVALID_SOCKET)
continue;
FD_SET(pnode->hSocket, &fdsetError);
hSocketMax = max(hSocketMax, pnode->hSocket);
have_fds = true;
// Implement the following logic:
// * If there is data to send, select() for sending data. As this only
// happens when optimistic write failed, we choose to first drain the
// write buffer in this case before receiving more. This avoids
// needlessly queueing received data, if the remote peer is not themselves
// receiving data. This means properly utilizing TCP flow control signalling.
// * Otherwise, if there is no (complete) message in the receive buffer,
// or there is space left in the buffer, select() for receiving data.
// * (if neither of the above applies, there is certainly one message
// in the receiver buffer ready to be processed).
// Together, that means that at least one of the following is always possible,
// so we don't deadlock:
// * We send some data.
// * We wait for data to be received (and disconnect after timeout).
// * We process a message in the buffer (message handler thread).
{
TRY_LOCK(pnode->cs_vSend, lockSend);
if (lockSend && !pnode->vSendMsg.empty()) {
FD_SET(pnode->hSocket, &fdsetSend);
continue;
}
}
{
TRY_LOCK(pnode->cs_vRecvMsg, lockRecv);
if (lockRecv && (
pnode->vRecvMsg.empty() || !pnode->vRecvMsg.front().complete() ||
pnode->GetTotalRecvSize() <= ReceiveFloodSize()))
FD_SET(pnode->hSocket, &fdsetRecv);
}
}
}
int nSelect = select(have_fds ? hSocketMax + 1 : 0,
&fdsetRecv, &fdsetSend, &fdsetError, &timeout);
boost::this_thread::interruption_point();
if (nSelect == SOCKET_ERROR)
{
if (have_fds)
{
int nErr = WSAGetLastError();
printf("socket select error %d\n", nErr);
for (unsigned int i = 0; i <= hSocketMax; i++)
FD_SET(i, &fdsetRecv);
}
FD_ZERO(&fdsetSend);
FD_ZERO(&fdsetError);
MilliSleep(timeout.tv_usec/1000);
}
//
// Accept new connections
//
BOOST_FOREACH(SOCKET hListenSocket, vhListenSocket)
if (hListenSocket != INVALID_SOCKET && FD_ISSET(hListenSocket, &fdsetRecv))
{
#ifdef USE_IPV6
struct sockaddr_storage sockaddr;
#else
struct sockaddr sockaddr;
#endif
socklen_t len = sizeof(sockaddr);
SOCKET hSocket = accept(hListenSocket, (struct sockaddr*)&sockaddr, &len);
CAddress addr;
int nInbound = 0;
if (hSocket != INVALID_SOCKET)
if (!addr.SetSockAddr((const struct sockaddr*)&sockaddr))
printf("Warning: Unknown socket family\n");
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
if (pnode->fInbound)
nInbound++;
}
if (hSocket == INVALID_SOCKET)
{
int nErr = WSAGetLastError();
if (nErr != WSAEWOULDBLOCK)
printf("socket error accept failed: %d\n", nErr);
}
else if (nInbound >= nMaxConnections - MAX_OUTBOUND_CONNECTIONS)
{
{
LOCK(cs_setservAddNodeAddresses);
if (!setservAddNodeAddresses.count(addr))
closesocket(hSocket);
}
}
else if (CNode::IsBanned(addr))
{
printf("connection from %s dropped (banned)\n", addr.ToString().c_str());
closesocket(hSocket);
}
else
{
printf("accepted connection %s\n", addr.ToString().c_str());
CNode* pnode = new CNode(hSocket, addr, "", true);
pnode->AddRef();
{
LOCK(cs_vNodes);
vNodes.push_back(pnode);
}
}
}
//
// Service each socket
//
vector<CNode*> vNodesCopy;
{
LOCK(cs_vNodes);
vNodesCopy = vNodes;
BOOST_FOREACH(CNode* pnode, vNodesCopy)
pnode->AddRef();
}
BOOST_FOREACH(CNode* pnode, vNodesCopy)
{
boost::this_thread::interruption_point();
//
// Receive
//
if (pnode->hSocket == INVALID_SOCKET)
continue;
if (FD_ISSET(pnode->hSocket, &fdsetRecv) || FD_ISSET(pnode->hSocket, &fdsetError))
{
TRY_LOCK(pnode->cs_vRecvMsg, lockRecv);
if (lockRecv)
{
{
// typical socket buffer is 8K-64K
char pchBuf[0x10000];
int nBytes = recv(pnode->hSocket, pchBuf, sizeof(pchBuf), MSG_DONTWAIT);
if (nBytes > 0)
{
if (!pnode->ReceiveMsgBytes(pchBuf, nBytes))
pnode->CloseSocketDisconnect();
pnode->nLastRecv = GetTime();
pnode->nRecvBytes += nBytes;
}
else if (nBytes == 0)
{
// socket closed gracefully
if (!pnode->fDisconnect)
printf("socket closed\n");
pnode->CloseSocketDisconnect();
}
else if (nBytes < 0)
{
// error
int nErr = WSAGetLastError();
if (nErr != WSAEWOULDBLOCK && nErr != WSAEMSGSIZE && nErr != WSAEINTR && nErr != WSAEINPROGRESS)
{
if (!pnode->fDisconnect)
printf("socket recv error %d\n", nErr);
pnode->CloseSocketDisconnect();
}
}
}
}
}
//
// Send
//
if (pnode->hSocket == INVALID_SOCKET)
continue;
if (FD_ISSET(pnode->hSocket, &fdsetSend))
{
TRY_LOCK(pnode->cs_vSend, lockSend);
if (lockSend)
SocketSendData(pnode);
}
//
// Inactivity checking
//
if (pnode->vSendMsg.empty())
pnode->nLastSendEmpty = GetTime();
if (GetTime() - pnode->nTimeConnected > 60)
{
if (pnode->nLastRecv == 0 || pnode->nLastSend == 0)
{
printf("socket no message in first 60 seconds, %d %d\n", pnode->nLastRecv != 0, pnode->nLastSend != 0);
pnode->fDisconnect = true;
}
else if (GetTime() - pnode->nLastSend > 90*60 && GetTime() - pnode->nLastSendEmpty > 90*60)
{
printf("socket not sending\n");
pnode->fDisconnect = true;
}
else if (GetTime() - pnode->nLastRecv > 90*60)
{
printf("socket inactivity timeout\n");
pnode->fDisconnect = true;
}
}
}
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodesCopy)
pnode->Release();
}
MilliSleep(10);
}
}
#ifdef USE_UPNP
void ThreadMapPort()
{
std::string port = strprintf("%u", GetListenPort());
const char * multicastif = 0;
const char * minissdpdpath = 0;
struct UPNPDev * devlist = 0;
char lanaddr[64];
#ifndef UPNPDISCOVER_SUCCESS
/* miniupnpc 1.5 */
devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0);
#else
/* miniupnpc 1.6 */
int error = 0;
devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, &error);
#endif
struct UPNPUrls urls;
struct IGDdatas data;
int r;
r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
if (r == 1)
{
if (fDiscover) {
char externalIPAddress[40];
r = UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIPAddress);
if(r != UPNPCOMMAND_SUCCESS)
printf("UPnP: GetExternalIPAddress() returned %d\n", r);
else
{
if(externalIPAddress[0])
{
printf("UPnP: ExternalIPAddress = %s\n", externalIPAddress);
AddLocal(CNetAddr(externalIPAddress), LOCAL_UPNP);
}
else
printf("UPnP: GetExternalIPAddress failed.\n");
}
}
string strDesc = "YoCoin " + FormatFullVersion();
try {
loop {
#ifndef UPNPDISCOVER_SUCCESS
/* miniupnpc 1.5 */
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0);
#else
/* miniupnpc 1.6 */
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0, "0");
#endif
if(r!=UPNPCOMMAND_SUCCESS)
printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n",
port.c_str(), port.c_str(), lanaddr, r, strupnperror(r));
else
printf("UPnP Port Mapping successful.\n");;
MilliSleep(20*60*1000); // Refresh every 20 minutes
}
}
catch (boost::thread_interrupted)
{
r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", 0);
printf("UPNP_DeletePortMapping() returned : %d\n", r);
freeUPNPDevlist(devlist); devlist = 0;
FreeUPNPUrls(&urls);
throw;
}
} else {
printf("No valid UPnP IGDs found\n");
freeUPNPDevlist(devlist); devlist = 0;
if (r != 0)
FreeUPNPUrls(&urls);
}
}
void MapPort(bool fUseUPnP)
{
static boost::thread* upnp_thread = NULL;
if (fUseUPnP)
{
if (upnp_thread) {
upnp_thread->interrupt();
upnp_thread->join();
delete upnp_thread;
}
upnp_thread = new boost::thread(boost::bind(&TraceThread<boost::function<void()> >, "upnp", &ThreadMapPort));
}
else if (upnp_thread) {
upnp_thread->interrupt();
upnp_thread->join();
delete upnp_thread;
upnp_thread = NULL;
}
}
#else
void MapPort(bool)
{
// Intentionally left blank.
}
#endif
// DNS seeds
// Each pair gives a source name and a seed name.
// The first name is used as information source for addrman.
// The second name should resolve to a list of seed addresses.
static const char *strMainNetDNSSeed[][2] = {
//{"YoCointools.com", "dnsseed.YoCointools.com"},
//{"YoCoinpool.org", "dnsseed.YoCoinpool.org"},
//{"xurious.com", "dnsseed.ltc.xurious.com"},
//{"koin-project.com", "dnsseed.koin-project.com"},
//{"weminemnc.com", "dnsseed.weminemnc.com"},
{NULL, NULL}
};
static const char *strTestNetDNSSeed[][2] = {
//{"YoCointools.com", "testnet-seed.YoCointools.com"},
//{"xurious.com", "testnet-seed.ltc.xurious.com"},
//{"wemine-testnet.com", "dnsseed.wemine-testnet.com"},
{NULL, NULL}
};
void ThreadDNSAddressSeed()
{
static const char *(*strDNSSeed)[2] = fTestNet ? strTestNetDNSSeed : strMainNetDNSSeed;
int found = 0;
printf("Loading addresses from DNS seeds (could take a while)\n");
for (unsigned int seed_idx = 0; strDNSSeed[seed_idx][0] != NULL; seed_idx++) {
if (HaveNameProxy()) {
AddOneShot(strDNSSeed[seed_idx][1]);
} else {
vector<CNetAddr> vaddr;
vector<CAddress> vAdd;
if (LookupHost(strDNSSeed[seed_idx][1], vaddr))
{
BOOST_FOREACH(CNetAddr& ip, vaddr)
{
int nOneDay = 24*3600;
CAddress addr = CAddress(CService(ip, GetDefaultPort()));
addr.nTime = GetTime() - 3*nOneDay - GetRand(4*nOneDay); // use a random age between 3 and 7 days old
vAdd.push_back(addr);
found++;
}
}
addrman.Add(vAdd, CNetAddr(strDNSSeed[seed_idx][0], true));
}
}
printf("%d addresses found from DNS seeds\n", found);
}
unsigned int pnSeed[] =
{
0x38a9b992, 0x73d4f3a2, 0x43eda52e, 0xa1c4a2b2, 0x73c41955, 0x6992f3a2, 0x729cb992, 0x8b53b205,
0xb651ec36, 0x8b422e4e, 0x0fe421b2, 0x83c1a2b2, 0xbd432705, 0x2e11b018, 0x281544c1, 0x8b72f3a2,
0xb934555f, 0x2ba02e4e, 0x6ab7c936, 0x8728555f, 0x03bfd143, 0x0a73df5b, 0xcd2b5a50, 0x746df3a2,
0x7481bb25, 0x6f4d4550, 0x78582f4e, 0xa03a0f46, 0xe8b0e2bc, 0xa2d17042, 0x718a09b0, 0xdaffd4a2,
0xbb1a175e, 0xb21f09b0, 0xb5549bc0, 0xe404c755, 0x95d882c3, 0xfff3692e, 0x3777d9c7, 0x425b2746,
0x497990c6, 0xb2782dcc, 0xf9352225, 0xa75cd443, 0x4c05fb94, 0x44c91c2e, 0x47c6a5bc, 0xd606fb94,
0xc1b9e2bc, 0x32acd23e, 0x89560da2, 0x5bebdad8, 0x3a210e08, 0xbdc5795b, 0xcc86bb25, 0xbe9f28bc,
0xef3ff3a2, 0xca29df59, 0xe4fd175e, 0x1f3eaa6b, 0xacdbaa6b, 0xb05f042e, 0x81ed6cd8, 0x9a3c0cc3,
0x4200175e, 0x5a017ebc, 0x42ef4c90, 0x8abfd143, 0x24fbf3a2, 0x140846a6, 0x4f7d9553, 0xeea5d151,
0xe67c0905, 0x52d8048e, 0xcabd2e4e, 0xe276692e, 0x07dea445, 0xdde3f3a2, 0x6c47bb25, 0xae0efb94,
0xf5e15a51, 0xaebdd25b, 0xf341175e, 0x46532705, 0xc47728bc, 0xe4e14c90, 0x9dc8f752, 0x050c042e,
0x1c84bb25, 0x4f163b25, 0x1a017ebc, 0xa5282e4e, 0x8c667e60, 0xc7113b25, 0xf0b44832, 0xf1a134d0,
0x973212d4, 0xd35cbb25, 0xd5123b25, 0x68220254, 0x7ad43e32, 0x9268e32e, 0xdf143b25, 0xaf04c436,
0xaded0051, 0xfa86d454, 0x09db048e, 0x26003b25, 0x58764c90, 0x9a2f555f, 0x0c24ec97, 0x92123b25,
0x0526d35f, 0x17db048e, 0xd2e42f4e, 0x38cca5bc, 0xc6320ab9, 0xe28ac836, 0xc560aa6b, 0xa5c16041,
0x70a6f1c0, 0x011ec8c1, 0xd6e9c332, 0x131263c0, 0xa15a4450, 0xef218abc, 0x2729f948, 0x02835443,
0x5614336c, 0xb12aacb2, 0xe368aa6b, 0x3cc6ffad, 0x36206494, 0x2c90e9c1, 0x32bb53d4, 0xca03de5c,
0x775c1955, 0x19ef1ba3, 0x0b00dc1f, 0x244d0f40, 0x54d9e2bc, 0x25ced152, 0x967b03ad, 0x951c555f,
0x4c3f3b25, 0x13f6f3a2, 0x17fca5bc, 0x0e2d306c, 0xacd8764b, 0xca230bcc, 0x8569d3c6, 0x3264d8a2,
0xe8630905, 0x25e02a64, 0x3aba1fb0, 0x6bbdd25b, 0xee9a4c90, 0xcda25982, 0x8b3e804e, 0xf043fb94,
0x4b05fb94, 0x0c44c052, 0xf403f45c, 0x4333aa6b, 0xc193484d, 0x3fbf5d4c, 0x0bd7f74d, 0x150e3fb2,
0x8e2eddb0, 0x09daf150, 0x8a67c7c6, 0x22a9e52e, 0x05cff476, 0xc99b2f4e, 0x0f183b25, 0xd0358953,
0x20f232c6, 0x0ce9e217, 0x09f55d18, 0x0555795b, 0x5ed2fa59, 0x2ec85917, 0x2bf61fb0, 0x024ef54d,
0x3c53b859, 0x441cbb25, 0x50c8aa6b, 0x1b79175e, 0x3125795b, 0x27fc1fb0, 0xbcd53e32, 0xfc781718,
0x7a8ec345, 0x1da6985d, 0x34bd1f32, 0xcb00edcf, 0xf9a5fdce, 0x21ccdbac, 0xb7730118, 0x6a43f6cc,
0x6e65e262, 0x21ca1f3d, 0x10143b25, 0xc8dea132, 0xaf076693, 0x7e431bc6, 0xaa3df5c6, 0x44f0c536,
0xeea80925, 0x262371d4, 0xc85c895b, 0xa6611bc6, 0x1844e47a, 0x49084c90, 0xf3d95157, 0x63a4a844,
0x00477c70, 0x2934d35f, 0xe8d24465, 0x13df88b7, 0x8fcb7557, 0xa591bd5d, 0xc39453d4, 0xd5c49452,
0xc8de1a56, 0x3cdd0608, 0x3c147a55, 0x49e6cf4a, 0xb38c8705, 0x0bef3479, 0x01540f48, 0xd9c3ec57,
0xed6d4c90, 0xa529fb94, 0xe1c81955, 0xfde617c6, 0x72d18932, 0x9d61bb6a, 0x6d5cb258, 0x27c7d655,
0xc5644c90, 0x31fae3bc, 0x3afaf25e, 0x98efe2bc, 0x91020905, 0xb566795b, 0xaf91bd5d, 0xb164d655,
0x72eb47d4, 0xae62f3a2, 0xb4193b25, 0x0613fb94, 0xa6db048e, 0xf002464b, 0xc15ebb6a, 0x8a51f3a2,
0x485e2ed5, 0x119675a3, 0x1f3f555f, 0x39dbc082, 0x09dea445, 0x74382446, 0x3e836c4e, 0x6e43f6cc,
0x134dd9a2, 0x5876f945, 0x3516f725, 0x670c81d4, 0xaf7f170c, 0xb0e31155, 0xe271894e, 0x615e175e,
0xb3446fd0, 0x13d58ac1, 0x07cff476, 0xe601e405, 0x8321277d, 0x0997548d, 0xdb55336c, 0xa1271d73,
0x582463c0, 0xc2543025, 0xf6851c73, 0xe75d32ae, 0xf916b4dd, 0xf558fb94, 0x52111d73, 0x2bc8615d,
0xd4dcaf42, 0x65e30979, 0x2e1b2360, 0x0da01d73, 0x3f1263c0, 0xd15c735d, 0x9cf2134c, 0x20d0048e,
0x48cf0125, 0xf585bf5d, 0x12d7645e, 0xd5ace2bc, 0x0c6220b2, 0xbe13bb25, 0x88d0a52e, 0x559425b0,
0x24079e3d, 0xfaa37557, 0xf219b96a, 0x07e61e4c, 0x3ea1d295, 0x24e0d852, 0xdde212df, 0x44c37758,
0x55c243a4, 0xe77dd35f, 0x10c19a5f, 0x14d1048e, 0x1d50fbc6, 0x1570456c, 0x567c692e, 0x641d6d5b,
0xab0c0cc6, 0xab6803c0, 0x136f21b2, 0x6a72545d, 0x21d031b2, 0xff8b5fad, 0xfd0096b2, 0x5f469ac3,
0x3f6ffa62, 0x7501f863, 0x48471f60, 0xcccff3a2, 0x7f772e44, 0xc1de7757, 0x0c94c3cb, 0x620ac658,
0x520f1d25, 0x37366c5f, 0x7594b159, 0x3804f23c, 0xb81ff054, 0x96dd32c6, 0x928228bc, 0xf4006e41,
0x0241c244, 0x8dbdf243, 0x26d1b247, 0xd5381c73, 0xf3136e41, 0x4afa9bc0, 0xa3abf8ce, 0x464ce718,
0xbd9d017b, 0xf4f26132, 0x141b32d4, 0x2ec50c18, 0x4df119d9, 0x93f81772, 0xd9607c70, 0x3522b648,
0xf2006e41, 0x761fe550, 0x40104836, 0x55dffe96, 0xc45db158, 0xe75e4836, 0x8dfab7ad, 0xe3eff3a2,
0x6a6eaa6b, 0x2177d9c7, 0x724ce953, 0xafe918b9, 0xf9368a55, 0xdc0a555f, 0xa4b2d35f, 0x4d87b0b8,
0x93496a54, 0x5a5c967b, 0xd47028bc, 0x3c44e47a, 0x11c363c0, 0x28107c70, 0xb756a558, 0xb82bbb6a,
0x285d49ad, 0x3b0ce85c, 0xe53eb45f, 0xa836e23c, 0x409f63c0, 0xc80fbd44, 0x3447f677, 0xe4ca983b,
0x20673774, 0x96471ed9, 0x4c1d09b0, 0x91d5685d, 0x55beec4d, 0x1008be48, 0x660455d0, 0xf8170fda,
0x3c21dd3a, 0x8239bb36, 0x9fe7e2bc, 0x900c47ae, 0x6a355643, 0x03dcb318, 0xefca123d, 0x6af8c4d9,
0x5195e1a5, 0x32e89925, 0x0adc51c0, 0x45d7164c, 0x02495177, 0x8131175e, 0x681b5177, 0x41b6aa6b,
0x55a9603a, 0x1a0c1c1f, 0xdb4da043, 0x3b9b1632, 0x37e08368, 0x8b54e260, 0xcd14d459, 0x82a663c0,
0x05adc7dd, 0xe683f3a2, 0x4cddb150, 0x67a1a62e, 0x8c0acd25, 0x07f01f3e, 0x3111296c, 0x2d0fda2e,
0xa4f163c0, 0xca6db982, 0x78ed2359, 0x7eaa21c1, 0x62e4f3a2, 0x50b81d73, 0xcd074a3a, 0xcb2d904b,
0x9b3735ce, 0xab67f25c, 0xa0eb5036, 0x62ae5344, 0xe2569bb2, 0xc4422e4e, 0xab5ec8d5, 0xaa81e8dd,
0xa39264c6, 0xf391563d, 0xb79bbb25, 0x174a7857, 0x0fd4aa43, 0x3e158c32, 0x3ae8b982, 0xea342225,
0x48d1a842, 0xa52bf0da, 0x4bcb4a4c, 0xa6d3c15b, 0x49a0d35f, 0x97131b4c, 0xf197e252, 0xfe3ebd18,
0x156dacb8, 0xf63328bc, 0x8e95b84c, 0x560455d0, 0xee918c4e, 0x1d3e435f, 0xe1292f50, 0x0f1ec018,
0x7d70c60e, 0x6a29d5be, 0xf5fecb18, 0xd6da1f63, 0xccce1c2e, 0x7a289f5e, 0x2775ae47, 0x696df560,
0x4dbe00ae, 0x474e6c5c, 0x604141d5, 0xaed0c718, 0x8acfd23e, 0x7ff4b84c, 0x4b44fc60, 0xdf58aa4f,
0x9b7440c0, 0xb811c854, 0xd90ec24e, 0xcff75c46, 0xa5a9cc57, 0xb3d21e4c, 0x794779d9, 0xe5613d46,
0x9478be43, 0xc5d11152, 0xe85fbb6a, 0x3e1ed052, 0xf747e418, 0x3b9c61c2, 0xb2532949, 0x43077432,
0xa3db0b68, 0xb3b6e35a, 0x70361b6c, 0x3a8bad3e, 0x23079e3d, 0x09314c32, 0x92f90053, 0x4fc31955,
0xa59b0905, 0x924128bc, 0x4e63c444, 0x344dc236, 0x43055fcb, 0xdc1a1c73, 0x38aaaa6b, 0xa61cf554,
0x6d8f63c0, 0x24800a4c, 0x2406f953, 0x9558bb6a, 0x1d281660, 0x054c4954, 0x2de4d418, 0x5fdaf043,
0xb681356c, 0xf8c3febc, 0x8854f950, 0x55b45d32, 0xde07bcd1, 0x156e4bda, 0x924cf718, 0xc34a0d47,
0xdd5e1c45, 0x4a0d63c0, 0xaf4b88d5, 0x7852b958, 0x6f205fc0, 0x838af043, 0x45ac795b, 0x43bbaa6b,
0x998d1c73, 0x11c1d558, 0x749ec444, 0x9a38c232, 0xad2f8c32, 0x3446c658, 0x8fe7a52e, 0x4e846b61,
0x064b2d05, 0x0fd09740, 0x7a81a743, 0xf1f08e3f, 0x35ca1967, 0x24bdb17d, 0x144c2d05, 0x5505bb46,
0x13fd1bb9, 0x25de2618, 0xc80a8b4b, 0xcec0fd6c, 0xdc30ad4c, 0x4009f3a2, 0x472f3fb2, 0x5e69c936,
0x0380796d, 0xa463f8a2, 0xa46fbdc7, 0x3b0cc547, 0xb6644f46, 0x4b90fc47, 0x39e3f563, 0x72d81e56,
0xe177d9c7, 0x95bff743, 0xea985542, 0xc210ec55, 0xeef70b67, 0xc9eb175e, 0x844d38ad, 0x65afa247,
0x72da6d26, 0xed165dbc, 0xe8c83ad0, 0x9a8f37d8, 0x925adf50, 0x6b6ac162, 0x4b969e32, 0x735e1c45,
0x4423ff60, 0xfa57ec6d, 0xcde2fb65, 0x11093257, 0x4748cd5b, 0x720c03dd, 0x8c7b0905, 0xba8b2e48
};
void DumpAddresses()
{
int64 nStart = GetTimeMillis();
CAddrDB adb;
adb.Write(addrman);
printf("Flushed %d addresses to peers.dat %"PRI64d"ms\n",
addrman.size(), GetTimeMillis() - nStart);
}
void static ProcessOneShot()
{
string strDest;
{
LOCK(cs_vOneShots);
if (vOneShots.empty())
return;
strDest = vOneShots.front();
vOneShots.pop_front();
}
CAddress addr;
CSemaphoreGrant grant(*semOutbound, true);
if (grant) {
if (!OpenNetworkConnection(addr, &grant, strDest.c_str(), true))
AddOneShot(strDest);
}
}
void ThreadOpenConnections()
{
// Connect to specific addresses
if (mapArgs.count("-connect") && mapMultiArgs["-connect"].size() > 0)
{
for (int64 nLoop = 0;; nLoop++)
{
ProcessOneShot();
BOOST_FOREACH(string strAddr, mapMultiArgs["-connect"])
{
CAddress addr;
OpenNetworkConnection(addr, NULL, strAddr.c_str());
for (int i = 0; i < 10 && i < nLoop; i++)
{
MilliSleep(500);
}
}
MilliSleep(500);
}
}
// Initiate network connections
int64 nStart = GetTime();
loop
{
ProcessOneShot();
MilliSleep(500);
CSemaphoreGrant grant(*semOutbound);
boost::this_thread::interruption_point();
// Add seed nodes if IRC isn't working
if (addrman.size()==0 && (GetTime() - nStart > 60) && !fTestNet)
{
std::vector<CAddress> vAdd;
for (unsigned int i = 0; i < ARRAYLEN(pnSeed); i++)
{
// It'll only connect to one or two seed nodes because once it connects,
// it'll get a pile of addresses with newer timestamps.
// Seed nodes are given a random 'last seen time' of between one and two
// weeks ago.
const int64 nOneWeek = 7*24*60*60;
struct in_addr ip;
memcpy(&ip, &pnSeed[i], sizeof(ip));
CAddress addr(CService(ip, GetDefaultPort()));
addr.nTime = GetTime()-GetRand(nOneWeek)-nOneWeek;
vAdd.push_back(addr);
}
addrman.Add(vAdd, CNetAddr("127.0.0.1"));
}
//
// Choose an address to connect to based on most recently seen
//
CAddress addrConnect;
// Only connect out to one peer per network group (/16 for IPv4).
// Do this here so we don't have to critsect vNodes inside mapAddresses critsect.
int nOutbound = 0;
set<vector<unsigned char> > setConnected;
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes) {
if (!pnode->fInbound) {
setConnected.insert(pnode->addr.GetGroup());
nOutbound++;
}
}
}
int64 nANow = GetAdjustedTime();
int nTries = 0;
loop
{
// use an nUnkBias between 10 (no outgoing connections) and 90 (8 outgoing connections)
CAddress addr = addrman.Select(10 + min(nOutbound,8)*10);
// if we selected an invalid address, restart
if (!addr.IsValid() || setConnected.count(addr.GetGroup()) || IsLocal(addr))
break;
// If we didn't find an appropriate destination after trying 100 addresses fetched from addrman,
// stop this loop, and let the outer loop run again (which sleeps, adds seed nodes, recalculates
// already-connected network ranges, ...) before trying new addrman addresses.
nTries++;
if (nTries > 100)
break;
if (IsLimited(addr))
continue;
// only consider very recently tried nodes after 30 failed attempts
if (nANow - addr.nLastTry < 600 && nTries < 30)
continue;
// do not allow non-default ports, unless after 50 invalid addresses selected already
if (addr.GetPort() != GetDefaultPort() && nTries < 50)
continue;
addrConnect = addr;
break;
}
if (addrConnect.IsValid())
OpenNetworkConnection(addrConnect, &grant);
}
}
void ThreadOpenAddedConnections()
{
{
LOCK(cs_vAddedNodes);
vAddedNodes = mapMultiArgs["-addnode"];
}
if (HaveNameProxy()) {
while(true) {
list<string> lAddresses(0);
{
LOCK(cs_vAddedNodes);
BOOST_FOREACH(string& strAddNode, vAddedNodes)
lAddresses.push_back(strAddNode);
}
BOOST_FOREACH(string& strAddNode, lAddresses) {
CAddress addr;
CSemaphoreGrant grant(*semOutbound);
OpenNetworkConnection(addr, &grant, strAddNode.c_str());
MilliSleep(500);
}
MilliSleep(120000); // Retry every 2 minutes
}
}
for (unsigned int i = 0; true; i++)
{
list<string> lAddresses(0);
{
LOCK(cs_vAddedNodes);
BOOST_FOREACH(string& strAddNode, vAddedNodes)
lAddresses.push_back(strAddNode);
}
list<vector<CService> > lservAddressesToAdd(0);
BOOST_FOREACH(string& strAddNode, lAddresses)
{
vector<CService> vservNode(0);
if(Lookup(strAddNode.c_str(), vservNode, GetDefaultPort(), fNameLookup, 0))
{
lservAddressesToAdd.push_back(vservNode);
{
LOCK(cs_setservAddNodeAddresses);
BOOST_FOREACH(CService& serv, vservNode)
setservAddNodeAddresses.insert(serv);
}
}
}
// Attempt to connect to each IP for each addnode entry until at least one is successful per addnode entry
// (keeping in mind that addnode entries can have many IPs if fNameLookup)
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
for (list<vector<CService> >::iterator it = lservAddressesToAdd.begin(); it != lservAddressesToAdd.end(); it++)
BOOST_FOREACH(CService& addrNode, *(it))
if (pnode->addr == addrNode)
{
it = lservAddressesToAdd.erase(it);
it--;
break;
}
}
BOOST_FOREACH(vector<CService>& vserv, lservAddressesToAdd)
{
CSemaphoreGrant grant(*semOutbound);
OpenNetworkConnection(CAddress(vserv[i % vserv.size()]), &grant);
MilliSleep(500);
}
MilliSleep(120000); // Retry every 2 minutes
}
}
// if successful, this moves the passed grant to the constructed node
bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOutbound, const char *strDest, bool fOneShot)
{
//
// Initiate outbound network connection
//
boost::this_thread::interruption_point();
if (!strDest)
if (IsLocal(addrConnect) ||
FindNode((CNetAddr)addrConnect) || CNode::IsBanned(addrConnect) ||
FindNode(addrConnect.ToStringIPPort().c_str()))
return false;
if (strDest && FindNode(strDest))
return false;
CNode* pnode = ConnectNode(addrConnect, strDest);
boost::this_thread::interruption_point();
if (!pnode)
return false;
if (grantOutbound)
grantOutbound->MoveTo(pnode->grantOutbound);
pnode->fNetworkNode = true;
if (fOneShot)
pnode->fOneShot = true;
return true;
}
// for now, use a very simple selection metric: the node from which we received
// most recently
double static NodeSyncScore(const CNode *pnode) {
return -pnode->nLastRecv;
}
void static StartSync(const vector<CNode*> &vNodes) {
CNode *pnodeNewSync = NULL;
double dBestScore = 0;
// fImporting and fReindex are accessed out of cs_main here, but only
// as an optimization - they are checked again in SendMessages.
if (fImporting || fReindex)
return;
// Iterate over all nodes
BOOST_FOREACH(CNode* pnode, vNodes) {
// check preconditions for allowing a sync
if (!pnode->fClient && !pnode->fOneShot &&
!pnode->fDisconnect && pnode->fSuccessfullyConnected &&
(pnode->nStartingHeight > (nBestHeight - 144)) &&
(pnode->nVersion < NOBLKS_VERSION_START || pnode->nVersion >= NOBLKS_VERSION_END)) {
// if ok, compare node's score with the best so far
double dScore = NodeSyncScore(pnode);
if (pnodeNewSync == NULL || dScore > dBestScore) {
pnodeNewSync = pnode;
dBestScore = dScore;
}
}
}
// if a new sync candidate was found, start sync!
if (pnodeNewSync) {
pnodeNewSync->fStartSync = true;
pnodeSync = pnodeNewSync;
}
}
void ThreadMessageHandler()
{
SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL);
while (true)
{
bool fHaveSyncNode = false;
vector<CNode*> vNodesCopy;
{
LOCK(cs_vNodes);
vNodesCopy = vNodes;
BOOST_FOREACH(CNode* pnode, vNodesCopy) {
pnode->AddRef();
if (pnode == pnodeSync)
fHaveSyncNode = true;
}
}
if (!fHaveSyncNode)
StartSync(vNodesCopy);
// Poll the connected nodes for messages
CNode* pnodeTrickle = NULL;
if (!vNodesCopy.empty())
pnodeTrickle = vNodesCopy[GetRand(vNodesCopy.size())];
bool fSleep = true;
BOOST_FOREACH(CNode* pnode, vNodesCopy)
{
if (pnode->fDisconnect)
continue;
// Receive messages
{
TRY_LOCK(pnode->cs_vRecvMsg, lockRecv);
if (lockRecv)
{
if (!ProcessMessages(pnode))
pnode->CloseSocketDisconnect();
if (pnode->nSendSize < SendBufferSize())
{
if (!pnode->vRecvGetData.empty() || (!pnode->vRecvMsg.empty() && pnode->vRecvMsg[0].complete()))
{
fSleep = false;
}
}
}
}
boost::this_thread::interruption_point();
// Send messages
{
TRY_LOCK(pnode->cs_vSend, lockSend);
if (lockSend)
SendMessages(pnode, pnode == pnodeTrickle);
}
boost::this_thread::interruption_point();
}
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodesCopy)
pnode->Release();
}
if (fSleep)
MilliSleep(100);
}
}
bool BindListenPort(const CService &addrBind, string& strError)
{
strError = "";
int nOne = 1;
// Create socket for listening for incoming connections
#ifdef USE_IPV6
struct sockaddr_storage sockaddr;
#else
struct sockaddr sockaddr;
#endif
socklen_t len = sizeof(sockaddr);
if (!addrBind.GetSockAddr((struct sockaddr*)&sockaddr, &len))
{
strError = strprintf("Error: bind address family for %s not supported", addrBind.ToString().c_str());
printf("%s\n", strError.c_str());
return false;
}
SOCKET hListenSocket = socket(((struct sockaddr*)&sockaddr)->sa_family, SOCK_STREAM, IPPROTO_TCP);
if (hListenSocket == INVALID_SOCKET)
{
strError = strprintf("Error: Couldn't open socket for incoming connections (socket returned error %d)", WSAGetLastError());
printf("%s\n", strError.c_str());
return false;
}
#ifdef SO_NOSIGPIPE
// Different way of disabling SIGPIPE on BSD
setsockopt(hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&nOne, sizeof(int));
#endif
#ifndef WIN32
// Allow binding if the port is still in TIME_WAIT state after
// the program was closed and restarted. Not an issue on windows.
setsockopt(hListenSocket, SOL_SOCKET, SO_REUSEADDR, (void*)&nOne, sizeof(int));
#endif
#ifdef WIN32
// Set to non-blocking, incoming connections will also inherit this
if (ioctlsocket(hListenSocket, FIONBIO, (u_long*)&nOne) == SOCKET_ERROR)
#else
if (fcntl(hListenSocket, F_SETFL, O_NONBLOCK) == SOCKET_ERROR)
#endif
{
strError = strprintf("Error: Couldn't set properties on socket for incoming connections (error %d)", WSAGetLastError());
printf("%s\n", strError.c_str());
return false;
}
#ifdef USE_IPV6
// some systems don't have IPV6_V6ONLY but are always v6only; others do have the option
// and enable it by default or not. Try to enable it, if possible.
if (addrBind.IsIPv6()) {
#ifdef IPV6_V6ONLY
#ifdef WIN32
setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&nOne, sizeof(int));
#else
setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (void*)&nOne, sizeof(int));
#endif
#endif
#ifdef WIN32
int nProtLevel = 10 /* PROTECTION_LEVEL_UNRESTRICTED */;
int nParameterId = 23 /* IPV6_PROTECTION_LEVEl */;
// this call is allowed to fail
setsockopt(hListenSocket, IPPROTO_IPV6, nParameterId, (const char*)&nProtLevel, sizeof(int));
#endif
}
#endif
if (::bind(hListenSocket, (struct sockaddr*)&sockaddr, len) == SOCKET_ERROR)
{
int nErr = WSAGetLastError();
if (nErr == WSAEADDRINUSE)
strError = strprintf(_("Unable to bind to %s on this computer. YoCoin is probably already running."), addrBind.ToString().c_str());
else
strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %d, %s)"), addrBind.ToString().c_str(), nErr, strerror(nErr));
printf("%s\n", strError.c_str());
return false;
}
printf("Bound to %s\n", addrBind.ToString().c_str());
// Listen for incoming connections
if (listen(hListenSocket, SOMAXCONN) == SOCKET_ERROR)
{
strError = strprintf("Error: Listening for incoming connections failed (listen returned error %d)", WSAGetLastError());
printf("%s\n", strError.c_str());
return false;
}
vhListenSocket.push_back(hListenSocket);
if (addrBind.IsRoutable() && fDiscover)
AddLocal(addrBind, LOCAL_BIND);
return true;
}
void static Discover()
{
if (!fDiscover)
return;
#ifdef WIN32
// Get local host IP
char pszHostName[1000] = "";
if (gethostname(pszHostName, sizeof(pszHostName)) != SOCKET_ERROR)
{
vector<CNetAddr> vaddr;
if (LookupHost(pszHostName, vaddr))
{
BOOST_FOREACH (const CNetAddr &addr, vaddr)
{
AddLocal(addr, LOCAL_IF);
}
}
}
#else
// Get local host ip
struct ifaddrs* myaddrs;
if (getifaddrs(&myaddrs) == 0)
{
for (struct ifaddrs* ifa = myaddrs; ifa != NULL; ifa = ifa->ifa_next)
{
if (ifa->ifa_addr == NULL) continue;
if ((ifa->ifa_flags & IFF_UP) == 0) continue;
if (strcmp(ifa->ifa_name, "lo") == 0) continue;
if (strcmp(ifa->ifa_name, "lo0") == 0) continue;
if (ifa->ifa_addr->sa_family == AF_INET)
{
struct sockaddr_in* s4 = (struct sockaddr_in*)(ifa->ifa_addr);
CNetAddr addr(s4->sin_addr);
if (AddLocal(addr, LOCAL_IF))
printf("IPv4 %s: %s\n", ifa->ifa_name, addr.ToString().c_str());
}
#ifdef USE_IPV6
else if (ifa->ifa_addr->sa_family == AF_INET6)
{
struct sockaddr_in6* s6 = (struct sockaddr_in6*)(ifa->ifa_addr);
CNetAddr addr(s6->sin6_addr);
if (AddLocal(addr, LOCAL_IF))
printf("IPv6 %s: %s\n", ifa->ifa_name, addr.ToString().c_str());
}
#endif
}
freeifaddrs(myaddrs);
}
#endif
// Don't use external IPv4 discovery, when -onlynet="IPv6"
if (!IsLimited(NET_IPV4))
NewThread(ThreadGetMyExternalIP, NULL);
}
void StartNode(boost::thread_group& threadGroup)
{
if (semOutbound == NULL) {
// initialize semaphore
int nMaxOutbound = min(MAX_OUTBOUND_CONNECTIONS, nMaxConnections);
semOutbound = new CSemaphore(nMaxOutbound);
}
if (pnodeLocalHost == NULL)
pnodeLocalHost = new CNode(INVALID_SOCKET, CAddress(CService("127.0.0.1", 0), nLocalServices));
Discover();
//
// Start threads
//
if (!GetBoolArg("-dnsseed", true))
printf("DNS seeding disabled\n");
else
threadGroup.create_thread(boost::bind(&TraceThread<boost::function<void()> >, "dnsseed", &ThreadDNSAddressSeed));
#ifdef USE_UPNP
// Map ports with UPnP
MapPort(GetBoolArg("-upnp", USE_UPNP));
#endif
// Send and receive from sockets, accept connections
threadGroup.create_thread(boost::bind(&TraceThread<void (*)()>, "net", &ThreadSocketHandler));
// Initiate outbound connections from -addnode
threadGroup.create_thread(boost::bind(&TraceThread<void (*)()>, "addcon", &ThreadOpenAddedConnections));
// Initiate outbound connections
threadGroup.create_thread(boost::bind(&TraceThread<void (*)()>, "opencon", &ThreadOpenConnections));
// Process messages
threadGroup.create_thread(boost::bind(&TraceThread<void (*)()>, "msghand", &ThreadMessageHandler));
// Dump network addresses
threadGroup.create_thread(boost::bind(&LoopForever<void (*)()>, "dumpaddr", &DumpAddresses, DUMP_ADDRESSES_INTERVAL * 1000));
}
bool StopNode()
{
printf("StopNode()\n");
GenerateBitcoins(false, NULL);
MapPort(false);
nTransactionsUpdated++;
if (semOutbound)
for (int i=0; i<MAX_OUTBOUND_CONNECTIONS; i++)
semOutbound->post();
MilliSleep(50);
DumpAddresses();
return true;
}
class CNetCleanup
{
public:
CNetCleanup()
{
}
~CNetCleanup()
{
// Close sockets
BOOST_FOREACH(CNode* pnode, vNodes)
if (pnode->hSocket != INVALID_SOCKET)
closesocket(pnode->hSocket);
BOOST_FOREACH(SOCKET hListenSocket, vhListenSocket)
if (hListenSocket != INVALID_SOCKET)
if (closesocket(hListenSocket) == SOCKET_ERROR)
printf("closesocket(hListenSocket) failed with error %d\n", WSAGetLastError());
// clean up some globals (to help leak detection)
BOOST_FOREACH(CNode *pnode, vNodes)
delete pnode;
BOOST_FOREACH(CNode *pnode, vNodesDisconnected)
delete pnode;
vNodes.clear();
vNodesDisconnected.clear();
delete semOutbound;
semOutbound = NULL;
delete pnodeLocalHost;
pnodeLocalHost = NULL;
#ifdef WIN32
// Shutdown Windows Sockets
WSACleanup();
#endif
}
}
instance_of_cnetcleanup;
void RelayTransaction(const CTransaction& tx, const uint256& hash)
{
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss.reserve(10000);
ss << tx;
RelayTransaction(tx, hash, ss);
}
void RelayTransaction(const CTransaction& tx, const uint256& hash, const CDataStream& ss)
{
CInv inv(MSG_TX, hash);
{
LOCK(cs_mapRelay);
// Expire old relay messages
while (!vRelayExpiration.empty() && vRelayExpiration.front().first < GetTime())
{
mapRelay.erase(vRelayExpiration.front().second);
vRelayExpiration.pop_front();
}
// Save original serialized message so newer versions are preserved
mapRelay.insert(std::make_pair(inv, ss));
vRelayExpiration.push_back(std::make_pair(GetTime() + 15 * 60, inv));
}
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{
if(!pnode->fRelayTxes)
continue;
LOCK(pnode->cs_filter);
if (pnode->pfilter)
{
if (pnode->pfilter->IsRelevantAndUpdate(tx, hash))
pnode->PushInventory(inv);
} else
pnode->PushInventory(inv);
}
}
| [
"[email protected]"
] | |
4288ee827b93a52cb0542fca3eef97dfae2a55f8 | 243af6f697c16c54af3613988ddaef62a2b29212 | /firmware/uvc_controller/mbed-os/drivers/source/usb/USBCDC.cpp | a5a64c428503be04d23055790fd5c8c9d0e5fc0f | [
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | permissive | davewhiiite/uvc | 0020fcc99d279a70878baf7cdc5c02c19b08499a | fd45223097eed5a824294db975b3c74aa5f5cc8f | refs/heads/main | 2023-05-29T10:18:08.520756 | 2021-06-12T13:06:40 | 2021-06-12T13:06:40 | 376,287,264 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 18,659 | cpp | /*
* Copyright (c) 2018-2019, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdint.h>
#include <string.h>
#include "USBCDC.h"
#include "EndpointResolver.h"
#include "AsyncOp.h"
#include "usb_phy_api.h"
static const uint8_t cdc_line_coding_default[7] = {0x80, 0x25, 0x00, 0x00, 0x00, 0x00, 0x08};
#define DEFAULT_CONFIGURATION (1)
#define CDC_SET_LINE_CODING 0x20
#define CDC_GET_LINE_CODING 0x21
#define CDC_SET_CONTROL_LINE_STATE 0x22
// Control Line State bits
#define CLS_DTR (1 << 0)
#define CLS_RTS (1 << 1)
#define CDC_MAX_PACKET_SIZE 64
class USBCDC::AsyncWrite: public AsyncOp {
public:
AsyncWrite(USBCDC *serial, uint8_t *buf, uint32_t size):
serial(serial), tx_buf(buf), tx_size(size), result(false)
{
}
virtual ~AsyncWrite()
{
}
virtual bool process()
{
if (!serial->_terminal_connected) {
result = false;
return true;
}
uint32_t actual_size = 0;
serial->send_nb(tx_buf, tx_size, &actual_size, true);
tx_size -= actual_size;
tx_buf += actual_size;
if (tx_size == 0) {
result = true;
return true;
}
// Start transfer if it hasn't been
serial->_send_isr_start();
return false;
}
USBCDC *serial;
uint8_t *tx_buf;
uint32_t tx_size;
bool result;
};
class USBCDC::AsyncRead: public AsyncOp {
public:
AsyncRead(USBCDC *serial, uint8_t *buf, uint32_t size, uint32_t *size_read, bool read_all)
: serial(serial), rx_buf(buf), rx_size(size), rx_actual(size_read), all(read_all), result(false)
{
}
virtual ~AsyncRead()
{
}
virtual bool process()
{
if (!serial->_terminal_connected) {
result = false;
return true;
}
uint32_t actual_size = 0;
serial->receive_nb(rx_buf, rx_size, &actual_size);
rx_buf += actual_size;
*rx_actual += actual_size;
rx_size -= actual_size;
if ((!all && *rx_actual > 0) || (rx_size == 0)) {
// Wake thread if request is done
result = true;
return true;
}
serial->_receive_isr_start();
return false;
}
USBCDC *serial;
uint8_t *rx_buf;
uint32_t rx_size;
uint32_t *rx_actual;
bool all;
bool result;
};
class USBCDC::AsyncWait: public AsyncOp {
public:
AsyncWait(USBCDC *serial)
: serial(serial)
{
}
virtual ~AsyncWait()
{
}
virtual bool process()
{
if (serial->_terminal_connected) {
return true;
}
return false;
}
USBCDC *serial;
};
USBCDC::USBCDC(bool connect_blocking, uint16_t vendor_id, uint16_t product_id, uint16_t product_release)
: USBDevice(get_usb_phy(), vendor_id, product_id, product_release)
{
_init();
if (connect_blocking) {
connect();
wait_ready();
} else {
init();
}
}
USBCDC::USBCDC(USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint16_t product_release)
: USBDevice(phy, vendor_id, product_id, product_release)
{
_init();
}
USBCDC::~USBCDC()
{
deinit();
}
void USBCDC::_init()
{
memcpy(_cdc_line_coding, cdc_line_coding_default, sizeof(_cdc_line_coding));
EndpointResolver resolver(endpoint_table());
resolver.endpoint_ctrl(CDC_MAX_PACKET_SIZE);
_bulk_in = resolver.endpoint_in(USB_EP_TYPE_BULK, CDC_MAX_PACKET_SIZE);
_bulk_out = resolver.endpoint_out(USB_EP_TYPE_BULK, CDC_MAX_PACKET_SIZE);
_int_in = resolver.endpoint_in(USB_EP_TYPE_INT, CDC_MAX_PACKET_SIZE);
MBED_ASSERT(resolver.valid());
_terminal_connected = false;
_tx_in_progress = false;
_tx_buf = _tx_buffer;
_tx_size = 0;
_rx_in_progress = false;
_rx_buf = _rx_buffer;
_rx_size = 0;
}
void USBCDC::callback_reset()
{
assert_locked();
/* Called in ISR context */
_change_terminal_connected(false);
};
void USBCDC::callback_state_change(DeviceState new_state)
{
assert_locked();
/* Called in ISR context */
if (new_state != Configured) {
_change_terminal_connected(false);
}
}
void USBCDC::callback_request(const setup_packet_t *setup)
{
assert_locked();
/* Called in ISR context */
RequestResult result = PassThrough;
uint8_t *data = NULL;
uint32_t size = 0;
/* Only process class-specific requests */
if (setup->bmRequestType.Type == CLASS_TYPE) {
switch (setup->bRequest) {
case CDC_GET_LINE_CODING:
result = Send;
data = _cdc_line_coding;
size = 7;
break;
case CDC_SET_LINE_CODING:
result = Receive;
data = _cdc_new_line_coding;
size = 7;
break;
case CDC_SET_CONTROL_LINE_STATE:
if (setup->wValue & CLS_DTR) {
_change_terminal_connected(true);
} else {
_change_terminal_connected(false);
}
result = Success;
break;
default:
result = Failure;
break;
}
}
complete_request(result, data, size);
}
void USBCDC::callback_request_xfer_done(const setup_packet_t *setup, bool aborted)
{
assert_locked();
/* Called in ISR context */
if (aborted) {
complete_request_xfer_done(false);
return;
}
bool success = false;
/* Process class-specific requests */
if (setup->bmRequestType.Type == CLASS_TYPE) {
if ((setup->bRequest == CDC_SET_LINE_CODING) && (setup->wLength == 7)) {
if (memcmp(_cdc_line_coding, _cdc_new_line_coding, 7)) {
memcpy(_cdc_line_coding, _cdc_new_line_coding, 7);
const uint8_t *buf = _cdc_line_coding;
int baud = buf[0] + (buf[1] << 8)
+ (buf[2] << 16) + (buf[3] << 24);
int stop = buf[4];
int bits = buf[6];
int parity = buf[5];
line_coding_changed(baud, bits, parity, stop);
}
success = true;
}
if (setup->bRequest == CDC_GET_LINE_CODING) {
success = true;
}
}
complete_request_xfer_done(success);
}
void USBCDC::callback_set_configuration(uint8_t configuration)
{
assert_locked();
/* Called in ISR context */
bool ret = false;
if (configuration == DEFAULT_CONFIGURATION) {
// Configure endpoints > 0
endpoint_add(_int_in, CDC_MAX_PACKET_SIZE, USB_EP_TYPE_INT);
endpoint_add(_bulk_in, CDC_MAX_PACKET_SIZE, USB_EP_TYPE_BULK, &USBCDC::_send_isr);
endpoint_add(_bulk_out, CDC_MAX_PACKET_SIZE, USB_EP_TYPE_BULK, &USBCDC::_receive_isr);
read_start(_bulk_out, _rx_buf, sizeof(_rx_buffer));
_rx_in_progress = true;
ret = true;
}
complete_set_configuration(ret);
}
void USBCDC::callback_set_interface(uint16_t interface, uint8_t alternate)
{
assert_locked();
complete_set_interface(true);
}
void USBCDC::_change_terminal_connected(bool connected)
{
assert_locked();
_terminal_connected = connected;
if (!_terminal_connected) {
// Abort TX
if (_tx_in_progress) {
endpoint_abort(_bulk_in);
_tx_in_progress = false;
}
_tx_buf = _tx_buffer;
_tx_size = 0;
_tx_list.process();
MBED_ASSERT(_tx_list.empty());
// Abort RX
if (_rx_in_progress) {
endpoint_abort(_bulk_in);
_rx_in_progress = false;
}
_rx_buf = _rx_buffer;
_rx_size = 0;
_rx_list.process();
MBED_ASSERT(_rx_list.empty());
}
_connected_list.process();
}
bool USBCDC::ready()
{
lock();
bool ready = _terminal_connected;
unlock();
return ready;
}
void USBCDC::wait_ready()
{
lock();
AsyncWait wait_op(this);
_connected_list.add(&wait_op);
unlock();
wait_op.wait(NULL);
}
bool USBCDC::send(uint8_t *buffer, uint32_t size)
{
lock();
AsyncWrite write_op(this, buffer, size);
_tx_list.add(&write_op);
unlock();
write_op.wait(NULL);
return write_op.result;
}
void USBCDC::send_nb(uint8_t *buffer, uint32_t size, uint32_t *actual, bool now)
{
lock();
*actual = 0;
if (_terminal_connected && !_tx_in_progress) {
uint32_t free = sizeof(_tx_buffer) - _tx_size;
uint32_t write_size = free > size ? size : free;
if (size > 0) {
memcpy(_tx_buf, buffer, write_size);
}
_tx_size += write_size;
*actual = write_size;
if (now) {
_send_isr_start();
}
}
unlock();
}
void USBCDC::_send_isr_start()
{
assert_locked();
if (!_tx_in_progress && _tx_size) {
if (USBDevice::write_start(_bulk_in, _tx_buffer, _tx_size)) {
_tx_in_progress = true;
}
}
}
/*
* Called by when CDC data is sent
* Warning: Called in ISR
*/
void USBCDC::_send_isr()
{
assert_locked();
write_finish(_bulk_in);
_tx_buf = _tx_buffer;
_tx_size = 0;
_tx_in_progress = false;
_tx_list.process();
if (!_tx_in_progress) {
data_tx();
}
}
bool USBCDC::receive(uint8_t *buffer, uint32_t size, uint32_t *size_read)
{
lock();
bool read_all = size_read == NULL;
uint32_t size_read_dummy;
uint32_t *size_read_ptr = read_all ? &size_read_dummy : size_read;
*size_read_ptr = 0;
AsyncRead read_op(this, buffer, size, size_read_ptr, read_all);
_rx_list.add(&read_op);
unlock();
read_op.wait(NULL);
return read_op.result;
}
void USBCDC::receive_nb(uint8_t *buffer, uint32_t size, uint32_t *size_read)
{
*size_read = 0;
if (_terminal_connected && !_rx_in_progress) {
// Copy data over
uint32_t copy_size = _rx_size > size ? size : _rx_size;
memcpy(buffer, _rx_buf, copy_size);
*size_read = copy_size;
_rx_buf += copy_size;
_rx_size -= copy_size;
if (_rx_size == 0) {
_receive_isr_start();
}
}
}
void USBCDC::_receive_isr_start()
{
if ((_rx_size == 0) && !_rx_in_progress) {
// Refill the buffer
_rx_in_progress = true;
read_start(_bulk_out, _rx_buffer, sizeof(_rx_buffer));
}
}
/*
* Called by when CDC data is received
* Warning: Called in ISR
*/
void USBCDC::_receive_isr()
{
assert_locked();
MBED_ASSERT(_rx_size == 0);
_rx_buf = _rx_buffer;
_rx_size = read_finish(_bulk_out);
_rx_in_progress = false;
_rx_list.process();
if (!_rx_in_progress) {
data_rx();
}
}
const uint8_t *USBCDC::device_desc()
{
uint8_t ep0_size = endpoint_max_packet_size(0x00);
uint8_t device_descriptor_temp[] = {
18, // bLength
1, // bDescriptorType
0x10, 0x01, // bcdUSB
2, // bDeviceClass
0, // bDeviceSubClass
0, // bDeviceProtocol
ep0_size, // bMaxPacketSize0
(uint8_t)(LSB(vendor_id)), (uint8_t)(MSB(vendor_id)), // idVendor
(uint8_t)(LSB(product_id)), (uint8_t)(MSB(product_id)),// idProduct
0x00, 0x01, // bcdDevice
1, // iManufacturer
2, // iProduct
3, // iSerialNumber
1 // bNumConfigurations
};
MBED_ASSERT(sizeof(device_descriptor_temp) == sizeof(device_descriptor));
memcpy(device_descriptor, device_descriptor_temp, sizeof(device_descriptor));
return device_descriptor;
}
const uint8_t *USBCDC::string_iinterface_desc()
{
static const uint8_t stringIinterfaceDescriptor[] = {
0x08,
STRING_DESCRIPTOR,
'C', 0, 'D', 0, 'C', 0,
};
return stringIinterfaceDescriptor;
}
const uint8_t *USBCDC::string_iproduct_desc()
{
static const uint8_t stringIproductDescriptor[] = {
0x16,
STRING_DESCRIPTOR,
'C', 0, 'D', 0, 'C', 0, ' ', 0, 'D', 0, 'E', 0, 'V', 0, 'I', 0, 'C', 0, 'E', 0
};
return stringIproductDescriptor;
}
#define CONFIG1_DESC_SIZE (9+8+9+5+5+4+5+7+9+7+7)
const uint8_t *USBCDC::configuration_desc(uint8_t index)
{
uint8_t config_descriptor_temp[] = {
// configuration descriptor
9, // bLength
2, // bDescriptorType
LSB(CONFIG1_DESC_SIZE), // wTotalLength
MSB(CONFIG1_DESC_SIZE),
2, // bNumInterfaces
1, // bConfigurationValue
0, // iConfiguration
0x80, // bmAttributes
50, // bMaxPower
// IAD to associate the two CDC interfaces
0x08, // bLength
0x0b, // bDescriptorType
0x00, // bFirstInterface
0x02, // bInterfaceCount
0x02, // bFunctionClass
0x02, // bFunctionSubClass
0, // bFunctionProtocol
0, // iFunction
// interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
9, // bLength
4, // bDescriptorType
0, // bInterfaceNumber
0, // bAlternateSetting
1, // bNumEndpoints
0x02, // bInterfaceClass
0x02, // bInterfaceSubClass
0x01, // bInterfaceProtocol
0, // iInterface
// CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26
5, // bFunctionLength
0x24, // bDescriptorType
0x00, // bDescriptorSubtype
0x10, 0x01, // bcdCDC
// Call Management Functional Descriptor, CDC Spec 5.2.3.2, Table 27
5, // bFunctionLength
0x24, // bDescriptorType
0x01, // bDescriptorSubtype
0x03, // bmCapabilities
1, // bDataInterface
// Abstract Control Management Functional Descriptor, CDC Spec 5.2.3.3, Table 28
4, // bFunctionLength
0x24, // bDescriptorType
0x02, // bDescriptorSubtype
0x06, // bmCapabilities
// Union Functional Descriptor, CDC Spec 5.2.3.8, Table 33
5, // bFunctionLength
0x24, // bDescriptorType
0x06, // bDescriptorSubtype
0, // bMasterInterface
1, // bSlaveInterface0
// endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
ENDPOINT_DESCRIPTOR_LENGTH, // bLength
ENDPOINT_DESCRIPTOR, // bDescriptorType
_int_in, // bEndpointAddress
E_INTERRUPT, // bmAttributes (0x03=intr)
LSB(CDC_MAX_PACKET_SIZE), // wMaxPacketSize (LSB)
MSB(CDC_MAX_PACKET_SIZE), // wMaxPacketSize (MSB)
16, // bInterval
// interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
9, // bLength
4, // bDescriptorType
1, // bInterfaceNumber
0, // bAlternateSetting
2, // bNumEndpoints
0x0A, // bInterfaceClass
0x00, // bInterfaceSubClass
0x00, // bInterfaceProtocol
0, // iInterface
// endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
ENDPOINT_DESCRIPTOR_LENGTH, // bLength
ENDPOINT_DESCRIPTOR, // bDescriptorType
_bulk_in, // bEndpointAddress
E_BULK, // bmAttributes (0x02=bulk)
LSB(CDC_MAX_PACKET_SIZE), // wMaxPacketSize (LSB)
MSB(CDC_MAX_PACKET_SIZE), // wMaxPacketSize (MSB)
0, // bInterval
// endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
ENDPOINT_DESCRIPTOR_LENGTH, // bLength
ENDPOINT_DESCRIPTOR, // bDescriptorType
_bulk_out, // bEndpointAddress
E_BULK, // bmAttributes (0x02=bulk)
LSB(CDC_MAX_PACKET_SIZE), // wMaxPacketSize (LSB)
MSB(CDC_MAX_PACKET_SIZE), // wMaxPacketSize (MSB)
0 // bInterval
};
if (index == 0) {
MBED_ASSERT(sizeof(config_descriptor_temp) == sizeof(_config_descriptor));
memcpy(_config_descriptor, config_descriptor_temp, sizeof(_config_descriptor));
return _config_descriptor;
} else {
return NULL;
}
}
| [
"[email protected]"
] | |
dc07a7cf6fb0fc60e15728addfa8fce916dc912d | c4a66686285857e441d05420f970a9b72bc8d5d5 | /2502_SumOfTwoArray.cpp | 7e73e1d4f0617715ed164367ded1a75420dab3ec | [] | no_license | himanshu-rawat/CBcplusplus | 99140cb25a96b66c6160f6689b02d278ac8ba66d | fbb5de2e4945457eed604fc11fb2093da4258ecc | refs/heads/master | 2020-05-03T20:38:32.174661 | 2019-07-24T13:13:06 | 2019-07-24T13:13:06 | 178,807,210 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 565 | cpp | #include<iostream>
using namespace std;
int main(){
int a[1000],b[1000],sum[1000]={0};
int n,m,i,size,val,carry=0,number;
cin>>n;
for(i=0;i<n;i++){
cin>>a[i];
}
cin>>m;
for(i=0;i<m;i++){
cin>>b[i];
}
if(n>m){
size=n;
}
else{
size=m;
}
for(i=(size-1);i>=0;i--){
carry=0;
val=a[i]+b[i];
if(val>9){
number=val%10;
sum[i]=number;
}
carry=val/10;
sum[i]=val+carry;
// }
return 0;
} | [
"[email protected]"
] | |
7825d11ae8e0e84c1d7f8859cedcc12a1526eb1b | 8f0187f8c47a0b3d812b1e9435955a5700b724f1 | /NIFLib/CNiSkinPartition.h | fceb1a5d9d2748460f891b05ddbea38c241f0242 | [] | no_license | Dawn-of-Light/NIFLib | 4c1c046f6fc841b5af31ce6b48425fe60896b2b5 | c397b7c0e3bdf996b4d202b404be81f0870d93eb | refs/heads/master | 2016-08-13T00:58:01.404231 | 2013-04-16T13:47:04 | 2013-04-16T13:47:04 | 47,083,395 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 460 | h | #pragma once
#include "cnode.h"
/**
* \todo not working on all models
**/
class CNiSkinPartition : public CNode
{
public:
CNiSkinPartition(void);
~CNiSkinPartition(void);
bool Load(CNifStream&);
DECLARE_CHUNK(NiSkinPartition,"NiSkinPartition");
private:
struct s_unknown
{
unsigned nof1;
unsigned nof2;
unsigned nof3;
unsigned nof4;
unsigned nof5;
};
TArray <s_unknown> mas_unknown;
};
| [
"[email protected]"
] | |
c3bf08f53ff2a6410d99a2d20c1ee5ff78f2159f | 27c0c781e6bf95c5956a47975c39974ea72f3971 | /best_fit_decreasing.cpp | 7282e47a3d5cefff66dec798fe34dbdeb1c09188 | [] | no_license | simrikm/Binpacking_Algorithms | 6ec45a3d8950c881b663e1bcf47f1b90ff413c73 | e2cf2656b6c42e201cc891d1e42140d8aae9ccde | refs/heads/master | 2020-06-18T10:37:35.397679 | 2019-07-10T20:52:13 | 2019-07-10T20:52:13 | 196,273,397 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 495 | cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "project2.h"
#include <bits/stdc++.h>
using namespace std;
void best_fit_decreasing(const vector<double>& items, vector<int>&assignment, vector<double>& free_space){
assignment.clear();
free_space.clear();
vector<double> copy_items;
for (int i=0;i<items.size();i++)
copy_items.push_back(items[i]);
sort(copy_items.rbegin(),copy_items.rend());
best_fit(copy_items,assignment,free_space);
}
| [
"[email protected]"
] | |
4fe7d281db6e584d7cf43b95e0765497faa33a15 | c54b16b05178f5f8155fcb5e7a86cb91925c9801 | /Alchemy/Kernel/CResourceReadBlock.cpp | 7e05d5603975f1e1f7f7e00a970737458f1bed08 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | SiegeLord/TranscendenceDev | 72e9b668da82e89d36dad0d1655b7752dfabad1c | e936d0c0ab7d9202a05f6261c6cd14497947a3ac | refs/heads/master | 2021-07-19T09:20:22.178976 | 2019-01-18T04:24:57 | 2019-01-18T04:24:57 | 166,512,940 | 0 | 0 | NOASSERTION | 2019-01-19T06:10:02 | 2019-01-19T06:10:02 | null | UTF-8 | C++ | false | false | 1,319 | cpp | // CResourceReadBlock.cpp
//
// Implements CResourceReadBlock object
// Copyright (c) 2019 Kronosaur Productions, LLC. All Rights Reserved.
#include "PreComp.h"
static CObjectClass<CResourceReadBlock>g_Class(OBJID_CRESOURCEREADBLOCK, NULL);
CResourceReadBlock::CResourceReadBlock (void) :
CObject(&g_Class)
// CResourceReadBlock constructor
{
}
CResourceReadBlock::CResourceReadBlock (HMODULE hModule, char *pszRes, char *pszType) :
CObject(&g_Class),
m_hModule(hModule),
m_pszRes(pszRes),
m_pszType(pszType),
m_pData(NULL)
// CResourceReadBlock constructor
{
}
CResourceReadBlock::~CResourceReadBlock (void)
// CResourceReadBlock destructor
{
// Close the file if necessary
Close();
}
ALERROR CResourceReadBlock::Close (void)
// CResourceReadBlock
//
// Close the stream
{
return NOERROR;
}
ALERROR CResourceReadBlock::Open (void)
// Open
//
// Opens the stream for reading
{
HRSRC hRsrc;
HGLOBAL hGlobal;
hRsrc = FindResource(m_hModule, m_pszRes, m_pszType);
if (hRsrc == NULL)
return ERR_FAIL;
// Get the length
m_dwLength = SizeofResource(m_hModule, hRsrc);
// Load it
hGlobal = LoadResource(m_hModule, hRsrc);
if (hGlobal == NULL)
return ERR_FAIL;
m_pData = (char *)LockResource(hGlobal);
if (m_pData == NULL)
return ERR_FAIL;
return NOERROR;
}
| [
"[email protected]"
] | |
bc844e4740bf79d4761d86b41866ff216acbdee4 | 509649339062e2b3996e8be7328cdbbbee80d87c | /library/video/codec/msdk/dk_msdk_encoder/source/msdk_encoder.cpp | 651386c7d73e6b6152da52b8623f095ef7e020f8 | [] | no_license | RATime360/media-processing-system | ad4f819bbf3f77496ff48bbf7789f553ffe3e1bb | e2aa4cf0f0204a21bc5331912e2cb908f1a69f07 | refs/heads/master | 2021-06-02T17:39:19.356279 | 2016-09-12T08:40:51 | 2016-09-12T08:40:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,523 | cpp | #include "msdk_encoder.h"
#include <time.h>
#include <process.h>
#include <dk_fileio.h>
#include <dk_string_helper.h>
#include <d3d9.h>
#include <dk_macros.h>
//#include <d3dx9tex.h>
msdk_encoder::msdk_encoder(dk_msdk_encoder * front)
: _front(front)
, _config(nullptr)
, _state(dk_msdk_encoder::ENCODER_STATE_NONE)
{
#if defined(WITH_DEBUG_ES)
_file = ::open_file_write("test.h264");
#endif
}
msdk_encoder::~msdk_encoder(void)
{
release_encoder();
#if defined(WITH_DEBUG_ES)
::close_file(_file);
#endif
_state = dk_msdk_encoder::ENCODER_STATE_NONE;
}
dk_msdk_encoder::ENCODER_STATE msdk_encoder::state(void)
{
return _state;
}
dk_msdk_encoder::ERR_CODE msdk_encoder::initialize_encoder(dk_msdk_encoder::configuration_t * config)
{
if ((_state != dk_msdk_encoder::ENCODER_STATE_NONE) && (_state != dk_msdk_encoder::ENCODER_STATE_RELEASED))
return dk_msdk_encoder::ERR_CODE_FAIL;
release_encoder();
_state = dk_msdk_encoder::ENCODER_STATE_INITIALIZING;
_config = config;
mfxStatus code = MFX_ERR_NONE;
mfxVersion min_version;
mfxVersion version;
mfxIMPL impl = MFX_IMPL_HARDWARE_ANY;
if (config->mem_type == dk_msdk_encoder::MEMORY_TYPE_DX11)
impl |= MFX_IMPL_VIA_D3D11;
code = _session.Init(impl, &min_version);
if (code != MFX_ERR_NONE)
code = _session.Init((impl & (!MFX_IMPL_HARDWARE_ANY)) | MFX_IMPL_HARDWARE, &min_version);
if (code != MFX_ERR_NONE)
return dk_msdk_encoder::ERR_CODE_FAIL;
if ((_config->codec == dk_msdk_encoder::SUBMEDIA_TYPE_MVC) && !check_version(&version, dk_msdk_encoder::MSDK_FEATURE_MVC))
{
_session.Close();
_state = dk_msdk_encoder::ENCODER_STATE_NONE;
return dk_msdk_encoder::ERR_CODE_FAIL;
}
/*
if ((pParams->MVC_flags & MVC_VIEWOUTPUT) != 0 && !CheckVersion(&version, MSDK_FEATURE_MVC_VIEWOUTPUT)) {
msdk_printf(MSDK_STRING("error: MVC Viewoutput is not supported in the %d.%d API version\n"),
version.Major, version.Minor);
return MFX_ERR_UNSUPPORTED;
}
*/
if ((_config->codec == dk_msdk_encoder::SUBMEDIA_TYPE_JPEG) && !check_version(&version, dk_msdk_encoder::MSDK_FEATURE_JPEG_ENCODE))
{
_session.Close();
_state = dk_msdk_encoder::ENCODER_STATE_NONE;
return dk_msdk_encoder::ERR_CODE_FAIL;
}
if ((_config->rc_mode == dk_msdk_encoder::RC_MODE_LA) && !check_version(&version, dk_msdk_encoder::MSDK_FEATURE_LOOK_AHEAD))
{
_session.Close();
_state = dk_msdk_encoder::ENCODER_STATE_NONE;
return dk_msdk_encoder::ERR_CODE_FAIL;
}
code = init_encoder_parameter();
if (code != MFX_ERR_NONE)
{
_session.Close();
_state = dk_msdk_encoder::ENCODER_STATE_NONE;
return dk_msdk_encoder::ERR_CODE_FAIL;
}
_encoder = new MFXVideoENCODE(_session);
_state = dk_msdk_encoder::ENCODER_STATE_INITIALIZED;
return dk_msdk_encoder::ERR_CODE_SUCCESS;
}
dk_msdk_encoder::ERR_CODE msdk_encoder::release_encoder(void)
{
if ((_state != dk_msdk_encoder::ENCODER_STATE_NONE) && (_state != dk_msdk_encoder::ENCODER_STATE_INITIALIZED) && (_state != dk_msdk_encoder::ENCODER_STATE_ENCODED))
return dk_msdk_encoder::ERR_CODE_FAIL;
_state = dk_msdk_encoder::ENCODER_STATE_RELEASING;
_state = dk_msdk_encoder::ENCODER_STATE_RELEASED;
return dk_msdk_encoder::ERR_CODE_SUCCESS;
}
dk_msdk_encoder::ERR_CODE msdk_encoder::encode(dk_msdk_encoder::dk_video_entity_t * input, dk_msdk_encoder::dk_video_entity_t * bitstream)
{
dk_msdk_encoder::ERR_CODE status = encode(input);
if (status != dk_msdk_encoder::ERR_CODE_SUCCESS)
return status;
status = get_queued_data(bitstream);
if (status != dk_msdk_encoder::ERR_CODE_SUCCESS)
return status;
return dk_msdk_encoder::ERR_CODE_SUCCESS;
}
dk_msdk_encoder::ERR_CODE msdk_encoder::encode(dk_msdk_encoder::dk_video_entity_t * input)
{
if ((_state != dk_msdk_encoder::ENCODER_STATE_INITIALIZED) &&
(_state != dk_msdk_encoder::ENCODER_STATE_ENCODED))
return dk_msdk_encoder::ERR_CODE_SUCCESS;
_state = dk_msdk_encoder::ENCODER_STATE_ENCODING;
_state = dk_msdk_encoder::ENCODER_STATE_ENCODED;
return dk_msdk_encoder::ERR_CODE_SUCCESS;
}
dk_msdk_encoder::ERR_CODE msdk_encoder::get_queued_data(dk_msdk_encoder::dk_video_entity_t * bitstream)
{
if (_front)
{
bitstream->mem_type = dk_msdk_encoder::MEMORY_TYPE_HOST;
return _front->pop((uint8_t*)bitstream->data, bitstream->data_size, bitstream->pts);
}
else
{
return dk_msdk_encoder::ERR_CODE_FAIL;
}
}
dk_msdk_encoder::ERR_CODE msdk_encoder::encode_async(dk_video_encoder::dk_video_entity_t * input)
{
#if defined(WITH_ENCODING_THREAD)
return dk_msdk_encoder::ERR_CODE_SUCCESS;
#else
return dk_msdk_encoder::ERR_CODE_NOT_IMPLEMENTED;
#endif
}
dk_msdk_encoder::ERR_CODE msdk_encoder::check_encoding_finish(void)
{
#if defined(WITH_ENCODING_THREAD)
if (::WaitForSingleObject(_encoding_finish_event, 0) == WAIT_OBJECT_0)
return dk_msdk_encoder::ERR_CODE_SUCCESS;
else
return dk_msdk_encoder::ERR_CODE_ENCODING_UNDER_PROCESSING;
#else
return dk_msdk_encoder::ERR_CODE_NOT_IMPLEMENTED;
#endif
}
#if defined(WITH_AMF_CALLBACK_THREAD)
unsigned __stdcall msdk_encoder::query_output_callback(void * param)
{
msdk_encoder * self = static_cast<msdk_encoder*>(param);
self->query_output();
return 0;
}
void msdk_encoder::query_output(void)
{
AMF_RESULT status = AMF_OK; // error checking can be added later
_cb_run = true;
while (_cb_run)
{
if (::WaitForSingleObject(_cb_event, 5000) == WAIT_OBJECT_0)
{
do
{
} while (0);
}
}
}
#endif
#if defined(WITH_ENCODING_THREAD)
unsigned __stdcall msdk_encoder::process_encoding_callback(void * param)
{
msdk_encoder * self = static_cast<msdk_encoder*>(param);
self->process_encoding();
return 0;
}
void msdk_encoder::process_encoding(void)
{
_encoding_run = true;
while (_encoding_run)
{
if (_encoding)
{
//D3DLOCKED_RECT lockedRect;
//((LPDIRECT3DSURFACE9)_encoding_param.surface)->LockRect(&lockedRect, NULL, 0);
D3DXSaveSurfaceToFile(L"screen_1.bmp", D3DXIFF_BMP, (LPDIRECT3DSURFACE9)_encoding_param.surface, NULL, NULL);
encode(&_encoding_param);
//((LPDIRECT3DSURFACE9)_encoding_param.surface)->UnlockRect();
//((IDirect3DSurface9*)_encoding_param.surface)->Release();
//_encoding_param.surface = nullptr;
_encoding = false;
}
else
{
::Sleep(1);
}
}
}
#endif
mfxStatus msdk_encoder::init_encoder_parameter(void)
{
switch (_config->codec)
{
case dk_msdk_encoder::SUBMEDIA_TYPE_H264:
_encoder_param.mfx.CodecId = MFX_CODEC_AVC;
break;
case dk_msdk_encoder::SUBMEDIA_TYPE_HEVC:
_encoder_param.mfx.CodecId = MFX_CODEC_HEVC;
break;
case dk_msdk_encoder::SUBMEDIA_TYPE_VC1:
_encoder_param.mfx.CodecId = MFX_CODEC_VC1;
break;
case dk_msdk_encoder::SUBMEDIA_TYPE_MVC:
_encoder_param.mfx.CodecId = MFX_CODEC_AVC;
_encoder_param.mfx.CodecProfile = MFX_PROFILE_AVC_STEREO_HIGH;
break;
case dk_msdk_encoder::SUBMEDIA_TYPE_JPEG:
_encoder_param.mfx.CodecId = MFX_CODEC_JPEG;
_encoder_param.mfx.Interleaved = 1;
_encoder_param.mfx.Quality = _config->quality;
_encoder_param.mfx.RestartInterval = 0;
ZERO_MEMORY(_encoder_param.mfx.reserved5);
break;
case dk_msdk_encoder::SUBMEDIA_TYPE_VP8:
_encoder_param.mfx.CodecId = MFX_CODEC_VP8;
break;
}
switch (_config->usage)
{
case dk_msdk_encoder::USAGE_BALANCED:
_encoder_param.mfx.TargetUsage = MFX_TARGETUSAGE_BEST_QUALITY;
break;
case dk_msdk_encoder::USAGE_BEST_QUALITY:
_encoder_param.mfx.TargetUsage = MFX_TARGETUSAGE_BALANCED;
break;
case dk_msdk_encoder::USAGE_BEST_SPEED:
_encoder_param.mfx.TargetUsage = MFX_TARGETUSAGE_BEST_SPEED;
break;
}
_encoder_param.mfx.TargetKbps = _config->bitrate / 1000; // in Kbps
switch (_config->rc_mode)
{
case dk_msdk_encoder::RC_MODE_CONSTQP:
_encoder_param.mfx.RateControlMethod = MFX_RATECONTROL_CQP;
//_encoder_param.mfx.QPI = pInParams->nQPI;
//_encoder_param.mfx.QPP = pInParams->nQPP;
//_encoder_param.mfx.QPB = pInParams->nQPB;
break;
case dk_msdk_encoder::RC_MODE_VBR:
_encoder_param.mfx.RateControlMethod = MFX_RATECONTROL_VBR;
break;
case dk_msdk_encoder::RC_MODE_CBR:
_encoder_param.mfx.RateControlMethod = MFX_RATECONTROL_CBR;
break;
case dk_msdk_encoder::RC_MODE_AVBR:
_encoder_param.mfx.RateControlMethod = MFX_RATECONTROL_AVBR;
break;
case dk_msdk_encoder::RC_MODE_LA:
_encoder_param.mfx.RateControlMethod = MFX_RATECONTROL_LA;
break;
case dk_msdk_encoder::RC_MODE_ICQ:
_encoder_param.mfx.RateControlMethod = MFX_RATECONTROL_ICQ;
break;
case dk_msdk_encoder::RC_MODE_VCM:
_encoder_param.mfx.RateControlMethod = MFX_RATECONTROL_VCM;
break;
case dk_msdk_encoder::RC_MODE_LA_ICQ:
_encoder_param.mfx.RateControlMethod = MFX_RATECONTROL_LA_ICQ;
break;
case dk_msdk_encoder::RC_MODE_LA_EXT:
_encoder_param.mfx.RateControlMethod = MFX_RATECONTROL_LA_EXT;
break;
case dk_msdk_encoder::RC_MODE_LA_HRD:
_encoder_param.mfx.RateControlMethod = MFX_RATECONTROL_LA_HRD;
break;
case dk_msdk_encoder::RC_MODE_QVBR:
_encoder_param.mfx.RateControlMethod = MFX_RATECONTROL_QVBR;
break;
}
_encoder_param.mfx.NumSlice = _config->slice_per_frame;
convert_fps(_config->fps, &_encoder_param.mfx.FrameInfo.FrameRateExtN, &_encoder_param.mfx.FrameInfo.FrameRateExtD);
_encoder_param.mfx.EncodedOrder = 0; // binary flag, 0 signals encoder to take frames in display order
if (_config->mem_type == dk_msdk_encoder::MEMORY_TYPE_HOST)
_encoder_param.IOPattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY;
else
_encoder_param.IOPattern = MFX_IOPATTERN_IN_VIDEO_MEMORY;
_encoder_param.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12;
_encoder_param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
_encoder_param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
_encoder_param.mfx.FrameInfo.Width = ALIGN16(_config->width);
_encoder_param.mfx.FrameInfo.Height = (_encoder_param.mfx.FrameInfo.PicStruct == MFX_PICSTRUCT_PROGRESSIVE) ? ALIGN16(_config->height) : ALIGN32(_config->height);
_encoder_param.mfx.FrameInfo.CropX = 0;
_encoder_param.mfx.FrameInfo.CropY = 0;
_encoder_param.mfx.FrameInfo.CropW = _config->width;
_encoder_param.mfx.FrameInfo.CropH = _config->height;
/*// configure and attach external parameters
if (MVC_ENABLED & pInParams->MVC_flags)
m_EncExtParams.push_back((mfxExtBuffer *)&m_MVCSeqDesc);
if (MVC_VIEWOUTPUT & pInParams->MVC_flags)
{
// ViewOuput option requested
m_CodingOption.ViewOutput = MFX_CODINGOPTION_ON;
m_EncExtParams.push_back((mfxExtBuffer *)&m_CodingOption);
}
// configure the depth of the look ahead BRC if specified in command line
if (pInParams->nLADepth || pInParams->nMaxSliceSize)
{
m_CodingOption2.LookAheadDepth = pInParams->nLADepth;
m_CodingOption2.MaxSliceSize = pInParams->nMaxSliceSize;
m_EncExtParams.push_back((mfxExtBuffer *)&m_CodingOption2);
}
// In case of HEVC when height and/or width divided with 8 but not divided with 16
// add extended parameter to increase performance
if ((!((m_mfxEncParams.mfx.FrameInfo.CropW & 15) ^ 8) ||
!((m_mfxEncParams.mfx.FrameInfo.CropH & 15) ^ 8)) &&
(m_mfxEncParams.mfx.CodecId == MFX_CODEC_HEVC))
{
m_ExtHEVCParam.PicWidthInLumaSamples = m_mfxEncParams.mfx.FrameInfo.CropW;
m_ExtHEVCParam.PicHeightInLumaSamples = m_mfxEncParams.mfx.FrameInfo.CropH;
m_EncExtParams.push_back((mfxExtBuffer*)&m_ExtHEVCParam);
}
if (!m_EncExtParams.empty())
{
_encoder_param.ExtParam = &m_EncExtParams[0]; // vector is stored linearly in memory
_encoder_param.NumExtParam = (mfxU16)m_EncExtParams.size();
}*/
_encoder_param.AsyncDepth = 4;
return MFX_ERR_NONE;
}
mfxStatus msdk_encoder::init_vpp_parameter(void)
{
}
bool msdk_encoder::check_version(mfxVersion * version, dk_msdk_encoder::MSDK_API_FEATURE feature)
{
if (!version->Major || (version->Major > 1))
{
return false;
}
switch (feature)
{
case dk_msdk_encoder::MSDK_FEATURE_NONE:
return true;
case dk_msdk_encoder::MSDK_FEATURE_MVC:
if ((version->Major == 1) && (version->Minor >= 3))
{
return true;
}
break;
case dk_msdk_encoder::MSDK_FEATURE_JPEG_DECODE:
if ((version->Major == 1) && (version->Minor >= 3))
{
return true;
}
break;
case dk_msdk_encoder::MSDK_FEATURE_LOW_LATENCY:
if ((version->Major == 1) && (version->Minor >= 3))
{
return true;
}
break;
case dk_msdk_encoder::MSDK_FEATURE_MVC_VIEWOUTPUT:
if ((version->Major == 1) && (version->Minor >= 4))
{
return true;
}
break;
case dk_msdk_encoder::MSDK_FEATURE_JPEG_ENCODE:
if ((version->Major == 1) && (version->Minor >= 6))
{
return true;
}
break;
case dk_msdk_encoder::MSDK_FEATURE_LOOK_AHEAD:
if ((version->Major == 1) && (version->Minor >= 7))
{
return true;
}
break;
case dk_msdk_encoder::MSDK_FEATURE_PLUGIN_API:
if ((version->Major == 1) && (version->Minor >= 8))
{
return true;
}
break;
default:
return false;
}
return false;
}
mfxStatus msdk_encoder::convert_fps(mfxF64 dFrameRate, mfxU32 * pnFrameRateExtN, mfxU32 * pnFrameRateExtD)
{
mfxU32 fr;
fr = (mfxU32)(dFrameRate + .5);
if (fabs(fr - dFrameRate) < 0.0001)
{
*pnFrameRateExtN = fr;
*pnFrameRateExtD = 1;
return MFX_ERR_NONE;
}
fr = (mfxU32)(dFrameRate * 1.001 + .5);
if (fabs(fr * 1000 - dFrameRate * 1001) < 10)
{
*pnFrameRateExtN = fr * 1000;
*pnFrameRateExtD = 1001;
return MFX_ERR_NONE;
}
*pnFrameRateExtN = (mfxU32)(dFrameRate * 10000 + .5);
*pnFrameRateExtD = 10000;
return MFX_ERR_NONE;
}
mfxF64 msdk_encoder::calculate_fps(mfxU32 nFrameRateExtN, mfxU32 nFrameRateExtD)
{
if (nFrameRateExtN && nFrameRateExtD)
return (mfxF64)nFrameRateExtN / nFrameRateExtD;
else
return 0;
}
| [
"[email protected]"
] | |
eaccb0015a77d2d956aa306da8899d2b733c8c4f | 30656e026ffce9ebf902aa92ac25182750a68ef0 | /Projects/Assignment8.cpp | 78edb009762e474e35517bd16f12166345ab69be | [] | no_license | embosi97/CSCI-211-Object-Oriented-Programming-in-CPP | 7a9aa08c1a1ef1d6b26d8eccdbf0d1a0aa6afacc | ee784090e034a9399be2f0d2644ba5a677c9a6b6 | refs/heads/master | 2023-03-06T11:19:49.539688 | 2021-02-17T01:50:04 | 2021-02-17T01:50:04 | 339,582,743 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,098 | cpp | #include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
void print(int q[]) {
int i, j, k, l;
typedef char box[5][7];
box bb, wb, *board[8][8];
static box bq = { {char(219),char(219),char(219),char(219),char(219),char(219),char(219)},
{char(219),' ' ,char(219),' ' ,char(219),' ' ,char(219)},
{char(219),' ' ,' ' ,' ' ,' ' ,' ' ,char(219)},
{char(219),' ' ,' ' ,' ' ,' ' ,' ' ,char(219)},
{char(219),char(219),char(219),char(219),char(219),char(219),char(219)} };
static box wq = { {' ' ,' ' ,' ' ,' ' ,' ' ,' ' ,' ' },
{' ' ,char(241),' ' ,char(241),' ' ,char(241),' ' },
{' ' ,char(241),char(241),char(241),char(241),char(241),' ' },
{' ' ,char(241),char(241),char(241),char(241),char(241),' ' },
{' ' ,' ' ,' ' ,' ' ,' ' ,' ' ,' ' } };
// fill in bb = black box and wb = white box
for (i = 0; i < 5; i++)
for (j = 0; j < 7; j++)
{
wb[i][j] = ' ';
bb[i][j] = char(219);
}
// fill board with pointers to bb and wb in alterate positions
for (i = 0; i < 8; i++)
for (j = 0; j < 8; j++)
if ((i + j) % 2 == 0) {
if (q[i] == j) {
board[i][j] = &wq;
} else {
board[i][j] = &wb;
}
} else {
if (q[i] == j) {
board[i][j] = &bq;
} else {
board[i][j] = &bb;
}
}
// print the board via the pointers in array board
// first print the upper border
cout << " ";
for (i = 0; i < 7 * 8; i++)
cout << "_";
cout << endl;
// now print the board
for (i = 0; i < 8; i++)
for (k = 0; k < 5; k++)
{
cout << " " << "|"; // print the left boarder
for (j = 0; j < 8; j++)
for (l = 0; l < 7; l++)
cout << (*board[i][j])[k][l];
cout << "|" << endl; // at end of line print bar and then newline
}
// before exiting print lower border
cout << " ";
for (i = 0; i < 7 * 8; i++)
cout << "_";
cout << endl;
}
bool isOk(int q[], int c) {
for (int i = 0; i < c; i++) {
if (q[i] == q[c] || c - i == abs(q[c] - q[i]))
return false;
}
return true;
}
void backtrack(int q[], int &c) {
c--;
if (c == -1) {
exit(0);
q[c]++;
}
}
int main() {
static int solution = 0;
cout << "Solution # " << ++solution << ":" << endl;
int q[8] = {}, c = 0;
q[0] = 0;
while (c >= 0) {
c++;
if (c == 8) {
print(q);
backtrack(q, c);
} else {
q[c] = -1;
} while (c >= 0) {
q[c]++;
if (q[c] == 8) {
backtrack(q, c);
} else {
if (isOk(q, c))
break;
}
}
}
return 0;
}
| [
"[email protected]"
] | |
6a87f574a8c587f478503d4f06916ee0e94771b8 | ebd8718bb85fa296fb5a1cd6c762941fe54306ae | /core/cc/windows/crash_handler.cpp | 140528f0a0c633e8baa448145a3b66ca2ab59ef0 | [
"Apache-2.0"
] | permissive | y-novikov/gapid | d54f88494f736707f0f1e368b043680531cd5c15 | 17d908132a976dafa904cb001fb57620afe117ec | refs/heads/master | 2021-09-04T06:49:14.455444 | 2018-01-09T20:02:14 | 2018-01-11T17:21:43 | 117,157,387 | 0 | 0 | null | 2018-01-11T21:46:06 | 2018-01-11T21:46:06 | null | UTF-8 | C++ | false | false | 2,474 | cpp | /*
* Copyright (C) 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "../crash_handler.h"
#include "client/windows/handler/exception_handler.h"
#include "../log.h"
#include <windows.h>
#include <memory>
namespace {
static bool handleCrash(const wchar_t* minidumpDir, const wchar_t* minidumpId, void* crashHandlerPtr,
EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion, bool succeeded) {
core::CrashHandler* crashHandler = reinterpret_cast<core::CrashHandler*>(crashHandlerPtr);
// convert wchar_t to UTF-8
size_t dirLen = WideCharToMultiByte(CP_UTF8, 0, minidumpDir, -1, NULL, 0, NULL, NULL);
size_t IdLen = WideCharToMultiByte(CP_UTF8, 0, minidumpId, -1, NULL, 0, NULL, NULL);
std::unique_ptr<char[]> dirBuffer(new char[dirLen]);
std::unique_ptr<char[]> idBuffer(new char[IdLen]);
WideCharToMultiByte(CP_UTF8, 0, minidumpDir, -1, dirBuffer.get(), dirLen, NULL, NULL);
WideCharToMultiByte(CP_UTF8, 0, minidumpId, -1, idBuffer.get(), IdLen, NULL, NULL);
std::string minidumpPath(dirBuffer.get());
minidumpPath.append(idBuffer.get());
minidumpPath.append(".dmp");
return crashHandler->handleMinidump(minidumpPath, succeeded);
}
}
namespace core {
CrashHandler::CrashHandler() : mHandlerFunction(defaultHandlerFunction) {
wchar_t tempPathBuf[MAX_PATH+1];
GetTempPathW(MAX_PATH+1, tempPathBuf);
std::wstring tempPath(tempPathBuf);
mHandler = std::unique_ptr<google_breakpad::ExceptionHandler>(new google_breakpad::ExceptionHandler(
tempPath, NULL, ::handleCrash, reinterpret_cast<void*>(this),
google_breakpad::ExceptionHandler::HandlerType::HANDLER_ALL));
}
// this prevents unique_ptr<CrashHandler> from causing an incomplete type error from inlining the destructor.
// The incomplete type is the previously forward declared google_breakpad::ExceptionHandler.
CrashHandler::~CrashHandler() = default;
} // namespace core
| [
"[email protected]"
] | |
eecc0927363365cfaa9d29622c616e9a71412d02 | 0ab5b3e86ea65a9fb216e7178b3f8ae5fe6b3a1c | /mobile/taf/include/servant/Global.h | 6a1961c4e8730fb0113be4e7e890162926c6e8ee | [] | no_license | lineCode/mobile-1 | 197675bcde3d8db021c84858e276fc961b960643 | 66971911b57105b8ef5ad126b089b3fd1cc0f9b0 | refs/heads/master | 2020-03-29T11:02:22.037467 | 2017-02-13T09:40:59 | 2017-02-13T09:40:59 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 7,473 | h | #ifndef __TAF_GLOBAL_H_
#define __TAF_GLOBAL_H_
#include <inttypes.h>
#include <iostream>
#include <sstream>
#include <map>
#include <list>
#include <deque>
#include <vector>
#include <memory>
#include <netinet/in.h>
#include <errno.h>
#include <iomanip>
#include <sys/ipc.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>
#include "util/tc_clientsocket.h"
#include "util/tc_autoptr.h"
#include "util/tc_common.h"
#include "util/tc_logger.h"
#include "util/tc_thread_mutex.h"
#include "util/tc_functor.h"
#include "util/tc_loki.h"
#include "jce/RequestF.h"
#include "servant/BaseF.h"
using namespace std;
namespace taf
{
class Communicator;
class AdapterProxy;
class ServantProxy;
class ServantProxyCallback;
class ServantProxyRouter;
class ObjectProxy;
class BaseProxy;
class JceCurrent;
class FDReactor;
class QueueTimeout;
//class TMReactor;
//class FDEventHandle;
class Transceiver;
class TransceiverHandle;
class ReqMessage;
class StatFProxy;
class StatReport;
class ServantProxyFactory;
class ObjectProxyFactory;
class AdapterProxyFactory;
//class TMEventHandle;
class AsyncProcThread;
class AsyncProcThreadRunner;
//class ThreadContextCallback;
//class PrivateContextThread;
typedef TC_AutoPtr<Communicator> CommunicatorPtr;
//typedef TC_AutoPtr<AdapterProxy> AdapterPrx;
typedef TC_AutoPtr<ServantProxy> ServantPrx;
typedef TC_AutoPtr<ServantProxyCallback> ServantProxyCallbackPtr;
//typedef TC_AutoPtr<ThreadContextCallback> ThreadContextCallbackPtr;
typedef TC_AutoPtr<ServantProxyRouter> ServantProxyRouterPtr;
typedef TC_AutoPtr<ObjectProxy> ObjectPrx;
typedef TC_AutoPtr<JceCurrent> JceCurrentPtr;
typedef TC_AutoPtr<StatFProxy> StatFPrx;
typedef TC_AutoPtr<StatReport> StatReportPtr;
typedef TC_AutoPtr<BaseProxy> BasePrx;
typedef TC_AutoPtr<FDReactor> FDReactorPtr;
typedef TC_AutoPtr<QueueTimeout> QueueTimeoutPtr;
//typedef TC_AutoPtr<TMReactor> TMReactorPtr;
//typedef TC_AutoPtr<FDEventHandle> FDEventHandlePtr;
//typedef TC_AutoPtr<Transceiver> TransceiverPtr;
typedef TC_AutoPtr<TransceiverHandle> TransceiverHandlePtr;
typedef TC_AutoPtr<ReqMessage> ReqMessagePtr;
typedef TC_AutoPtr<ServantProxyFactory> ServantProxyFactoryPtr;
typedef TC_AutoPtr<ObjectProxyFactory> ObjectProxyFactoryPtr;
typedef TC_AutoPtr<AdapterProxyFactory> AdapterProxyFactoryPtr;
//typedef TC_AutoPtr<TMEventHandle> TMEventHandlePtr;
typedef TC_AutoPtr<AsyncProcThread> AsyncProcThreadPtr;
typedef TC_AutoPtr<AsyncProcThreadRunner> AsyncProcThreadRunnerPtr;
//typedef TC_AutoPtr<PrivateContextThread> PrivateContextThreadPtr;
//////////////////////////////////////////////////////////////
// 定义TAF网络调用的异常基类
struct TafException : public TC_Exception
{
TafException(const string &buffer) : TC_Exception(buffer){};
TafException(const string &buffer, int err) : TC_Exception(buffer, err){};
~TafException() throw(){};
/**
* 根据返回值抛出异常
* @param ret
* @param desc
*/
static void throwException(int ret, const string& desc = "");
};
////////////////////////////////////////////////////////////////
// 定义网络异常
/**
* 建立连接异常
*/
struct TafNetConnectException : public TafException
{
TafNetConnectException(const string &buffer) : TafException(buffer){};
TafNetConnectException(const string &buffer, int err) : TafException(buffer, err){};
~TafNetConnectException() throw(){};
};
/**
* 链接丢失
*/
struct TafNetConnectLostException : public TafException
{
TafNetConnectLostException(const string &buffer) : TafException(buffer){};
TafNetConnectLostException(const string &buffer, int err) : TafException(buffer, err){};
~TafNetConnectLostException() throw(){};
};
/**
* Socket异常
*/
struct TafNetSocketException : public TafException
{
TafNetSocketException(const string &buffer) : TafException(buffer){};
TafNetSocketException(const string &buffer, int err) : TafException(buffer, err){};
~TafNetSocketException() throw(){};
};
/**
* Proxy解码异常
*/
struct TafProxyDecodeException : public TafException
{
TafProxyDecodeException(const string &buffer) : TafException(buffer){};
TafProxyDecodeException(const string &buffer, int err) : TafException(buffer, err){};
~TafProxyDecodeException() throw(){};
};
/**
* Proxy编码异常
*/
struct TafProxyEncodeException : public TafException
{
TafProxyEncodeException(const string &buffer) : TafException(buffer){};
TafProxyEncodeException(const string &buffer, int err) : TafException(buffer, err){};
~TafProxyEncodeException() throw(){};
};
/**
* Server编码异常
*/
struct TafServerEncodeException : public TafException
{
TafServerEncodeException(const string &buffer) : TafException(buffer){};
TafServerEncodeException(const string &buffer, int err) : TafException(buffer, err){};
~TafServerEncodeException() throw(){};
};
/**
* Server解码异常
*/
struct TafServerDecodeException : public TafException
{
TafServerDecodeException(const string &buffer) : TafException(buffer){};
TafServerDecodeException(const string &buffer, int err) : TafException(buffer, err){};
~TafServerDecodeException() throw(){};
};
/**
* Server无函数异常
*/
struct TafServerNoFuncException : public TafException
{
TafServerNoFuncException(const string &buffer) : TafException(buffer){};
TafServerNoFuncException(const string &buffer, int err) : TafException(buffer, err){};
~TafServerNoFuncException() throw(){};
};
/**
* Server无对象异常
*/
struct TafServerNoServantException : public TafException
{
TafServerNoServantException(const string &buffer) : TafException(buffer){};
TafServerNoServantException(const string &buffer, int err) : TafException(buffer, err){};
~TafServerNoServantException() throw(){};
};
/**
* 消息在服务端队列超时
*/
struct TafServerQueueTimeoutException : public TafException
{
TafServerQueueTimeoutException(const string &buffer) : TafException(buffer){};
TafServerQueueTimeoutException(const string &buffer, int err) : TafException(buffer, err){};
~TafServerQueueTimeoutException() throw(){};
};
/**
* 服务端返回的未知值
*/
struct TafServerUnknownException : public TafException
{
TafServerUnknownException(const string &buffer) : TafException(buffer){};
TafServerUnknownException(const string &buffer, int err) : TafException(buffer, err){};
~TafServerUnknownException() throw(){};
};
/**
* 同步调用超时异常
*/
struct TafSyncCallTimeoutException : public TafException
{
TafSyncCallTimeoutException (const string &buffer) : TafException(buffer){};
TafSyncCallTimeoutException (const string &buffer, int err) : TafException(buffer, err){};
~TafSyncCallTimeoutException () throw(){};
};
/**
* 访问 Registry 错误
*/
struct TafRegistryException : public TafException
{
TafRegistryException(const string &buffer) : TafException(buffer){};
TafRegistryException(const string &buffer, int err) : TafException(buffer, err){};
~TafRegistryException() throw(){};
};
/**
* 服务端重置Grid状态
*/
struct TafServerResetGridException : public TafException
{
TafServerResetGridException(const string &buffer) : TafException(buffer){};
TafServerResetGridException(const string &buffer, int err) : TafException(buffer, err){};
~TafServerResetGridException() throw(){};
};
///////////////////////////////////////////////////////////////////
}
#endif
| [
"[email protected]"
] | |
7c9afde6bb59a286ebacdcd315bffb25d6f81783 | 53da134a84dd99bb2930e8488b36e73c3e4a4352 | /src/BlockSpawnerFunc/TutorialSpawnerFunc.h | 543a32d0ffa751e3be68ca7b6e28ee51df845e8d | [] | permissive | rishi-menon/Dasher | 27c13fe9c90f900257c4a18877e6097eab8f2deb | 2613d25a5c8484002e37905b445aed1c3f233343 | refs/heads/master | 2023-04-25T20:18:50.579107 | 2021-06-06T06:13:15 | 2021-06-06T06:13:15 | 273,335,716 | 5 | 0 | MIT | 2021-01-19T17:11:38 | 2020-06-18T20:39:53 | C++ | UTF-8 | C++ | false | false | 248 | h | #pragma once
#include "Events/BlockSpawnerLayer.h"
class TutorialBlockSpawnerLayer;
extern TutorialBlockSpawnerLayer* g_currentInstance;
extern void TutorialSpawnerFunc (CircularQueue<Block>& blocksQueue, double& nextSpawnTime, double curPhase);
| [
"[email protected]"
] | |
ec98a82cd43ac9bc4c7ff36854096e99e95fb1bf | 2f963bca8b440d23edfc9a46c31fdeab65aa15a0 | /third_party/SimpleBLE/simpleble/src_c/simpleble.cpp | d588906ffdd3b042ab04b08953e6faf3387ca556 | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | OpenBCI/OpenBCI_GUI_Helpers | 1fa52e150fa1a49480b8c08b342a7e7bc797010a | dd608e9635971c96f14f923a940d277ef7a979f7 | refs/heads/master | 2023-08-31T15:01:03.661902 | 2023-03-13T23:20:24 | 2023-03-13T23:20:24 | 238,425,587 | 4 | 6 | MIT | 2023-08-21T21:38:53 | 2020-02-05T10:38:45 | C | UTF-8 | C++ | false | false | 107 | cpp | #include <simpleble_c/simpleble.h>
#include <cstdlib>
void simpleble_free(void* handle) { free(handle); } | [
"[email protected]"
] | |
373848c832a64a233517413d9c233d66d658e06f | a1f60f65f8d92f89bdb0bce03c12a588279267ca | /src/pubkey.h | d9cad821e91f60611aef12dedceed23e4821134e | [
"MIT"
] | permissive | IngenuityCoin/Ingenuity | e262eadc29e4485336dd04e978869e1501ff28f1 | 475289926e435a9939358c695f4f10d1503bfa0c | refs/heads/master | 2020-04-04T19:14:51.892964 | 2019-03-11T12:11:49 | 2019-03-11T12:11:49 | 156,198,049 | 4 | 5 | null | null | null | null | UTF-8 | C++ | false | false | 7,906 | h | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2016-2018 The PIVX developers
// Copyright (c) 2018-2019 The Ingenuity developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef Ingenuity_PUBKEY_H
#define Ingenuity_PUBKEY_H
#include "hash.h"
#include "serialize.h"
#include "uint256.h"
#include <stdexcept>
#include <vector>
const unsigned int BIP32_EXTKEY_SIZE = 74;
/** A reference to a CKey: the Hash160 of its serialized public key */
class CKeyID : public uint160
{
public:
CKeyID() : uint160() {}
explicit CKeyID(const uint160& in) : uint160(in) {}
};
typedef uint256 ChainCode;
/** An encapsulated public key. */
class CPubKey
{
public:
/**
* secp256k1:
*/
static const unsigned int PUBLIC_KEY_SIZE = 65;
static const unsigned int COMPRESSED_PUBLIC_KEY_SIZE = 33;
static const unsigned int SIGNATURE_SIZE = 72;
static const unsigned int COMPACT_SIGNATURE_SIZE = 65;
/**
* see www.keylength.com
* script supports up to 75 for single byte push
*/
static_assert(
PUBLIC_KEY_SIZE >= COMPRESSED_PUBLIC_KEY_SIZE,
"COMPRESSED_PUBLIC_KEY_SIZE is larger than PUBLIC_KEY_SIZE");
private:
/**
* Just store the serialized data.
* Its length can very cheaply be computed from the first byte.
*/
unsigned char vch[PUBLIC_KEY_SIZE];
//! Compute the length of a pubkey with a given first byte.
unsigned int static GetLen(unsigned char chHeader)
{
if (chHeader == 2 || chHeader == 3)
return COMPRESSED_PUBLIC_KEY_SIZE;
if (chHeader == 4 || chHeader == 6 || chHeader == 7)
return PUBLIC_KEY_SIZE;
return 0;
}
//! Set this key data to be invalid
void Invalidate()
{
vch[0] = 0xFF;
}
public:
//! Construct an invalid public key.
CPubKey()
{
Invalidate();
}
//! Initialize a public key using begin/end iterators to byte data.
template <typename T>
void Set(const T pbegin, const T pend)
{
int len = pend == pbegin ? 0 : GetLen(pbegin[0]);
if (len && len == (pend - pbegin))
memcpy(vch, (unsigned char*)&pbegin[0], len);
else
Invalidate();
}
//! Construct a public key using begin/end iterators to byte data.
template <typename T>
CPubKey(const T pbegin, const T pend)
{
Set(pbegin, pend);
}
//! Construct a public key from a byte vector.
explicit CPubKey(const std::vector<unsigned char>& _vch)
{
Set(_vch.begin(), _vch.end());
}
//! Simple read-only vector-like interface to the pubkey data.
unsigned int size() const { return GetLen(vch[0]); }
const unsigned char* begin() const { return vch; }
const unsigned char* end() const { return vch + size(); }
const unsigned char& operator[](unsigned int pos) const { return vch[pos]; }
//! Comparator implementation.
friend bool operator==(const CPubKey& a, const CPubKey& b)
{
return a.vch[0] == b.vch[0] &&
memcmp(a.vch, b.vch, a.size()) == 0;
}
friend bool operator!=(const CPubKey& a, const CPubKey& b)
{
return !(a == b);
}
friend bool operator<(const CPubKey& a, const CPubKey& b)
{
return a.vch[0] < b.vch[0] ||
(a.vch[0] == b.vch[0] && memcmp(a.vch, b.vch, a.size()) < 0);
}
//! Implement serialization, as if this was a byte vector.
unsigned int GetSerializeSize(int nType, int nVersion) const
{
return size() + 1;
}
template <typename Stream>
void Serialize(Stream& s, int nType, int nVersion) const
{
unsigned int len = size();
::WriteCompactSize(s, len);
s.write((char*)vch, len);
}
template <typename Stream>
void Unserialize(Stream& s, int nType, int nVersion)
{
unsigned int len = ::ReadCompactSize(s);
if (len <= PUBLIC_KEY_SIZE) {
s.read((char*)vch, len);
} else {
// invalid pubkey, skip available data
char dummy;
while (len--)
s.read(&dummy, 1);
Invalidate();
}
}
//! Get the KeyID of this public key (hash of its serialization)
CKeyID GetID() const
{
return CKeyID(Hash160(vch, vch + size()));
}
//! Get the 256-bit hash of this public key.
uint256 GetHash() const
{
return Hash(vch, vch + size());
}
/*
* Check syntactic correctness.
*
* Note that this is consensus critical as CheckSig() calls it!
*/
bool IsValid() const
{
return size() > 0;
}
//! fully validate whether this is a valid public key (more expensive than IsValid())
bool IsFullyValid() const;
//! Check whether this is a compressed public key.
bool IsCompressed() const
{
return size() == COMPRESSED_PUBLIC_KEY_SIZE;
}
/**
* Verify a DER signature (~72 bytes).
* If this public key is not fully valid, the return value will be false.
*/
bool Verify(const uint256& hash, const std::vector<unsigned char>& vchSig) const;
/**
* Check whether a signature is normalized (lower-S).
*/
static bool CheckLowS(const std::vector<unsigned char>& vchSig);
//! Recover a public key from a compact signature.
bool RecoverCompact(const uint256& hash, const std::vector<unsigned char>& vchSig);
//! Turn this public key into an uncompressed public key.
bool Decompress();
//! Derive BIP32 child pubkey.
bool Derive(CPubKey& pubkeyChild, ChainCode &ccChild, unsigned int nChild, const ChainCode& cc) const;
std::vector<unsigned char> Raw() const
{
return std::vector<unsigned char>(vch, vch + size());
}
std::string GetHex()
{
std::string my_std_string(reinterpret_cast<const char*>(vch), 65);
return my_std_string;
}
};
struct CExtPubKey {
unsigned char nDepth;
unsigned char vchFingerprint[4];
unsigned int nChild;
ChainCode chaincode;
CPubKey pubkey;
friend bool operator==(const CExtPubKey& a, const CExtPubKey& b)
{
return a.nDepth == b.nDepth &&
memcmp(&a.vchFingerprint[0], &b.vchFingerprint[0], sizeof(vchFingerprint)) == 0 &&
a.nChild == b.nChild &&
a.chaincode == b.chaincode &&
a.pubkey == b.pubkey;
}
void Encode(unsigned char code[BIP32_EXTKEY_SIZE]) const;
void Decode(const unsigned char code[BIP32_EXTKEY_SIZE]);
bool Derive(CExtPubKey& out, unsigned int nChild) const;
void Serialize(CSizeComputer& s) const
{
// Optimized implementation for ::GetSerializeSize that avoids copying.
s.seek(BIP32_EXTKEY_SIZE + 1); // add one byte for the size (compact int)
}
template <typename Stream>
void Serialize(Stream& s) const
{
unsigned int len = BIP32_EXTKEY_SIZE;
::WriteCompactSize(s, len);
unsigned char code[BIP32_EXTKEY_SIZE];
Encode(code);
s.write((const char *)&code[0], len);
}
template <typename Stream>
void Unserialize(Stream& s)
{
unsigned int len = ::ReadCompactSize(s);
unsigned char code[BIP32_EXTKEY_SIZE];
if (len != BIP32_EXTKEY_SIZE)
throw std::runtime_error("Invalid extended key size\n");
s.read((char *)&code[0], len);
Decode(code);
}
};
/** Users of this module must hold an ECCVerifyHandle. The constructor and
* destructor of these are not allowed to run in parallel, though. */
class ECCVerifyHandle
{
static int refcount;
public:
ECCVerifyHandle();
~ECCVerifyHandle();
};
#endif // Ingenuity_PUBKEY_H
| [
"[email protected]"
] | |
3e5f6bb52f1b56bc81e2733f3ee08412a0bbe8e0 | e97178ce0c52be77487a1206cf1d99426fe777a1 | /src/m_random.cpp | 436b803bcae7d8065ccd3354f970014642ec3240 | [] | no_license | RomanHargrave/the-tower-of-babel | 923c0fbd525bb977b0d9719a787ac97b06be4822 | c30c440b1f24ee00976a68a8d761b89c27c590af | refs/heads/master | 2020-06-01T15:24:35.102932 | 2013-02-17T17:37:56 | 2013-02-17T17:37:56 | 35,354,525 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,977 | cpp | /*
** m_random.cpp
** Random number generators
**
**---------------------------------------------------------------------------
** Copyright 2002-2009 Randy Heit
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
**---------------------------------------------------------------------------
**
** This file employs the techniques for improving demo sync and backward
** compatibility that Lee Killough introduced with BOOM. However, none of
** the actual code he wrote is left. In contrast to BOOM, each RNG source
** in ZDoom is implemented as a separate class instance that provides an
** interface to the high-quality Mersenne Twister. See
** <http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html>.
**
** As Killough's description from m_random.h is still mostly relevant,
** here it is:
** killough 2/16/98:
**
** Make every random number generator local to each control-equivalent block.
** Critical for demo sync. The random number generators are made local to
** reduce the chances of sync problems. In Doom, if a single random number
** generator call was off, it would mess up all random number generators.
** This reduces the chances of it happening by making each RNG local to a
** control flow block.
**
** Notes to developers: if you want to reduce your demo sync hassles, follow
** this rule: for each call to P_Random you add, add a new class to the enum
** type below for each block of code which calls P_Random. If two calls to
** P_Random are not in "control-equivalent blocks", i.e. there are any cases
** where one is executed, and the other is not, put them in separate classes.
*/
// HEADER FILES ------------------------------------------------------------
#include <assert.h>
#include "doomstat.h"
#include "m_random.h"
#include "farchive.h"
#include "b_bot.h"
#include "m_png.h"
#include "m_crc32.h"
#include "i_system.h"
#include "c_dispatch.h"
#include "files.h"
// MACROS ------------------------------------------------------------------
#define RAND_ID MAKE_ID('r','a','N','d')
// TYPES -------------------------------------------------------------------
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
extern FRandom pr_spawnmobj;
extern FRandom pr_acs;
extern FRandom pr_chase;
extern FRandom pr_lost;
extern FRandom pr_slam;
extern FRandom pr_exrandom;
// PUBLIC DATA DEFINITIONS -------------------------------------------------
FRandom M_Random;
// Global seed. This is modified predictably to initialize every RNG.
DWORD rngseed;
// PRIVATE DATA DEFINITIONS ------------------------------------------------
FRandom *FRandom::RNGList;
static TDeletingArray<FRandom *> NewRNGs;
// CODE --------------------------------------------------------------------
//==========================================================================
//
// FRandom - Nameless constructor
//
// Constructing an RNG in this way means it won't be stored in savegames.
//
//==========================================================================
FRandom::FRandom ()
: NameCRC (0)
{
#ifndef NDEBUG
Name = NULL;
initialized = false;
#endif
Next = RNGList;
RNGList = this;
}
//==========================================================================
//
// FRandom - Named constructor
//
// This is the standard way to construct RNGs.
//
//==========================================================================
FRandom::FRandom (const char *name)
{
NameCRC = CalcCRC32 ((const BYTE *)name, (unsigned int)strlen (name));
#ifndef NDEBUG
initialized = false;
Name = name;
// A CRC of 0 is reserved for nameless RNGs that don't get stored
// in savegames. The chance is very low that you would get a CRC of 0,
// but it's still possible.
assert (NameCRC != 0);
#endif
// Insert the RNG in the list, sorted by CRC
FRandom **prev = &RNGList, *probe = RNGList;
while (probe != NULL && probe->NameCRC < NameCRC)
{
prev = &probe->Next;
probe = probe->Next;
}
#ifndef NDEBUG
if (probe != NULL)
{
// Because RNGs are identified by their CRCs in save games,
// no two RNGs can have names that hash to the same CRC.
// Obviously, this means every RNG must have a unique name.
assert (probe->NameCRC != NameCRC);
}
#endif
Next = probe;
*prev = this;
}
//==========================================================================
//
// FRandom - Destructor
//
//==========================================================================
FRandom::~FRandom ()
{
FRandom *rng, **prev;
FRandom *last = NULL;
prev = &RNGList;
rng = RNGList;
while (rng != NULL && rng != this)
{
last = rng;
rng = rng->Next;
}
if (rng != NULL)
{
*prev = rng->Next;
}
}
//==========================================================================
//
// FRandom :: StaticClearRandom
//
// Initialize every RNGs. RNGs are seeded based on the global seed and their
// name, so each different RNG can have a different starting value despite
// being derived from a common global seed.
//
//==========================================================================
void FRandom::StaticClearRandom ()
{
// go through each RNG and set each starting seed differently
for (FRandom *rng = FRandom::RNGList; rng != NULL; rng = rng->Next)
{
rng->Init(rngseed);
}
}
//==========================================================================
//
// FRandom :: Init
//
// Initialize a single RNG with a given seed.
//
//==========================================================================
void FRandom::Init(DWORD seed)
{
// [RH] Use the RNG's name's CRC to modify the original seed.
// This way, new RNGs can be added later, and it doesn't matter
// which order they get initialized in.
DWORD seeds[2] = { NameCRC, seed };
InitByArray(seeds, 2);
}
//==========================================================================
//
// FRandom :: StaticSumSeeds
//
// This function produces a DWORD that can be used to check the consistancy
// of network games between different machines. Only a select few RNGs are
// used for the sum, because not all RNGs are important to network sync.
//
//==========================================================================
DWORD FRandom::StaticSumSeeds ()
{
return
pr_spawnmobj.sfmt.u[0] + pr_spawnmobj.idx +
pr_acs.sfmt.u[0] + pr_acs.idx +
pr_chase.sfmt.u[0] + pr_chase.idx +
pr_lost.sfmt.u[0] + pr_lost.idx +
pr_slam.sfmt.u[0] + pr_slam.idx;
}
//==========================================================================
//
// FRandom :: StaticWriteRNGState
//
// Stores the state of every RNG into a savegame.
//
//==========================================================================
void FRandom::StaticWriteRNGState (FILE *file)
{
FRandom *rng;
FPNGChunkArchive arc (file, RAND_ID);
arc << rngseed;
for (rng = FRandom::RNGList; rng != NULL; rng = rng->Next)
{
// Only write those RNGs that have names
if (rng->NameCRC != 0)
{
arc << rng->NameCRC << rng->idx;
for (int i = 0; i < SFMT::N32; ++i)
{
arc << rng->sfmt.u[i];
}
}
}
}
//==========================================================================
//
// FRandom :: StaticReadRNGState
//
// Restores the state of every RNG from a savegame. RNGs that were added
// since the savegame was created are cleared to their initial value.
//
//==========================================================================
void FRandom::StaticReadRNGState (PNGHandle *png)
{
FRandom *rng;
size_t len = M_FindPNGChunk (png, RAND_ID);
if (len != 0)
{
const size_t sizeof_rng = sizeof(rng->NameCRC) + sizeof(rng->idx) + sizeof(rng->sfmt.u);
const int rngcount = (int)((len-4) / sizeof_rng);
int i;
DWORD crc;
FPNGChunkArchive arc (png->File->GetFile(), RAND_ID, len);
arc << rngseed;
FRandom::StaticClearRandom ();
for (i = rngcount; i; --i)
{
arc << crc;
for (rng = FRandom::RNGList; rng != NULL; rng = rng->Next)
{
if (rng->NameCRC == crc)
{
arc << rng->idx;
for (int i = 0; i < SFMT::N32; ++i)
{
arc << rng->sfmt.u[i];
}
break;
}
}
if (rng == NULL)
{ // The RNG was removed. Skip it.
int idx;
DWORD sfmt;
arc << idx;
for (int i = 0; i < SFMT::N32; ++i)
{
arc << sfmt;
}
}
}
png->File->ResetFilePtr();
}
}
//==========================================================================
//
// FRandom :: StaticFindRNG
//
// This function attempts to find an RNG with the given name.
// If it can't it will create a new one. Duplicate CRCs will
// be ignored and if it happens map to the same RNG.
// This is for use by DECORATE.
//
//==========================================================================
FRandom *FRandom::StaticFindRNG (const char *name)
{
DWORD NameCRC = CalcCRC32 ((const BYTE *)name, (unsigned int)strlen (name));
// Use the default RNG if this one happens to have a CRC of 0.
if (NameCRC == 0) return &pr_exrandom;
// Find the RNG in the list, sorted by CRC
FRandom **prev = &RNGList, *probe = RNGList;
while (probe != NULL && probe->NameCRC < NameCRC)
{
prev = &probe->Next;
probe = probe->Next;
}
// Found one so return it.
if (probe == NULL || probe->NameCRC != NameCRC)
{
// A matching RNG doesn't exist yet so create it.
probe = new FRandom(name);
// Store the new RNG for destruction when ZDoom quits.
NewRNGs.Push(probe);
}
return probe;
}
//==========================================================================
//
// FRandom :: StaticPrintSeeds
//
// Prints a snapshot of the current RNG states. This is probably wrong.
//
//==========================================================================
#ifndef NDEBUG
void FRandom::StaticPrintSeeds ()
{
FRandom *rng = RNGList;
while (rng != NULL)
{
int idx = rng->idx < SFMT::N32 ? rng->idx : 0;
Printf ("%s: %08x .. %d\n", rng->Name, rng->sfmt.u[idx], idx);
rng = rng->Next;
}
}
CCMD (showrngs)
{
FRandom::StaticPrintSeeds ();
}
#endif
| [
"[email protected]@0eb28523-2a4b-4d5f-ebe6-796f958357e9"
] | [email protected]@0eb28523-2a4b-4d5f-ebe6-796f958357e9 |
c52c7e5cd9447a2830d58081e1039facc0ebf805 | 848d8b12ea7a60e34ab5047367a701a06f473138 | /DLinkedList.cpp | 72df79dcbe23d1f7d9a14a83e5b6ff62d957504d | [] | no_license | 92tnrud92/database | 846f293d556046adfe87edda497dff7c9d269596 | f14725fc254ee28d86f8d2ed3f8a7a8c24ab051f | refs/heads/master | 2021-06-19T01:25:57.853901 | 2017-06-28T13:34:26 | 2017-06-28T13:34:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,268 | cpp | #include <stdio.h>
#include <stdlib.h>
#include "DLikedList.h"
void ListInit(List * plist)
{
plist->head = (Node*)malloc(sizeof(Node));
plist->head->next = NULL;
plist->numOfData = 0;
}
void FInsert(List * plist, LData data)
{
Node * newNode = (Node*)malloc(sizeof(Node));
newNode->data = data;
newNode->next = plist->head->next;
plist->head->next = newNode;
(plist->numOfData)++;
}
void LInsert(List * plist, LData data)
{
if (plist->comp == NULL)
FInsert(plist, data);
/* else
SInsert(plist, data);*/
}
int LFirst(List * plist, LData * pdata)
{
if (plist->head->next == NULL)
return FALSE;
plist->before = plist->head;
plist->cur = plist->head->next;
*pdata = plist->cur->data;
return TRUE;
}
int LNext(List * plist, LData * pdata)
{
if (plist->cur->next == NULL)
return FALSE;
plist->before = plist->cur;
plist->cur = plist->cur->next;
*pdata = plist->cur->data;
return TRUE;
}
LData LRemove(List * plist)
{
Node * rpos = plist->cur;
LData rdata = rpos->data;
plist->before->next = plist->cur->next;
plist->cur = plist->before;
free(rpos);
(plist->numOfData)--;
return rdata;
}
int LCount(List * plist)
{
return plist->numOfData;
}
| [
"[email protected]"
] | |
2b06a5fa58bd67fbdc8b785469bacc61f37aaa80 | 962ac382978958d8a85369a1c88321fae1d20098 | /sample_sketch.ino | 82dc1170267a64bb1453c9851a6382b27424df62 | [] | no_license | eriknl1982/esp8266_mh-z14a-mqtt | 909717920210d096a1a924c332c68add88a7ddff | 725b17227411d6a3bda840ca631ec3ec9896eb86 | refs/heads/master | 2020-03-13T23:28:31.988699 | 2018-04-27T19:20:32 | 2018-04-27T19:20:32 | 131,335,938 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,736 | ino | /***************************************************************************
Sample sketch for using a mh-z14a co2 with a ESP8266 sensor and sending the result over MQTT once a minute.
Written by Erik Lemcke, combined out of the following samples:
https://www.letscontrolit.com/forum/viewtopic.php?f=2&t=1785&start=40, calibration sample by s3030150
https://www.home-assistant.io/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/, home assistant mqqt by Paulus Schoutsen
wiring:
ESP --> mh-z14a
4 rx
5 tx
gnd gnd
Make sure the ESP is supplied with 3.3v, while the mh-z14a needs 5v
***************************************************************************/
#include <SoftwareSerial.h>
#include <SPI.h>
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#define INTERVAL 5000
#define MH_Z19_RX 4 //RX pin
#define MH_Z19_TX 5 //TX pin
#define wifi_ssid "<YOUR WIFI SSID>"
#define wifi_password "<YOUR WIFI PASSWORD>"
#define mqtt_server "<YOUR MQTT SERVER IP>"
#define mqtt_user "<YOUR MQTT USERNAME>"
#define mqtt_password "<YOUR MQTT PASSWORD>"
#define co2_topic "MHZ14A/co2"
WiFiClient espClient;
PubSubClient client(espClient);
byte mhzResp[9]; // 9 bytes bytes response
byte mhzCmdReadPPM[9] = {0xFF,0x01,0x86,0x00,0x00,0x00,0x00,0x00,0x79};
byte mhzCmdCalibrateZero[9] = {0xFF,0x01,0x87,0x00,0x00,0x00,0x00,0x00,0x78};
byte mhzCmdABCEnable[9] = {0xFF,0x01,0x79,0xA0,0x00,0x00,0x00,0x00,0xE6};
byte mhzCmdABCDisable[9] = {0xFF,0x01,0x79,0x00,0x00,0x00,0x00,0x00,0x86};
byte mhzCmdReset[9] = {0xFF,0x01,0x8d,0x00,0x00,0x00,0x00,0x00,0x72};
byte mhzCmdMeasurementRange1000[9] = {0xFF,0x01,0x99,0x00,0x00,0x00,0x03,0xE8,0x7B};
byte mhzCmdMeasurementRange2000[9] = {0xFF,0x01,0x99,0x00,0x00,0x00,0x07,0xD0,0x8F};
byte mhzCmdMeasurementRange3000[9] = {0xFF,0x01,0x99,0x00,0x00,0x00,0x0B,0xB8,0xA3};
byte mhzCmdMeasurementRange5000[9] = {0xFF,0x01,0x99,0x00,0x00,0x00,0x13,0x88,0xCB};
int shifts=0,co2ppm;
long previousMillis = 0;
SoftwareSerial co2Serial(MH_Z19_RX, MH_Z19_TX); // define MH-Z19
byte checksum(byte response[9]){
byte crc = 0;
for (int i = 1; i < 8; i++) {
crc += response[i];
}
crc = 255 - crc + 1;
return crc;
}
void disableABC() {
co2Serial.write(mhzCmdABCDisable, 9);
}
void enableABC() {
co2Serial.write(mhzCmdABCEnable, 9);
}
void setRange5000() {
co2Serial.write(mhzCmdMeasurementRange5000, 9);
}
void calibrateZero(){
co2Serial.write(mhzCmdCalibrateZero, 9);
}
int readCO2() {
byte cmd[9] = {0xFF, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79};
byte response[9];
co2Serial.write(cmd, 9);
// The serial stream can get out of sync. The response starts with 0xff, try to resync.
while (co2Serial.available() > 0 && (unsigned char)co2Serial.peek() != 0xFF) {
co2Serial.read();
shifts++;
}
memset(response, 0, 9);
co2Serial.readBytes(response, 9);
for (int i=0; i<9; i++) {
Serial.print(" 0x");
Serial.print(response[i], HEX);
}
Serial.println(" Response OK. Shifts="+String(shifts));
if (response[1] != 0x86)
{
Serial.println(" Invalid response from co2 sensor!");
return -1;
}
if (response[8] == checksum(response)) {
int responseHigh = (int) response[2];
int responseLow = (int) response[3];
int ppm = (256 * responseHigh) + responseLow;
return ppm;
} else {
Serial.println("CRC error!");
return -1;
}
}
void setup_wifi() {
delay(10);
// We start by connecting to a WiFi network
Serial.println();
Serial.print("Connecting to ");
Serial.println(wifi_ssid);
WiFi.mode(WIFI_STA); //Make sure the ESP isn't exposed as a access point
WiFi.begin(wifi_ssid, wifi_password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void reconnect() {
// Loop until we're reconnected
while (!client.connected()) {
Serial.print("Attempting MQTT connection...");
// Attempt to connect
// If you do not want to use a username and password, change next line to
// if (client.connect("ESP8266Client")) {
if (client.connect("ESP8266Client", mqtt_user, mqtt_password)) {
Serial.println("connected");
} else {
Serial.print("failed, rc=");
Serial.print(client.state());
Serial.println(" try again in 5 seconds");
// Wait 5 seconds before retrying
delay(5000);
}
}
}
void setup() {
Serial.begin(115200);
Serial.println("Startup");
setup_wifi();
client.setServer(mqtt_server, 1883);
unsigned long previousMillis = millis();
delay(500);
Serial.println("Disabling ABC");
disableABC();
Serial.println("Setting range to 5000");
setRange5000();
Serial.println("Waiting half an hour before calibrating zero");
delay(1800000);
calibrateZero();
Serial.println("Zero was calibrated");
}
long lastMsg = 0;
void loop() {
if (!client.connected()) {
reconnect();
}
client.loop();
long now = millis();
//send a meaage every minute
if (now - lastMsg > 60 * 1000) {
lastMsg = now;
unsigned long currentMillis = millis();
if (abs(currentMillis - previousMillis) > INTERVAL)
{
previousMillis = currentMillis;
Serial.print("Requesting CO2 concentration...");
co2ppm=-999;
co2ppm = readCO2();
//If no proper co2 value is returned, try again
while (co2ppm == -1){
Serial.print("re-Requesting CO2 concentration...");
co2ppm = readCO2();
}
Serial.println(" PPM = " + String(co2ppm));
client.publish(co2_topic, String(co2ppm).c_str(), true);
}
}
} | [
"[email protected]"
] | |
91247f2bc031c02053f0dc9b58649ad9ec3d86fe | 0c846022d0ed927b2d827764ec0e246cca2d7530 | /abc/abc128/3.cpp | a60f6ae0b23850cc897de98e1f496ae5c86a9a89 | [] | no_license | kagasan/atcoder | 03e3e0ba66b763fc3e16ff636e49d951e42d4ef6 | e3f851bbc20a4dd028e80db91b5c3d6b5fc5a61c | refs/heads/master | 2020-05-04T10:15:06.772386 | 2020-03-20T09:39:26 | 2020-03-20T09:39:26 | 179,084,448 | 5 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 797 | cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main(){
int N, M;
cin >> N >> M;
int flg[11][11] = {};
int p[11] = {};
for(int i = 0; i < M; i++){
int k;
cin >> k;
for(int j = 0; j < k; j++){
int s;
cin >> s;
s--;
flg[i][s] = 1;
}
}
for(int i = 0; i < M; i++)cin >> p[i];
int ans = 0;
for(int i = 0; i < (1 << N); i++){
int f = 1;
for(int j = 0; j < M; j++){
int cnt = 0;
for(int k = 0; k < N; k++){
if((i & (1 << k)) && flg[j][k])cnt++;
}
if(cnt % 2 != p[j]){
f = 0;
}
}
if(f)ans++;
}
cout << ans << endl;
return 0;
} | [
"[email protected]"
] | |
64748b43b0af0fd760632c475fc201b4f3b88d1e | 27a013c0b95b09ec9dcd36e72c9817a089919fd9 | /Arduino/tinkercad.ino | fe9640d251c21444888fc6d135c4247cae373250 | [] | no_license | AlejoCuPe/Ovo | 670e1d2d7e867f092edb25e8b64ca46e1fbfcb47 | 4bec7293386820f9be7da9c407952fbe325fd6e3 | refs/heads/master | 2020-05-27T12:58:16.659230 | 2019-05-30T04:59:51 | 2019-05-30T04:59:51 | 188,627,637 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,251 | ino | /*
A0 instead of 14
https://www.baldengineer.com/tips/arduino-pinmode-on-analog-inputs
*/
const byte tamanoTablero = 4;
const int entradas[tamanoTablero][tamanoTablero] = {
{0, 2, 3, 4},
{5, 6, 7, 8},
{9, 10, 11, 12},
{13, 14, 15, 16}
};
// La RX no pasa nada PERO con la TX se jode por que se intenta
// comunicar
/*
Para 2 jugadores seran jugador A y B, Para 4 seran jugador A,B,C Y D.
*/
byte tablero[tamanoTablero][tamanoTablero];
byte cantidadJugadores = 0;
boolean enJuego = false;
byte areaBusqueda = 2;
byte partidaI = 10;
byte partidaJ = 10;
byte finI;
byte finJ;
void setup()
{
Serial.begin(9600);
for (byte i = 0; i < tamanoTablero; i++) {
for (byte j = 0; j < tamanoTablero; j++) {
pinMode(entradas[i][j], INPUT);
}
}
}
void loop()
{
Serial.println(cantidadJugadores);
if (cantidadJugadores == 0) {
// Me puede regresar solo 2 o 4 0 para cuando no se halla seteado el juego
cantidadJugadores = identificarJugadores();
Serial.print("La cantidad de jugadores es: ");
Serial.println(cantidadJugadores);
//enJuego = cantidadJugadores != 0 ? true : false;
if (cantidadJugadores != 0) {
enJuego = true;
configurarTablero(cantidadJugadores);
}
}
if (enJuego) {
// Se comenzo/esta juegando
Serial.println(" Se inicia ya que se ocuparon los puestos");
// Registrar movimiento
registroMovimiento();
delay(1000);
identificarLlegada();
delay(3000);
}
imprimirTablero();
//imprimirValores();
}
/*
Detectar el movimiento del huevo, comparando los valores en las posiciones dependiendo del turno
del jugador
*/
void registroMovimiento() {
// Conocer partida
for (byte i = 0; i < tamanoTablero; i++) {
for (byte j = 0; j < tamanoTablero; j++) {
// En la posicion electronica se pasa a cero entonces veo lo que habia antes
if (tablero[i][j] == 1 && digitalRead(entradas[i][j]) == LOW) {
// De donde se partio
partidaI = i;
partidaJ = j;
break;
}
}
}
}
/*
Identificacion de a donde se movio el huevo
*/
void identificarLlegada() {
if (partidaI != 10) {
// Identificar fin
for (int i = 0; i < tamanoTablero; i++) {
for (int j = 0; j < tamanoTablero; j++) {
if ( tablero[i][j] == 0 && digitalRead(entradas[i][j]) == HIGH) {
// A donde llego
tablero[i][j] = 1;
tablero[partidaI][partidaJ] = 0;
finI = i;
finJ = j;
Serial.print("Partida i ");
Serial.print(partidaI);
Serial.print(", j ");
Serial.print(partidaJ);
Serial.println("------");
Serial.print("fin i ");
Serial.print(finI);
Serial.print(", j ");
Serial.print(finJ);
Serial.println("------");
break;
}
}
}
}
}
/*
Funcion para identificar la cantidad de jugadores, viendo si en ciertas areas del tablero al iniciar se encuentran
posicionandos los huevos.
*/
byte identificarJugadores() {
byte num = 0;
// Observar si solo son dos jugadores
int suma = 0;
for (byte j = 0; j < tamanoTablero; j++ ) {
suma += digitalRead(entradas[0][j]); // Primeros 6 botones, entradas es un multiarray
suma += digitalRead(entradas[tamanoTablero - 1][j]); // Ultimos 6 botones, entradas es un multiarray
}
Serial.print("Valor de la suma ");
Serial.println( suma );
//suma = 8;
//delay(6000);
if (suma == tamanoTablero * 2) {
num = 2; // Solo son 2 jugadores
} else {
suma = 0;
// Chequear los 4
byte sj0 = posJugadores(0, 0);
byte sj1 = posJugadores(0, tamanoTablero-areaBusqueda);
byte sj2 = posJugadores(tamanoTablero-areaBusqueda, 0);
byte sj3 = posJugadores(tamanoTablero-areaBusqueda, tamanoTablero-areaBusqueda);
suma = sj0 + sj1 + sj2 + sj3;
num = (suma == 16)? 4 : 0;
}
return num;
}
byte posJugadores(byte idxI, byte idxJ) {
byte suma = 0;
for (byte i = idxI; i < idxI + areaBusqueda; i++ ) {
for (byte j = idxJ; j < idxJ + areaBusqueda; j++) {
suma += digitalRead(entradas[i][j]);
}
}
return suma;
}
void imprimirValores() {
for (byte i = 0; i < tamanoTablero ; i++) {
for (byte j = 0; j < tamanoTablero; j++) {
Serial.print("Valor fila ");
Serial.print(i);
Serial.print(" columna ");
Serial.print(j);
Serial.print(" => ");
Serial.println(digitalRead(entradas[i][j]));
Serial.print("Final de carrera numero ");
delay(100);
}
}
}
void imprimirTablero() {
for (byte i = 0; i < tamanoTablero; i++) {
for (byte j = 0; j < tamanoTablero; j++) {
Serial.print("Tablero Valor fila ");
Serial.print(i);
Serial.print(" columna ");
Serial.print(j);
Serial.print(" => ");
Serial.println(tablero[i][j]);
delay(100);
}
}
}
void configurarTablero(byte jugadores) {
if (jugadores == 2) {
for (byte j = 0; j < tamanoTablero; j++) {
tablero[0][j] = 1;
tablero[tamanoTablero - 1][j] = 1;
}
} else {
tablero[0][0] = 1;
tablero[0][tamanoTablero - 1] = 1;
tablero[tamanoTablero - 1][0] = 1;
tablero[tamanoTablero - 1][tamanoTablero - 1] = 1;
}
} | [
"[email protected]"
] | |
58f5936184d2f2507f29176f3c0071b379b5d437 | 0577a46d8d28e1fd8636893bbdd2b18270bb8eb8 | /update_notifier/thirdparty/wxWidgets/src/xrc/xh_dlg.cpp | ae940dffdc7ce485629d0a70539d5dc58d10a622 | [
"BSD-3-Clause"
] | permissive | ric2b/Vivaldi-browser | 388a328b4cb838a4c3822357a5529642f86316a5 | 87244f4ee50062e59667bf8b9ca4d5291b6818d7 | refs/heads/master | 2022-12-21T04:44:13.804535 | 2022-12-17T16:30:35 | 2022-12-17T16:30:35 | 86,637,416 | 166 | 41 | BSD-3-Clause | 2021-03-31T18:49:30 | 2017-03-29T23:09:05 | null | UTF-8 | C++ | false | false | 2,145 | cpp | /////////////////////////////////////////////////////////////////////////////
// Name: src/xrc/xh_dlg.cpp
// Purpose: XRC resource for dialogs
// Author: Vaclav Slavik
// Created: 2000/03/05
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if wxUSE_XRC
#include "wx/xrc/xh_dlg.h"
#ifndef WX_PRECOMP
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/frame.h"
#include "wx/dialog.h"
#endif
wxIMPLEMENT_DYNAMIC_CLASS(wxDialogXmlHandler, wxXmlResourceHandler);
wxDialogXmlHandler::wxDialogXmlHandler() : wxXmlResourceHandler()
{
XRC_ADD_STYLE(wxSTAY_ON_TOP);
XRC_ADD_STYLE(wxCAPTION);
XRC_ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
XRC_ADD_STYLE(wxSYSTEM_MENU);
XRC_ADD_STYLE(wxRESIZE_BORDER);
XRC_ADD_STYLE(wxCLOSE_BOX);
XRC_ADD_STYLE(wxDIALOG_NO_PARENT);
XRC_ADD_STYLE(wxTAB_TRAVERSAL);
XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
XRC_ADD_STYLE(wxDIALOG_EX_METAL);
XRC_ADD_STYLE(wxMAXIMIZE_BOX);
XRC_ADD_STYLE(wxMINIMIZE_BOX);
XRC_ADD_STYLE(wxFRAME_SHAPED);
XRC_ADD_STYLE(wxDIALOG_EX_CONTEXTHELP);
AddWindowStyles();
}
wxObject *wxDialogXmlHandler::DoCreateResource()
{
XRC_MAKE_INSTANCE(dlg, wxDialog)
dlg->Create(m_parentAsWindow,
GetID(),
GetText(wxT("title")),
wxDefaultPosition, wxDefaultSize,
GetStyle(wxT("style"), wxDEFAULT_DIALOG_STYLE),
GetName());
if (HasParam(wxT("size")))
dlg->SetClientSize(GetSize(wxT("size"), dlg));
if (HasParam(wxT("pos")))
dlg->Move(GetPosition());
if (HasParam(wxT("icon")))
dlg->SetIcons(GetIconBundle(wxT("icon"), wxART_FRAME_ICON));
SetupWindow(dlg);
CreateChildren(dlg);
if (GetBool(wxT("centered"), false))
dlg->Centre();
return dlg;
}
bool wxDialogXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxDialog"));
}
#endif // wxUSE_XRC
| [
"[email protected]"
] | |
5c3ae93835db1ddd5c5e4c77444eaebb1f4d613e | 0fd2e14f1776d186963892e1612439ce57604115 | /CodechefJanuaryLunchtime2019/TheNightsWatch.cpp | ea7f1e6ba1c01430ea86223222c5184fe2a03727 | [] | no_license | aravindm711/contest-archives | 534914e234d67ce1070b03cfb4fa9ce460f0a65e | 42ab2fba88b5fb766c226febfc5045c86f1c0b9b | refs/heads/master | 2020-07-09T01:53:47.893397 | 2019-09-03T18:10:27 | 2019-09-03T18:10:27 | 203,842,203 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 927 | cpp | # include <iostream>
# include <vector>
# include <string>
# include <cmath>
# include <algorithm>
using namespace std;
# define loopup(x, a, b) for(int x = a; x < b; x++)
# define loopdown(x, a, b) for (int x = b - 1; x >= a; x--)
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int N;
int count;
string input_str;
int t;
cin >> t;
while(t--) {
cin >> N;
count = 0;
cin >> input_str;
loopup(i, 0, N)
if (input_str[i] == '0')
count++;
if (count < N) {
count = 0;
if (input_str[0] == '0' && input_str[1] == '0') {
count++;
input_str[0] = '1';
}
loopup(i, 1, N - 1) {
if (input_str[i] == '0' && input_str[i - 1] == '0' && input_str[i + 1] == '0') {
count++;
input_str[i] = '1';
}
}
if (input_str[N - 1] == '0' && input_str[N - 2] == '0') count++;
cout << count << endl;
} else cout << ceil((float)N / 2) << endl;
}
return 0;
} | [
"[email protected]"
] | |
238066e28e4490addbd7b44c268b9c6574d89726 | 807bae02476e9c1e6ebdafe658fdf701dc5b70c7 | /src/pieces/T.cpp | 8b55ae0ceba4b09387c11a9c94248038c47e5381 | [
"Apache-2.0"
] | permissive | benlamonica/tetra-table | 7539a8ffa23bf0d57a75b2ee10ba914b7ea1cf51 | 521082f2a848d04608ef6368004e90e780ef62ea | refs/heads/master | 2021-01-02T08:38:58.308315 | 2017-06-04T16:47:41 | 2017-06-04T16:47:41 | 28,732,235 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 476 | cpp | //
// T.cpp
// TetraTable
//
// Created by Ben La Monica on 1/13/15.
// Copyright (c) 2015 Benjamin Alan La Monica. All rights reserved.
//
#include "T.hpp"
/*
██
██████
██
████
██
██████
██
██
████
██
*/
T::T() : super(std::vector<std::string>({" T TTT ", " T TT T ", " TTT T ", " T TT T "}), 'T', Color(0xA1, 0, 0xF1), Color(0x9e,0x9e,0x9e), 3){
}
T::~T() {
} | [
"[email protected]"
] | |
6797e12249970816037d3ddbd24c2fa2b4012585 | c3442c04fa2d739a3fbd6ac93a7119c1d18fc873 | /cie_sign_sdk/src/cryptopp/chacha.h | 0fab929a3cec3a262009518fb98081290474b9fb | [
"BSD-3-Clause"
] | permissive | italia/cie-middleware-macos | 47542b2cde1e98cdf35d0e7d0ad91744530e0110 | e26910245026dc091c6c1dec6999395e8669ce63 | refs/heads/master | 2023-06-23T16:10:05.809155 | 2023-06-05T13:02:56 | 2023-06-05T13:02:56 | 147,847,859 | 16 | 4 | BSD-3-Clause | 2023-06-15T09:09:17 | 2018-09-07T16:20:45 | C++ | UTF-8 | C++ | false | false | 9,840 | h | // chacha.h - written and placed in the public domain by Jeffrey Walton.
// Based on Wei Dai's Salsa20, Botan's SSE2 implementation,
// and Bernstein's reference ChaCha family implementation at
// http://cr.yp.to/chacha.html.
// The library added Bernstein's ChaCha classses at Crypto++ 5.6.4. The IETF
// uses a slightly different implementation than Bernstein, and the IETF
// ChaCha and XChaCha classes were added at Crypto++ 8.1. We wanted to maintain
// ABI compatibility at the 8.1 release so the original ChaCha classes were not
// disturbed. Instead new classes were added for IETF ChaCha. The back-end
// implementation shares code as expected, however.
/// \file chacha.h
/// \brief Classes for ChaCha8, ChaCha12 and ChaCha20 stream ciphers
/// \details Crypto++ provides Bernstein and ECRYPT's ChaCha from <a
/// href="http://cr.yp.to/chacha/chacha-20080128.pdf">ChaCha, a
/// variant of Salsa20</a> (2008.01.28). Crypto++ also provides the
/// IETF implementation of ChaCha using the ChaChaTLS name. Bernstein's
/// implementation is _slightly_ different from the TLS working group's
/// implementation for cipher suites
/// <tt>TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256</tt>,
/// <tt>TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256</tt>,
/// and <tt>TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256</tt>. Finally,
/// the library provides <a
/// href="https://tools.ietf.org/html/draft-arciszewski-xchacha">XChaCha:
/// eXtended-nonce ChaCha and AEAD_XChaCha20_Poly1305 (rev. 03)</a>.
/// \since ChaCha since Crypto++ 5.6.4, ChaChaTLS and XChaCha20 since Crypto++ 8.1
#ifndef CRYPTOPP_CHACHA_H
#define CRYPTOPP_CHACHA_H
#include "strciphr.h"
#include "secblock.h"
NAMESPACE_BEGIN(CryptoPP)
////////////////////////////// Bernstein ChaCha //////////////////////////////
/// \brief ChaCha stream cipher information
/// \since Crypto++ 5.6.4
struct ChaCha_Info : public VariableKeyLength<32, 16, 32, 16, SimpleKeyingInterface::UNIQUE_IV, 8>
{
/// \brief The algorithm name
/// \returns the algorithm name
/// \details StaticAlgorithmName returns the algorithm's name as a static
/// member function.
/// \details Bernstein named the cipher variants ChaCha8, ChaCha12 and
/// ChaCha20. More generally, Bernstein called the family ChaCha{r}.
/// AlgorithmName() provides the exact name once rounds are set.
static const char* StaticAlgorithmName() {
return "ChaCha";
}
};
/// \brief ChaCha stream cipher implementation
/// \since Crypto++ 5.6.4
class CRYPTOPP_NO_VTABLE ChaCha_Policy : public AdditiveCipherConcretePolicy<word32, 16>
{
public:
virtual ~ChaCha_Policy() {}
ChaCha_Policy() : m_rounds(ROUNDS) {}
protected:
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
void CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length);
bool CipherIsRandomAccess() const {return true;}
void SeekToIteration(lword iterationCount);
unsigned int GetAlignment() const;
unsigned int GetOptimalBlockSize() const;
std::string AlgorithmName() const;
std::string AlgorithmProvider() const;
CRYPTOPP_CONSTANT(ROUNDS = 20) // Default rounds
FixedSizeAlignedSecBlock<word32, 16> m_state;
unsigned int m_rounds;
};
/// \brief ChaCha stream cipher
/// \details This is Bernstein and ECRYPT's ChaCha. It is _slightly_ different
/// from the IETF's version of ChaCha called ChaChaTLS.
/// \sa <a href="http://cr.yp.to/chacha/chacha-20080208.pdf">ChaCha, a variant
/// of Salsa20</a> (2008.01.28).
/// \since Crypto++ 5.6.4
struct ChaCha : public ChaCha_Info, public SymmetricCipherDocumentation
{
/// \brief ChaCha Encryption
typedef SymmetricCipherFinal<ConcretePolicyHolder<ChaCha_Policy, AdditiveCipherTemplate<> >, ChaCha_Info > Encryption;
/// \brief ChaCha Decryption
typedef Encryption Decryption;
};
////////////////////////////// IETF ChaChaTLS //////////////////////////////
/// \brief ChaCha-TLS stream cipher information
/// \since Crypto++ 8.1
struct ChaChaTLS_Info : public FixedKeyLength<32, SimpleKeyingInterface::UNIQUE_IV, 12>, FixedRounds<20>
{
/// \brief The algorithm name
/// \returns the algorithm name
/// \details StaticAlgorithmName returns the algorithm's name as a static
/// member function.
/// \details This is the IETF's variant of Bernstein's ChaCha from RFC
/// 8439. IETF ChaCha is called ChaChaTLS in the Crypto++ library. It
/// is _slightly_ different from Bernstein's implementation.
static const char* StaticAlgorithmName() {
return "ChaChaTLS";
}
};
/// \brief ChaCha-TLS stream cipher implementation
/// \since Crypto++ 8.1
class CRYPTOPP_NO_VTABLE ChaChaTLS_Policy : public AdditiveCipherConcretePolicy<word32, 16>
{
public:
virtual ~ChaChaTLS_Policy() {}
ChaChaTLS_Policy() : m_counter(0) {}
protected:
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
void CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length);
bool CipherIsRandomAccess() const {return true;}
void SeekToIteration(lword iterationCount);
unsigned int GetAlignment() const;
unsigned int GetOptimalBlockSize() const;
std::string AlgorithmName() const;
std::string AlgorithmProvider() const;
FixedSizeAlignedSecBlock<word32, 16+8> m_state;
unsigned int m_counter;
CRYPTOPP_CONSTANT(ROUNDS = ChaChaTLS_Info::ROUNDS)
CRYPTOPP_CONSTANT(KEY = 16) // Index into m_state
CRYPTOPP_CONSTANT(CTR = 24) // Index into m_state
};
/// \brief ChaCha-TLS stream cipher
/// \details This is the IETF's variant of Bernstein's ChaCha from RFC 8439.
/// IETF ChaCha is called ChaChaTLS in the Crypto++ library. It is
/// _slightly_ different from the Bernstein implementation. ChaCha-TLS
/// can be used for cipher suites
/// <tt>TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256</tt>,
/// <tt>TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256</tt>, and
/// <tt>TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256</tt>.
/// \sa <a href="https://tools.ietf.org/html/rfc8439">RFC 8439, ChaCha20 and
/// Poly1305 for IETF Protocols</a>, <A
/// HREF="https://mailarchive.ietf.org/arch/msg/cfrg/gsOnTJzcbgG6OqD8Sc0GO5aR_tU">How
/// to handle block counter wrap in IETF's ChaCha algorithm?</A> and
/// <A HREF="https://github.com/weidai11/cryptopp/issues/790">Issue
/// 790, ChaChaTLS results when counter block wraps</A>.
/// \since Crypto++ 8.1
struct ChaChaTLS : public ChaChaTLS_Info, public SymmetricCipherDocumentation
{
/// \brief ChaCha-TLS Encryption
typedef SymmetricCipherFinal<ConcretePolicyHolder<ChaChaTLS_Policy, AdditiveCipherTemplate<> >, ChaChaTLS_Info > Encryption;
/// \brief ChaCha-TLS Decryption
typedef Encryption Decryption;
};
////////////////////////////// IETF XChaCha20 draft //////////////////////////////
/// \brief XChaCha stream cipher information
/// \since Crypto++ 8.1
struct XChaCha20_Info : public FixedKeyLength<32, SimpleKeyingInterface::UNIQUE_IV, 24>
{
/// \brief The algorithm name
/// \returns the algorithm name
/// \details StaticAlgorithmName returns the algorithm's name as a static
/// member function.
/// \details This is the IETF's XChaCha from draft-arciszewski-xchacha.
static const char* StaticAlgorithmName() {
return "XChaCha20";
}
};
/// \brief XChaCha stream cipher implementation
/// \since Crypto++ 8.1
class CRYPTOPP_NO_VTABLE XChaCha20_Policy : public AdditiveCipherConcretePolicy<word32, 16>
{
public:
virtual ~XChaCha20_Policy() {}
XChaCha20_Policy() : m_counter(0), m_rounds(ROUNDS) {}
protected:
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
void CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length);
bool CipherIsRandomAccess() const {return false;}
void SeekToIteration(lword iterationCount);
unsigned int GetAlignment() const;
unsigned int GetOptimalBlockSize() const;
std::string AlgorithmName() const;
std::string AlgorithmProvider() const;
FixedSizeAlignedSecBlock<word32, 16+8> m_state;
unsigned int m_counter, m_rounds;
CRYPTOPP_CONSTANT(ROUNDS = 20) // Default rounds
CRYPTOPP_CONSTANT(KEY = 16) // Index into m_state
};
/// \brief XChaCha stream cipher
/// \details This is the IETF's XChaCha from draft-arciszewski-xchacha.
/// \sa <a href="https://tools.ietf.org/html/draft-arciszewski-xchacha">XChaCha:
/// eXtended-nonce ChaCha and AEAD_XChaCha20_Poly1305 (rev. 03)</a>, <A
/// HREF="https://mailarchive.ietf.org/arch/msg/cfrg/gsOnTJzcbgG6OqD8Sc0GO5aR_tU">How
/// to handle block counter wrap in IETF's ChaCha algorithm?</A> and
/// <A HREF="https://github.com/weidai11/cryptopp/issues/790">Issue
/// 790, ChaCha20 results when counter block wraps</A>.
/// \since Crypto++ 8.1
struct XChaCha20 : public XChaCha20_Info, public SymmetricCipherDocumentation
{
/// \brief XChaCha Encryption
typedef SymmetricCipherFinal<ConcretePolicyHolder<XChaCha20_Policy, AdditiveCipherTemplate<> >, XChaCha20_Info > Encryption;
/// \brief XChaCha Decryption
typedef Encryption Decryption;
};
NAMESPACE_END
#endif // CRYPTOPP_CHACHA_H
| [
"[email protected]"
] | |
a47b05188b81a39dcdc4bf53a3e43dd4ca5ddf9c | e1e7b3cd75689fd3d5be3b360fe3183c22c7bd2f | /System.h | 71c15154e9be9b7621779a9d4e10205e9dcdc3bd | [] | no_license | vortex314/Ebos | 7ac8668a55d777b077151cdb51fafb7a6f4895b5 | b5acd621091cafeece618b33ab5eb364498332e2 | refs/heads/master | 2021-01-12T01:16:17.727466 | 2017-12-26T20:13:54 | 2017-12-26T20:13:54 | 78,363,173 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 314 | h | #ifndef SYSTEM_H
#define SYSTEM_H
#include <EventBus.h>
class System : public Actor {
uint32_t _idxProps;
public:
System(const char* name);
~System();
void setup();
void init();
void onEvent(Cbor& msg);
void reset();
void setBootTime(uint64_t t);
void publishProps();
};
#endif // SYSTEM_H
| [
"[email protected]"
] | |
64993a8490d51d75ec421bf5701ca369bf598a88 | d59e36022692822e5bef9f28d5322a32976bbbd3 | /RPG-控制台版/RoleSel.cpp | 856451b5f49b59fec772542bb01b7f60ac876e1d | [] | no_license | TingXuanR/RPG-Game-In-Cmd | e4781dfb6ec8bbc60b642d07b97ada714e7bdf18 | b6a4e7491d8790b022fd4e36073a474b846f0706 | refs/heads/main | 2023-03-20T10:18:07.125358 | 2021-03-14T15:23:12 | 2021-03-14T15:23:12 | 347,670,442 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 1,310 | cpp | #include "stdafx.h"
#include "RoleSel.h"
#include "ConfigMgr.h"
#include "GameMgr.h"
CRoleSel::CRoleSel() :m_nState(E_ROLE_ZHANSHI)
{
m_pVecData = CConfigMgr::getInstance()->getRoleDtMgr()->getAllData();
}
CRoleSel::~CRoleSel()
{
SAFE_DEL_VEC(m_pVecData);
}
void CRoleSel::update()
{
if (KEY_DOWN(VK_UP))
{
m_nState--;
if (m_nState < E_ROLE_ZHANSHI)
{
m_nState = E_ROLE_SHESHOU;
}
}
else if (KEY_DOWN(VK_DOWN))
{
m_nState++;
if (m_nState > E_ROLE_SHESHOU)
{
m_nState = E_ROLE_ZHANSHI;
}
}
else if (KEY_DOWN(VK_RETURN))
{
CGameMgr::getInstance()->getGameMap()->getPlayer()->initConfig(m_pVecData[m_nState]);
CGameMgr::getInstance()->setState(E_STATE_MAP);
}
}
void CRoleSel::render()
{
cout << setw(CONSOLE_WIDTH*0.65) << "----------------½ÇɫѡÔñ----------------" << endl;
cout << setw(CONSOLE_WIDTH*0.5) << "ID\tHP\tACK\tNAME\tPic" << endl;
for (int i = 0; i < m_pVecData.size(); i++)
{
cout << setw(CONSOLE_WIDTH*0.35);
SRoleDt* pDt = m_pVecData[i];
if (m_nState == i)
{
Set_Color(GreenBlue);
cout << "->";
}
else
{
Set_Color(White);
cout << " ";
}
cout << pDt->nID << "\t" << pDt->nHp << "\t" << pDt->nAck
<< "\t" << pDt->strName << "\t" << pDt->strPic << endl;
if (i == m_pVecData.size() - 1) Set_Color(White);
}
}
| [
"[email protected]"
] | |
7cdb3c3a7bf70c87a6f30692e0beb02d5e4985b0 | e168ae8ca5ea46bd7216472b142750cb12947893 | /TREES/BINARY TREE/LevelTreeTraversal.cpp | 92ecaa2232cafcf8eece8a2413c8db5487e15dea | [] | no_license | Priyanshi-Chauhan/DATA_STRUCTURE | f2e815fa66edc68bc8765e00bea9fda2597d9642 | edd1cbc90d19117aba2ac04a5ad8375402e82b44 | refs/heads/master | 2021-08-16T07:58:38.019212 | 2021-08-10T17:21:00 | 2021-08-10T17:21:00 | 224,453,679 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 911 | cpp | #include<iostream>
using namespace std;
class node{
public:
int data;
node *left;
node *right;
node(int d) {
data =d;
left =NULL;
right=NULL;
}};
node *BuildTree(){
int d;
cin>>d;
if(d == -1){
return NULL;
}
node*root = new node(d);
root->left = BuildTree();
root->right =BuildTree();
return root;
}
int height(node *root) {
if(root==NULL){
return 0;
}
return 1+ max(height(root->left),height(root->right));
}
void printKthLevel(node*root,int k){
if(root ==NULL){
return ;
}
if(k==1){
cout<<root->data<<" , ";
return ;
}
printKthLevel(root -> left,k-1);
printKthLevel(root -> right,k-1);
return ;
}
void PrintAllLevels(node *root){
int h =height(root);
for (int i=1;i<=h;i++){
printKthLevel(root,i);
cout<<endl;}
return;
}
int main (){
node*root =BuildTree();
PrintAllLevels(root);
return 0;}
| [
"[email protected]"
] | |
3c3853f26e646e4360cbc061a5311ef26aa02aff | 00eedc0c5d00a9bb3eb94ab11c2ccc326174bd86 | /InputHandling/InputMapping/InputConstants.h | 4c3bf77d84dfc3e5bc1626ffbfd1bfd7e2efa545 | [] | no_license | SinclairRoss/CalamityAtStarBase349 | 9d0522cd5470565e42c966c37b82ca258c77dbfb | 0bc42983a5d4c8e9eb43392de7efb7779201c95c | refs/heads/master | 2020-04-18T08:16:52.672563 | 2019-01-24T15:57:23 | 2019-01-24T15:57:23 | 167,390,745 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,205 | h | #pragma once
namespace Input
{
enum class Action
{
INTERACT,
MOVE_UP,
MOVE_DOWN,
MOVE_LEFT,
MOVE_RIGHT,
MENU_NAVIGATE_UP,
MENU_NAVIGATE_DOWN,
MENU_NAVIGATE_LEFT,
MENU_NAVIGATE_RIGHT,
MENU_SELECT,
MENU_CANCEL,
// Level Editor.
INTERACT_ALT,
CAMERA_PAN_MODE,
CAMERA_PAN_UP,
CAMERA_PAN_DOWN,
CAMERA_PAN_LEFT,
CAMERA_PAN_RIGHT,
ROTATE_CW,
ROTATE_CCW,
NAVIGATE_LEVEL_UP,
NAVIGATE_LEVEL_DOWN,
SELECT_NEXT_MAP_ELEMENT,
SELECT_PREVIOUS_MAP_ELEMENT,
HOTKEY_1,
HOTKEY_2,
HOTKEY_3,
HOTKEY_4,
HOTKEY_5,
HOTKEY_6,
HOTKEY_7,
HOTKEY_8,
HOTKEY_9,
// Pathing test
START_PATHING,
_INVALID,
};
enum class Range
{
MOVE_X,
MOVE_Y,
LOOK_X,
LOOK_Y,
// Level Editor.
CURSOR_X,
CURSOR_Y,
CURSOR_DELTA_X,
CURSOR_DELTA_Y,
CAMERA_ZOOM,
_INVALID
};
} | [
"[email protected]"
] | |
7e8ebf50b4cab70e0a58371c84215900f8d81968 | 37c757f24b674f67edd87b75b996d8d5015455cb | /Server/include/dataProcess.h | 1f4dbe31a1e5d83d7d203ca5b3b02f72a0c9bbb1 | [] | no_license | SakuraSinojun/cotalking | 1118602313f85d1c49d73e1603cf6642bc15f36d | 37354d99db6b7033019fd0aaccec84e68aee2adf | refs/heads/master | 2021-01-10T21:20:50.269547 | 2011-04-07T06:15:04 | 2011-04-07T06:15:04 | 32,323,167 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 877 | h | /***************************************************
Project: grouptalk
author: TaXueWuHen
data Process;
***************************************************/
#ifndef __TALK_DATAPROCESS_H__
#define __TALK_DATAPROCESS_H__
#include <stdio.h>
#include <map>
#include "../include/def.h"
#include "../include/defGroupTalk.h"
#include "../include/publicOpt.h"
#include "../include/dataManager.h"
using namespace std;
// data cache
typedef struct st_scDataCache
{
int dataLength;
char data[C_SCDATA_LENGTH * 2];
} scDataCache, *pscDataCache;
class TS_dataProcess
{
private:
int cachePoint;
map<int, pscDataCache> m_dataCache;
TS_dataManager *dataMng;
public:
TS_dataProcess();
~TS_dataProcess();
public:
void* getAddr(int key);
bool dataAnalyse(int key, int size);
void setDataManager(TS_dataManager *pdm);
};
#endif
| [
"SakuraSinojun@02eed91f-dd82-7cf9-bfd0-73567c4360d3"
] | SakuraSinojun@02eed91f-dd82-7cf9-bfd0-73567c4360d3 |
6f6f40c83a20d42c59548d547eb1591ed5042755 | 9fe13c6bea4b915f5509b8591741fcd7f41d20ed | /Week09-2/Greedy1.cpp | 2987b33feb4f93c8c5bfb236a25e04068df8b079 | [] | no_license | Baek-jongwon/study | 34ffce8fcb51097d3b929ac55836ade087c51033 | 5115d850f506f5095c1455c6faf785210bd28d28 | refs/heads/main | 2023-04-01T05:24:17.194650 | 2021-04-13T14:18:54 | 2021-04-13T14:18:54 | 332,777,400 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,041 | cpp | #include <string>
#include <vector>
#include <queue>
#include <iostream>
#include <algorithm>
using namespace std;
int solution(int n, vector<int> lost, vector<int> reserve) {
int answer = 0;
int lost_idx = 0;
queue<int> q;
sort(lost.begin(), lost.end());
sort(reserve.begin(), reserve.end());
int cnt = 0;
int cnt2 = 0;
int cnt3 = 0;
for (int i = 0; i < reserve.size(); i++)
{
bool check = false;
for (int j = 0; j < lost.size(); j++)
{
if (reserve[i] == lost[j])
{
lost[j] = -1;
check = true;
cnt2++;
}
}
if (!check) q.push(reserve[i]);
}
cnt3 = q.size();
while (!q.empty())
{
int a = q.front();
q.pop();
for (int i = lost_idx; i < lost.size(); i++)
{
if (a + 1 == lost[i])
{
cnt++;
lost[i] = -1;
break;
}
else if (a - 1 == lost[i])
{
cnt++;
lost[i] = -1;
break;
}
}
}
if (cnt2 > 0) answer = n - lost.size() + cnt2 + cnt;
else answer = n - lost.size() + cnt;
return answer;
} | [
"[email protected]"
] | |
6e3894640094ee8df0e684d8de1a3cc31264917f | bc8e83e8f447e84cd5bb03e9872347e8893e1ead | /google/code jam 2021 round 2/hidden-pancakes.cpp | fbf6137c0e994c25ffa92234d0e0668c88990200 | [] | no_license | plasmatic1/other-judge-solutions | c04861f843f9122b7b69f1bc00fd4a5a839c8473 | 4702e0ddaa9243acd71a1ac241fe8dd3e72ce06a | refs/heads/master | 2022-09-30T08:39:54.284860 | 2022-08-29T03:41:32 | 2022-08-29T03:41:32 | 214,307,016 | 1 | 1 | null | 2021-04-06T16:56:43 | 2019-10-11T00:00:25 | C++ | UTF-8 | C++ | false | false | 4,444 | cpp | // ./hidden-pancakes.yml
#include "bits/stdc++.h"
using namespace std;
// Defines
#define fs first
#define sn second
#define pb push_back
#define eb emplace_back
#define mpr make_pair
#define mtp make_tuple
#define all(x) (x).begin(), (x).end()
// Basic type definitions
using ll = long long; using ull = unsigned long long; using ld = long double;
using pii = pair<int, int>; using pll = pair<long long, long long>;
#ifdef __GNUG__
// PBDS order statistic tree
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T, class comp = less<T>> using os_tree = tree<T, null_type, comp, rb_tree_tag, tree_order_statistics_node_update>;
template <typename K, typename V, class comp = less<K>> using treemap = tree<K, V, comp, rb_tree_tag, tree_order_statistics_node_update>;
// HashSet
#include <ext/pb_ds/assoc_container.hpp>
template <typename T, class Hash> using hashset = gp_hash_table<T, null_type, Hash>;
template <typename K, typename V, class Hash> using hashmap = gp_hash_table<K, V, Hash>;
const ll RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
struct chash { ll operator()(ll x) const { return x ^ RANDOM; } };
#endif
// More utilities
int SZ(string &v) { return v.length(); }
template <typename C> int SZ(C &v) { return v.size(); }
template <typename C> void UNIQUE(vector<C> &v) { sort(v.begin(), v.end()); v.resize(unique(v.begin(), v.end()) - v.begin()); }
template <typename T, typename U> void maxa(T &a, U b) { a = max(a, b); }
template <typename T, typename U> void mina(T &a, U b) { a = min(a, b); }
const ll INF = 0x3f3f3f3f, LLINF = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9 + 7;
ll fix(ll &&x) { x %= MOD; if (x < 0) x += MOD; return x; }
ll fix(ll &x) { x %= MOD; if (x < 0) x += MOD; return x; }
ll fpow(ll x, ll y, ll mod = MOD) {
if (!y) return 1LL;
return fpow(x * x % mod, y >> 1, mod) * ((y & 1) ? x : 1LL) % mod;
}
ll inv(ll x, ll mod = MOD) { return fpow(x, mod - 2, mod); }
// N choose R
vector<ll> fact, invf;
void init_nchooser(int MN) {
fact.resize(MN + 1); invf.resize(MN + 1);
fact[0] = 1LL;
for (int i = 1; i <= MN; i++) fact[i] = fix(fact[i - 1] * i);
invf[MN] = inv(fact[MN]);
for (auto i = MN-1; i >= 0; i--) invf[i] = fix(invf[i + 1] * (i + 1));
}
ll choose(ll N, ll K) { return fix(fact[N] * fix(invf[K] * invf[N - K])); }
ll permute(ll N, ll K) { return fix(fact[N] * invf[N - K]); }
const int MN = 1e5 + 1;
int N,
V[MN];
int sz[MN], dp[MN], par[MN];
vector<int> g[MN], rg[MN];
ll ans;
void dfs(int c) {
if (dp[c] != -1) return;
dp[c] = -INF;
for (auto to : rg[c]) {
dfs(to);
int alt = dp[to]+1;
// printf("c=%d to=%d dpto=%d alt=%d\n", c,to,dp[to],alt);
if (alt > dp[c]) {
dp[c] = alt;
par[c] = to;
}
}
}
void dfs2(int c) {
sz[c] = 1;
ll comb = 1;
for (auto to : g[c]) {
if (par[to] == c) {
dfs2(to);
sz[c] += sz[to];
comb = comb * invf[sz[to]] % MOD;
}
}
comb = comb * fact[sz[c]-1] % MOD;
ans = ans * comb % MOD;
}
void solve() {
cin >> N;
for (auto i = 1; i <= N; i++) cin >> V[i];
for (auto i = 2; i <= N; i++) {
if (V[i]-V[i-1] >= 2) {
cout << "0\n";
return;
}
}
vector<int> stk{0};
for (auto i = 1; i <= N; i++) {
int lst = -1;
while (stk.size() > V[i]) {
lst = stk.back();
stk.pop_back();
}
g[stk.back()].push_back(i);
rg[i].push_back(stk.back());
if (lst != -1) {
g[i].push_back(lst);
rg[lst].push_back(i);
}
stk.push_back(i);
}
ans = 1;
fill(dp, dp+N+1, -1);
dp[0] = 0;
for (auto i = 1; i <= N; i++)
dfs(i);
// for (auto i = 1; i <= N; i++)
// printf("i=%d par=%d\n", i,par[i]);
dfs2(0);
cout << ans << '\n';
// clearing things
ans = 0;
for (auto i = 0; i <= N; i++) {
g[i].clear();
rg[i].clear();
sz[i] = dp[i] = par[i] = 0;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
init_nchooser(MN+10);
int T;
cin >> T;
for (int caseno = 1; caseno <= T; caseno++) {
// Input
cout << "Case #" << caseno << ": ";
solve();
// Reset
}
}
| [
"[email protected]"
] | |
f8deb47a65678ab6bff6a58a1bb45e2c17ba6e18 | 1f43d1bb29341c669b0e369c34745a34d5950fc5 | /牛客网/一个浮点数的四舍五入.cpp | fca8b6ccb7102549fd1d57fd651399462e7f58d0 | [] | no_license | narutolai/leetcode | 7f15879c53872d7ae7779fdeaa9311de057b7db3 | 7312fa3e91f4d591e2c2cd401deb1208475ea2c2 | refs/heads/master | 2022-10-29T01:30:32.209024 | 2022-10-23T03:49:57 | 2022-10-23T03:49:57 | 253,961,624 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 179 | cpp | #include <iostream>
using namespace std;
int main()
{
double x;
cin >> x;
int d = (int)x;
int r = x - d >= 0.5 ? d + 1 : d;
cout << r << endl;
return 0;
}
| [
"[email protected]"
] | |
7dc2d00e6487ece7c021e0248da3da3154cf0847 | 28c17bce11196486c299c76a5c8a8db994b9542a | /eval/src/tests/tensor/dense_fast_rename_optimizer/dense_fast_rename_optimizer_test.cpp | 773381b4c7748d8d8fcf39e6d148807e04868fbf | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ohad7/vespa | 733ef8247e8dc4da9f297da762c3bc6d71661c18 | ea65fbd5cf342cb2a79c2972727bf1d68bfef9fa | refs/heads/master | 2020-05-01T01:50:40.819377 | 2019-11-21T14:41:40 | 2019-11-21T14:41:40 | 177,204,224 | 0 | 0 | null | 2019-03-22T20:20:25 | 2019-03-22T20:20:25 | null | UTF-8 | C++ | false | false | 3,177 | cpp | // Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/eval/eval/tensor_function.h>
#include <vespa/eval/eval/simple_tensor.h>
#include <vespa/eval/eval/simple_tensor_engine.h>
#include <vespa/eval/tensor/default_tensor_engine.h>
#include <vespa/eval/tensor/dense/dense_replace_type_function.h>
#include <vespa/eval/tensor/dense/dense_fast_rename_optimizer.h>
#include <vespa/eval/tensor/dense/dense_tensor.h>
#include <vespa/eval/eval/test/tensor_model.hpp>
#include <vespa/eval/eval/test/eval_fixture.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/stash.h>
using namespace vespalib;
using namespace vespalib::eval;
using namespace vespalib::eval::test;
using namespace vespalib::tensor;
using namespace vespalib::eval::tensor_function;
const TensorEngine &prod_engine = DefaultTensorEngine::ref();
EvalFixture::ParamRepo make_params() {
return EvalFixture::ParamRepo()
.add("x5", spec({x(5)}, N()))
.add("x5f", spec({x(5)}, N()), "tensor<float>(x[5])")
.add("x_m", spec({x({"a", "b", "c"})}, N()))
.add("x5y3", spec({x(5),y(3)}, N()));
}
EvalFixture::ParamRepo param_repo = make_params();
void verify_optimized(const vespalib::string &expr) {
EvalFixture fixture(prod_engine, expr, param_repo, true);
EXPECT_EQUAL(fixture.result(), EvalFixture::ref(expr, param_repo));
auto info = fixture.find_all<DenseReplaceTypeFunction>();
EXPECT_EQUAL(info.size(), 1u);
}
void verify_not_optimized(const vespalib::string &expr) {
EvalFixture fixture(prod_engine, expr, param_repo, true);
EXPECT_EQUAL(fixture.result(), EvalFixture::ref(expr, param_repo));
auto info = fixture.find_all<DenseReplaceTypeFunction>();
EXPECT_TRUE(info.empty());
}
TEST("require that non-transposing dense renames are optimized") {
TEST_DO(verify_optimized("rename(x5,x,y)"));
TEST_DO(verify_optimized("rename(x5,x,a)"));
TEST_DO(verify_optimized("rename(x5y3,y,z)"));
TEST_DO(verify_optimized("rename(x5y3,x,a)"));
TEST_DO(verify_optimized("rename(x5y3,(x,y),(a,b))"));
TEST_DO(verify_optimized("rename(x5y3,(x,y),(z,zz))"));
TEST_DO(verify_optimized("rename(x5y3,(x,y),(y,z))"));
TEST_DO(verify_optimized("rename(x5y3,(y,x),(b,a))"));
}
TEST("require that transposing dense renames are not optimized") {
TEST_DO(verify_not_optimized("rename(x5y3,x,z)"));
TEST_DO(verify_not_optimized("rename(x5y3,y,a)"));
TEST_DO(verify_not_optimized("rename(x5y3,(x,y),(y,x))"));
TEST_DO(verify_not_optimized("rename(x5y3,(x,y),(b,a))"));
TEST_DO(verify_not_optimized("rename(x5y3,(y,x),(a,b))"));
}
TEST("require that non-dense renames are not optimized") {
TEST_DO(verify_not_optimized("rename(x_m,x,y)"));
}
TEST("require that chained optimized renames are compacted into a single operation") {
TEST_DO(verify_optimized("rename(rename(x5,x,y),y,z)"));
}
TEST("require that optimization is disabled for tensors with non-double cells") {
TEST_DO(verify_not_optimized("rename(x5f,x,y)"));
}
TEST_MAIN() { TEST_RUN_ALL(); }
| [
"[email protected]"
] | |
3f9187b6ac6d7d4ede37214ddc845bfa02bc99f3 | 89804d52c46e0de7d2ae42572ca4ab09da05bcf7 | /edmond_karp.cpp | 4b60faa04440ccdf5787ad24684f1397fb7c52fc | [] | no_license | LionsWrath/grafos-rework | 0dce70780b8bd2364a4e4778b7ed3df4844c92e5 | 5c9dc5850bf779ced112b811ec69d5ccb0401541 | refs/heads/master | 2016-08-12T18:22:15.640478 | 2015-10-06T03:49:17 | 2015-10-06T03:49:17 | 43,728,618 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,692 | cpp | #include <iostream>
#include <iomanip>
#include <queue>
#include <map>
#define MAXV 15
#define INF 99999
using namespace std;
typedef pair<int, int> ii;
typedef vector<ii> vii;
vii adjList[MAXV];
//Matriz de adjacências utilizada para guardar capacidade residual
int adjMat[MAXV][MAXV];
map<int, int> p;
int max_flow = 0;
int f, s, t;
void augmentPath(int v, int minEdge) {
if (v == s) {
f = minEdge;
return;
} else if (p.count(v)) { //melhora se existe um caminho
//Matriz de Adjacência para otimizar o acesso
augmentPath(p[v], min(minEdge, adjMat[p[v]][v]));
adjMat[p[v]][v] -= f; //arestas de avanço diminui
adjMat[v][p[v]] += f; //arestas de retorno aumenta
}
}
void edmond_karp() {
while (1) {
f = 0;
queue<int> q;
map<int, int> dist;
q.push(s);
dist[s] = 0;
while (!q.empty()) {
int u = q.front();
q.pop();
if (u == t) break;
for(vii::iterator it = adjList[u].begin(); it != adjList[u].end(); it++) {
if (adjMat[u][it->first] > 0 && !dist.count(it->first)) {
dist[it->first] = dist[u] + 1;
q.push(it->first);
p[it->first] = u;
}
}
}
augmentPath(t, INF);
if (f == 0) break;
max_flow += f;
}
}
int main() {
int V,E,X,Y,Z;
cin >> V >> E;
for (int i=0; i<E; i++) {
cin >> X >> Y >> Z;
adjList[X].push_back(make_pair(Y,Z));
adjMat[X][Y] = Z;
}
cin >> s >> t;
edmond_karp();
cout << max_flow << endl;
return 0;
}
| [
"[email protected]"
] | |
60c305663610f6b0fde6e819212b970b74756963 | 2717096aeec0fd4211efd22a94f80a269b9c240b | /plag-project/plagproject/media1/ashishsaggar/26.cpp | 849035f6fc37b358a63871da42eb1243325e8b3d | [] | no_license | sanchi191/Plagiarism | 13777c57aa5fae1f51e24d1f2c7f77e5890c7462 | 531b915eba84cb060fa6a2b999fede3569869fbb | refs/heads/main | 2023-09-02T11:43:02.923497 | 2021-11-06T16:15:56 | 2021-11-06T16:15:56 | 403,244,564 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,783 | cpp | #include<iostream>
#include<vector>
using namespace std;
vector<int> merge(vector<int> lt, vector<int> rt,vector<int> &invp, vector<int> &invq)
{
vector<int> result;
while (lt.size() > 0 || rt.size() > 0) {
if (lt.size() > 0 && rt.size() > 0) {
if (invp[lt.front()-1]<invp[rt.front()-1] || invq[lt.front()-1]<invq[rt.front()-1]) {
result.push_back(lt.front());
lt.erase(lt.begin());
}
else {
result.push_back(rt.front());
rt.erase(rt.begin());
}
} else if (lt.size() > 0) {
for (int i = 0; i < lt.size(); i++)
result.push_back(lt[i]);
break;
} else if (rt.size() > 0) {
for (int i = 0; i < rt.size(); i++)
result.push_back(rt[i]);
break;
}
}
return result;
}
vector<int> mergeSort(vector<int> m,vector<int> &invp, vector<int> &invq)
{
if (m.size() <= 1)
return m;
vector<int> lt, rt, result;
int middle = (m.size()+ 1) / 2;
for (int i = 0; i < middle; i++) {
lt.push_back(m[i]);
}
for (int i = middle; i < (int)m.size(); i++) {
rt.push_back(m[i]);
}
lt = mergeSort(lt,invp,invq);
rt = mergeSort(rt,invp,invq);
result = merge(lt, rt,invp,invq);
return result;
}
int main()
{
int n,i;
cin>>n;
n=6;
vector<int> p(n,0);
vector<int> q(n,0);
vector<int> invp(n,0);
vector<int> invq(n,0);
vector<int> r(n,0);
vector<int> s(n,0);
///////////////////////////
//p[0]=4;p[1]=2;p[2]=6;p[3]=1;p[4]=5;p[5]=3;
//q[0]=5;q[1]=2;q[2]=3;q[3]=6;q[4]=1;q[5]=4;
//////////////////////Input
for(i=0;i<n;i++){
cin>>p[i];
invp[p[i]-1]=i+1;
r[i]=i+1;
}
for(i=0;i<n;i++){
cin>>q[i];
invq[q[i]-1]=i+1;
s[i]=invp[q[i]-1];
}
r=mergeSort(r,invp,invq);
int cntp=0;
int cntq=0;
int cnts=0;
int cntr=0;
bool flag=false;
int j;
for(int i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(p[j]<p[i])
cntp++;
if(q[j]<q[i])
cntq++;
if(s[j]<s[i])
cnts++;
if(r[j]<r[i])
{
cntr++;
if(invp[r[j]-1]<invp[r[i]-1]||invq[r[j]-1]<invq[r[i]-1])
{flag=true;break;}
}
}
}
//cout<<temp1<<temp2<<endl;
//cout<<cntp<<endl<<cntq<<endl<<cnts<<endl<<cntr<<endl;
if(cntr==cntp+cntq-cnts&&!flag)
{cout<<"consistent"<<endl;
for(int k=0;k<n;k++)
cout<<r[k]<<" ";}
else
{
cout<<"inconsistent"<<endl;
//cout<<r[temp2-1]<<" "<<r[temp2]<<" "<<r[temp1]<<endl;
}
}
| [
"[email protected]"
] | |
86315823af8d3a7b997d3aba7fabf0706cc5cd4b | d822ffd937fae821fdc1f96369c26b8b31c0cda6 | /codeforces/p1325B.cpp | 643c1b1dfe2f1c75cf23b6db3e3e789c51d30c0a | [
"MIT"
] | permissive | freedomDR/coding | f8bb5b43951f49cc1018132cc5c53e756a782740 | 408f0fd8d7e5dd986842746d27d4d26a8dc9896c | refs/heads/master | 2023-03-30T03:01:01.837043 | 2023-03-28T12:36:53 | 2023-03-28T12:36:53 | 183,414,292 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 323 | cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int n;
cin >> n;
set<int> s;
for(int i = 0; i < n; i++)
{
int v; cin >> v;
s.insert(v);
}
cout << s.size() << endl;
}
return 0;
} | [
"[email protected]"
] | |
f8b082d0729cb526f8dc7e35113c0f4ea0d30e2e | f21f2ded46b41572720c68039e65e2933faa799b | /soil_read.ino | a87e91e5fa3df962a9989c8ab5123afa77f1feef | [] | no_license | jg302/soil-sensor | 7d053c64bf5b9190ab480c6cbd9e9539907e52c0 | 045bba1bbca1ea822f8cfc888fc3217a9cf011c7 | refs/heads/master | 2021-05-06T22:08:28.411307 | 2017-09-27T09:28:01 | 2017-09-27T09:28:01 | 112,722,222 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,656 | ino | // YL-39 + YL-69 humidity sensor
byte humidity_sensor_pin = A1;
byte humidity_sensor_vcc = 6;
const int pump_on = 9;
const int wet = 450;
const int dry = 46
5;
float results[5];
const int times_to_check = 5;
int counter = 0;
int average_result = 0;
void setup() {
// Init the humidity sensor board
pinMode(humidity_sensor_vcc, OUTPUT);
pinMode(pump_on, OUTPUT);
digitalWrite(humidity_sensor_vcc, LOW);
// Setup Serial
while (!Serial);
delay(1000);
Serial.begin(9600);
}
int read_humidity_sensor() {
digitalWrite(humidity_sensor_vcc, HIGH);
delay(500);
int value = analogRead(humidity_sensor_pin);
digitalWrite(humidity_sensor_vcc, LOW);
int new_value = 1023 - value;
return new_value;
}
int read_average_humidity() {
int sum;
while (counter < times_to_check) {
results[counter] = (read_humidity_sensor());
Serial.print("Reading no");
Serial.print(counter);
Serial.print(" = ");
Serial.println(results[counter]);
sum = sum + results[counter];
counter ++;
delay(500);
}
counter = 0;
average_result = sum / times_to_check;
Serial.print("Average humidity Level (0-1023): ");
return average_result;
}
void loop() {
Serial.println(read_average_humidity());
delay(1000);
if (average_result < wet) {
Serial.println("Too dry, running pump");
digitalWrite(pump_on, HIGH);
delay(100*100);
Serial.print(".");
delay(100*100);
Serial.print(".");
delay(100*100);
Serial.print(".");
delay(100*100);
digitalWrite(pump_on, LOW);
}
else {
Serial.println("Plants are good!");
delay(100*100);
delay(100*100);
}
}
| [
"[email protected]"
] | |
19ee4b41aa134a1294ce7cd286c16d543cb17dae | 3db45e05998660d4fd15c2dca7c6431e0759c2e9 | /Floreto/Utils/DataUtils.cpp | 7d4fb8790dee75fef2d7b113cb03ad45ace3cf4c | [] | no_license | flatgames/Floreto | 0015c5186ad9dd5d6bb12ff22a9066bf30351fcc | ac54b1be6a592c310e28e38b515157b7b95cf5d6 | refs/heads/master | 2021-01-22T05:10:55.446306 | 2017-02-11T04:38:49 | 2017-02-11T04:38:49 | 81,630,332 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,255 | cpp | #include "DataUtils.h"
#include "JsonUtils.h"
#include <errno.h>
#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
#include <WinSock2.h>
#else
#include <netinet/in.h>
#endif
using namespace cocos2d;
namespace Floreto
{
bool DataUtils::UsingXor = false;
Value DataUtils::readFromFile(const char *filename)
{
std::string data;
std::string path = StringUtils::format("%s%s", FileUtils::getInstance()->getWritablePath().c_str(), filename);
if (FileUtils::getInstance()->isFileExist(path))
data = FileUtils::getInstance()->getStringFromFile(path);
else
data = FileUtils::getInstance()->getStringFromFile(filename);
Value obj = JsonUtils::getValueFromJson(data.c_str());
return obj;
}
DataUtils::FileWriteResult DataUtils::writeToFile(const char *filename, const Value &dataObject, bool unquoted)
{
auto path = StringUtils::format("%s%s", FileUtils::getInstance()->getWritablePath().c_str(), filename);
#if RAPIDJSON_UNQUOTE_SUPPORTED
auto data = unquoted
? JsonUtils::getCompactJsonFromValue(dataObject, true /*pretty*/)
: JsonUtils::getJsonFromValue(dataObject, true /*pretty*/);
#else
auto data = JsonUtils::getJsonFromValue(dataObject, true /*pretty*/);
#endif
FILE *fp = fopen(path.c_str(), "wb");
if (!fp)
return FileWriteResult::FopenFailed;
size_t dataSize = strlen(data);
size_t result = fwrite(data, 1, dataSize, fp);
fclose(fp);
return result == dataSize ? FileWriteResult::OK : FileWriteResult::FwriteFailed;
}
Value DataUtils::readFromFileEncrypted(const char *key, const char *filename)
{
Data data;
std::string path = StringUtils::format("%s%s", FileUtils::getInstance()->getWritablePath().c_str(), filename);
if (FileUtils::getInstance()->isFileExist(path))
data = FileUtils::getInstance()->getDataFromFile(path);
else
data = FileUtils::getInstance()->getDataFromFile(filename);
if (data.isNull())
return Value::Null;
size_t len = (size_t)data.getSize() + 1;
char *buffer = new char[len];
memcpy(buffer, data.getBytes(), len - 1);
buffer[len - 1] = 0;
uint32_t fileChecksum = *(uint32_t *)buffer;
fileChecksum = (uint32_t)ntohl((u_long)fileChecksum);
if (DataUtils::UsingXor)
DataUtils::xorString(key, buffer + sizeof(uint32_t), len - sizeof(uint32_t) - 1);
else
DataUtils::decodeString(key, buffer + sizeof(uint32_t), len - sizeof(uint32_t) - 1);
uint32_t realChecksum = DataUtils::calculateChecksum(buffer + sizeof(uint32_t), len - sizeof(uint32_t) - 1);
if (fileChecksum != realChecksum)
{
delete[]buffer;
return Value::Null;
}
Value obj = JsonUtils::getValueFromJson(buffer + sizeof(uint32_t));
delete[]buffer;
return obj;
}
DataUtils::FileWriteResult DataUtils::writeToFileEncrypted(const char *key, const char *filename, const Value &dataObject, bool unquoted)
{
auto path = StringUtils::format("%s%s", FileUtils::getInstance()->getWritablePath().c_str(), filename);
FILE *fp = fopen(path.c_str(), "wb");
if (!fp)
return FileWriteResult::FopenFailed;
#if RAPIDJSON_UNQUOTE_SUPPORTED
auto str = unquoted
? JsonUtils::getCompactJsonFromValue(dataObject, false)
: JsonUtils::getJsonFromValue(dataObject);
#else
auto str = JsonUtils::getJsonFromValue(dataObject, false /*pretty*/);
#endif
size_t len = strlen(str) + sizeof(uint32_t);
char *buffer = new char[len];
memcpy(buffer + sizeof(int32_t), str, len - sizeof(uint32_t));
if (DataUtils::UsingXor)
DataUtils::xorString(key, buffer + sizeof(uint32_t), len - sizeof(uint32_t));
else
DataUtils::encodeString(key, buffer + sizeof(uint32_t), len - sizeof(uint32_t));
uint32_t checksum = DataUtils::calculateChecksum(str, len - sizeof(uint32_t));
checksum = (uint32_t)htonl((u_long)checksum);
memcpy(buffer, (void *)&checksum, sizeof(uint32_t));
size_t result = fwrite(buffer, 1, len, fp);
fclose(fp);
delete[]str;
delete[]buffer;
return result == len ? FileWriteResult::OK : FileWriteResult::FwriteFailed;
}
uint32_t DataUtils::calculateChecksum(const char *str, int32_t len)
{
if (len < 0)
len = strlen(str);
uint32_t h = 0;
for (int32_t i = 0; i < len; ++i)
h = ((h << 4) | (h >> 28)) ^ str[i]; // _rotl(h, 4) ^ *s
return h;
}
void DataUtils::encodeString(const char *key, char *buffer, int32_t length)
{
if (length < 0)
length = strlen(buffer);
const int32_t cryptoSize = strlen(key);
for (int32_t i = 0, k = 0; k < length; i += cryptoSize)
for (int32_t j = 0; j < cryptoSize && k < length; ++j, ++k)
buffer[k] = (char)((int)buffer[k] + (int)key[j]);
}
void DataUtils::decodeString(const char *key, char *buffer, int32_t length)
{
if (length < 0)
length = strlen(buffer);
const int32_t cryptoSize = strlen(key);
for (int32_t i = 0, k = 0; k < length; i += cryptoSize)
for (int32_t j = 0; j < cryptoSize && k < length; ++j, ++k)
buffer[k] = (char)((int)buffer[k] - (int)key[j]);
}
void DataUtils::xorString(const char *key, char *buffer, int32_t length)
{
if (length < 0)
length = strlen(buffer);
const int32_t cryptoSize = strlen(key);
for (int32_t i = 0, k = 0; k < length; i += cryptoSize)
for (int32_t j = 0; j < cryptoSize && k < length; ++j, ++k)
buffer[k] = (char)((int)buffer[k] ^ (int)key[j]);
}
}
| [
"[email protected]"
] | |
51cd868eaa4b1d85ad14472280379beab2d8ad4b | f68c1a09ade5d969f3973246747466e4a540ff74 | /src/prod/src/data/interop/ReliableCollectionService/StatefulServiceBase.h | a1526d4758c60b0bb167c5ce04f5370590decdc0 | [
"MIT"
] | permissive | GitTorre/service-fabric | ab38752d4cc7c8f2ee03553372c0f3e05911ff67 | 88da19dc5ea8edfe1c9abebe25a5c5079995db63 | refs/heads/master | 2021-04-09T10:57:45.678751 | 2018-08-20T19:17:28 | 2018-08-20T19:17:28 | 125,401,516 | 0 | 0 | MIT | 2018-03-15T17:13:53 | 2018-03-15T17:13:52 | null | UTF-8 | C++ | false | false | 4,829 | h | // ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
#pragma once
typedef void(*removePartitionContextCallback)(long long key);
typedef void(*addPartitionContextCallback)(long long key, TxnReplicatorHandle txReplicator, IFabricStatefulServicePartition* partition, GUID partitionId, long long replicaId);
namespace TXRStatefulServiceBase
{
class StatefulServiceBase
: public IFabricStatefulServiceReplica
, Common::ComUnknownBase
{
BEGIN_COM_INTERFACE_LIST(StatefulServiceBase)
COM_INTERFACE_ITEM(IID_IUnknown, IFabricStatefulServiceReplica)
COM_INTERFACE_ITEM(IID_IFabricStatefulServiceReplica, IFabricStatefulServiceReplica)
END_COM_INTERFACE_LIST()
// IFabricStatefulServiceReplica methods
public:
HRESULT STDMETHODCALLTYPE BeginOpen(
/* [in] */ FABRIC_REPLICA_OPEN_MODE openMode,
/* [in] */ IFabricStatefulServicePartition *partition,
/* [in] */ IFabricAsyncOperationCallback *callback,
/* [retval][out] */ IFabricAsyncOperationContext **context);
HRESULT STDMETHODCALLTYPE EndOpen(
/* [in] */ IFabricAsyncOperationContext *context,
/* [retval][out] */ IFabricReplicator **replicationEngine);
HRESULT STDMETHODCALLTYPE BeginChangeRole(
/* [in] */ FABRIC_REPLICA_ROLE newRole,
/* [in] */ IFabricAsyncOperationCallback *callback,
/* [retval][out] */ IFabricAsyncOperationContext **context);
HRESULT STDMETHODCALLTYPE EndChangeRole(
/* [in] */ IFabricAsyncOperationContext *context,
/* [retval][out] */ IFabricStringResult **serviceEndpoint);
HRESULT STDMETHODCALLTYPE BeginClose(
/* [in] */ IFabricAsyncOperationCallback *callback,
/* [retval][out] */ IFabricAsyncOperationContext **context);
HRESULT STDMETHODCALLTYPE EndClose(
/* [in] */ IFabricAsyncOperationContext *context);
void STDMETHODCALLTYPE Abort();
Common::ComPointer<IFabricStateProvider2Factory> GetStateProviderFactory();
Common::ComPointer<IFabricDataLossHandler> GetDataLossHandler();
StatefulServiceBase(
__in ULONG httpListeningPort,
__in FABRIC_PARTITION_ID partitionId,
__in FABRIC_REPLICA_ID replicaId,
__in Common::ComponentRootSPtr const & root);
// Uses default http endpoint resource. Name is a const defined in Helpers::ServiceHttpEndpointResourceName in Helpers.cpp
StatefulServiceBase(
__in FABRIC_PARTITION_ID partitionId,
__in FABRIC_REPLICA_ID replicaId,
__in Common::ComponentRootSPtr const & root);
virtual ~StatefulServiceBase();
public:
static void SetCallback(addPartitionContextCallback addCallback, removePartitionContextCallback removeCallback)
{
s_addPartitionContextCallbackFnptr = addCallback;
s_removePartitionContextCallbackFnptr = removeCallback;
}
protected:
__declspec(property(get = get_ReplicaId)) FABRIC_REPLICA_ID ReplicaId;
FABRIC_REPLICA_ID get_ReplicaId() const
{
return replicaId_;
}
__declspec(property(get = get_PartitionId)) FABRIC_PARTITION_ID PartitionId;
FABRIC_PARTITION_ID get_PartitionId() const
{
return partitionId_;
}
__declspec(property(get = get_TxReplicator)) TxnReplicatorHandle TxReplicator;
TxnReplicatorHandle get_TxReplicator() const
{
return txReplicator_;
}
__declspec(property(get = get_Role)) FABRIC_REPLICA_ROLE Role;
FABRIC_REPLICA_ROLE get_Role() const
{
return role_;
}
private:
LONGLONG StatefulServiceBase::GetPartitionLowKey();
LONGLONG const instanceId_;
Common::ComponentRootSPtr const root_;
FABRIC_REPLICA_ID const replicaId_;
FABRIC_PARTITION_ID const partitionId_;
std::wstring const httpListenAddress_;
std::wstring const changeRoleEndpoint_;
FABRIC_REPLICA_ROLE role_;
Common::ComPointer<IFabricStatefulServicePartition> partition_;
Common::ComPointer<IFabricPrimaryReplicator> primaryReplicator_;
TxnReplicatorHandle txReplicator_;
private:
static addPartitionContextCallback s_addPartitionContextCallbackFnptr;
static removePartitionContextCallback s_removePartitionContextCallbackFnptr;
};
typedef Common::ComPointer<StatefulServiceBase> StatefulServiceBaseCPtr;
}
| [
"[email protected]"
] | |
a85c02d4013c05e6127e138e848be5b155576edc | 2b36b7999765c3910f8b49f7f7dd46edf37471b5 | /light.h | 928a634f0656487244c5afdfc83584965aa515cb | [] | no_license | KayJo/BARealTimeRayTracingA | 69bce04c49b1eea2de51d7ecd241ee7d8937adef | 8e2721230d14ecf085450eaee91df1f5784b1d35 | refs/heads/master | 2021-01-19T09:51:21.487575 | 2013-10-22T10:54:04 | 2013-10-22T10:54:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 579 | h | #ifndef LIGHT_H
#define LIGHT_H
#include <QVector3D>
#include "rgb.h"
#include "shaderec.h"
class ShadeRec;
class Light
{
public:
Light();
Light(const Light& l);
virtual ~Light();
virtual Light* clone() const = 0;
virtual QVector3D get_direction(ShadeRec& sr) = 0;
virtual RGB L(ShadeRec& sr);
virtual bool inShadow(const Ray& ray, const ShadeRec& sr) const = 0;
bool castsShadows();
void setShadows(bool _shadows);
private:
bool shadows;
};
inline void Light::setShadows(bool _shadows)
{
shadows = _shadows;
}
#endif // LIGHT_H
| [
"[email protected]"
] | |
5d40420feb857b085f64d151f2d2b4cb75b60738 | 7a44204672c44e103aad47f3afd18952fbd9afd0 | /tags/release-2.2/SupportClasses/Brughera96Channels.h | bd2e5d29fec393432478748f7bb01a81b1f5c06a | [
"MIT"
] | permissive | AuditoryBiophysicsLab/EarLab | 202acdb79489ea903c20e45239a9a3ba820caeba | bc5ccc39076ee0419078e9ff5147e98f28fac3c9 | refs/heads/master | 2020-04-15T20:45:36.062819 | 2019-07-10T11:54:27 | 2019-07-10T11:54:27 | 27,502,131 | 3 | 1 | null | 2017-06-28T01:53:57 | 2014-12-03T18:47:42 | C++ | UTF-8 | C++ | false | false | 883 | h | #ifndef _BRUGHERA_96_CHANNELS_H_INCLUDED
#define _BRUGHERA_96_CHANNELS_H_INCLUDED
#include "HHChannelPopulation.h"
// Note: This factor is used to compensate for the fact that in the original Bushy Cell code by
// Hong Mei Cai and Andy Brughera, the millisecond-to-second scaling factor of 1000 was accidentally
// omitted from the code
#define BRUGHERA_96_RATE_CONSTANT .001
class Brughera96Kfast : public HHChannelPopulation
{
public:
Brughera96Kfast(double InitialVoltage_V, double Temperature_DegreesC);
virtual void CalculateRates(double Voltage_V);
virtual double GetCurrent_Amperes(void);
};
class Brughera96NaInactivation : public HHChannelPopulation
{
public:
Brughera96NaInactivation(double InitialVoltage_V, double Temperature_DegreesC);
virtual void CalculateRates(double Voltage_V);
virtual double GetCurrent_Amperes(void);
};
#endif
| [
"[email protected]"
] | |
60a23b2a0dfeaba75e118a78e74defad0c77cc02 | 970eafae5e57d610147438356a46256ff2881c49 | /A6/P1/cone.h | e2e867901f61facb6ef3e77a165e28aec41c4b82 | [] | no_license | EhsanEsc/AP-Projects | 9b3397d001c23c6244e5844db129d8fa63eed9ed | 96bce50e6fad3384d296f7989c63227ef90b0f71 | refs/heads/master | 2021-06-17T23:21:52.343762 | 2021-02-17T19:31:30 | 2021-02-17T19:31:30 | 178,702,421 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 283 | h |
#ifndef CONE_H
#define CONE_H
#include<string>
#include "shape.h"
class Cone : public Shape
{
public:
Cone(int _x, int _y, int _z, int _rad, int _h);
void scale(int factor);
int volume() const;
std::string get_type() const;
private:
int radius;
int height;
};
#endif
| [
"[email protected]"
] | |
f55398e07c06e1ad18aa95704be37c37a647640d | 5456502f97627278cbd6e16d002d50f1de3da7bb | /media/capture/mojo/video_capture_types_typemap_traits.cc | bcaf1890e3d41d49c7cd7b30dd538a64e77928d7 | [
"BSD-3-Clause"
] | permissive | TrellixVulnTeam/Chromium_7C66 | 72d108a413909eb3bd36c73a6c2f98de1573b6e5 | c8649ab2a0f5a747369ed50351209a42f59672ee | refs/heads/master | 2023-03-16T12:51:40.231959 | 2017-12-20T10:38:26 | 2017-12-20T10:38:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,758 | cc | // Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/capture/mojo/video_capture_types_typemap_traits.h"
#include "media/base/ipc/media_param_traits_macros.h"
#include "ui/gfx/geometry/mojo/geometry.mojom.h"
#include "ui/gfx/geometry/mojo/geometry_struct_traits.h"
namespace mojo {
// static
media::mojom::VideoPixelStorage
EnumTraits<media::mojom::VideoPixelStorage, media::VideoPixelStorage>::ToMojom(
media::VideoPixelStorage video_pixel_storage) {
DCHECK_EQ(media::PIXEL_STORAGE_CPU, video_pixel_storage);
return media::mojom::VideoPixelStorage::CPU;
}
// static
bool EnumTraits<media::mojom::VideoPixelStorage, media::VideoPixelStorage>::
FromMojom(media::mojom::VideoPixelStorage input,
media::VideoPixelStorage* out) {
DCHECK_EQ(media::mojom::VideoPixelStorage::CPU, input);
*out = media::PIXEL_STORAGE_CPU;
return true;
}
// static
media::mojom::ResolutionChangePolicy
EnumTraits<media::mojom::ResolutionChangePolicy,
media::ResolutionChangePolicy>::ToMojom(media::ResolutionChangePolicy
input) {
switch (input) {
case media::RESOLUTION_POLICY_FIXED_RESOLUTION:
return media::mojom::ResolutionChangePolicy::FIXED_RESOLUTION;
case media::RESOLUTION_POLICY_FIXED_ASPECT_RATIO:
return media::mojom::ResolutionChangePolicy::FIXED_ASPECT_RATIO;
case media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT:
return media::mojom::ResolutionChangePolicy::ANY_WITHIN_LIMIT;
}
NOTREACHED();
return media::mojom::ResolutionChangePolicy::FIXED_RESOLUTION;
}
// static
bool EnumTraits<media::mojom::ResolutionChangePolicy,
media::ResolutionChangePolicy>::
FromMojom(media::mojom::ResolutionChangePolicy input,
media::ResolutionChangePolicy* output) {
switch (input) {
case media::mojom::ResolutionChangePolicy::FIXED_RESOLUTION:
*output = media::RESOLUTION_POLICY_FIXED_RESOLUTION;
return true;
case media::mojom::ResolutionChangePolicy::FIXED_ASPECT_RATIO:
*output = media::RESOLUTION_POLICY_FIXED_ASPECT_RATIO;
return true;
case media::mojom::ResolutionChangePolicy::ANY_WITHIN_LIMIT:
*output = media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT;
return true;
}
NOTREACHED();
return false;
}
// static
media::mojom::PowerLineFrequency EnumTraits<
media::mojom::PowerLineFrequency,
media::PowerLineFrequency>::ToMojom(media::PowerLineFrequency input) {
switch (input) {
case media::PowerLineFrequency::FREQUENCY_DEFAULT:
return media::mojom::PowerLineFrequency::DEFAULT;
case media::PowerLineFrequency::FREQUENCY_50HZ:
return media::mojom::PowerLineFrequency::HZ_50;
case media::PowerLineFrequency::FREQUENCY_60HZ:
return media::mojom::PowerLineFrequency::HZ_60;
}
NOTREACHED();
return media::mojom::PowerLineFrequency::DEFAULT;
}
// static
bool EnumTraits<media::mojom::PowerLineFrequency, media::PowerLineFrequency>::
FromMojom(media::mojom::PowerLineFrequency input,
media::PowerLineFrequency* output) {
switch (input) {
case media::mojom::PowerLineFrequency::DEFAULT:
*output = media::PowerLineFrequency::FREQUENCY_DEFAULT;
return true;
case media::mojom::PowerLineFrequency::HZ_50:
*output = media::PowerLineFrequency::FREQUENCY_50HZ;
return true;
case media::mojom::PowerLineFrequency::HZ_60:
*output = media::PowerLineFrequency::FREQUENCY_60HZ;
return true;
}
NOTREACHED();
return false;
}
// static
bool StructTraits<media::mojom::VideoCaptureFormatDataView,
media::VideoCaptureFormat>::
Read(media::mojom::VideoCaptureFormatDataView data,
media::VideoCaptureFormat* out) {
if (!data.ReadFrameSize(&out->frame_size))
return false;
out->frame_rate = data.frame_rate();
if (!data.ReadPixelFormat(&out->pixel_format))
return false;
if (!data.ReadPixelStorage(&out->pixel_storage))
return false;
return true;
}
// static
bool StructTraits<media::mojom::VideoCaptureParamsDataView,
media::VideoCaptureParams>::
Read(media::mojom::VideoCaptureParamsDataView data,
media::VideoCaptureParams* out) {
if (!data.ReadRequestedFormat(&out->requested_format))
return false;
if (!data.ReadResolutionChangePolicy(&out->resolution_change_policy))
return false;
if (!data.ReadPowerLineFrequency(&out->power_line_frequency))
return false;
return true;
}
} // namespace mojo
| [
"[email protected]"
] | |
1272d580ee7d8ed7c37a5e7a115e48c8fc9a261c | 30596203fbd1a52cdabb368c6ce8e5230d4f4a04 | /ConcurrentAsyncQueueTests/ConcurrentAsyncQueueTryPush.h | 8cf941c0826a576567e7604198c18fc6274e29dd | [] | no_license | LeGnours/Cpp_HandsOn | 5edde874d168a22b9b7c8491e2b5643e6b5bce66 | f1de659d1fdcb7ae827ed57195a7227753c9d746 | refs/heads/master | 2020-03-16T03:42:55.036097 | 2018-05-09T22:45:29 | 2018-05-09T22:45:29 | 132,493,718 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 981 | h | #pragma once
#include <future>
#include <gtest/gtest.h>
#include "ConcurrentAsyncQueueMock.hpp"
using namespace std::chrono_literals;
class ConcurrentAsyncQueueTryPush : public testing::TestWithParam<::testing::tuple<bool, int, int, int>>
{
public:
void SetUp() final
{
size_queue_used_ = ::testing::get<0>(GetParam());
nb_threads_ = ::testing::get<1>(GetParam());
nb_values_to_add_ = ::testing::get<2>(GetParam());
size_queue_ = ::testing::get<3>(GetParam());
//nb_values_to_add_ = ::testing::get<4>(GetParam());
test_queue_ = size_queue_used_ ? new ConcurrentAsyncQueueMock<int>(size_queue_) :
new ConcurrentAsyncQueueMock<int>();
}
void TearDown() final
{
delete test_queue_;
test_queue_ = nullptr;
std::this_thread::sleep_for(250ms);
}
protected:
ConcurrentAsyncQueueMock<int> *test_queue_;
std::vector<std::future<bool>> test_threads_result_;
bool size_queue_used_;
int nb_threads_;
int nb_values_to_add_;
int size_queue_;
};
| [
"[email protected]"
] | |
2a4cabd912e5b45f0a83d97691126f58116940dd | 90c2a4943c5a410ffb71f8f6630d32a2e3a883d8 | /H4API/lib/h4api/H4_Defines.hpp | 88be0a90c471c20b139a294f460d53e409dbf99b | [] | no_license | RoseKavalier/H4MS | 503eca610dc0766dbfafb7dddaa8dffc5cfa8479 | a7db81ef48c1b79bcdecf8aa8c90f7ce828a8178 | refs/heads/master | 2023-08-28T07:43:25.446089 | 2023-01-08T15:02:53 | 2023-01-08T15:02:53 | 228,939,519 | 18 | 2 | null | 2023-01-08T15:02:54 | 2019-12-18T23:41:10 | C++ | UTF-8 | C++ | false | false | 963 | hpp | //////////////////////////////////////////////////////////////////////
// //
// Created by RoseKavalier: //
// [email protected] //
// Created: 2019-12-18 //
// Last edit: 2019-12-18 //
// ***You may use or distribute these files freely //
// so long as this notice remains present.*** //
// //
//////////////////////////////////////////////////////////////////////
#ifndef _H4_DEFINES_HPP_
#define _H4_DEFINES_HPP_
#include "H4_Core.hpp"
#include "H4Defines/H4Defines.hpp"
#include "H4Defines/H4Defines.inl"
#ifdef _H4API_HEADER_ONLY_
#include "H4Defines/H4Defines.cpp"
#endif
#endif /* #define _H4_DEFINES_HPP_ */ | [
"[email protected]"
] | |
9b9b100e3ed0935f8ffa6b693c1abc39ff080314 | a0b5eb18e791d204bd65ec2a8a4bddb1ea9bb41a | /persona.h | 2078824308dc5cffaebf5fae062a3b0ea6a6faf7 | [] | no_license | JHONEFRAIN98/Reservacion-de-citas-para-una-clinica | 27b35eb60af568039463d46219159c9347576468 | d2abab46f12e25de724c05a0676ca9d863c961d2 | refs/heads/main | 2023-07-07T04:52:35.531228 | 2021-07-31T05:02:05 | 2021-07-31T05:02:05 | 391,257,358 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 287 | h | #ifndef PERSONA_H
#define PERSONA_H
#include <QDialog>
namespace Ui {
class Persona;
}
class Persona : public QDialog
{
Q_OBJECT
public:
explicit Persona(QWidget *parent = nullptr);
~Persona();
private:
Ui::Persona *ui;
};
#endif // PERSONA_H
| [
"[email protected]"
] | |
18aef2c3f63a7f81ca996fd244684d9a41d744d5 | 721ecafc8ab45066f3661cbde2257f6016f5b3a8 | /codechef/enigma-2020/miniand.cpp | 73700b1291149894bc82108375fc723cb8a7c58d | [] | no_license | dr0pdb/competitive | 8651ba9722ec260aeb40ef4faf5698e6ebd75d4b | fd0d17d96f934d1724069c4e737fee37a5874887 | refs/heads/master | 2022-04-08T02:14:39.203196 | 2020-02-15T19:05:38 | 2020-02-15T19:05:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,123 | cpp | #include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;
const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);
#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define ull unsigned long long
#define deb(x ) cerr << #x << " = "<< x << endl;
#define endl "\n"
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define fill(x, y) memset(x, y, sizeof(y))
#define all(x) (x).begin(), (x).end()
#define bitcount(x) __builtin_popcount(x)
#define cps CLOCKS_PER_SEC
#define verify(x) if(x >= MOD) x -= MOD;
inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void print_case(int tn) {cout<<"Case #"<<tn<<": ";}
template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using maxpq = priority_queue<T>;
/*----------------------------------------------------------------------*/
const int nax = 1e5+5;
int arr[nax], pref[nax];
int main(){
std::ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
clock_t clk = clock();
int t,n,q; cin>>t;
while(t--) {
cin>>n;
pref[0] = 0;
FOR(i, 1, n + 1) {
cin>>arr[i];
pref[i] = pref[i - 1] + (arr[i] & 1);
}
cin>>q; int l,r;
FOR(i, 0, q) {
cin>>l>>r;
if(pref[r] - pref[l - 1] == (r - l + 1)) {
cout<<"ODD\n";
} else {
cout<<"EVEN\n";
}
}
}
cerr << endl << "Time (in ms): " << double(clock() - clk) * 1000.0 / cps << endl;
return 0;
} | [
"[email protected]"
] | |
7f3504614270c6d79cf06c5359378ee4cc9102d3 | 5ee0660a0f5f71477ce599c789bdc0b4e7833c20 | /src/lib/diagnose_dups/SignatureBuffer.hpp | 28aff1f40d7ddc1726ad190509e5cbd5af8ebe61 | [
"MIT"
] | permissive | tabbott/diagnose_dups | a2fdcb559b74ae55b2a86ef6e72b085bbb83b5f2 | af8734092c5fda998c2263a60d298a3c80fc13df | refs/heads/master | 2020-12-24T09:39:12.313790 | 2015-09-19T20:15:10 | 2015-09-19T20:36:28 | 42,760,413 | 0 | 0 | null | 2015-09-19T04:59:04 | 2015-09-19T04:59:02 | C++ | UTF-8 | C++ | false | false | 1,876 | hpp | #pragma once
#include "Signature.hpp"
#include "Read.hpp"
#include "BufferProcessor.hpp"
#include "io/BamRecord.hpp"
#include <map>
#include <vector>
#include <algorithm>
class SignatureBuffer {
public:
typedef std::map<Signature, std::vector<Read> > SigRead;
typedef SigRead::iterator SigReadIter;
SignatureBuffer(int32_t window_size, BufferProcessor processor)
: window_(window_size)
, processor_(processor) {
}
void add(bam1_t const* record) {
Signature sig(record);//TODO this might throw
Read read;
if (!sig.is_for_rightmost_read()) {
parse_read(record, read);//TODO this might throw?
process(sig);
buffer_[sig].push_back(read);
}
}
void process(Signature const& last_sig) {
if (buffer_.empty()) {
return;
}
SigReadIter i = buffer_.begin();
//FIXME This should use < or > operator once we figure out how those work
while (i != buffer_.end() && (i->first.tid < last_sig.tid || (i->first.tid == last_sig.tid && i->first.pos + window_ < last_sig.pos))) {
processor_(i->second);
i++;
}
//TODO Ensure that i is in fact the last thing we want to erase
//Alternatively, could probably remove i - 1
buffer_.erase(buffer_.begin(), i);
}
void process_all() {
for (SigReadIter i = buffer_.begin(); i != buffer_.end(); ++i)
processor_(i->second);
}
void write_output(std::ostream& os) {
processor_.write_output(os);
}
private:
int32_t window_;
BufferProcessor processor_;
std::map<Signature, std::vector<Read> > buffer_;
};
| [
"[email protected]"
] | |
f1f47f519c2c29bec5775476f7ba64f6f17b1211 | 14999861023015579b9cd1d08b5692f8425bdcf1 | /miwu/Classes/Army.h | 4b2896f2f303bd0f78b87eda243ee1b0206e3d08 | [] | no_license | jishankai/miwu | 5e9b554f825703414f518c34bf4fc97755830165 | 15ed8f165a5687ca4ace9ffe446c112915119f78 | refs/heads/master | 2021-06-08T13:23:41.748527 | 2014-03-14T10:14:05 | 2014-03-14T10:14:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,288 | h | //
// Army.h
// miwu
//
// Created by Ji Shankai on 13-6-8.
//
//
#ifndef __miwu__Army__
#define __miwu__Army__
#include "cocos2d.h"
#include "cocos-ext.h"
#include "LayerWithDialog.h"
class Army : public LayerWithDialog
{
private:
cocos2d::CCSprite* s1;
cocos2d::CCSprite* s2;
cocos2d::CCSprite* s3;
cocos2d::CCSprite* s4;
cocos2d::CCSprite* s5;
cocos2d::CCSprite* s6;
cocos2d::CCSprite* s7;
cocos2d::CCSprite* s8;
cocos2d::CCSprite* s9;
cocos2d::CCSprite* show_s1;
cocos2d::CCSprite* show_s2;
cocos2d::CCSprite* show_s3;
cocos2d::CCSprite* show_s4;
cocos2d::CCSprite* show_s5;
cocos2d::CCSprite* show_s6;
cocos2d::CCSprite* show_s7;
cocos2d::CCSprite* show_s8;
cocos2d::CCSprite* show_s9;
void clearArmyShow();
public:
virtual void onEnter();
CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(Army, create);
virtual bool onAssignCCBMemberVariable(CCObject* pTarget, const char* pMemberVariableName, CCNode* pNode);
virtual bool ccTouchBegan(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent);
void onInfoRequestCompleted(cocos2d::extension::CCHttpClient *sender, cocos2d::extension::CCHttpResponse *response);
};
#endif /* defined(__miwu__Army__) */
| [
"[email protected]"
] | |
7f330fee8c3e1aea29c2ac69542d158381407912 | 3433f6bd7abf7b09b533ce3ee46081ea11588931 | /HeyaldaAudio/HeyaldaAudio.h | 06221d8f5a0f91fe0a6c291ea9948afd5b95073f | [
"Unlicense"
] | permissive | PooperPig/HeyaldaSimpleAudioEngine | ae320f5261de0c66f9874d0d3703268a943f8466 | b169bab6532822db963372aa200d0278d7906cd6 | refs/heads/master | 2021-01-17T16:48:46.484004 | 2015-07-06T21:10:04 | 2015-07-06T21:10:04 | 38,684,859 | 1 | 0 | null | 2015-07-07T12:01:07 | 2015-07-07T12:01:07 | null | UTF-8 | C++ | false | false | 2,430 | h | #ifndef __Heyalda_HeyaldaAudio__
#define __Heyalda_HeyaldaAudio__
/*
Copyright (c) 2011-2015 Heyalda Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <string>
#include "HeyaldaAudioSupport.h"
class HeyaldaAudio {
public:
static HeyaldaAudio * getInstance();
static void end();
static bool getShouldStartMusicWhenPauseEnds();
static void setShouldStartMusicWhenPauseEnds( bool shouldStartMusicWhenPauseEnds );
static int playEffect(const std::string & fileName, bool loop, float pitch, float pan, float gain);
static int playEffect(const std::string & fileName, float pitch, float pan, float gain);
static void stopEffect(unsigned int soundId);
static void setEffectPriority(unsigned int soundId, int priority);
static bool isBackgroundMusicEnabled();
static void stopMusic();
static void enableBackgroundMusic();
static void disableBackgroundMusic();
static void setAudioForPauseMenuState(bool isGamePaused);
static void pauseMusic();
static void resumeMusic();
static void setMusicVolume(float level);
static void setEffectsVolume(float volumeLevel);
static void setEffectVolume(unsigned int soundID, float volume);
static void setEffectPitch(unsigned int soundID, float pitch);
private:
HeyaldaAudio();
~HeyaldaAudio();
static std::string getMusicLoopNameForLoopNumber(int loopNumber);
};
#endif // #define __Heyalda_HeyaldaAudio__
| [
"[email protected]"
] | |
2d06383737c144a08fd01949cd85da0df21909bc | 6b1bfb419ca81027fa9b3b7d95feaf602b0bb216 | /virtual_base.cpp | 3ecd6472c448bbe0c4ca4201e46d25360aa83c33 | [] | no_license | Arijit365/C-C-examples | df5eba6636b66ffd1358d51748b022efe0c22f7f | cb202d2f7387ee6db89ff3f8ed94b4bf342f4048 | refs/heads/main | 2023-08-16T13:21:15.843508 | 2021-10-12T13:07:02 | 2021-10-12T13:07:02 | 416,333,063 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,486 | cpp | #include<iostream>
using namespace std;
/*
using virtual base method in c++ program to create class method
student , test , sports , result --> we use the names as class method
*/
class student{
protected:
int roll_no;
public :
void set_number(int a){roll_no = a;}
void print_number(void){cout<< " Your roll No. is " << roll_no << endl;}
};
class test : virtual public student{
protected:
float math , physics;
public :
void set_marks(float m1 , float m2){
math = m1;
physics = m2;
}
void print_marks(void){
cout << " your marks is here:" << endl;
cout << " math :"<< math << endl;
cout << " physics:" << physics << endl;
}
};
class sports : virtual public student{
protected:
int score;
public:
void set_score(int sc){score = sc;}
void print_score(void){
cout << " Your Score in PT is :" << score << endl;
}
};
class result : public test , public sports{
private:
float total;
public:
void display(void){
total = physics + math + score;
print_number();
print_marks();
print_score();
cout << " Your total Score is :" << total << endl;
}
};
int main(){
result Arijit ;
Arijit.set_number(5026);
Arijit.set_marks(93.89 , 97.08);
Arijit.set_score(9); // PT exam is conduct in 10 marks
Arijit.display();
return 0;
} | [
"[email protected]"
] | |
56c8fcae8e5baeb13c32bf6a57a3c170c64c6ebb | 518bf342bc4138982af3e2724e75f1d9ca3ba56c | /solutions/1290. Convert Binary Number in a Linked List to Integer/1290.cpp | 27deba76135ba5da8d50c8d79c6f12e18adf1d1d | [
"MIT"
] | permissive | walkccc/LeetCode | dae85af7cc689882a84ee5011f0a13a19ad97f18 | a27be41c174565d365cbfe785f0633f634a01b2a | refs/heads/main | 2023-08-28T01:32:43.384999 | 2023-08-20T19:00:45 | 2023-08-20T19:00:45 | 172,231,974 | 692 | 302 | MIT | 2023-08-13T14:48:42 | 2019-02-23T15:46:23 | C++ | UTF-8 | C++ | false | false | 177 | cpp | class Solution {
public:
int getDecimalValue(ListNode* head) {
int ans = 0;
for (; head; head = head->next)
ans = ans * 2 + head->val;
return ans;
}
};
| [
"[email protected]"
] | |
96040cd57555f0066e71f555a518a4c7e90212ad | a5771d30a850d6b24932913eda102d50baffc07a | /test_four.cpp | 39d37d790d1473c025df4805523a3cc29ad5465b | [] | no_license | PathfinderTJU/CSAPP_ex01 | 3a4f4228abf17a0dc89ad666991468dfce0f05ad | a5d7f497d8c3b7e6eef811576a58388f45229201 | refs/heads/master | 2020-05-14T01:25:33.276137 | 2019-04-16T12:26:42 | 2019-04-16T12:26:42 | 181,684,584 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,129 | cpp | #include <iostream>
#include "test_four.h"
using namespace std;
void Test4::printAddress(int* a[], int x, int y){
for (int i = 0 ; i < x ; i++){
cout << "a[" << i << "](" << ((a) + (y * i)) << "): ";//编译器的优化,地址加一个int数,会自动乘以int的大小4
for (int j = 0 ; j < y ; j++){
cout << a[i][j] << "(" << (a)+ (i*y+j) << ") ";
}
cout << endl;
}
}
void Test4::showEle(int a[], int x){
cout << "The address of a[0]: " << a << endl;
cout << "The address of a[" << x <<"]: " << a+x << endl;
}
void Test4::pointerPrint(int* a, int n){
for (int i = 0 ; i < n ; i++){
cout << "a[" << i << "]: " << *(a + i) << "(" << (a + i) << ")" << endl;
}
*(a+5) = 10;
cout << "Modified a[5] by 10: *(a+5) = 10. Result a[5] = " << a[5] << endl;
}
void Test4::pointerShow(int* a[], int x, int y){
for (int i = 0 ; i < x ; i++){
for (int j = 0 ; j < y ; j++){
cout << "a[" << i << "][" << j << "]: " << *(*(a + i) + j) << "(" << (*(a + i) + j) << ")" << endl;
}
}
}
| [
"[email protected]"
] | |
c921169f05ef584a7f7f14fea9a3d2b1afe9eb16 | 2f329704f0b497c5751194697a9833011ea023ff | /Macadamian/NothinButNet/src/Sales.h | 759494998ed114e29b0bfa2f599b1040f2c31d33 | [] | no_license | jcmurray/Cascades-Community-Samples | 7f5f9f04d46a5a94932947d507d93dc2273584af | 4749d8105d1136b960784ae451cd78fca5377b4a | refs/heads/master | 2020-04-03T16:46:29.260600 | 2016-01-25T20:03:01 | 2016-01-25T20:03:01 | 4,585,897 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 799 | h | /*
* Copyright (c) 2011-2012 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef SALES_H_
#define SALES_H_
namespace data {
class Sales {
public:
Sales();
virtual ~Sales();
};
} /* namespace data */
#endif /* SALES_H_ */
| [
"[email protected]"
] | |
1db8e4c63f4233769de15cad63907eb2056a9bdd | f12e53b806ba418a58f814ebc87c4446a422b2f5 | /solutions/spoj/test/test.cpp | d54a3a387b3a3bcda059bc094b694e6f4b122dab | [
"MIT"
] | permissive | biadelmont/playground | f775cd86109e30ed464d4d6eff13f9ded40627cb | 93c6248ec6cd25d75f0efbda1d50e0705bbd1e5a | refs/heads/master | 2021-05-06T15:49:43.253788 | 2017-11-07T13:00:31 | 2017-11-07T13:00:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 190 | cpp | #include <iostream>
#include <string>
int main() {
std::string n;
while (std::cin >> n) {
if (n == "42") break;
std::cout << n << std::endl;
}
return 0;
}
| [
"[email protected]"
] | |
f4b823989a14ec68e89191584a6c6841b9a57087 | 6c0a11f53eff7b31ee0c493524e69b003b5938d7 | /src.force/BulletCollision/gim_basic_geometry_operations.h | b0c78e8cdae63532d1c25e73fa57205c290052c4 | [] | no_license | yangfengzzz/Sisy | d2a8a6c34cd24f2eb9ab11bf99c76c68032ccc25 | 1f9637bcdc31905a4fb28fe2b9446c1ed279a923 | refs/heads/master | 2023-02-02T20:16:19.307627 | 2020-03-26T02:03:15 | 2020-03-26T02:03:15 | 322,533,099 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,089 | h | #ifndef GIM_BASIC_GEOMETRY_OPERATIONS_H_INCLUDED
#define GIM_BASIC_GEOMETRY_OPERATIONS_H_INCLUDED
/*! \file gim_basic_geometry_operations.h
*\author Francisco Leon Najera
type independant geometry routines
*/
/*
-----------------------------------------------------------------------------
This source file is part of GIMPACT Library.
For the latest info, see http://gimpact.sourceforge.net/
Copyright (c) 2006 Francisco Leon Najera. C.C. 80087371.
email: [email protected]
This library is free software; you can redistribute it and/or
modify it under the terms of EITHER:
(1) The GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at
your option) any later version. The text of the GNU Lesser
General Public License is included with this library in the
file GIMPACT-LICENSE-LGPL.TXT.
(2) The BSD-style license that is included with this library in
the file GIMPACT-LICENSE-BSD.TXT.
(3) The zlib/libpng license that is included with this library in
the file GIMPACT-LICENSE-ZLIB.TXT.
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 files
GIMPACT-LICENSE-LGPL.TXT, GIMPACT-LICENSE-ZLIB.TXT and GIMPACT-LICENSE-BSD.TXT for more details.
-----------------------------------------------------------------------------
*/
#include "gim_linear_math.h"
#ifndef PLANEDIREPSILON
#define PLANEDIREPSILON 0.0000001f
#endif
#ifndef PARALELENORMALS
#define PARALELENORMALS 0.000001f
#endif
#define TRIANGLE_NORMAL(v1, v2, v3, n) \
{ \
vec3f _dif1, _dif2; \
VEC_DIFF(_dif1, v2, v1); \
VEC_DIFF(_dif2, v3, v1); \
VEC_CROSS(n, _dif1, _dif2); \
VEC_NORMALIZE(n); \
}
#define TRIANGLE_NORMAL_FAST(v1, v2, v3, n) \
{ \
vec3f _dif1, _dif2; \
VEC_DIFF(_dif1, v2, v1); \
VEC_DIFF(_dif2, v3, v1); \
VEC_CROSS(n, _dif1, _dif2); \
}
/// plane is a vec4f
#define TRIANGLE_PLANE(v1, v2, v3, plane) \
{ \
TRIANGLE_NORMAL(v1, v2, v3, plane); \
plane[3] = VEC_DOT(v1, plane); \
}
/// plane is a vec4f
#define TRIANGLE_PLANE_FAST(v1, v2, v3, plane) \
{ \
TRIANGLE_NORMAL_FAST(v1, v2, v3, plane); \
plane[3] = VEC_DOT(v1, plane); \
}
/// Calc a plane from an edge an a normal. plane is a vec4f
#define EDGE_PLANE(e1, e2, n, plane) \
{ \
vec3f _dif; \
VEC_DIFF(_dif, e2, e1); \
VEC_CROSS(plane, _dif, n); \
VEC_NORMALIZE(plane); \
plane[3] = VEC_DOT(e1, plane); \
}
#define DISTANCE_PLANE_POINT(plane, point) (VEC_DOT(plane, point) - plane[3])
#define PROJECT_POINT_PLANE(point, plane, projected) \
{ \
GREAL _dis; \
_dis = DISTANCE_PLANE_POINT(plane, point); \
VEC_SCALE(projected, -_dis, plane); \
VEC_SUM(projected, projected, point); \
}
//! Verifies if a point is in the plane hull
template <typename CLASS_POINT, typename CLASS_PLANE>
SIMD_FORCE_INLINE bool POINT_IN_HULL(
const CLASS_POINT &point, const CLASS_PLANE *planes, GUINT plane_count)
{
GREAL _dis;
for (GUINT _i = 0; _i < plane_count; ++_i)
{
_dis = DISTANCE_PLANE_POINT(planes[_i], point);
if (_dis > 0.0f) return false;
}
return true;
}
template <typename CLASS_POINT, typename CLASS_PLANE>
SIMD_FORCE_INLINE void PLANE_CLIP_SEGMENT(
const CLASS_POINT &s1,
const CLASS_POINT &s2, const CLASS_PLANE &plane, CLASS_POINT &clipped)
{
GREAL _dis1, _dis2;
_dis1 = DISTANCE_PLANE_POINT(plane, s1);
VEC_DIFF(clipped, s2, s1);
_dis2 = VEC_DOT(clipped, plane);
VEC_SCALE(clipped, -_dis1 / _dis2, clipped);
VEC_SUM(clipped, clipped, s1);
}
enum ePLANE_INTERSECTION_TYPE
{
G_BACK_PLANE = 0,
G_COLLIDE_PLANE,
G_FRONT_PLANE
};
enum eLINE_PLANE_INTERSECTION_TYPE
{
G_FRONT_PLANE_S1 = 0,
G_FRONT_PLANE_S2,
G_BACK_PLANE_S1,
G_BACK_PLANE_S2,
G_COLLIDE_PLANE_S1,
G_COLLIDE_PLANE_S2
};
//! Confirms if the plane intersect the edge or nor
/*!
intersection type must have the following values
<ul>
<li> 0 : Segment in front of plane, s1 closest
<li> 1 : Segment in front of plane, s2 closest
<li> 2 : Segment in back of plane, s1 closest
<li> 3 : Segment in back of plane, s2 closest
<li> 4 : Segment collides plane, s1 in back
<li> 5 : Segment collides plane, s2 in back
</ul>
*/
template <typename CLASS_POINT, typename CLASS_PLANE>
SIMD_FORCE_INLINE eLINE_PLANE_INTERSECTION_TYPE PLANE_CLIP_SEGMENT2(
const CLASS_POINT &s1,
const CLASS_POINT &s2,
const CLASS_PLANE &plane, CLASS_POINT &clipped)
{
GREAL _dis1 = DISTANCE_PLANE_POINT(plane, s1);
GREAL _dis2 = DISTANCE_PLANE_POINT(plane, s2);
if (_dis1 > -G_EPSILON && _dis2 > -G_EPSILON)
{
if (_dis1 < _dis2) return G_FRONT_PLANE_S1;
return G_FRONT_PLANE_S2;
}
else if (_dis1 < G_EPSILON && _dis2 < G_EPSILON)
{
if (_dis1 > _dis2) return G_BACK_PLANE_S1;
return G_BACK_PLANE_S2;
}
VEC_DIFF(clipped, s2, s1);
_dis2 = VEC_DOT(clipped, plane);
VEC_SCALE(clipped, -_dis1 / _dis2, clipped);
VEC_SUM(clipped, clipped, s1);
if (_dis1 < _dis2) return G_COLLIDE_PLANE_S1;
return G_COLLIDE_PLANE_S2;
}
//! Confirms if the plane intersect the edge or not
/*!
clipped1 and clipped2 are the vertices behind the plane.
clipped1 is the closest
intersection_type must have the following values
<ul>
<li> 0 : Segment in front of plane, s1 closest
<li> 1 : Segment in front of plane, s2 closest
<li> 2 : Segment in back of plane, s1 closest
<li> 3 : Segment in back of plane, s2 closest
<li> 4 : Segment collides plane, s1 in back
<li> 5 : Segment collides plane, s2 in back
</ul>
*/
template <typename CLASS_POINT, typename CLASS_PLANE>
SIMD_FORCE_INLINE eLINE_PLANE_INTERSECTION_TYPE PLANE_CLIP_SEGMENT_CLOSEST(
const CLASS_POINT &s1,
const CLASS_POINT &s2,
const CLASS_PLANE &plane,
CLASS_POINT &clipped1, CLASS_POINT &clipped2)
{
eLINE_PLANE_INTERSECTION_TYPE intersection_type = PLANE_CLIP_SEGMENT2(s1, s2, plane, clipped1);
switch (intersection_type)
{
case G_FRONT_PLANE_S1:
VEC_COPY(clipped1, s1);
VEC_COPY(clipped2, s2);
break;
case G_FRONT_PLANE_S2:
VEC_COPY(clipped1, s2);
VEC_COPY(clipped2, s1);
break;
case G_BACK_PLANE_S1:
VEC_COPY(clipped1, s1);
VEC_COPY(clipped2, s2);
break;
case G_BACK_PLANE_S2:
VEC_COPY(clipped1, s2);
VEC_COPY(clipped2, s1);
break;
case G_COLLIDE_PLANE_S1:
VEC_COPY(clipped2, s1);
break;
case G_COLLIDE_PLANE_S2:
VEC_COPY(clipped2, s2);
break;
}
return intersection_type;
}
//! Finds the 2 smallest cartesian coordinates of a plane normal
#define PLANE_MINOR_AXES(plane, i0, i1) VEC_MINOR_AXES(plane, i0, i1)
//! Ray plane collision in one way
/*!
Intersects plane in one way only. The ray must face the plane (normals must be in opossite directions).<br/>
It uses the PLANEDIREPSILON constant.
*/
template <typename T, typename CLASS_POINT, typename CLASS_PLANE>
SIMD_FORCE_INLINE bool RAY_PLANE_COLLISION(
const CLASS_PLANE &plane,
const CLASS_POINT &vDir,
const CLASS_POINT &vPoint,
CLASS_POINT &pout, T &tparam)
{
GREAL _dis, _dotdir;
_dotdir = VEC_DOT(plane, vDir);
if (_dotdir < PLANEDIREPSILON)
{
return false;
}
_dis = DISTANCE_PLANE_POINT(plane, vPoint);
tparam = -_dis / _dotdir;
VEC_SCALE(pout, tparam, vDir);
VEC_SUM(pout, vPoint, pout);
return true;
}
//! line collision
/*!
*\return
-0 if the ray never intersects
-1 if the ray collides in front
-2 if the ray collides in back
*/
template <typename T, typename CLASS_POINT, typename CLASS_PLANE>
SIMD_FORCE_INLINE GUINT LINE_PLANE_COLLISION(
const CLASS_PLANE &plane,
const CLASS_POINT &vDir,
const CLASS_POINT &vPoint,
CLASS_POINT &pout,
T &tparam,
T tmin, T tmax)
{
GREAL _dis, _dotdir;
_dotdir = VEC_DOT(plane, vDir);
if (btFabs(_dotdir) < PLANEDIREPSILON)
{
tparam = tmax;
return 0;
}
_dis = DISTANCE_PLANE_POINT(plane, vPoint);
char returnvalue = _dis < 0.0f ? 2 : 1;
tparam = -_dis / _dotdir;
if (tparam < tmin)
{
returnvalue = 0;
tparam = tmin;
}
else if (tparam > tmax)
{
returnvalue = 0;
tparam = tmax;
}
VEC_SCALE(pout, tparam, vDir);
VEC_SUM(pout, vPoint, pout);
return returnvalue;
}
/*! \brief Returns the Ray on which 2 planes intersect if they do.
Written by Rodrigo Hernandez on ODE convex collision
\param p1 Plane 1
\param p2 Plane 2
\param p Contains the origin of the ray upon returning if planes intersect
\param d Contains the direction of the ray upon returning if planes intersect
\return true if the planes intersect, 0 if paralell.
*/
template <typename CLASS_POINT, typename CLASS_PLANE>
SIMD_FORCE_INLINE bool INTERSECT_PLANES(
const CLASS_PLANE &p1,
const CLASS_PLANE &p2,
CLASS_POINT &p,
CLASS_POINT &d)
{
VEC_CROSS(d, p1, p2);
GREAL denom = VEC_DOT(d, d);
if (GIM_IS_ZERO(denom)) return false;
vec3f _n;
_n[0] = p1[3] * p2[0] - p2[3] * p1[0];
_n[1] = p1[3] * p2[1] - p2[3] * p1[1];
_n[2] = p1[3] * p2[2] - p2[3] * p1[2];
VEC_CROSS(p, _n, d);
p[0] /= denom;
p[1] /= denom;
p[2] /= denom;
return true;
}
//***************** SEGMENT and LINE FUNCTIONS **********************************///
/*! Finds the closest point(cp) to (v) on a segment (e1,e2)
*/
template <typename CLASS_POINT>
SIMD_FORCE_INLINE void CLOSEST_POINT_ON_SEGMENT(
CLASS_POINT &cp, const CLASS_POINT &v,
const CLASS_POINT &e1, const CLASS_POINT &e2)
{
vec3f _n;
VEC_DIFF(_n, e2, e1);
VEC_DIFF(cp, v, e1);
GREAL _scalar = VEC_DOT(cp, _n);
_scalar /= VEC_DOT(_n, _n);
if (_scalar < 0.0f)
{
VEC_COPY(cp, e1);
}
else if (_scalar > 1.0f)
{
VEC_COPY(cp, e2);
}
else
{
VEC_SCALE(cp, _scalar, _n);
VEC_SUM(cp, cp, e1);
}
}
/*! \brief Finds the line params where these lines intersect.
\param dir1 Direction of line 1
\param point1 Point of line 1
\param dir2 Direction of line 2
\param point2 Point of line 2
\param t1 Result Parameter for line 1
\param t2 Result Parameter for line 2
\return dointersect 0 if the lines won't intersect, else 1
*/
template <typename T, typename CLASS_POINT>
SIMD_FORCE_INLINE bool LINE_INTERSECTION_PARAMS(
const CLASS_POINT &dir1,
CLASS_POINT &point1,
const CLASS_POINT &dir2,
CLASS_POINT &point2,
T &t1, T &t2)
{
GREAL det;
GREAL e1e1 = VEC_DOT(dir1, dir1);
GREAL e1e2 = VEC_DOT(dir1, dir2);
GREAL e2e2 = VEC_DOT(dir2, dir2);
vec3f p1p2;
VEC_DIFF(p1p2, point1, point2);
GREAL p1p2e1 = VEC_DOT(p1p2, dir1);
GREAL p1p2e2 = VEC_DOT(p1p2, dir2);
det = e1e2 * e1e2 - e1e1 * e2e2;
if (GIM_IS_ZERO(det)) return false;
t1 = (e1e2 * p1p2e2 - e2e2 * p1p2e1) / det;
t2 = (e1e1 * p1p2e2 - e1e2 * p1p2e1) / det;
return true;
}
//! Find closest points on segments
template <typename CLASS_POINT>
SIMD_FORCE_INLINE void SEGMENT_COLLISION(
const CLASS_POINT &vA1,
const CLASS_POINT &vA2,
const CLASS_POINT &vB1,
const CLASS_POINT &vB2,
CLASS_POINT &vPointA,
CLASS_POINT &vPointB)
{
CLASS_POINT _AD, _BD, n;
vec4f _M; //plane
VEC_DIFF(_AD, vA2, vA1);
VEC_DIFF(_BD, vB2, vB1);
VEC_CROSS(n, _AD, _BD);
GREAL _tp = VEC_DOT(n, n);
if (_tp < G_EPSILON) //ARE PARALELE
{
//project B over A
bool invert_b_order = false;
_M[0] = VEC_DOT(vB1, _AD);
_M[1] = VEC_DOT(vB2, _AD);
if (_M[0] > _M[1])
{
invert_b_order = true;
GIM_SWAP_NUMBERS(_M[0], _M[1]);
}
_M[2] = VEC_DOT(vA1, _AD);
_M[3] = VEC_DOT(vA2, _AD);
//mid points
n[0] = (_M[0] + _M[1]) * 0.5f;
n[1] = (_M[2] + _M[3]) * 0.5f;
if (n[0] < n[1])
{
if (_M[1] < _M[2])
{
vPointB = invert_b_order ? vB1 : vB2;
vPointA = vA1;
}
else if (_M[1] < _M[3])
{
vPointB = invert_b_order ? vB1 : vB2;
CLOSEST_POINT_ON_SEGMENT(vPointA, vPointB, vA1, vA2);
}
else
{
vPointA = vA2;
CLOSEST_POINT_ON_SEGMENT(vPointB, vPointA, vB1, vB2);
}
}
else
{
if (_M[3] < _M[0])
{
vPointB = invert_b_order ? vB2 : vB1;
vPointA = vA2;
}
else if (_M[3] < _M[1])
{
vPointA = vA2;
CLOSEST_POINT_ON_SEGMENT(vPointB, vPointA, vB1, vB2);
}
else
{
vPointB = invert_b_order ? vB1 : vB2;
CLOSEST_POINT_ON_SEGMENT(vPointA, vPointB, vA1, vA2);
}
}
return;
}
VEC_CROSS(_M, n, _BD);
_M[3] = VEC_DOT(_M, vB1);
LINE_PLANE_COLLISION(_M, _AD, vA1, vPointA, _tp, btScalar(0), btScalar(1));
/*Closest point on segment*/
VEC_DIFF(vPointB, vPointA, vB1);
_tp = VEC_DOT(vPointB, _BD);
_tp /= VEC_DOT(_BD, _BD);
_tp = GIM_CLAMP(_tp, 0.0f, 1.0f);
VEC_SCALE(vPointB, _tp, _BD);
VEC_SUM(vPointB, vPointB, vB1);
}
//! Line box intersection in one dimension
/*!
*\param pos Position of the ray
*\param dir Projection of the Direction of the ray
*\param bmin Minimum bound of the box
*\param bmax Maximum bound of the box
*\param tfirst the minimum projection. Assign to 0 at first.
*\param tlast the maximum projection. Assign to INFINITY at first.
*\return true if there is an intersection.
*/
template <typename T>
SIMD_FORCE_INLINE bool BOX_AXIS_INTERSECT(T pos, T dir, T bmin, T bmax, T &tfirst, T &tlast)
{
if (GIM_IS_ZERO(dir))
{
return !(pos < bmin || pos > bmax);
}
GREAL a0 = (bmin - pos) / dir;
GREAL a1 = (bmax - pos) / dir;
if (a0 > a1) GIM_SWAP_NUMBERS(a0, a1);
tfirst = GIM_MAX(a0, tfirst);
tlast = GIM_MIN(a1, tlast);
if (tlast < tfirst) return false;
return true;
}
//! Sorts 3 componets
template <typename T>
SIMD_FORCE_INLINE void SORT_3_INDICES(
const T *values,
GUINT *order_indices)
{
//get minimum
order_indices[0] = values[0] < values[1] ? (values[0] < values[2] ? 0 : 2) : (values[1] < values[2] ? 1 : 2);
//get second and third
GUINT i0 = (order_indices[0] + 1) % 3;
GUINT i1 = (i0 + 1) % 3;
if (values[i0] < values[i1])
{
order_indices[1] = i0;
order_indices[2] = i1;
}
else
{
order_indices[1] = i1;
order_indices[2] = i0;
}
}
#endif // GIM_VECTOR_H_INCLUDED
| [
"[email protected]"
] | |
98058511dfea47d1650df88ce48bba68555c19ce | 154af226e35a9ba52db9560eca50b07f5ed661fd | /hohejd8/Assignment03hohejd8/Executables/MyTDMInversehohejd8.cpp | 72d928a42b13176333146c64b7c072dd33fd24d4 | [] | no_license | jeffdk/SpecClass2011 | 9492e7386ef03914f2867391c3e5c3a7344bedd4 | 8598c47f3e99e6317285213d2c466eb9715c16fb | refs/heads/master | 2016-09-06T03:33:20.952155 | 2012-09-10T22:29:27 | 2012-09-10T22:29:27 | 1,931,578 | 18 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 1,031 | cpp | #include "DataMesh.hpp"
#include "Tensor.hpp"
#include "InvertRank2Tensor.hpp"
#include <cstdlib>
int main(void) {
//initialize mesh, Tensor<DataMesh>, and inverses
//const Mesh m(IPoint(MV::fill,10,10));
const Mesh m(IPoint(MV::fill,3,3,3));
Tensor<DataMesh> Trand(3,"aa", m);
Tensor<DataMesh> InvT(Trand.Structure(), m);
Tensor<DataMesh> InvInvT(Trand.Structure(), m);
//seed random number generator
srand ( time(NULL) );
//create random data for *symmetric* TDm in the range [0.0, 1.0)
int mSize = m.Size();
for(int i=0; i<3; i++){
for(int j=i; j<3; j++){
for(int k=0; k<mSize; k++){
Trand(i,j)[k] = (rand()%1000)/1000.0;
}
}
}
//compute the inverse
InvertRank2Tensor(Trand, InvT);
//compute the inverse of the inverse
InvertRank2Tensor(InvT, InvInvT);
std::cout << "Tensor<DataMesh> inverse routine: \n" <<
"Trand = \n" << Trand << "\n" <<
"InvT = \n" << InvT << "\n" <<
"InvInvT = \n" << InvInvT << std::endl;
return EXIT_SUCCESS;
}
| [
"[email protected]"
] | |
386cf1c19214e587ba243ddac57e16cb8c844fea | 1a403e89c29a81df2b0e980f3855d2f34fb19039 | /C++/trackit.cc | 25fc8cd46a14022141996a94bc88ff3039565bf7 | [] | no_license | saxstrack/SAXSTracker | 33fea692f6e0e4c60e0816f2538c5f03f5e7fbdb | 04f15fd24324208666bd8a2fc7f8b92f1d7a46d3 | refs/heads/master | 2021-01-22T13:08:25.915232 | 2013-06-18T12:14:07 | 2013-06-18T12:14:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,707 | cc | //#include "opencv/cv.h"
//#include "opencv/highgui.h"
//#include "opencv2/opencv.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "stdio.h"
#include <iostream>
#include <fstream>
//#include <sstream>
//#include <string>
// Sudden changes should be dampend, if line sticks to same place for several frames, then quick jumps should
// be either ignored or moved partly towards. I.e. believe the line that got most frames more..
// (like a second delay or something)
// I want to be able to call the C++ function from python.. starting the C++ tracking..
// then monitor the line location from python.. by calling a C++ function.
// As soon as the C function is called it will block.. how do I then monitor the internal
// line location values?
int find_top()
{
//ssn
}
int main()
{
int key = 0;
int seek_line_idx = 120;
CvPoint pt1 = cvPoint(0,seek_line_idx);
CvPoint pt2 = cvPoint(350,seek_line_idx);
CvPoint pt1_beam_right = cvPoint(180,0);
CvPoint pt2_beam_right = cvPoint(180,250);
CvPoint pt1_beam_left = cvPoint(160,0);
CvPoint pt2_beam_left = cvPoint(160,250);
cv::Scalar green(0,250,0);
cv::Scalar red(0,0,250); // BGR
cv::Scalar white(255,255,255);
//std::vector<Point2f> circles;
//CvScalar red = CV_RGB(250,0,0);
int thickness = 1;
int connectivity = 8;
int sub;
// Initialize camera and OpenCV image
//CvCapture* capture = cvCaptureFromCAM( 0 );
//CvCapture* capture = cvCaptureFromAVI( "sample_plug.avi" );
//******* Read background file: **************
std::string strline;
std::vector<double> record;
//std::vector <std::vector <std::string> > data;
std::ifstream bgfile("example.txt");
std::getline(bgfile, strline); //reads until a '\n' character
//std::cout << strline << "\n";
std::stringstream ss( strline );
std::string field;
std::getline(ss, field, ','); //reads until a ',' character
// Convert read numbers to double:
while (std::getline( ss, field, ','))
{
std::stringstream fs( field );
double f = 0.0;
fs >> f;
// store the background values in record:
record.push_back( f );
}
// ********************************************
//std::cout << record.front() << "\n";
for(int i = 0; i < record.size(); i++)
{
sub = record.at(i);
std::cout << sub << "\n";
printf("%d\n", uchar(sub));
std::cout << record.size() << "\n";
}
cv::VideoCapture capture("sample_plug.avi");
cv::Mat frame, gray_frame;
//cv::Vec3f circles;
std::vector<cv::Vec3f> circles2;
//IplImage* frame = cvQueryFrame( capture );
//IplImage *grey_frame;
// Check
if ( !capture.isOpened())
{
fprintf( stderr, "Cannot open AVI!\n" );
return 1;
}
// Get the fps, needed to set the delay
//int fps = ( int )cvGetCaptureProperty( capture, CV_CAP_PROP_FPS );
int fps = capture.get(CV_CAP_PROP_FPS);
capture >> frame; // Get first frame CV_8UC3
printf("\nFPS: %f\n", float(fps));
printf("Channels: %d\n", int(frame.channels()));
// Create a window to display the video
cv::namedWindow("video", CV_WINDOW_AUTOSIZE );
cv::namedWindow("Plot", CV_WINDOW_AUTOSIZE );
cv::Mat plt(300, frame.cols, CV_8UC1);
printf("Cols: %d\n", int(frame.cols));
printf("Rows: %d\n", int(frame.rows));
printf("Channels: %d\n", int(frame.channels()));
int frame_count = 0;
int frame_step = 1;
int line_location = -1;
//int window_length = 15;
float old_frame[frame.cols];
float subtract[frame.cols];
float clean_signal[frame.cols];
float filtered_signal[frame.cols];
int step_key = 0;
while( key != 'x' )
{
// get the image frame
//frame = cvQueryFrame( capture );
// Get a new frame
capture >> frame;
// if( frame_count == frame_step)
// frame_count = 0;
// else
// frame_count++;
// exit if unsuccessful
if( frame.empty() ) break;
//Convert frame to gray scale
cv::cvtColor(frame, gray_frame, CV_RGB2GRAY);
//smooth the gray_scale frame
cv::GaussianBlur(gray_frame, gray_frame, cv::Size (11, 11), 0);
// Add ability to pause and step through frames
if(step_key == 1)
key = 'p';
if( key == 'p' ){
key = 0;
while( key != 'p' && key != 27 ){
key = cvWaitKey( 250 );
if (key == 's'){
// Write background to file:
printf("Save check!!\n");
// std::ofstream myfile("example.txt", std::ios::app);
//
// for(int i = 0; i <frame.cols; i++){
// uchar val = gray_frame.at<uchar>(seek_line_idx, i);
// myfile << int(val);
// myfile << ",";
// }
// myfile << int(gray_frame.at<uchar>(seek_line_idx, frame.cols));
//
// myfile << "\n";
// myfile.close();
key = 0;
}
if (key == 'n'){
printf("Step!\n");
step_key = 1;
break;
}
else
step_key = 0;
}
}
// *********** Plot background subtracted seek_line ****************
int res;
for(int i = gray_frame.cols-1; i >= 0 ; i--)
{
//Get image intensity on seek_line:
uchar val = gray_frame.at<uchar>(seek_line_idx, i);
//Get background intensity:
sub = record.at(i);
//Avoid chaos if itensity-bg < 0
res = (255-val) + uchar(sub)-250;
if(res < 0)
res = 1;
//Save itensity-bg value
clean_signal[i] = res;
// plot curve:
plt.at<uchar>(res, i) = 250;
//std::cout << res << "\n";
}
// Plot tracking line:
for(int i = gray_frame.cols; i >= 0; i--)
{
if(double(clean_signal[i]) > 80.0)
{
CvPoint pt1_plug = cvPoint(i, 0);
CvPoint pt2_plug = cvPoint(i, 250);
cv:line(gray_frame, pt1_plug, pt2_plug, white, thickness, connectivity);
line_location = i;
//std::cout << line_location << "\n";
break;
}
}
//cvCvtColor(frame, &grey_frame, CV_BGR2GRAY);
//Draw horizontal line across the image to indicate seek_line
cv::line(gray_frame, pt1, pt2, red, thickness,connectivity);
cv::line(gray_frame, pt1_beam_right, pt2_beam_right, red, thickness, connectivity);
cv::line(gray_frame, pt1_beam_left, pt2_beam_left, red, thickness, connectivity);
//cv::line(gray_frame, pt1_beam, pt2_beam, green, thickness,connectivity);
// display current frame
cv::imshow( "video", gray_frame );
cv::imshow("Plot", plt);
//cvReleaseImage(&grey_frame);
// exit if user presses 'x'
key = cv::waitKey( 1000 / fps );
// Clear plot:
plt = plt * 0;
}
// Tidy up
cv::destroyWindow( "video" );
frame.release();
gray_frame.release();
capture.release();
return 0;
} | [
"[email protected]"
] | |
618500bf462cf333875cedffe46f006f104f7272 | 56e1d915b1270e38248bb0e0241622eff71d9cf9 | /src/rhal/arduino/motorcontrol.cpp | a38f7dbf470807f90891a60de45e292e5284c814 | [] | no_license | Lichor8/evc | 608d7c3f350257b66c2a897f5f2a3c4aaa76f108 | 53bebcef6221304b3331fa7d1420f0189061c104 | refs/heads/master | 2020-04-05T14:36:18.966653 | 2016-08-31T14:30:43 | 2016-08-31T14:30:43 | 57,280,849 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,094 | cpp | // import libraries
#include <Arduino.h>
#include "motorcontrol.h"
// functions
void pcontrol(float phi_d, float phi_a, float &omega, float &v, float &e_old, float &E)
{
// PID controller for omega (rotation speed)
const float Kp = 0.1;
const float Ki = 0.0;
const float Kd = 0.0;
float e = phi_d - phi_a;
float e_dot = e - e_old;
E = E + e;
e_old = e;
omega = Kp*e + Ki*E + Kd*e_dot;
v = 0.25; // base speed [m/s]
}
float scontrol(float theta_dot_d, float theta_dot_a, float &e_old, float &E)
{
// state space controller
// const int K[2] = {0.3101, -0.0688 };
// const int F = 0;
// float r = theta_dot_d;
// float x1 = theta_dot_a;
// float x2 = dc_current_a;
// float c = K[0]*x1 + K[1]*x2 + F*r
// PID controller for c (duty cycle)
const float Kp = 0.1;
const float Ki = 0.01;
const float Kd = 0.02;
float e = theta_dot_d - theta_dot_a;
float e_dot = e - e_old;
E = E + e;
e_old = e;
float c = Kp*e + Ki*E + Kd*e_dot;
if ( c > 1)
{
c = 1;
}
else if (c < -1)
{
c = -1;
}
return c;
}
//float scontrol_l(float theta_dot_d, float theta_dot_a, float &e_old_l, float &E_l)
//{
// // PID controller for c (duty cycle)
// const float Kp = 1.0;
// const float Ki = 0.0;
// const float Kd = 0.0;
//
// float e = theta_dot_d - theta_dot_a;
// float e_dot_l = e - e_old_l;
// E_l = E_l + e;
// e_old_l = e;
//
// float c = Kp*e + Ki*E_l + Kd*e_dot_l;
// if ( c > 1)
// {
// c = 1;
// }
// else if (c < -1)
// {
// c = -1;
// }
// return c;
//}
//
//float scontrol_r(float theta_dot_d, float theta_dot_a, float &e_old_r, float &E_r)
//{
// // PID controller for c (duty cycle)
// const float Kp = 1.0;
// const float Ki = 0.0;
// const float Kd = 0.0;
//
// float e = theta_dot_d - theta_dot_a;
// float e_dot_r = e - e_old_r;
// E_r = E_r + e;
// e_old_r = e;
//
// float c = Kp*e + Ki*E_r + Kd*e_dot_r;
// if ( c > 1)
// {
// c = 1;
// }
// else if (c < -1)
// {
// c = -1;
// }
// return c;
//}
void setMotor(const unsigned char cucPWM, const unsigned char cucFWD , const unsigned char cucBWD, const int ciSpeed)
{
if (ciSpeed < 0)
{
digitalWrite(cucFWD, LOW);
digitalWrite(cucBWD, LOW);
digitalWrite(cucFWD, LOW);
digitalWrite(cucBWD, HIGH);
}
else
{
digitalWrite(cucFWD, LOW);
digitalWrite(cucBWD, LOW);
digitalWrite(cucFWD, HIGH);
digitalWrite(cucBWD, LOW);
}
analogWrite(cucPWM, abs(ciSpeed));
}
// // PID controller for c (duty cycle)
// const float Kp = 2.0;
// const float Ki = 0.0;
// const float Kd = 0.0;
//
// float e = theta_dot_d_l - theta_dot_a_l;
// float e_dot_l = e - e_old_l;
// E_l = E_l + e;
// e_old_l = e;
// float c_l = Kp*e + Ki*E_l + Kd*e_dot_l;
//
// e = theta_dot_d_r - theta_dot_a_r;\
// float e_dot_r = e - e_old_r;
// E_r = E_r + e;
// e_old_r = e;
// float c_r = Kp*e + Ki*E_r + Kd*e_dot_r;
| [
"[email protected]"
] | |
cd3d8420b930b44c9189dcac817470df72dda987 | bc01d89e3b77b9b60afd6f5f8fcad5675b813f8e | /natfw/natfwclient/src/natfwcredentials.cpp | e5329be1fc7b8b7a164cd9ff45aed50f68384dab | [] | no_license | SymbianSource/oss.FCL.sf.mw.ipappsrv | fce862742655303fcfa05b9e77788734aa66724e | 65c20a5a6e85f048aa40eb91066941f2f508a4d2 | refs/heads/master | 2021-01-12T15:40:59.380107 | 2010-09-17T05:32:38 | 2010-09-17T05:32:38 | 71,849,396 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,347 | cpp | /*
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
#include "natfwcredentials.h"
#include "natfwclientlogs.h"
// ======== MEMBER FUNCTIONS ========
// ---------------------------------------------------------------------------
// CNATFWCredentials::CNATFWCredentials
// ---------------------------------------------------------------------------
//
CNATFWCredentials::CNATFWCredentials()
{
__NATFWCLIENT("CNATFWCredentials::CNATFWCredentials" )
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::ConstructL
// ---------------------------------------------------------------------------
//
void CNATFWCredentials::ConstructL( )
{
__NATFWCLIENT("CNATFWCredentials::ConstructL" )
iUsername.Assign( KNullDesC8().AllocL() );
iPassword.Assign( KNullDesC8().AllocL() );
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::ConstructL
// ---------------------------------------------------------------------------
//
void CNATFWCredentials::ConstructL(
const CNATFWCredentials& aCredentials)
{
__NATFWCLIENT("CNATFWCredentials::ConstructL (copy)" )
iDirection = aCredentials.Direction();
iStreamCollectionId = aCredentials.StreamCollectionId();
iStreamId = aCredentials.StreamId();
iUsername.Assign( aCredentials.Username().AllocL() );
iPassword.Assign( aCredentials.Password().AllocL() );
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::NewL
// ---------------------------------------------------------------------------
//
EXPORT_C CNATFWCredentials* CNATFWCredentials::NewL()
{
__NATFWCLIENT("CNATFWCredentials::NewL")
CNATFWCredentials* self = CNATFWCredentials::NewLC();
CleanupStack::Pop( self );
return self;
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::NewL
// ---------------------------------------------------------------------------
//
EXPORT_C CNATFWCredentials* CNATFWCredentials::NewL(
const CNATFWCredentials& aCredentials )
{
__NATFWCLIENT("CNATFWCredentials::NewL (copy)")
CNATFWCredentials* self = CNATFWCredentials::NewLC( aCredentials );
CleanupStack::Pop( self );
return self;
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::NewLC
// ---------------------------------------------------------------------------
//
EXPORT_C CNATFWCredentials* CNATFWCredentials::NewLC(
const CNATFWCredentials& aCredentials )
{
__NATFWCLIENT("CNATFWCredentials::NewLC (copy)")
CNATFWCredentials* self = new( ELeave ) CNATFWCredentials();
CleanupStack::PushL( self );
self->ConstructL( aCredentials );
return self;
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::NewLC
// ---------------------------------------------------------------------------
//
EXPORT_C CNATFWCredentials* CNATFWCredentials::NewLC()
{
__NATFWCLIENT("CNATFWCredentials::NewLC")
CNATFWCredentials* self = new( ELeave ) CNATFWCredentials();
CleanupStack::PushL( self );
self->ConstructL();
return self;
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::~CNATFWCredentials
// ---------------------------------------------------------------------------
//
CNATFWCredentials::~CNATFWCredentials()
{
__NATFWCLIENT("CNATFWCredentials::~CNATFWCredentials")
iUsername.Close();
iPassword.Close();
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::SetStreamCollectionId
// ---------------------------------------------------------------------------
//
EXPORT_C void CNATFWCredentials::SetStreamCollectionId(
TUint aStreamCollectionId )
{
__NATFWCLIENT_INT1(
"CNATFWCredentials::SetStreamCollectionId", aStreamCollectionId )
iStreamCollectionId = aStreamCollectionId;
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::StreamCollectionId
// ---------------------------------------------------------------------------
//
EXPORT_C TUint CNATFWCredentials::StreamCollectionId() const
{
__NATFWCLIENT_INT1(
"CNATFWCredentials::StreamCollectionId", iStreamCollectionId )
return iStreamCollectionId;
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::SetStreamId
// ---------------------------------------------------------------------------
//
EXPORT_C void CNATFWCredentials::SetStreamId( TUint aStreamId )
{
__NATFWCLIENT_INT1( "CNATFWCredentials::SetStreamId", aStreamId )
iStreamId = aStreamId;
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::StreamId
// ---------------------------------------------------------------------------
//
EXPORT_C TUint CNATFWCredentials::StreamId() const
{
__NATFWCLIENT_INT1( "CNATFWCredentials::StreamId", iStreamId )
return iStreamId;
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::SetDirection
// ---------------------------------------------------------------------------
//
EXPORT_C void CNATFWCredentials::SetDirection(
TUtilizationDirection aDirection )
{
__NATFWCLIENT_INT1("CNATFWCredentials::SetDirection", aDirection )
iDirection = aDirection;
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::Direction
// ---------------------------------------------------------------------------
//
EXPORT_C CNATFWCredentials::TUtilizationDirection
CNATFWCredentials::Direction() const
{
__NATFWCLIENT_INT1("CNATFWCredentials::Direction", iDirection )
return iDirection;
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::SetUsernameL
// ---------------------------------------------------------------------------
//
EXPORT_C void CNATFWCredentials::SetUsernameL( const TDesC8& aUsername )
{
__NATFWCLIENT_STR8("CNATFWCredentials::SetUsernameL", aUsername )
iUsername.Close();
iUsername.Assign( aUsername.AllocL() );
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::Username
// ---------------------------------------------------------------------------
//
EXPORT_C const TDesC8& CNATFWCredentials::Username() const
{
__NATFWCLIENT_STR8("CNATFWCredentials::Username", iUsername )
return iUsername;
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::SetPasswordL
// ---------------------------------------------------------------------------
//
EXPORT_C void CNATFWCredentials::SetPasswordL( const TDesC8& aPassword )
{
__NATFWCLIENT_STR8("CNATFWCredentials::SetPasswordL", aPassword )
iPassword.Close();
iPassword.Assign( aPassword.AllocL() );
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::Password
// ---------------------------------------------------------------------------
//
EXPORT_C const TDesC8& CNATFWCredentials::Password() const
{
__NATFWCLIENT_STR8("CNATFWCredentials::Password", iPassword )
return iPassword;
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::Compare
// Implements TIdentityRelation.
// ---------------------------------------------------------------------------
//
EXPORT_C TBool CNATFWCredentials::Compare(
const CNATFWCredentials& aCredential1,
const CNATFWCredentials& aCredential2 )
{
return ( aCredential1 == aCredential2 );
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::CopyL
// ---------------------------------------------------------------------------
//
EXPORT_C void CNATFWCredentials::CopyL(
const CNATFWCredentials& aCredentials)
{
__NATFWCLIENT("CNATFWCredentials::CopyL" )
iDirection = aCredentials.Direction();
iStreamCollectionId = aCredentials.StreamCollectionId();
iPassword.Close();
iPassword.Assign( aCredentials.Password().AllocL() );
iUsername.Close();
iUsername.Assign( aCredentials.Username().AllocL() );
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::operator==
// ---------------------------------------------------------------------------
//
EXPORT_C TBool CNATFWCredentials::operator==(
const CNATFWCredentials& aCredentials ) const
{
return (
iStreamCollectionId == aCredentials.StreamCollectionId()
&& iStreamId == aCredentials.StreamId()
&& iDirection == aCredentials.Direction()
&& iUsername == aCredentials.Username()
&& iPassword == aCredentials.Password() );
}
// ---------------------------------------------------------------------------
// CNATFWCredentials::operator!=
// ---------------------------------------------------------------------------
//
EXPORT_C TBool CNATFWCredentials::operator!=(
const CNATFWCredentials& aCredentials ) const
{
return !(
iStreamCollectionId == aCredentials.StreamCollectionId()
&& iStreamId == aCredentials.StreamId()
&& iDirection == aCredentials.Direction()
&& iUsername == aCredentials.Username()
&& iPassword == aCredentials.Password() );
}
| [
"[email protected]"
] | |
12da8af1490b85c8383f8525c7362ff04fdb0a70 | 9de18ef120a8ae68483b866c1d4c7b9c2fbef46e | /third_party/libbase/parsenetaddress_test.cpp | a3bfac860ad0e26f9cedf0c5a6cd776ef2e801a0 | [
"Apache-2.0",
"BSD-3-Clause",
"BSD-2-Clause",
"LicenseRef-scancode-free-unknown"
] | permissive | google/orbit | 02a5b4556cd2f979f377b87c24dd2b0a90dff1e2 | 68c4ae85a6fe7b91047d020259234f7e4961361c | refs/heads/main | 2023-09-03T13:14:49.830576 | 2023-08-25T06:28:36 | 2023-08-25T06:28:36 | 104,358,587 | 2,680 | 325 | BSD-2-Clause | 2023-08-25T06:28:37 | 2017-09-21T14:28:35 | C++ | UTF-8 | C++ | false | false | 3,715 | cpp | /*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "android-base/parsenetaddress.h"
#include <gtest/gtest.h>
using android::base::ParseNetAddress;
TEST(ParseNetAddressTest, TestUrl) {
std::string canonical, host, error;
int port = 123;
EXPECT_TRUE(
ParseNetAddress("www.google.com", &host, &port, &canonical, &error));
EXPECT_EQ("www.google.com:123", canonical);
EXPECT_EQ("www.google.com", host);
EXPECT_EQ(123, port);
EXPECT_TRUE(
ParseNetAddress("www.google.com:666", &host, &port, &canonical, &error));
EXPECT_EQ("www.google.com:666", canonical);
EXPECT_EQ("www.google.com", host);
EXPECT_EQ(666, port);
}
TEST(ParseNetAddressTest, TestIpv4) {
std::string canonical, host, error;
int port = 123;
EXPECT_TRUE(ParseNetAddress("1.2.3.4", &host, &port, &canonical, &error));
EXPECT_EQ("1.2.3.4:123", canonical);
EXPECT_EQ("1.2.3.4", host);
EXPECT_EQ(123, port);
EXPECT_TRUE(ParseNetAddress("1.2.3.4:666", &host, &port, &canonical, &error));
EXPECT_EQ("1.2.3.4:666", canonical);
EXPECT_EQ("1.2.3.4", host);
EXPECT_EQ(666, port);
}
TEST(ParseNetAddressTest, TestIpv6) {
std::string canonical, host, error;
int port = 123;
EXPECT_TRUE(ParseNetAddress("::1", &host, &port, &canonical, &error));
EXPECT_EQ("[::1]:123", canonical);
EXPECT_EQ("::1", host);
EXPECT_EQ(123, port);
EXPECT_TRUE(ParseNetAddress("fe80::200:5aee:feaa:20a2", &host, &port,
&canonical, &error));
EXPECT_EQ("[fe80::200:5aee:feaa:20a2]:123", canonical);
EXPECT_EQ("fe80::200:5aee:feaa:20a2", host);
EXPECT_EQ(123, port);
EXPECT_TRUE(ParseNetAddress("[::1]:666", &host, &port, &canonical, &error));
EXPECT_EQ("[::1]:666", canonical);
EXPECT_EQ("::1", host);
EXPECT_EQ(666, port);
EXPECT_TRUE(ParseNetAddress("[fe80::200:5aee:feaa:20a2]:666", &host, &port,
&canonical, &error));
EXPECT_EQ("[fe80::200:5aee:feaa:20a2]:666", canonical);
EXPECT_EQ("fe80::200:5aee:feaa:20a2", host);
EXPECT_EQ(666, port);
}
TEST(ParseNetAddressTest, TestInvalidAddress) {
std::string canonical, host;
int port;
std::string failure_cases[] = {
// Invalid IPv4.
"1.2.3.4:",
"1.2.3.4::",
":123",
// Invalid IPv6.
":1",
"::::::::1",
"[::1",
"[::1]",
"[::1]:",
"[::1]::",
// Invalid port.
"1.2.3.4:-1",
"1.2.3.4:0",
"1.2.3.4:65536"
"1.2.3.4:hello",
"[::1]:-1",
"[::1]:0",
"[::1]:65536",
"[::1]:hello",
};
for (const auto& address : failure_cases) {
// Failure should give some non-empty error string.
std::string error;
EXPECT_FALSE(ParseNetAddress(address, &host, &port, &canonical, &error));
EXPECT_NE("", error);
}
}
// Null canonical address argument.
TEST(ParseNetAddressTest, TestNullCanonicalAddress) {
std::string host, error;
int port = 42;
EXPECT_TRUE(ParseNetAddress("www.google.com", &host, &port, nullptr, &error));
EXPECT_TRUE(ParseNetAddress("1.2.3.4", &host, &port, nullptr, &error));
EXPECT_TRUE(ParseNetAddress("::1", &host, &port, nullptr, &error));
}
| [
"[email protected]"
] | |
71060ddfe7efda3156c7d8c6ad20ff5001ece985 | 2335eb5096f3fc0cc8348a849e9b68d371b869ae | /Source/Foundation/bsfCore/Scene/BsPrefab.cpp | bf67462d431500412859336c12114d4ffce194bc | [
"MIT"
] | permissive | except134/bsf | d013edd7a22ffd8c8afa68dfaa4e2d621f994671 | 950d7192557f8899dcd4972b17699a20f8335567 | refs/heads/master | 2020-05-07T10:50:07.376865 | 2019-04-09T14:44:05 | 2019-04-09T14:44:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,929 | cpp | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
#include "Scene/BsPrefab.h"
#include "Private/RTTI/BsPrefabRTTI.h"
#include "Resources/BsResources.h"
#include "Scene/BsSceneObject.h"
#include "Scene/BsPrefabUtility.h"
#include "BsCoreApplication.h"
namespace bs
{
Prefab::Prefab()
:Resource(false), mHash(0), mIsScene(true)
{
}
Prefab::~Prefab()
{
if (mRoot != nullptr)
mRoot->destroy(true);
}
HPrefab Prefab::create(const HSceneObject& sceneObject, bool isScene)
{
SPtr<Prefab> newPrefab = createEmpty();
newPrefab->mIsScene = isScene;
PrefabUtility::clearPrefabIds(sceneObject, true, false);
newPrefab->initialize(sceneObject);
HPrefab handle = static_resource_cast<Prefab>(gResources()._createResourceHandle(newPrefab));
newPrefab->mUUID = handle.getUUID();
sceneObject->mPrefabLinkUUID = newPrefab->mUUID;
newPrefab->_getRoot()->mPrefabLinkUUID = newPrefab->mUUID;
return handle;
}
SPtr<Prefab> Prefab::createEmpty()
{
SPtr<Prefab> newPrefab = bs_core_ptr<Prefab>(new (bs_alloc<Prefab>()) Prefab());
newPrefab->_setThisPtr(newPrefab);
return newPrefab;
}
void Prefab::initialize(const HSceneObject& sceneObject)
{
sceneObject->mPrefabDiff = nullptr;
PrefabUtility::generatePrefabIds(sceneObject);
// If there are any child prefab instances, make sure to update their diffs so they are saved with this prefab
Stack<HSceneObject> todo;
todo.push(sceneObject);
while (!todo.empty())
{
HSceneObject current = todo.top();
todo.pop();
UINT32 childCount = current->getNumChildren();
for (UINT32 i = 0; i < childCount; i++)
{
HSceneObject child = current->getChild(i);
if (!child->mPrefabLinkUUID.empty())
PrefabUtility::recordPrefabDiff(child);
else
todo.push(child);
}
}
// Clone the hierarchy for internal storage
if (mRoot != nullptr)
mRoot->destroy(true);
mRoot = sceneObject->clone(false, true);
mRoot->mParent = nullptr;
mRoot->mLinkId = -1;
// Remove objects with "dont save" flag
todo.push(mRoot);
while (!todo.empty())
{
HSceneObject current = todo.top();
todo.pop();
if (current->hasFlag(SOF_DontSave))
current->destroy();
else
{
UINT32 numChildren = current->getNumChildren();
for (UINT32 i = 0; i < numChildren; i++)
todo.push(current->getChild(i));
}
}
}
void Prefab::update(const HSceneObject& sceneObject)
{
initialize(sceneObject);
sceneObject->mPrefabLinkUUID = mUUID;
mRoot->mPrefabLinkUUID = mUUID;
mHash++;
}
void Prefab::_updateChildInstances() const
{
Stack<HSceneObject> todo;
todo.push(mRoot);
while (!todo.empty())
{
HSceneObject current = todo.top();
todo.pop();
UINT32 childCount = current->getNumChildren();
for (UINT32 i = 0; i < childCount; i++)
{
HSceneObject child = current->getChild(i);
if (!child->mPrefabLinkUUID.empty())
PrefabUtility::updateFromPrefab(child);
else
todo.push(child);
}
}
}
HSceneObject Prefab::_instantiate(bool preserveUUIDs) const
{
if (mRoot == nullptr)
return HSceneObject();
#if BS_IS_BANSHEE3D
if (gCoreApplication().isEditor())
{
// Update any child prefab instances in case their prefabs changed
_updateChildInstances();
}
#endif
HSceneObject clone = _clone(preserveUUIDs);
clone->_instantiate();
return clone;
}
HSceneObject Prefab::_clone(bool preserveUUIDs) const
{
if (mRoot == nullptr)
return HSceneObject();
mRoot->mPrefabHash = mHash;
mRoot->mLinkId = -1;
return mRoot->clone(false, preserveUUIDs);
}
RTTITypeBase* Prefab::getRTTIStatic()
{
return PrefabRTTI::instance();
}
RTTITypeBase* Prefab::getRTTI() const
{
return Prefab::getRTTIStatic();
}
} | [
"[email protected]"
] | |
465d659ee16c7afd04c202a23314fa2a643630f7 | 61314f889041b72d98e233a28e4e79c06167d1b4 | /target/qnx6/usr/include/c++/4.4.2/debug/multiset.h | 663bffcbb9302d07345e16fc4ee2e8bf543a2ead | [] | no_license | CyberSys/qnx650 | 37867847dacf9331926736e97009bc0af83850bd | a10a0e62384d0a6a24cc3879dee3b7bacf6d4601 | refs/heads/master | 2021-05-27T03:46:05.775523 | 2014-05-02T00:15:16 | 2014-05-02T00:15:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,061 | h | // Debugging multiset implementation -*- C++ -*-
// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
// 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 3, 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.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file debug/multiset.h
* This file is a GNU debug extension to the Standard C++ Library.
*/
#ifndef _GLIBCXX_DEBUG_MULTISET_H
#define _GLIBCXX_DEBUG_MULTISET_H 1
#include <debug/safe_sequence.h>
#include <debug/safe_iterator.h>
#include <utility>
namespace std
{
namespace __debug
{
template<typename _Key, typename _Compare = std::less<_Key>,
typename _Allocator = std::allocator<_Key> >
class multiset
: public _GLIBCXX_STD_D::multiset<_Key, _Compare, _Allocator>,
public __gnu_debug::_Safe_sequence<multiset<_Key, _Compare, _Allocator> >
{
typedef _GLIBCXX_STD_D::multiset<_Key, _Compare, _Allocator> _Base;
typedef __gnu_debug::_Safe_sequence<multiset> _Safe_base;
public:
// types:
typedef _Key key_type;
typedef _Key value_type;
typedef _Compare key_compare;
typedef _Compare value_compare;
typedef _Allocator allocator_type;
typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference;
typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, multiset>
iterator;
typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
multiset> const_iterator;
typedef typename _Base::size_type size_type;
typedef typename _Base::difference_type difference_type;
typedef typename _Base::pointer pointer;
typedef typename _Base::const_pointer const_pointer;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// 23.3.3.1 construct/copy/destroy:
explicit multiset(const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator())
: _Base(__comp, __a) { }
template<typename _InputIterator>
multiset(_InputIterator __first, _InputIterator __last,
const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator())
: _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
__comp, __a) { }
multiset(const multiset& __x)
: _Base(__x), _Safe_base() { }
multiset(const _Base& __x)
: _Base(__x), _Safe_base() { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
multiset(multiset&& __x)
: _Base(std::forward<multiset>(__x)), _Safe_base()
{ this->_M_swap(__x); }
multiset(initializer_list<value_type> __l,
const _Compare& __comp = _Compare(),
const allocator_type& __a = allocator_type())
: _Base(__l, __comp, __a), _Safe_base() { }
#endif
~multiset() { }
multiset&
operator=(const multiset& __x)
{
*static_cast<_Base*>(this) = __x;
this->_M_invalidate_all();
return *this;
}
#ifdef __GXX_EXPERIMENTAL_CXX0X__
multiset&
operator=(multiset&& __x)
{
// NB: DR 675.
clear();
swap(__x);
return *this;
}
multiset&
operator=(initializer_list<value_type> __l)
{
this->clear();
this->insert(__l);
return *this;
}
#endif
using _Base::get_allocator;
// iterators:
iterator
begin()
{ return iterator(_Base::begin(), this); }
const_iterator
begin() const
{ return const_iterator(_Base::begin(), this); }
iterator
end()
{ return iterator(_Base::end(), this); }
const_iterator
end() const
{ return const_iterator(_Base::end(), this); }
reverse_iterator
rbegin()
{ return reverse_iterator(end()); }
const_reverse_iterator
rbegin() const
{ return const_reverse_iterator(end()); }
reverse_iterator
rend()
{ return reverse_iterator(begin()); }
const_reverse_iterator
rend() const
{ return const_reverse_iterator(begin()); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
const_iterator
cbegin() const
{ return const_iterator(_Base::begin(), this); }
const_iterator
cend() const
{ return const_iterator(_Base::end(), this); }
const_reverse_iterator
crbegin() const
{ return const_reverse_iterator(end()); }
const_reverse_iterator
crend() const
{ return const_reverse_iterator(begin()); }
#endif
// capacity:
using _Base::empty;
using _Base::size;
using _Base::max_size;
// modifiers:
iterator
insert(const value_type& __x)
{ return iterator(_Base::insert(__x), this); }
iterator
insert(iterator __position, const value_type& __x)
{
__glibcxx_check_insert(__position);
return iterator(_Base::insert(__position.base(), __x), this);
}
template<typename _InputIterator>
void
insert(_InputIterator __first, _InputIterator __last)
{
__glibcxx_check_valid_range(__first, __last);
_Base::insert(__first, __last);
}
#ifdef __GXX_EXPERIMENTAL_CXX0X__
void
insert(initializer_list<value_type> __l)
{ _Base::insert(__l); }
#endif
void
erase(iterator __position)
{
__glibcxx_check_erase(__position);
__position._M_invalidate();
_Base::erase(__position.base());
}
size_type
erase(const key_type& __x)
{
std::pair<iterator, iterator> __victims = this->equal_range(__x);
size_type __count = 0;
while (__victims.first != __victims.second)
{
iterator __victim = __victims.first++;
__victim._M_invalidate();
_Base::erase(__victim.base());
++__count;
}
return __count;
}
void
erase(iterator __first, iterator __last)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 151. can't currently clear() empty container
__glibcxx_check_erase_range(__first, __last);
while (__first != __last)
this->erase(__first++);
}
void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(multiset&& __x)
#else
swap(multiset& __x)
#endif
{
_Base::swap(__x);
this->_M_swap(__x);
}
void
clear()
{ this->erase(begin(), end()); }
// observers:
using _Base::key_comp;
using _Base::value_comp;
// multiset operations:
iterator
find(const key_type& __x)
{ return iterator(_Base::find(__x), this); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 214. set::find() missing const overload
const_iterator
find(const key_type& __x) const
{ return const_iterator(_Base::find(__x), this); }
using _Base::count;
iterator
lower_bound(const key_type& __x)
{ return iterator(_Base::lower_bound(__x), this); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 214. set::find() missing const overload
const_iterator
lower_bound(const key_type& __x) const
{ return const_iterator(_Base::lower_bound(__x), this); }
iterator
upper_bound(const key_type& __x)
{ return iterator(_Base::upper_bound(__x), this); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 214. set::find() missing const overload
const_iterator
upper_bound(const key_type& __x) const
{ return const_iterator(_Base::upper_bound(__x), this); }
std::pair<iterator,iterator>
equal_range(const key_type& __x)
{
typedef typename _Base::iterator _Base_iterator;
std::pair<_Base_iterator, _Base_iterator> __res =
_Base::equal_range(__x);
return std::make_pair(iterator(__res.first, this),
iterator(__res.second, this));
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 214. set::find() missing const overload
std::pair<const_iterator,const_iterator>
equal_range(const key_type& __x) const
{
typedef typename _Base::const_iterator _Base_iterator;
std::pair<_Base_iterator, _Base_iterator> __res =
_Base::equal_range(__x);
return std::make_pair(const_iterator(__res.first, this),
const_iterator(__res.second, this));
}
_Base&
_M_base() { return *this; }
const _Base&
_M_base() const { return *this; }
private:
void
_M_invalidate_all()
{
typedef typename _Base::const_iterator _Base_const_iterator;
typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
this->_M_invalidate_if(_Not_equal(_M_base().end()));
}
};
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator==(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator!=(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator<(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator<=(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator>=(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator>(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
void
swap(multiset<_Key, _Compare, _Allocator>& __x,
multiset<_Key, _Compare, _Allocator>& __y)
{ return __x.swap(__y); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Key, typename _Compare, typename _Allocator>
void
swap(multiset<_Key, _Compare, _Allocator>&& __x,
multiset<_Key, _Compare, _Allocator>& __y)
{ return __x.swap(__y); }
template<typename _Key, typename _Compare, typename _Allocator>
void
swap(multiset<_Key, _Compare, _Allocator>& __x,
multiset<_Key, _Compare, _Allocator>&& __y)
{ return __x.swap(__y); }
#endif
} // namespace __debug
} // namespace std
#endif
| [
"[email protected]"
] | |
19d930a1cfca30c76217103c2fae006db7741ca7 | efb58f38c456ce47f2f8e9defd9aa8853ad285e2 | /cs3800Proj1_file.h | 2071f1d0a1fc4e896b263c96801ab41076037a37 | [] | no_license | Mashroor/cs3800-1-FileSystemMgmt | c42ebf0d6af41ec5604f624b464476f60a208ea7 | 5aa343465d284a3b08982b875d4998f4fd7358fd | refs/heads/master | 2020-04-19T21:04:19.068508 | 2019-02-13T01:46:45 | 2019-02-13T01:46:45 | 168,431,934 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,517 | h | //file: cs3800Proj1_file.h
//author: Mashroor Rashid, CS3800 Sec B
//Directory class; this class intends to be a dummy file. Stores a few parameters to be manipulated
#ifndef CS3800PROJ1_FILE_H
#define CS3800PROJ1_FILE_H
#include<iostream>
#include<cstring>
#include<string>
#include<ctime>
using namespace std;
class file{
private:
//inner properties of file class
string permissions;
string userName;
int fileSize;
string timestamp;
string path;
string fileName;
public:
//constructor, only used in touch, no need for destructor since new mem not allocated
file(string name);
//getters, returns any values in the private section
string getPermissions() const{return permissions;}
string getUserName() const{return userName;}
int getFileSize() const{return fileSize;}
string getTimestamp() const{return timestamp;}
string getFileName() const{return fileName;}
//Func: setTimestamp()
//Pre: A file must be acted upon.
//Post: Timestamp variable will be reset
void setTimestamp();
//Func: setPermissions()
//Pre: A file must be the calling object, the permission must be a length 3 string, of only numbers
//Post: The permission variable will be set to a permission string
void setPermissions(string PermCode);
//this obj does not need any extra functions, since this is only here as a dummy obj
};
#endif | [
"[email protected]"
] | |
c27fe3deb092cd158b9df475c3ebbd691bed8683 | 5a157ee5838918ef1fe6624cdbcd9d5408e498e8 | /BOJ/11651.cpp | 02e9f6f658300f1f28ed1620696444abede92303 | [] | no_license | rlagksruf16/Algorithm_Everyday | 93e1071ef667e0a3417104cb1d6f14a5f39967ae | cf9032a04d8be7732a71b874dde124e0cb06421e | refs/heads/master | 2023-06-22T01:55:20.751238 | 2021-07-15T08:01:48 | 2021-07-15T08:01:48 | 217,672,321 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 498 | cpp | // x,y 좌표 거꾸로 정렬하기
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
using namespace std;
int main() {
int N; // 갯수
int a,b;
cin >> N;
vector<pair<int, int>>v;
for(int i = 0; i < N; i++) {
cin >> a >> b;
v.push_back(make_pair(b, a));
}
sort(v.begin(),v.end());
for(int j = 0; j < N; j++) {
cout << v[j].second << " " << v[j].first << endl;
}
return 0;
}
| [
"[email protected]"
] | |
bc7eca5be264a08b1336ec75645619c5a0d4607e | d5f380982bbde7cb42bdc755f5387c2c08cfb8a0 | /Project files/APM2_Simulink_Blockset/APM2/cores/arduino/DataFlash_APM2.cpp | 7116e6049575e9065525c5292da850392622b14a | [
"BSD-3-Clause",
"MIT"
] | permissive | riscveval/Flight-Controller-design-for-SHAKTHI-C64-Processor | 242f97411769ca232592cc35e2dd87d7f99f2c05 | c5784d0662fd72a464b92a146d1ad615c988fa95 | refs/heads/main | 2023-06-07T22:42:59.921351 | 2021-07-03T15:28:15 | 2021-07-03T15:28:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,411 | cpp | /// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
/*
DataFlash_APM2.cpp - DataFlash log library for AT45DB321D
Code by Jordi Muñoz and Jose Julio. DIYDrones.com
This code works only on ATMega2560. It uses Serial port 3 in SPI MSPI mdoe.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
Dataflash library for AT45DB321D flash memory
Memory organization : 8192 pages of 512 bytes or 528 bytes
Maximun write bandwidth : 512 bytes in 14ms
This code is written so the master never has to wait to write the data on the eeprom
Methods:
Init() : Library initialization (SPI initialization)
StartWrite(page) : Start a write session. page=start page.
WriteByte(data) : Write a byte
WriteInt(data) : Write an integer (2 bytes)
WriteLong(data) : Write a long (4 bytes)
StartRead(page) : Start a read on (page)
GetWritePage() : Returns the last page written to
GetPage() : Returns the last page read
ReadByte()
ReadInt()
ReadLong()
Properties:
*/
extern "C" {
// AVR LibC Includes
#include <inttypes.h>
#include <avr/interrupt.h>
}
#define ARDUINO 100
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WConstants.h"
#endif
#include "DataFlash_APM2.h"
// DataFlash is connected to Serial Port 3 (we will use SPI mode)
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define DF_DATAOUT 14 // MOSI
#define DF_DATAIN 15 // MISO
#define DF_SPICLOCK PJ2 // SCK
#define DF_SLAVESELECT 28 // SS (PA6)
#define DF_RESET 41 // RESET (PG0)
#define DF_CARDDETECT 33 // PC4
#else
# error Please check the Tools/Board menu to ensure you have selected Arduino Mega as your target.
#endif
// AT45DB321D Commands (from Datasheet)
#define DF_TRANSFER_PAGE_TO_BUFFER_1 0x53
#define DF_TRANSFER_PAGE_TO_BUFFER_2 0x55
#define DF_STATUS_REGISTER_READ 0xD7
#define DF_READ_MANUFACTURER_AND_DEVICE_ID 0x9F
#define DF_PAGE_READ 0xD2
#define DF_BUFFER_1_READ 0xD4
#define DF_BUFFER_2_READ 0xD6
#define DF_BUFFER_1_WRITE 0x84
#define DF_BUFFER_2_WRITE 0x87
#define DF_BUFFER_1_TO_PAGE_WITH_ERASE 0x83
#define DF_BUFFER_2_TO_PAGE_WITH_ERASE 0x86
#define DF_PAGE_ERASE 0x81
#define DF_BLOCK_ERASE 0x50
#define DF_SECTOR_ERASE 0x7C
#define DF_CHIP_ERASE_0 0xC7
#define DF_CHIP_ERASE_1 0x94
#define DF_CHIP_ERASE_2 0x80
#define DF_CHIP_ERASE_3 0x9A
// *** INTERNAL FUNCTIONS ***
unsigned char DataFlash_APM2::SPI_transfer(unsigned char data)
{
/* Wait for empty transmit buffer */
while ( !( UCSR3A & (1<<UDRE3)) );
/* Put data into buffer, sends the data */
UDR3 = data;
/* Wait for data to be received */
while ( !(UCSR3A & (1<<RXC3)) );
/* Get and return received data from buffer */
return UDR3;
}
// disable device
void DataFlash_APM2::CS_inactive()
{
digitalWrite(DF_SLAVESELECT,HIGH);
}
// enable device
void DataFlash_APM2::CS_active()
{
digitalWrite(DF_SLAVESELECT,LOW);
}
// Constructors ////////////////////////////////////////////////////////////////
DataFlash_APM2::DataFlash_APM2()
{
}
// Public Methods //////////////////////////////////////////////////////////////
void DataFlash_APM2::Init(void)
{
pinMode(DF_DATAOUT, OUTPUT);
pinMode(DF_DATAIN, INPUT);
pinMode(DF_SLAVESELECT,OUTPUT);
pinMode(DF_RESET,OUTPUT);
pinMode(DF_CARDDETECT, INPUT);
// Reset the chip
digitalWrite(DF_RESET,LOW);
delay(1);
digitalWrite(DF_RESET,HIGH);
// disable device
CS_inactive();
// Setup Serial Port3 in SPI mode (MSPI), Mode 0, Clock: 8Mhz
UBRR3 = 0;
DDRJ |= (1<<PJ2); // SPI clock XCK3 (PJ2) as output. This enable SPI Master mode
// Set MSPI mode of operation and SPI data mode 0.
UCSR3C = (1<<UMSEL31)|(1<<UMSEL30); //|(1<<1)|(1<<UCPOL3);
// Enable receiver and transmitter.
UCSR3B = (1<<RXEN3)|(1<<TXEN3);
// Set Baud rate
UBRR3 = 0; // SPI running at 8Mhz
// get page size: 512 or 528 (by default: 528)
df_PageSize=PageSize();
ReadManufacturerID();
// see page 22 of the spec for the density code
uint8_t density_code = (df_device >> 8) & 0x1F;
// note that we set df_NumPages to one lower than the highest, as
// the last page is reserved for a config page
if (density_code == 0x7) {
// 32 Mbit
df_NumPages = 8191;
} else if (density_code == 0x6) {
// 16 Mbit
df_NumPages = 4095;
} else {
// what is this??? card not inserted perhaps?
df_NumPages = 0;
}
}
// This function is mainly to test the device
void DataFlash_APM2::ReadManufacturerID()
{
// activate dataflash command decoder
CS_active();
// Read manufacturer and ID command...
SPI_transfer(DF_READ_MANUFACTURER_AND_DEVICE_ID);
df_manufacturer = SPI_transfer(0xff);
df_device = SPI_transfer(0xff);
df_device = (df_device<<8) | SPI_transfer(0xff);
SPI_transfer(0xff);
// release SPI bus for use by other sensors
CS_inactive();
}
// This function return 1 if Card is inserted on SD slot
bool DataFlash_APM2::CardInserted()
{
return (df_NumPages >= 4095 && digitalRead(DF_CARDDETECT) == 0);
}
// Read the status register
byte DataFlash_APM2::ReadStatusReg()
{
byte tmp;
// activate dataflash command decoder
CS_active();
// Read status command
SPI_transfer(DF_STATUS_REGISTER_READ);
tmp = SPI_transfer(0x00); // We only want to extract the READY/BUSY bit
// release SPI bus for use by other sensors
CS_inactive();
return tmp;
}
// Read the status of the DataFlash
inline
byte DataFlash_APM2::ReadStatus()
{
return(ReadStatusReg()&0x80); // We only want to extract the READY/BUSY bit
}
inline
uint16_t DataFlash_APM2::PageSize()
{
return(528-((ReadStatusReg()&0x01)<<4)); // if first bit 1 trhen 512 else 528 bytes
}
// Wait until DataFlash is in ready state...
void DataFlash_APM2::WaitReady()
{
while(!ReadStatus());
}
void DataFlash_APM2::PageToBuffer(unsigned char BufferNum, uint16_t PageAdr)
{
// activate dataflash command decoder
CS_active();
if (BufferNum==1)
SPI_transfer(DF_TRANSFER_PAGE_TO_BUFFER_1);
else
SPI_transfer(DF_TRANSFER_PAGE_TO_BUFFER_2);
if(df_PageSize==512){
SPI_transfer((unsigned char)(PageAdr >> 7));
SPI_transfer((unsigned char)(PageAdr << 1));
}else{
SPI_transfer((unsigned char)(PageAdr >> 6));
SPI_transfer((unsigned char)(PageAdr << 2));
}
SPI_transfer(0x00); // don´t care bytes
//initiate the transfer
CS_inactive();
CS_active();
while(!ReadStatus()); //monitor the status register, wait until busy-flag is high
// release SPI bus for use by other sensors
CS_inactive();
}
void DataFlash_APM2::BufferToPage (unsigned char BufferNum, uint16_t PageAdr, unsigned char wait)
{
// activate dataflash command decoder
CS_active();
if (BufferNum==1)
SPI_transfer(DF_BUFFER_1_TO_PAGE_WITH_ERASE);
else
SPI_transfer(DF_BUFFER_2_TO_PAGE_WITH_ERASE);
if(df_PageSize==512){
SPI_transfer((unsigned char)(PageAdr >> 7));
SPI_transfer((unsigned char)(PageAdr << 1));
}else{
SPI_transfer((unsigned char)(PageAdr >> 6));
SPI_transfer((unsigned char)(PageAdr << 2));
}
SPI_transfer(0x00); // don´t care bytes
//initiate the transfer
CS_inactive();
CS_active();
// Check if we need to wait to write the buffer to memory or we can continue...
if (wait)
while(!ReadStatus()); //monitor the status register, wait until busy-flag is high
// release SPI bus for use by other sensors
CS_inactive();
}
void DataFlash_APM2::BufferWrite (unsigned char BufferNum, uint16_t IntPageAdr, unsigned char Data)
{
// activate dataflash command decoder
CS_active();
if (BufferNum==1)
SPI_transfer(DF_BUFFER_1_WRITE);
else
SPI_transfer(DF_BUFFER_2_WRITE);
SPI_transfer(0x00); // don't care
SPI_transfer((unsigned char)(IntPageAdr>>8)); // upper part of internal buffer address
SPI_transfer((unsigned char)(IntPageAdr)); // lower part of internal buffer address
SPI_transfer(Data); // write data byte
// release SPI bus for use by other sensors
CS_inactive();
}
unsigned char DataFlash_APM2::BufferRead (unsigned char BufferNum, uint16_t IntPageAdr)
{
byte tmp;
// activate dataflash command decoder
CS_active();
if (BufferNum==1)
SPI_transfer(DF_BUFFER_1_READ);
else
SPI_transfer(DF_BUFFER_2_READ);
SPI_transfer(0x00);
SPI_transfer((unsigned char)(IntPageAdr>>8)); //upper part of internal buffer address
SPI_transfer((unsigned char)(IntPageAdr)); //lower part of internal buffer address
SPI_transfer(0x00); //don't cares
tmp = SPI_transfer(0x00); //read data byte
// release SPI bus for use by other sensors
CS_inactive();
return (tmp);
}
// *** END OF INTERNAL FUNCTIONS ***
void DataFlash_APM2::PageErase (uint16_t PageAdr)
{
// activate dataflash command decoder
CS_active();
// Send page erase command
SPI_transfer(DF_PAGE_ERASE);
if(df_PageSize==512){
SPI_transfer((unsigned char)(PageAdr >> 7));
SPI_transfer((unsigned char)(PageAdr << 1));
}else{
SPI_transfer((unsigned char)(PageAdr >> 6));
SPI_transfer((unsigned char)(PageAdr << 2));
}
SPI_transfer(0x00);
//initiate flash page erase
CS_inactive();
CS_active();
while(!ReadStatus());
// release SPI bus for use by other sensors
CS_inactive();
}
// erase a block of 8 pages.
void DataFlash_APM2::BlockErase(uint16_t BlockAdr)
{
// activate dataflash command decoder
CS_active();
// Send block erase command
SPI_transfer(DF_BLOCK_ERASE);
if (df_PageSize==512) {
SPI_transfer((unsigned char)(BlockAdr >> 3));
SPI_transfer((unsigned char)(BlockAdr << 5));
} else {
SPI_transfer((unsigned char)(BlockAdr >> 4));
SPI_transfer((unsigned char)(BlockAdr << 4));
}
SPI_transfer(0x00);
//initiate flash page erase
CS_inactive();
CS_active();
while(!ReadStatus());
// release SPI bus for use by other sensors
CS_inactive();
}
void DataFlash_APM2::ChipErase(void (*delay_cb)(unsigned long))
{
// activate dataflash command decoder
CS_active();
// opcodes for chip erase
SPI_transfer(DF_CHIP_ERASE_0);
SPI_transfer(DF_CHIP_ERASE_1);
SPI_transfer(DF_CHIP_ERASE_2);
SPI_transfer(DF_CHIP_ERASE_3);
//initiate flash page erase
CS_inactive();
CS_active();
while(!ReadStatus()) {
delay_cb(1);
}
// release SPI bus for use by other sensors
CS_inactive();
}
| [
"[email protected]"
] | |
ecef2e9476c42160b1ddd04bad4b6b93f3a83ddc | df773315e24a97629acbebfe023623390ac704b9 | /include/YourDetectorConstruction.hh | a3d91f27cede7b0a267b0c38f1df40b7240446fc | [] | no_license | santiglesias/Practica_Geant_4 | 1a279ce7ffe0f1bbfec260d2e3287223437c2605 | 0a064d4c40cabccd7cddb72fe6ee376fc77c6ec0 | refs/heads/master | 2023-04-12T03:34:04.609449 | 2021-04-22T11:42:10 | 2021-04-22T11:42:10 | 358,546,133 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,058 | hh |
#ifndef YOURDETECTORCONSTRUCTION_HH
#define YOURDETECTORCONSTRUCTION_HH
#include "G4VUserDetectorConstruction.hh"
class YourDetectorMessenger;
class G4Material;
class G4String;
class G4LogicalVolume;
class YourDetectorConstruction : public G4VUserDetectorConstruction {
public:
YourDetectorConstruction();
virtual ~YourDetectorConstruction();
virtual G4VPhysicalVolume* Construct();
void SetTargetThickness(const G4double thick) {fTargetThickness = thick; }
G4double GetTargetThickness() const { return fTargetThickness ;}
void SetTargetMaterial(const G4String& matName);
const G4Material* GetTargetMaterial() const { return fTargetMaterial ; }
G4double GetGunXPosition() {return fGunXPosition; }
const G4VPhysicalVolume* GetTargetPhysicalVolume() const {
return fTargetPhysicalVolume;
}
private:
YourDetectorMessenger* fDetMessenger;
G4Material* fTargetMaterial;
G4VPhysicalVolume* fTargetPhysicalVolume;
G4double fTargetThickness;
G4double fGunXPosition;
};
#endif
| [
"[email protected]"
] | |
44eb193d0d25e19900d9296519f5e03ee49424e7 | 4d7d177b18baa31c11f77bb12cf3144a07b3d589 | /Advanced C/C-MRND2017_WinterCamp/src/P6_Merge2SLLs.cpp | 362da4acdac14e5bf68acfb67509a77fb26bd76c | [] | no_license | pvsmpraveen/MissionRnd | e6bde351c828f349bb18dfeb051103f7faf0ce9c | 68a10595b354f1d5bd23406c4ec9367d1f0ff3b6 | refs/heads/master | 2021-06-15T13:17:26.515233 | 2017-04-24T11:45:50 | 2017-04-24T11:45:50 | 89,233,533 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 702 | cpp | /*
Given two Singly linked lists which are in ascending order.
Return an merged sorted SLL of both
Ex:
INPUT:
one: 1 -> 3 -> 5
two: 2 -> 4 -> 6
OUTPUT:
1 -> 2-> 3-> 4-> 5-> 6
NOTE: Dont create any new SLL's. Just change the links
*/
#include<stdio.h>
struct Node {
char data;
Node *next;
};
struct Node* merge(struct Node *one, struct Node *two)
{
if (!one || !two) return NULL;
Node *Aptr = one,*tmp1 = one,*tmp2 = two;
while (tmp1){
if (tmp1->data > tmp2->data){
char tmp = tmp1->data;
tmp1->data = tmp2->data;
tmp2->data = tmp;
}
tmp1 = tmp1->next;
}
tmp1 = one;
while (tmp1->next != NULL) tmp1 = tmp1->next;
tmp1->next = two;
return Aptr;
} | [
"[email protected]"
] | |
3b4f9bf47e82cdffd756b71ff94fa25c00bfc400 | a1b441f050efee7245b7ef8ebb8597363600c14d | /P3 Variable Management/scope.cpp | 0779e3023286d8c57c0513cf90ed973f354164db | [] | no_license | wuyuz99/COEN-175-Compiler | 9e83fe1eab274ef1fbdc3796accdf007b48a370d | 27929a15fd901ea933064ea9b9866b4af816f2b6 | refs/heads/main | 2023-04-05T13:29:57.881019 | 2021-04-14T22:33:29 | 2021-04-14T22:33:29 | 333,280,014 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,091 | cpp | # include <vector>
# include "type.h"
# include "scope.h"
using namespace std;
Scope::Scope(Scope *enclosing)
: _enclosing(enclosing)
{
}
void Scope::insert(Symbol *symbol) {
_symbols.push_back(symbol);
}
void Scope::remove(const string &name) {
size_t i = 0;
for(; i < _symbols.size(); ++i) {
if(_symbols[i]->name() == name){
break;
}
}
if (i != _symbols.size()) {
_symbols.erase(_symbols.begin() + i);
}
return;
}
Symbol *Scope::find(const string &name) const {
for (size_t i = 0; i < _symbols.size(); ++i) {
if(_symbols[i]->name() == name){
return _symbols[i];
}
}
return nullptr;
}
Symbol *Scope::lookup(const string &name) const {
const Scope *ptr = this;
while (ptr != nullptr) {
Symbol *result = ptr->find(name);
if(result) {
return result;
}
ptr = ptr->enclosing();
}
return nullptr;
}
Scope *Scope::enclosing() const {
return _enclosing;
}
const Symbols &Scope::symbols() const {
return _symbols;
}
| [
"[email protected]"
] | |
ba7b2c9a2019cccec10cd2fce144913e4a0d4258 | 5502d05107c094946bcd883ae55a974cff2657c5 | /include/SERunAction.hh | dd3ff6ca0c23098dcd4f5b67abf8a2d563514778 | [
"MIT"
] | permissive | yramachers/X-Ray-Beam | 485546c1dc045dc7e7075cf31a495865257d47b1 | 1e296adfc685b076e08b22bb3e4f5dcc748bbf6d | refs/heads/main | 2023-04-10T01:09:34.195973 | 2021-04-22T13:49:36 | 2021-04-22T13:49:36 | 360,232,635 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 616 | hh | #ifndef SERunAction_h
#define SERunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
class SEEventAction;
class G4Run;
/// Run action class
///
class SERunAction : public G4UserRunAction
{
public:
SERunAction(SEEventAction* eventAction, G4String name);
virtual ~SERunAction();
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
private:
SEEventAction* fEventAction; // have event information for run
G4String fout; // output file name
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
| [
"[email protected]"
] | |
7fdbe77e735a10c60f351734514b7d961902dd44 | 21ede326b6cfcf5347ca6772d392d3acca80cfa0 | /net/network_error_logging/network_error_logging_service_unittest.cc | 9c4369afffbc7bfa1ee5481c1c24bba3f5b0ebf9 | [
"BSD-3-Clause"
] | permissive | csagan5/kiwi | 6eaab0ab4db60468358291956506ad6f889401f8 | eb2015c28925be91b4a3130b3c2bee2f5edc91de | refs/heads/master | 2020-04-04T17:06:54.003121 | 2018-10-24T08:20:01 | 2018-10-24T08:20:01 | 156,107,399 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 20,975 | cc | // Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include <string>
#include <vector>
#include "base/bind.h"
#include "base/callback.h"
#include "base/macros.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/values_test_util.h"
#include "base/time/time.h"
#include "base/values.h"
#include "net/base/ip_address.h"
#include "net/base/net_errors.h"
#include "net/network_error_logging/network_error_logging_delegate.h"
#include "net/network_error_logging/network_error_logging_service.h"
#include "net/reporting/reporting_policy.h"
#include "net/reporting/reporting_service.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace net {
namespace {
class TestReportingService : public ReportingService {
public:
struct Report {
Report() = default;
Report(Report&& other)
: url(other.url),
group(other.group),
type(other.type),
body(std::move(other.body)),
depth(other.depth) {}
Report(const GURL& url,
const std::string& group,
const std::string& type,
std::unique_ptr<const base::Value> body,
int depth)
: url(url),
group(group),
type(type),
body(std::move(body)),
depth(depth) {}
~Report() = default;
GURL url;
std::string group;
std::string type;
std::unique_ptr<const base::Value> body;
int depth;
private:
DISALLOW_COPY(Report);
};
TestReportingService() = default;
const std::vector<Report>& reports() const { return reports_; }
// ReportingService implementation:
~TestReportingService() override = default;
void QueueReport(const GURL& url,
const std::string& group,
const std::string& type,
std::unique_ptr<const base::Value> body,
int depth) override {
reports_.push_back(Report(url, group, type, std::move(body), depth));
}
void ProcessHeader(const GURL& url,
const std::string& header_value) override {
NOTREACHED();
}
void RemoveBrowsingData(int data_type_mask,
const base::RepeatingCallback<bool(const GURL&)>&
origin_filter) override {
NOTREACHED();
}
void RemoveAllBrowsingData(int data_type_mask) override { NOTREACHED(); }
int GetUploadDepth(const URLRequest& request) override {
NOTREACHED();
return 0;
}
const ReportingPolicy& GetPolicy() const override {
NOTREACHED();
return dummy_policy_;
}
private:
std::vector<Report> reports_;
ReportingPolicy dummy_policy_;
DISALLOW_COPY_AND_ASSIGN(TestReportingService);
};
class NetworkErrorLoggingServiceTest : public ::testing::Test {
protected:
NetworkErrorLoggingServiceTest() {
service_ = NetworkErrorLoggingService::Create(
NetworkErrorLoggingDelegate::Create());
CreateReportingService();
}
void CreateReportingService() {
DCHECK(!reporting_service_);
reporting_service_ = std::make_unique<TestReportingService>();
service_->SetReportingService(reporting_service_.get());
}
void DestroyReportingService() {
DCHECK(reporting_service_);
service_->SetReportingService(nullptr);
reporting_service_.reset();
}
NetworkErrorLoggingService::RequestDetails
MakeRequestDetails(GURL url, Error error_type, int status_code = 0) {
NetworkErrorLoggingService::RequestDetails details;
details.uri = url;
details.referrer = kReferrer_;
details.server_ip = IPAddress::IPv4AllZeros();
details.status_code = status_code;
details.elapsed_time = base::TimeDelta::FromSeconds(1);
details.type = error_type;
details.reporting_upload_depth = 0;
return details;
}
NetworkErrorLoggingService* service() { return service_.get(); }
const std::vector<TestReportingService::Report>& reports() {
return reporting_service_->reports();
}
const GURL kUrl_ = GURL("https://example.com/path");
const GURL kUrlDifferentPort_ = GURL("https://example.com:4433/path");
const GURL kUrlSubdomain_ = GURL("https://subdomain.example.com/path");
const GURL kUrlDifferentHost_ = GURL("https://example2.com/path");
const url::Origin kOrigin_ = url::Origin::Create(kUrl_);
const url::Origin kOriginDifferentPort_ =
url::Origin::Create(kUrlDifferentPort_);
const url::Origin kOriginSubdomain_ = url::Origin::Create(kUrlSubdomain_);
const url::Origin kOriginDifferentHost_ =
url::Origin::Create(kUrlDifferentHost_);
const std::string kHeader_ = "{\"report_to\":\"group\",\"max_age\":86400}";
const std::string kHeaderIncludeSubdomains_ =
"{\"report_to\":\"group\",\"max_age\":86400,\"include_subdomains\":true}";
const std::string kHeaderMaxAge0_ = "{\"max_age\":0}";
const std::string kHeaderTooLong_ =
"{\"report_to\":\"group\",\"max_age\":86400,\"junk\":\"" +
std::string(32 * 1024, 'a') + "\"}";
const std::string kHeaderTooDeep_ =
"{\"report_to\":\"group\",\"max_age\":86400,\"junk\":[[[[[[[[[[]]]]]]]]]]"
"}";
const std::string kGroup_ = "group";
const std::string kType_ = NetworkErrorLoggingService::kReportType;
const GURL kReferrer_ = GURL("https://referrer.com/");
private:
std::unique_ptr<NetworkErrorLoggingService> service_;
std::unique_ptr<TestReportingService> reporting_service_;
};
void ExpectDictDoubleValue(double expected_value,
const base::DictionaryValue& value,
const std::string& key) {
double double_value = 0.0;
EXPECT_TRUE(value.GetDouble(key, &double_value)) << key;
EXPECT_DOUBLE_EQ(expected_value, double_value) << key;
}
TEST_F(NetworkErrorLoggingServiceTest, CreateService) {
// Service is created by default in the test fixture..
EXPECT_TRUE(service());
}
TEST_F(NetworkErrorLoggingServiceTest, NoReportingService) {
DestroyReportingService();
service()->OnHeader(kOrigin_, kHeader_);
service()->OnRequest(MakeRequestDetails(kUrl_, ERR_CONNECTION_REFUSED));
}
TEST_F(NetworkErrorLoggingServiceTest, OriginInsecure) {
const GURL kInsecureUrl("http://insecure.com/");
const url::Origin kInsecureOrigin = url::Origin::Create(kInsecureUrl);
service()->OnHeader(kInsecureOrigin, kHeader_);
service()->OnRequest(
MakeRequestDetails(kInsecureUrl, ERR_CONNECTION_REFUSED));
EXPECT_TRUE(reports().empty());
}
TEST_F(NetworkErrorLoggingServiceTest, NoPolicyForOrigin) {
service()->OnRequest(MakeRequestDetails(kUrl_, ERR_CONNECTION_REFUSED));
EXPECT_TRUE(reports().empty());
}
TEST_F(NetworkErrorLoggingServiceTest, JsonTooLong) {
service()->OnHeader(kOrigin_, kHeaderTooLong_);
service()->OnRequest(MakeRequestDetails(kUrl_, ERR_CONNECTION_REFUSED));
EXPECT_TRUE(reports().empty());
}
TEST_F(NetworkErrorLoggingServiceTest, JsonTooDeep) {
service()->OnHeader(kOrigin_, kHeaderTooDeep_);
service()->OnRequest(MakeRequestDetails(kUrl_, ERR_CONNECTION_REFUSED));
EXPECT_TRUE(reports().empty());
}
TEST_F(NetworkErrorLoggingServiceTest, SuccessReportQueued) {
static const std::string kHeaderSuccessFraction1 =
"{\"report_to\":\"group\",\"max_age\":86400,\"success_fraction\":1.0}";
service()->OnHeader(kOrigin_, kHeaderSuccessFraction1);
service()->OnRequest(MakeRequestDetails(kUrl_, OK));
ASSERT_EQ(1u, reports().size());
EXPECT_EQ(kUrl_, reports()[0].url);
EXPECT_EQ(kGroup_, reports()[0].group);
EXPECT_EQ(kType_, reports()[0].type);
EXPECT_EQ(0, reports()[0].depth);
const base::DictionaryValue* body;
ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body));
base::ExpectDictStringValue(kUrl_.spec(), *body,
NetworkErrorLoggingService::kUriKey);
base::ExpectDictStringValue(kReferrer_.spec(), *body,
NetworkErrorLoggingService::kReferrerKey);
// TODO(juliatuttle): Extract these constants.
ExpectDictDoubleValue(1.0, *body,
NetworkErrorLoggingService::kSamplingFractionKey);
base::ExpectDictStringValue("0.0.0.0", *body,
NetworkErrorLoggingService::kServerIpKey);
base::ExpectDictStringValue("", *body,
NetworkErrorLoggingService::kProtocolKey);
base::ExpectDictIntegerValue(0, *body,
NetworkErrorLoggingService::kStatusCodeKey);
base::ExpectDictIntegerValue(1000, *body,
NetworkErrorLoggingService::kElapsedTimeKey);
base::ExpectDictStringValue("ok", *body,
NetworkErrorLoggingService::kTypeKey);
}
TEST_F(NetworkErrorLoggingServiceTest, FailureReportQueued) {
static const std::string kHeaderFailureFraction1 =
"{\"report_to\":\"group\",\"max_age\":86400,\"failure_fraction\":1.0}";
service()->OnHeader(kOrigin_, kHeaderFailureFraction1);
service()->OnRequest(MakeRequestDetails(kUrl_, ERR_CONNECTION_REFUSED));
ASSERT_EQ(1u, reports().size());
EXPECT_EQ(kUrl_, reports()[0].url);
EXPECT_EQ(kGroup_, reports()[0].group);
EXPECT_EQ(kType_, reports()[0].type);
EXPECT_EQ(0, reports()[0].depth);
const base::DictionaryValue* body;
ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body));
base::ExpectDictStringValue(kUrl_.spec(), *body,
NetworkErrorLoggingService::kUriKey);
base::ExpectDictStringValue(kReferrer_.spec(), *body,
NetworkErrorLoggingService::kReferrerKey);
// TODO(juliatuttle): Extract these constants.
ExpectDictDoubleValue(1.0, *body,
NetworkErrorLoggingService::kSamplingFractionKey);
base::ExpectDictStringValue("0.0.0.0", *body,
NetworkErrorLoggingService::kServerIpKey);
base::ExpectDictStringValue("", *body,
NetworkErrorLoggingService::kProtocolKey);
base::ExpectDictIntegerValue(0, *body,
NetworkErrorLoggingService::kStatusCodeKey);
base::ExpectDictIntegerValue(1000, *body,
NetworkErrorLoggingService::kElapsedTimeKey);
base::ExpectDictStringValue("tcp.refused", *body,
NetworkErrorLoggingService::kTypeKey);
}
TEST_F(NetworkErrorLoggingServiceTest, HttpErrorReportQueued) {
static const std::string kHeaderFailureFraction1 =
"{\"report_to\":\"group\",\"max_age\":86400,\"failure_fraction\":1.0}";
service()->OnHeader(kOrigin_, kHeaderFailureFraction1);
service()->OnRequest(MakeRequestDetails(kUrl_, OK, 504));
ASSERT_EQ(1u, reports().size());
EXPECT_EQ(kUrl_, reports()[0].url);
EXPECT_EQ(kGroup_, reports()[0].group);
EXPECT_EQ(kType_, reports()[0].type);
EXPECT_EQ(0, reports()[0].depth);
const base::DictionaryValue* body;
ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body));
base::ExpectDictStringValue(kUrl_.spec(), *body,
NetworkErrorLoggingService::kUriKey);
base::ExpectDictStringValue(kReferrer_.spec(), *body,
NetworkErrorLoggingService::kReferrerKey);
// TODO(juliatuttle): Extract these constants.
ExpectDictDoubleValue(1.0, *body,
NetworkErrorLoggingService::kSamplingFractionKey);
base::ExpectDictStringValue("0.0.0.0", *body,
NetworkErrorLoggingService::kServerIpKey);
base::ExpectDictStringValue("", *body,
NetworkErrorLoggingService::kProtocolKey);
base::ExpectDictIntegerValue(504, *body,
NetworkErrorLoggingService::kStatusCodeKey);
base::ExpectDictIntegerValue(1000, *body,
NetworkErrorLoggingService::kElapsedTimeKey);
base::ExpectDictStringValue("http.error", *body,
NetworkErrorLoggingService::kTypeKey);
}
TEST_F(NetworkErrorLoggingServiceTest, MaxAge0) {
service()->OnHeader(kOrigin_, kHeader_);
service()->OnHeader(kOrigin_, kHeaderMaxAge0_);
service()->OnRequest(MakeRequestDetails(kUrl_, ERR_CONNECTION_REFUSED));
EXPECT_TRUE(reports().empty());
}
TEST_F(NetworkErrorLoggingServiceTest, SuccessFraction0) {
static const std::string kHeaderSuccessFraction0 =
"{\"report_to\":\"group\",\"max_age\":86400,\"success_fraction\":0.0}";
service()->OnHeader(kOrigin_, kHeaderSuccessFraction0);
// Each network error has a 0% chance of being reported. Fire off several and
// verify that no reports are produced.
constexpr size_t kReportCount = 100;
for (size_t i = 0; i < kReportCount; ++i)
service()->OnRequest(MakeRequestDetails(kUrl_, OK));
EXPECT_TRUE(reports().empty());
}
TEST_F(NetworkErrorLoggingServiceTest, SuccessFractionHalf) {
// Include a different value for failure_fraction to ensure that we copy the
// right value into sampling_fraction.
static const std::string kHeaderSuccessFractionHalf =
"{\"report_to\":\"group\",\"max_age\":86400,\"success_fraction\":0.5,"
"\"failure_fraction\":0.25}";
service()->OnHeader(kOrigin_, kHeaderSuccessFractionHalf);
// Each network error has a 50% chance of being reported. Fire off several
// and verify that some requests were reported and some weren't. (We can't
// verify exact counts because each decision is made randomly.)
constexpr size_t kReportCount = 100;
for (size_t i = 0; i < kReportCount; ++i)
service()->OnRequest(MakeRequestDetails(kUrl_, OK));
// If our random selection logic is correct, there is a 2^-100 chance that
// every single report above was skipped. If this check fails, it's much more
// likely that our code is wrong.
EXPECT_FALSE(reports().empty());
// There's also a 2^-100 chance that every single report was logged. Same as
// above, that's much more likely to be a code error.
EXPECT_GT(kReportCount, reports().size());
for (const auto& report : reports()) {
const base::DictionaryValue* body;
ASSERT_TRUE(report.body->GetAsDictionary(&body));
// Our header includes a different value for failure_fraction, so that this
// check verifies that we copy the correct fraction into sampling_fraction.
ExpectDictDoubleValue(0.5, *body,
NetworkErrorLoggingService::kSamplingFractionKey);
}
}
TEST_F(NetworkErrorLoggingServiceTest, FailureFraction0) {
static const std::string kHeaderFailureFraction0 =
"{\"report_to\":\"group\",\"max_age\":86400,\"failure_fraction\":0.0}";
service()->OnHeader(kOrigin_, kHeaderFailureFraction0);
// Each network error has a 0% chance of being reported. Fire off several and
// verify that no reports are produced.
constexpr size_t kReportCount = 100;
for (size_t i = 0; i < kReportCount; ++i)
service()->OnRequest(MakeRequestDetails(kUrl_, ERR_CONNECTION_REFUSED));
EXPECT_TRUE(reports().empty());
}
TEST_F(NetworkErrorLoggingServiceTest, FailureFractionHalf) {
// Include a different value for success_fraction to ensure that we copy the
// right value into sampling_fraction.
static const std::string kHeaderFailureFractionHalf =
"{\"report_to\":\"group\",\"max_age\":86400,\"failure_fraction\":0.5,"
"\"success_fraction\":0.25}";
service()->OnHeader(kOrigin_, kHeaderFailureFractionHalf);
// Each network error has a 50% chance of being reported. Fire off several
// and verify that some requests were reported and some weren't. (We can't
// verify exact counts because each decision is made randomly.)
constexpr size_t kReportCount = 100;
for (size_t i = 0; i < kReportCount; ++i)
service()->OnRequest(MakeRequestDetails(kUrl_, ERR_CONNECTION_REFUSED));
// If our random selection logic is correct, there is a 2^-100 chance that
// every single report above was skipped. If this check fails, it's much more
// likely that our code is wrong.
EXPECT_FALSE(reports().empty());
// There's also a 2^-100 chance that every single report was logged. Same as
// above, that's much more likely to be a code error.
EXPECT_GT(kReportCount, reports().size());
for (const auto& report : reports()) {
const base::DictionaryValue* body;
ASSERT_TRUE(report.body->GetAsDictionary(&body));
ExpectDictDoubleValue(0.5, *body,
NetworkErrorLoggingService::kSamplingFractionKey);
}
}
TEST_F(NetworkErrorLoggingServiceTest,
ExcludeSubdomainsDoesntMatchDifferentPort) {
service()->OnHeader(kOrigin_, kHeader_);
service()->OnRequest(
MakeRequestDetails(kUrlDifferentPort_, ERR_CONNECTION_REFUSED));
EXPECT_TRUE(reports().empty());
}
TEST_F(NetworkErrorLoggingServiceTest, ExcludeSubdomainsDoesntMatchSubdomain) {
service()->OnHeader(kOrigin_, kHeader_);
service()->OnRequest(
MakeRequestDetails(kUrlSubdomain_, ERR_CONNECTION_REFUSED));
EXPECT_TRUE(reports().empty());
}
TEST_F(NetworkErrorLoggingServiceTest, IncludeSubdomainsMatchesDifferentPort) {
service()->OnHeader(kOrigin_, kHeaderIncludeSubdomains_);
service()->OnRequest(
MakeRequestDetails(kUrlDifferentPort_, ERR_CONNECTION_REFUSED));
ASSERT_EQ(1u, reports().size());
EXPECT_EQ(kUrlDifferentPort_, reports()[0].url);
}
TEST_F(NetworkErrorLoggingServiceTest, IncludeSubdomainsMatchesSubdomain) {
service()->OnHeader(kOrigin_, kHeaderIncludeSubdomains_);
service()->OnRequest(
MakeRequestDetails(kUrlSubdomain_, ERR_CONNECTION_REFUSED));
ASSERT_EQ(1u, reports().size());
}
TEST_F(NetworkErrorLoggingServiceTest,
IncludeSubdomainsDoesntMatchSuperdomain) {
service()->OnHeader(kOriginSubdomain_, kHeaderIncludeSubdomains_);
service()->OnRequest(MakeRequestDetails(kUrl_, ERR_CONNECTION_REFUSED));
EXPECT_TRUE(reports().empty());
}
TEST_F(NetworkErrorLoggingServiceTest, RemoveAllBrowsingData) {
service()->OnHeader(kOrigin_, kHeader_);
service()->RemoveAllBrowsingData();
service()->OnRequest(MakeRequestDetails(kUrl_, ERR_CONNECTION_REFUSED));
EXPECT_TRUE(reports().empty());
}
TEST_F(NetworkErrorLoggingServiceTest, RemoveSomeBrowsingData) {
service()->OnHeader(kOrigin_, kHeader_);
service()->OnHeader(kOriginDifferentHost_, kHeader_);
service()->RemoveBrowsingData(
base::BindRepeating([](const GURL& origin) -> bool {
return origin.host() == "example.com";
}));
service()->OnRequest(MakeRequestDetails(kUrl_, ERR_CONNECTION_REFUSED));
EXPECT_TRUE(reports().empty());
service()->OnRequest(
MakeRequestDetails(kUrlDifferentHost_, ERR_CONNECTION_REFUSED));
ASSERT_EQ(1u, reports().size());
}
TEST_F(NetworkErrorLoggingServiceTest, Nested) {
service()->OnHeader(kOrigin_, kHeader_);
NetworkErrorLoggingService::RequestDetails details =
MakeRequestDetails(kUrl_, ERR_CONNECTION_REFUSED);
details.reporting_upload_depth =
NetworkErrorLoggingService::kMaxNestedReportDepth;
service()->OnRequest(details);
ASSERT_EQ(1u, reports().size());
EXPECT_EQ(NetworkErrorLoggingService::kMaxNestedReportDepth,
reports()[0].depth);
}
TEST_F(NetworkErrorLoggingServiceTest, NestedTooDeep) {
service()->OnHeader(kOrigin_, kHeader_);
NetworkErrorLoggingService::RequestDetails details =
MakeRequestDetails(kUrl_, ERR_CONNECTION_REFUSED);
details.reporting_upload_depth =
NetworkErrorLoggingService::kMaxNestedReportDepth + 1;
service()->OnRequest(details);
EXPECT_TRUE(reports().empty());
}
TEST_F(NetworkErrorLoggingServiceTest, StatusAsValue) {
base::SimpleTestTickClock clock;
service()->SetTickClockForTesting(&clock);
static const std::string kHeaderSuccessFraction1 =
"{\"report_to\":\"group\",\"max_age\":86400,\"success_fraction\":1.0}";
service()->OnHeader(kOrigin_, kHeaderSuccessFraction1);
service()->OnHeader(kOriginDifferentHost_, kHeader_);
service()->OnHeader(kOriginSubdomain_, kHeaderIncludeSubdomains_);
base::Value actual = service()->StatusAsValue();
std::unique_ptr<base::Value> expected = base::test::ParseJson(R"json(
{
"originPolicies": [
{
"origin": "https://example.com",
"includeSubdomains": false,
"expires": "86400000",
"reportTo": "group",
"successFraction": 1.0,
"failureFraction": 1.0,
},
{
"origin": "https://example2.com",
"includeSubdomains": false,
"expires": "86400000",
"reportTo": "group",
"successFraction": 0.0,
"failureFraction": 1.0,
},
{
"origin": "https://subdomain.example.com",
"includeSubdomains": true,
"expires": "86400000",
"reportTo": "group",
"successFraction": 0.0,
"failureFraction": 1.0,
},
]
}
)json");
EXPECT_EQ(*expected, actual);
}
} // namespace
} // namespace net
| [
"[email protected]"
] | |
600f67f2a877075d5cbb6a23ec9e0256a96f081c | d245a13a204bd87cec0721521e08c95e724bca56 | /main/regexhtmltag.h | 93c51c96a0d75581476557ad2c887b4493468697 | [] | no_license | arazgholami/azconvert | 8e107d00b98e1f43fd2019c420f48d1016c91ca7 | cf101b4d6180ca72482697f408593e6e09ed45a2 | refs/heads/master | 2023-03-17T06:16:29.788860 | 2019-07-09T19:55:15 | 2019-07-09T19:55:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 698 | h | /*!
* @file regexhtmltag.h
* @brief This file contains declaration of RegexHtmlTag class.
* @author Mousa Moradi
*/
#ifndef REGEXHTMLTAG_H
#define REGEXHTMLTAG_H
#include "regex.h"
/*!
* @brief The Html tag checker Regex class.
*/
class RegexHtmlTag : public Regex
{
public:
/*!
* @brief Class constructor
* @param source The source text to work on it
*/
RegexHtmlTag(QString& source);
protected:
/*!
* @brief Reads the regexp.cap() and gets the equivalent for the matched substrings
* @return The equivalent for the matched substrings. It may be the same as first matched one.
*/
QString getMatchEquivalent();
};
#endif // REGEXHTMLTAG_H
| [
"[email protected]"
] | |
59f593702a1afbfeeeb14af26eef0fcdf21ac0f3 | dedb0118e61b6b71caabca3e2b310707c2578b08 | /src/init.cpp | 3b66de6851eacd8eaf901c0283104085bb9eefdc | [] | no_license | CorraMatte/WordAsteroid | 91aaa210e9fed43f0508b276b4f7c80d84cfbead | 54b8481636aa3a29247cd493aa87ff606749c6fc | refs/heads/master | 2020-05-20T17:22:36.348435 | 2019-06-10T19:50:23 | 2019-06-10T19:50:23 | 185,685,809 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,124 | cpp | #include "init.h"
// Private
/**
* Funzione che inizializza i requisiti di Allegro riguardanti lo schermo.
*/
static void init_monitor_requirements(){
al_init_image_addon();
al_init_primitives_addon();
}
/**
* Funzione che ordina un array di elementi che rappresentano gli archivi in ordine crescente
* in base alla loro dimensione. \n
* Parametri: \n
* 1) file_list - Lista degli archivi; \n
*/
void sort_file_list(ls_t *file_list) {
file_t temp;
int i, j;
for (i = 0; i < file_list->nfile; i++)
for (int j = 0; j < file_list->nfile - 1; j++)
if (file_list->files[j].size < file_list->files[j + 1].size) {
temp = file_list->files[j];
file_list->files[j] = file_list->files[j + 1];
file_list->files[j + 1] = temp;
}
}
/**
* Funzione che inizializza un array di archivi ordinati. \n
* Ritorna un puntatore all'array di file, o nulllptr in caso di errori.
*/
static ls_t *init_file_list() {
ls_t *file_list = new ls_t;
if (!ls_tar(file_list)) {
return nullptr;
}
sort_file_list(file_list);
return file_list;
}
//**********
// Public
bool init_game_requirements(){
al_init_font_addon();
al_init_ttf_addon();
al_install_audio();
if(!al_install_audio()) return false;
if(!al_init_acodec_addon()) return false;
if(!al_reserve_samples(6)) return false;
// Installo e controllo se esiste la tastiera
if (!al_install_keyboard()) return false;
if (!al_is_keyboard_installed()) return false;
return true;
}
display_info_t init_display_res(){
ALLEGRO_MONITOR_INFO monitor_info;
int monitor_w, monitor_h, offset_w, offset_h;
float display_h, display_w;
display_info_t D;
init_monitor_requirements();
al_get_monitor_info(0, &monitor_info);
monitor_w = monitor_info.x2 - monitor_info.x1;
monitor_h = monitor_info.y2 - monitor_info.y1;
offset_w = monitor_w / MONITOR_OFFSET_RATE;
for(int offset_idx = MONITOR_OFFSET_RATE; offset_idx>0; offset_idx--){
offset_h = monitor_h / offset_idx;
display_h = monitor_h - offset_h;
display_w = (float)(display_h / GAMERES_H) * GAMERES_W;
if(display_w <= monitor_w - offset_w)
break;
}
D = {display_w, display_h};
return D;
}
void init_display(ALLEGRO_DISPLAY * & display){
display = al_create_display(display_info.width, display_info.height);
ALLEGRO_BITMAP *icon;
char *bmp_path;
char bmp_path_names[255] = "icon.png";
bmp_path = new char[255];
bmp_path[0] = '\0';
strcat(bmp_path, BMP_PATH_BASE);
strcat(bmp_path, bmp_path_names);
icon = al_load_bitmap(bmp_path);
assert(icon != nullptr);
delete[] bmp_path;
al_set_display_icon(display, icon);
}
ALLEGRO_EVENT_QUEUE* init_queue_event(ALLEGRO_DISPLAY * & display){
// Creo la code degli eventi
ALLEGRO_EVENT_QUEUE *event_queue = al_create_event_queue();
if (!event_queue) return nullptr;
// Associo il display e la tastiera agli eventi
al_register_event_source(event_queue, al_get_display_event_source(display));
al_register_event_source(event_queue, al_get_keyboard_event_source());
return event_queue;
}
int init_target_bonus(int& instant_ast_dest, const int& asteroids_destroyed){
srand(time(nullptr));
instant_ast_dest = asteroids_destroyed;
return (rand() % 5) + 5;
}
ALLEGRO_SAMPLE* init_sound_music(const char* path){
ALLEGRO_SAMPLE *sound = al_load_sample(path);
assert(sound != nullptr);
return sound;
}
void init_match_vars(match_vars_t& match_vars, ALLEGRO_EVENT_QUEUE * ev_queue){
int i;
for (i = 0; i < N_QUEUES; i++)
match_vars.ast_queues[i] = nullptr;
match_vars.score = 0;
match_vars.asteroids_destroyed = 0;
match_vars.spawn_interval = 2.7;
match_vars.spawn_timer = al_create_timer(match_vars.spawn_interval);
match_vars.timer_shield_bonus = al_create_timer(TIMER_SHIELD_BONUS);
match_vars.timer_rallenty_bonus = al_create_timer(TIMER_RALLENTY_BONUS);
al_register_event_source(ev_queue, al_get_timer_event_source(match_vars.spawn_timer));
al_register_event_source(ev_queue, al_get_timer_event_source(match_vars.timer_shield_bonus));
al_register_event_source(ev_queue, al_get_timer_event_source(match_vars.timer_rallenty_bonus));
match_vars.fps = 5000;
match_vars.insert_asteroid_index = -1;
match_vars.asteroid_head = 1;
match_vars.asteroid_to_generate = NORMAL;
match_vars.sound_exp = init_sound_music(SOUND_PATH_EXPLOSION);
match_vars.sound_fire = init_sound_music(SOUND_PATH_FIRE);
match_vars.sound_gameover = init_sound_music(SOUND_PATH_GAMEOVER);
match_vars.sound_error = init_sound_music(SOUND_PATH_ERROR);
match_vars.music_playwa = al_create_sample_instance(music_wa);
al_attach_sample_instance_to_mixer(match_vars.music_playwa, al_get_default_mixer());
al_set_sample_instance_playmode(match_vars.music_playwa, ALLEGRO_PLAYMODE_LOOP);
match_vars.current_asteroid = -1;
match_vars.key_error = -1;
match_vars.playing = ON;
match_vars.gameover = false;
for (i = 0; i < NUM_ITEMS; i++) match_vars.items[i] = 1;
match_vars.asteroid_to_bonus = init_target_bonus(match_vars.instant_ast_dest, match_vars.asteroids_destroyed);
match_vars.instant_ast_dest = 0;
}
void init_settings(settings_t& settings){
settings.sound = ON;
settings.music = ON;
settings.visible_hints = true;
}
void init_shooter(shooter_t& shooter){
shooter.x = display_info.width/2;
shooter.y = display_info.height/2;
shooter.slope = 0;
shooter.radius = PLAYWA_GV.SHOOTER_AREA_RAD;
}
void init_bullet(bullet_t& bullet){
bullet.x = 0;
bullet.y = 0;
bullet.slope = 0;
bullet.radius = PLAYWA_GV.BULLET_RADIUS;
}
void init_arr_bullet(bullet_t * arr_bullet){
int i;
for (i = 0; i < N_QUEUES; i++)
init_bullet(arr_bullet[i]);
}
void init_words_buffer(words_buffer_t &words_buffer) {
words_buffer.load = 0;
}
void init_thread_manager(thread_manager_t &thread_manager, char *email) {
pthread_condattr_t cond_attr;
pthread_mutexattr_t mutex_attr;
pthread_mutexattr_init(&mutex_attr);
pthread_condattr_init(&cond_attr);
sem_init(&thread_manager.consumer_sem, 0, 0);
sem_init(&thread_manager.searcher_sem, 0, 0);
pthread_cond_init(&thread_manager.spawn_cond, &cond_attr);
pthread_cond_init(&thread_manager.gameover_cond, &cond_attr);
pthread_mutex_init(&thread_manager.spawn_mutex, &mutex_attr);
pthread_mutex_init(&thread_manager.gameover_mutex, &mutex_attr);
pthread_mutex_init(&thread_manager.search_result_mutex, &mutex_attr);
pthread_mutex_init(&thread_manager.words_buffer_mutex, &mutex_attr);
pthread_condattr_destroy(&cond_attr);
pthread_mutexattr_destroy(&mutex_attr);
thread_manager.search_manager.file_list = init_file_list();
assert(thread_manager.search_manager.file_list != nullptr);
thread_manager.search_manager.email = email;
thread_manager.search_manager.res.count_result = 0;
} | [
"[email protected]"
] | |
a7b9529a3b1e95e334ed62a45c86f4b7b5e6969b | 35baea10e5fe085c1f7a672ab1c003ab27ee3006 | /Classes/EnemyRage.h | ad904e1bcaf1a259b55a593c6ec304d0526abbe9 | [] | no_license | houzisbw/TowerDefense_FinalVersion | e58a19db880d0526233a30b3f88cdd26ba2e273b | 08cde532fa838ce35e1906bba1043c06598df19f | refs/heads/master | 2020-03-26T22:30:27.083129 | 2017-10-07T08:00:52 | 2017-10-07T08:00:52 | 42,089,864 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 953 | h | #ifndef _ENEMYRAGE_H_
#define _ENEMYRAGE_H_
#include "cocos2d.h"
#include "EnemyBase.h"
#include "GameManager.h"
class EnemyRage :
public EnemyBase
{
public:
EnemyRage();
~EnemyRage();
virtual bool init() /*override*/;
virtual void changeDirection(float dt);
static EnemyRage* createEnemyRage(cocos2d::Vector<cocos2d::Node*> points, int hp);
GameManager * instance;
virtual void unscheduleChangeDirection();
//敌人冻住之后的解冻计时函数
virtual void deFroze(float dt);
//rage狂怒数值
CC_SYNTHESIZE(int, rage, Rage);
//狂怒值进度条
CC_SYNTHESIZE(cocos2d::ProgressTimer*, rageBar, RageBar);
//狂怒状态图标
CC_SYNTHESIZE(cocos2d::Sprite*, rageIcon, RageIcon);
//创建狂怒条
void createRageBar();
//该敌人加速前进一段时间
void runFastInPeroid();
//敌人怒气值衰减函数
void rageDecrease(float dt);
private:
cocos2d::Sprite* rageBgSprite;//怪物狂怒条背景图片
};
#endif
| [
"[email protected]"
] | |
f2f33498934cdc24220844f3e5e34f705cfbdaae | f8057b780a02274afc77db81ea62bdc793a62f88 | /hardware/arduino/http-solo-polu/http-solo-polu.ino | adaa9fc0fc18710159cf4749464acf14df5c40bb | [] | no_license | aux-lux/polucjant | 3143a1e11cde3d70f0693cada6fa366c094fbef4 | 576de477025134d95959664a6ba04027fd9bd852 | refs/heads/master | 2023-01-29T11:14:31.048249 | 2020-03-18T11:59:15 | 2020-03-18T11:59:15 | 242,981,904 | 0 | 0 | null | 2023-01-24T01:39:18 | 2020-02-25T11:19:31 | JavaScript | UTF-8 | C++ | false | false | 5,672 | ino | #include <ESP8266WiFi.h>
#include <ESP8266Ping.h>
//#include <WebSocketsClient.h>
#include <ESP8266HTTPClient.h>
#include <Adafruit_NeoPixel.h>
#include <credentials.h>
#include "PMS.h"
#define LED_PIN D3
#define NUMPIXELS 1
Adafruit_NeoPixel pixels(NUMPIXELS, LED_PIN, NEO_GRB + NEO_KHZ800);
PMS pms(Serial);
PMS::DATA data;
#define PMS_BAUD 9600
#define SERIAL_BAUD 115200
int id;
int lastInternet;
//#define DEBUG
#ifdef DEBUG
#define DEBUG_PRINT(x) Serial.print (x)
#define DEBUG_PRINTDEC(x) Serial.print (x, DEC)
#define DEBUG_PRINTLN(x) Serial.println (x)
#else
#define DEBUG_PRINT(x)
#define DEBUG_PRINTDEC(x)
#define DEBUG_PRINTLN(x)
#endif
int brightness = 20;
char serverAddress[] = "192.168.0.150"; // server address
IPAddress pingIp (8, 8, 8, 8); // The remote ip to ping
bool internet = false;
bool pmsFailure = false;
bool recognized = false;
//bool websocketUp = false;
//int port = 556;
/*
Adafruit_CCS811 ccs811;
uint16_t ccs811co2;
uint16_t ccs811tvoc;
*/
//WebSocketsClient webSocket;
#define USE_SERIAL Serial1
/*
void webSocketEvent(WStype_t type, uint8_t * payload, size_t length) {
switch(type) {
case WStype_DISCONNECTED:
DEBUG_PRINTLN("[WSc] Disconnected!");
websocketUp = false;
break;
case WStype_CONNECTED: {
DEBUG_PRINTLN("[WSc] Connected");
webSocket.sendTXT("Polucjant v0.4");
websocketUp = true;
// delay(1000);
// printAllData();
}
break;
case WStype_TEXT:
DEBUG_PRINT("Text: ");
// DEBUG_PRINTLN(payload);
Serial.printf("[WSc] get text: %s\n", payload);
break;
case WStype_BIN:
DEBUG_PRINT("Bin: ");
websocketUp = true;
if (payload[0] == 49) {
DEBUG_PRINTLN("Device recognized");
recognized = true;
printAllData();
} else if (payload[0] == 48) {
DEBUG_PRINTLN("Device NOT recognized!");
recognized = false;
} else if (payload[0] == 50) {
DEBUG_PRINTLN("Data received.");
} else if (payload[0] == 51) {
DEBUG_PRINTLN("Data request.");
printAllData();
}
// Serial.printf("[WSc] get binary length: %u\n", length);
// Serial.println(payload[0]);
// hexdump(payload, length);
break;
}
}
*/
void checkWifi() {
WiFi.begin(ssid, password);
DEBUG_PRINT("Connecting");
while (WiFi.status() != WL_CONNECTED) {
DEBUG_PRINT(".");
pixels.setPixelColor(0, brightness, 0, 0);
pixels.show();
delay(100);
pixels.setPixelColor(0, 0, 0, brightness);
pixels.show();
delay(100);
}
pixels.setPixelColor(0, 0, 0, 0);
pixels.show();
DEBUG_PRINTLN("Connected!");
}
void checkInternet() {
int now = millis();
if (!lastInternet || now - lastInternet > 1000 * 60) {
DEBUG_PRINTLN("Checking Internet...");
internet = Ping.ping(pingIp);
DEBUG_PRINT("Internet: ");
DEBUG_PRINTLN(internet);
if (!internet) {
DEBUG_PRINTLN("Waiting 10s for reconnect...");
for (int i=0;i < 50; i++) {
pixels.setPixelColor(0, brightness, 0, 0);
pixels.show();
delay(100);
pixels.setPixelColor(0, 0, brightness, 0);
pixels.show();
delay(100);
}
pixels.setPixelColor(0, 0, 0, 0);
pixels.show();
checkInternet();
} else {
lastInternet = millis();
}
}
}
/*
void setupWebsocket() {
id = ESP.getChipId();
DEBUG_PRINTLN(id);
webSocket.begin(serverAddress, port, "/");
char extraHeader[20];
sprintf(extraHeader,"device-id: %i",id);
webSocket.setExtraHeaders(extraHeader);
webSocket.onEvent(webSocketEvent);
webSocket.setReconnectInterval(5000);
}
*/
//////////////////////////////////////////////////////////////////
void setup()
{
Serial.begin(PMS_BAUD);
pixels.begin();
pixels.clear();
checkWifi();
checkInternet();
// setupWebsocket();
}
void setQuality(int pm25) {
if (pm25 < 10) {
pixels.setPixelColor(0, 0, brightness, brightness / 4);
} else if (pm25 < 25) {
pixels.setPixelColor(0, 0, brightness, 0);
} else if (pm25 < 50) {
pixels.setPixelColor(0, brightness, brightness, 0);
} else if (pm25 < 75) {
pixels.setPixelColor(0, brightness, brightness/2, 0);
} else if (pm25 < 100) {
pixels.setPixelColor(0, brightness, 0, 0);
} else if (pm25 < 150) {
pixels.setPixelColor(0, brightness, 0, brightness / 2);
} else {
pixels.setPixelColor(0, brightness, 0, brightness);
}
pixels.show();
}
void printAllData(){
DEBUG_PRINTLN("READING DATA...");
int limit = 1000;
int pm25 = 9999;
while (!pms.read(data) && limit > 0) {
pm25 = data.PM_AE_UG_2_5;
limit -= 1;
pmsFailure = false;
}
if (limit == 0) {
pm25 = 9999;
DEBUG_PRINTLN("PMS FAILURE");
pmsFailure = true;
} else {
setQuality(pm25);
uint16_t val0 = pm25;
uint64_t number = (uint64_t) val0 << 0;
uint8_t * buf = (uint8_t *) &number;
size_t buf_len = sizeof(number); // 1 byte
// webSocket.sendBIN(buf, buf_len);
}
}
void pmsAlert() {
for(int i=0;i<5;i++) {
pixels.setPixelColor(0, brightness, brightness, 0);
pixels.show();
delay(500);
pixels.setPixelColor(0, 0, brightness, brightness);
pixels.show();
delay(500);
}
pixels.setPixelColor(0, 0, 0, 0);
pixels.show();
}
void wsAlert() {
DEBUG_PRINTLN("WS ALERT");
pixels.setPixelColor(0, 0, brightness, 0);
pixels.show();
delay(100);
pixels.setPixelColor(0, brightness, 0, brightness);
pixels.show();
delay(100);
pixels.setPixelColor(0, 0, 0, 0);
pixels.show();
}
void handleErrors() {
if (pmsFailure) {
pmsAlert();
}
}
void loop() {
//handleErrors();
}
| [
"[email protected]"
] | |
f30bff068ca153d7aa040a8916295174488b41a7 | db6ed48dd2be8edbd038ea0b7aa9d2720d9121e6 | /jni/MPACK/Misc/Uncopyable.hpp | 8d604929f5240f3629c1af99f62b7a4899f1a7d4 | [
"Apache-2.0"
] | permissive | links234/MPACK | c66aa9d6a21c4ebed5bd52ba115b1ed90f57623e | 3eec9616630825d45453e9bf14dae0a3ee4d81e9 | refs/heads/master | 2021-05-16T03:22:02.479750 | 2016-11-21T16:07:10 | 2016-11-21T16:07:10 | 10,639,047 | 1 | 3 | null | 2015-11-27T20:45:28 | 2013-06-12T08:31:51 | C | UTF-8 | C++ | false | false | 267 | hpp | #ifndef MPACK_UNCOPYABLE_H
#define MPACK_UNCOPYABLE_H
namespace MPACK
{
class Uncopyable
{
protected:
Uncopyable () {}
~Uncopyable () {}
private:
Uncopyable (const Uncopyable&);
Uncopyable& operator=(const Uncopyable &);
};
}
#endif
| [
"[email protected]"
] | |
f9364f3ae331eb5cc41ae956c7900561e420b6d3 | 7ed28dffc9e1287cf504fdef5967a85fe9f564e7 | /weighted_union_find/abc87_d.cpp | 2658d75043c8896c1424eae5a2ef31aab5c1b340 | [
"MIT"
] | permissive | Takumi1122/data-structure-algorithm | 0d9cbb921315c94d559710181cdf8e3a1b8e62e5 | 6b9f26e4dbba981f034518a972ecfc698b86d837 | refs/heads/master | 2021-06-29T20:30:37.464338 | 2021-04-17T02:01:44 | 2021-04-17T02:01:44 | 227,387,243 | 0 | 0 | null | 2020-02-23T12:27:52 | 2019-12-11T14:37:49 | C++ | UTF-8 | C++ | false | false | 1,979 | cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
// 重み付きUnionFind
// 差分制約に使用 x[ri] - x[li] = di
// root の重みは0
/*
参考リンク
ABC 87 D - People on a Line
https://atcoder.jp/contests/abc087/tasks/arc090_b
*/
template <class Abel>
struct UnionFind {
vector<int> par;
vector<int> rank;
vector<Abel> diff_weight;
UnionFind(int n = 1, Abel SUM_UNITY = 0) { init(n, SUM_UNITY); }
void init(int n = 1, Abel SUM_UNITY = 0) {
par.resize(n);
rank.resize(n);
diff_weight.resize(n);
rep(i, n) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
}
int root(int x) {
if (par[x] == x) {
return x;
} else {
int r = root(par[x]);
diff_weight[x] += diff_weight[par[x]];
return par[x] = r;
}
}
Abel weight(int x) {
root(x);
return diff_weight[x];
}
// x と y が同じグループにいるかどうかを判定する
bool issame(int x, int y) { return root(x) == root(y); }
// weight(y) = weight(x) + w となるように x と y をマージする
bool merge(int x, int y, Abel w) {
w += weight(x);
w -= weight(y);
x = root(x);
y = root(y);
if (x == y) return false;
if (rank[x] < rank[y]) swap(x, y), w = -w;
if (rank[x] == rank[y]) ++rank[x];
par[y] = x;
diff_weight[y] = w;
return true;
}
// x と y とが同じグループにいるとき、weight(y) - weight(x) をリターンする
Abel diff(int x, int y) { return weight(y) - weight(x); }
};
int main() {
int n, m;
cin >> n >> m;
UnionFind<int> uf(n);
rep(i, m) {
int l, r, d;
cin >> l >> r >> d;
--l, --r;
if (uf.issame(l, r)) {
int diff = uf.diff(l, r);
if (diff != d) {
cout << "No" << endl;
return 0;
}
} else {
uf.merge(l, r, d);
}
}
cout << "Yes" << endl;
return 0;
} | [
"[email protected]"
] | |
da1df3ee3c6213761a9ece9ce82dbd2e0c94d3e8 | 8645ba7368f2ba10893e1ff8962e9e2eedf5104d | /src/Viewer/ViewerGUI.cpp | fcbf52266ae14b2e9d6a576d5d231c3295c7b7ce | [
"Apache-2.0"
] | permissive | reubenlindroos/OmniPhotos | c4560d74fd1bb031cc5c953269b95153ea3716f1 | de62590edc9caf1cfbd1c833bb9176993a10a579 | refs/heads/main | 2023-05-13T19:21:49.495691 | 2021-06-07T10:31:55 | 2021-06-07T10:31:55 | 344,496,849 | 1 | 0 | Apache-2.0 | 2021-03-04T14:10:47 | 2021-03-04T14:10:46 | null | UTF-8 | C++ | false | false | 16,832 | cpp | #include "ViewerGUI.hpp"
#include "3rdParty/fs_std.hpp"
#include "Utils/Logger.hpp"
#include "Utils/Utils.hpp"
#include "Viewer/ImGuiUtils.hpp"
#include "Viewer/ViewerApp.hpp"
ViewerGUI::ViewerGUI(ViewerApp* _app) :
app(_app)
{
// Hide the datasets window by default if only one dataset was found/loaded.
showDatasetWindow = app->numberOfDatasets() > 1;
}
ViewerGUI::~ViewerGUI()
{
// Release the dataset thumbnail textures.
for (int idx = 0; idx < datasetThumbList.size(); idx++)
{
const GLuint text_id = static_cast<GLint>(reinterpret_cast<intptr_t>(datasetThumbList[idx]));
glDeleteTextures(1, &text_id);
}
// Destroy the imgui context.
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();
}
void ViewerGUI::init()
{
window = app->getGLwindow()->getGLFWwindow();
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
app->ignoreMouseInput = &io.WantCaptureMouse;
app->ignoreKeyboardInput = &io.WantCaptureKeyboard;
app->showImGui = true;
// Setup Dear ImGui style
ImGui::StyleColorsDark();
//ImGui::StyleColorsClassic();
ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL3_Init("#version 130");
}
void ViewerGUI::draw()
{
// Start the Dear ImGui frame
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
// Shows debug window
showSettingsWindow();
//// Demo window
//ImGui::ShowDemoWindow();
// Render imgui
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
}
void ViewerGUI::showSettingsWindow()
{
ImGui::SetNextWindowPos(ImVec2(10, 10), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(300, 400), ImGuiCond_FirstUseEver);
ImGui::Begin("OmniPhotos Viewer");
//-------------------------------------------------------------------------
if (ImGui::CollapsingHeader("Rendering Settings", ImGuiTreeNodeFlags_DefaultOpen))
{
showRenderingSettings();
}
//-------------------------------------------------------------------------
if (ImGui::CollapsingHeader("Visualisation Tools"))
{
showVisualisationTools();
}
//-------------------------------------------------------------------------
if (ImGui::CollapsingHeader("Camera Path Animation"))
{
showCameraPathAnimation();
}
//-------------------------------------------------------------------------
if (ImGui::CollapsingHeader("Information", ImGuiTreeNodeFlags_DefaultOpen))
{
ImGui::Checkbox("Show datasets window", &showDatasetWindow);
ImGui::BulletText("Dataset: %s", app->getDataset()->name.c_str());
ImGui::BulletText("Cameras: %d", app->settings->numberOfCameras);
const auto cacheDir = fs::path(app->getDataset()->pathToCacheFolder).filename().string();
ImGui::BulletText("Cache directory: %s", cacheDir.c_str());
// Framerate estimate by Dear ImGUI
ImGui::BulletText("Rendering speed: %.2f ms", 1000.f / ImGui::GetIO().Framerate);
}
ImGui::End();
// Show the dataset window
if (showDatasetWindow)
showDatasets();
}
void ViewerGUI::showCameraPathAnimation()
{
static bool refresh = true;
static std::vector<std::string> path_files;
static std::vector<std::string> path_files_display_names;
static int selected_file = 0;
// Sanity check.
if (!app)
return;
GLCamera* gl_cam = app->getGLCamera();
if (!gl_cam)
return;
if (!gl_cam->cameraControl)
return;
// Refresh file list.
if (refresh)
{
path_files.clear();
path_files_display_names.clear();
// Add the first items for the camera swing motions.
path_files.push_back("");
path_files_display_names.push_back("Circle swing");
path_files.push_back("");
path_files_display_names.push_back("Translation swing");
// Find all CSV files in /src/Paths/.
std::error_code ec;
auto src_path = fs::path(determinePathToSource()) / "Paths";
if (fs::exists(src_path, ec))
{
for (const auto& entry : fs::directory_iterator(src_path))
{
// Skip if not a file.
if (entry.is_regular_file() == false) continue;
// Skip non-CSVs.
if (entry.path().extension() != ".csv") continue;
// Full path.
path_files.push_back(entry.path().generic_string());
// Just filename.
path_files_display_names.push_back("src/" + entry.path().filename().generic_string());
}
}
// Find all CSV files in the config directory.
for (const auto& entry : fs::directory_iterator(app->getDataset()->pathToConfigFolder))
{
// Skip if not a file.
if (entry.is_regular_file() == false) continue;
// Skip non-CSVs.
if (entry.path().extension() != ".csv") continue;
path_files.push_back(entry.path().generic_string()); // full path
path_files_display_names.push_back(entry.path().filename().generic_string()); // just filename
}
refresh = false;
}
// List camera paths in a dropdown
if (ImGui::Combo("Camera path", &selected_file, path_files_display_names))
{
// Stop any ongoing animation.
gl_cam->record = false;
std::vector<std::shared_ptr<Command>> commands;
if (selected_file == 0) // circle swing
{
auto swing = std::make_shared<CircleSwingCommand>();
swing->dataset_name = app->getDataset()->name;
swing->radius = app->getDataset()->circle->getRadius() / 2;
swing->basis = app->getDataset()->circle->getBase();
float look_dist = app->settings->lookAtDistance;
float dir_rad = degToRad(app->settings->lookAtDirection);
swing->lookAt = look_dist * Eigen::Vector3f(sinf(dir_rad), 0.f, -cosf(dir_rad));
commands.push_back(swing);
}
else if (selected_file == 1) // translate swing
{
auto swing = std::make_shared<TranslateSwingCommand>();
swing->dataset_name = app->getDataset()->name;
swing->radius = app->getDataset()->circle->getRadius() / 2;
swing->basis = app->getDataset()->circle->getBase();
float look_dist = app->settings->lookAtDistance;
float dir_rad = degToRad(app->settings->lookAtDirection);
swing->angle = degToRad(app->settings->lookAtDirection + 90);
swing->lookAt = look_dist * Eigen::Vector3f(sinf(dir_rad), 0.f, -cosf(dir_rad));
commands.push_back(swing);
}
else // camera path CSV
{
// Replace camera control commands with the selected file.
auto path_csv = fs::path(app->getDataset()->pathToConfigFolder) / path_files[selected_file];
LOG(INFO) << "Loading camera path from '" << path_csv.generic_string() << "'";
commands.push_back(std::make_shared<PathCommand>(path_csv.generic_string(), app->getDataset()->name));
}
gl_cam->cameraControl->init(commands);
}
if (ImGui::Button("Refresh file list"))
refresh = true;
ImGui::SameLine();
if (selected_file <= 1)
ImGui::Checkbox("Animate", &(gl_cam->record));
else
ImGui::Checkbox("Animate + Export", &(gl_cam->record));
if (ImGui::IsItemHovered())
ImGui::SetTooltip("toggle with 'F9'");
// GUI controls for the circle swing animation.
auto swing = std::dynamic_pointer_cast<CircleSwingCommand>(gl_cam->cameraControl->recording_session[0]);
if (swing != nullptr)
{
ImGui::SameLine();
ImGui::Checkbox("Record", &swing->record_frames);
ImGui::Separator();
ImGui::DragFloat("Circle radius", &swing->radius, 1, 0, 100, "%.1f cm");
float swing_speed = radToDeg(*(swing->speed));
if (ImGui::DragFloat("Angular speed", &swing_speed, 5, 5, 720, "%.1f deg/s"))
*(swing->speed) = degToRad(swing_speed);
ImGui::InputFloat3("Look-at point", swing->lookAt.data(), 0);
// Alternative controls to manipulate the look-at point with polar coordinates.
float dir_rad = atan2f(swing->lookAt.x(), -swing->lookAt.z());
float look_dist = swing->lookAt.norm();
bool update_lookat = false;
update_lookat |= ImGui::SliderAngle("Look-at dir.", &dir_rad, -180, 180);
update_lookat |= ImGui::DragFloat("Look-at rad.", &look_dist, 10, 0, 2000, "%.0f cm");
if (update_lookat)
swing->lookAt = look_dist * Eigen::Vector3f(sinf(dir_rad), 0.f, -cosf(dir_rad));
}
// GUI controls for the translate swing animation.
auto translate = std::dynamic_pointer_cast<TranslateSwingCommand>(gl_cam->cameraControl->recording_session[0]);
if (translate != nullptr)
{
ImGui::SameLine();
ImGui::Checkbox("Record", &translate->record_frames);
ImGui::Separator();
ImGui::DragFloat("Transl. radius", &translate->radius, 1, 0, 100, "%.1f cm");
ImGui::SliderAngle("Transl. angle", &translate->angle, -180, 180);
float swing_speed = radToDeg(*(translate->speed));
if (ImGui::DragFloat("Angular speed", &swing_speed, 5, 5, 720, "%.1f deg/s"))
*(translate->speed) = degToRad(swing_speed);
ImGui::InputFloat3("Look-at point", translate->lookAt.data(), 0);
// Alternative controls to manipulate the look-at point with polar coordinates.
float dir_rad = atan2f(translate->lookAt.x(), -translate->lookAt.z());
float look_dist = translate->lookAt.norm();
bool update_lookat = false;
update_lookat |= ImGui::SliderAngle("Look-at dir.", &dir_rad, -180, 180);
update_lookat |= ImGui::DragFloat("Look-at rad.", &look_dist, 10, 0, 2000, "%.0f cm");
if (update_lookat)
translate->lookAt = look_dist * Eigen::Vector3f(sinf(dir_rad), 0.f, -cosf(dir_rad));
}
}
void ViewerGUI::showRenderingSettings()
{
ImGui::Combo("Method", &app->settings->switchGLProgram, app->methods_str);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("'Tab/Num 0' for next; +Ctrl for previous");
ImGui::Combo("Proxy", &app->settings->switchGLRenderModel, app->proxies_str);
const char* displayMode[] = {
"Left camera view",
"Right camera view",
"Linear blending",
"World lines",
"Debug: Camera pair",
"Debug: TexLeft",
"Debug: TexRight",
"Debug: FlowLeft",
"Debug: FlowRight",
"Debug: CompFlowLeft",
"Debug: CompFlowRight",
"Debug: World positions",
};
ImGui::Combo("Display mode", (int*)&app->settings->displayMode, displayMode, IM_ARRAYSIZE(displayMode));
if (ImGui::IsItemHovered())
ImGui::SetTooltip("'b' for next, +Ctrl for previous");
// Change distance of the GLCamera Plane or change radius of Cylinder or Sphere.
// We do not allow changing the deformed spheres.
std::string proxy_str = app->proxies_str[app->settings->switchGLRenderModel];
//TODO: We "physically" create the geometric shapes with its vertices from scratch and updateGLBuffers -> This is stupid! :)
//What we want is to translate these operations into changes of Primitive's model matrix (not implemented yet).
//TODO: partially replicated in ViewerApp::handleUserInput()
if (proxy_str.compare("Plane") == 0)
{
float plane_distance = app->getGLCamera()->getPlaneDistance() / 100.f; // cm to m
if (ImGui::DragFloat("Plane dist.", &plane_distance, 0.1f, 1, 50, "%.1f m"))
{
// This might crash in the HMD, but then again we don't show the GUI in the HMD.
// We probably don't want to change these things in VR anyway.
app->getGLCamera()->setPlaneDistance(100.f * plane_distance); // m to cm
}
}
//TODO: We lose real-time interactivity for Cylinder and Sphere since it consists of many more vertices than a Plane.
//Cylinder is okayish, Sphere is slowly updating. -> Solution is to use model matrices for Primitives -> TODO!!!
if (proxy_str.compare("Cylinder") == 0)
{
float cylinder_radius = app->getDataset()->cylinder->radius / 100.f; // cm to m
if (ImGui::DragFloat("Cylinder rad.", &cylinder_radius, 0.1f, 1, 50, "%.1f m"))
{
app->getDataset()->cylinder->setRadius(100.f * cylinder_radius); // m to cm
app->getVisualization()->updateCylinderModel(app->settings->circle_resolution);
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip("increase with 'f'/decrease with 'v'");
}
if (proxy_str.compare("Sphere") == 0)
{
float sphere_radius = app->getDataset()->sphere->getRadius() / 100.f; // cm to m
if (ImGui::DragFloat("Sphere radius", &sphere_radius, 0.1f, 1, 50, "%.1f m"))
{
app->getDataset()->sphere->setRadius(100.f * sphere_radius); // m to cm
app->getVisualization()->updateSphereModel();
}
}
// Window size (width x height).
int window_size[2] = { app->getGLwindow()->getWidth(), app->getGLwindow()->getHeight() };
ImGui::InputInt2("Window size", window_size);
if (ImGui::IsItemDeactivatedAfterEdit())
app->getGLwindow()->resizeFramebuffer(window_size[0], window_size[1]);
// Vertical field of view (fovy) of the camera.
float fovy_deg = radToDeg(app->getGLCamera()->getFovy());
if (ImGui::DragFloat("Camera fovy", &fovy_deg, 0.2f, 5, 175, "%.1f deg"))
app->getGLCamera()->setFovy(degToRad(fovy_deg));
//Rendering options.
//per-pixel view-synthesis off -> Use exactly two viewpoints for novel view independent of pixel location
// -> Parallax360. Think of video frame interpolation.
ImGui::Checkbox("Per-pixel view synthesis", (bool*)&app->settings->raysPerPixel);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("toggle with 'z'");
ImGui::SameLine();
helpMarker("Enabled = MegaParallax/OmniPhotos\nDisabled = View synthesis is based only on the optical axis, like Parallax360.");
// Toggle optical flow on/off.
ImGui::Checkbox("Flow-based blending", (bool*)&app->settings->useOpticalFlow);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("toggle with 'o'");
ImGui::Checkbox("Fade out near boundary", (bool*)&app->settings->fadeNearBoundary);
}
void ViewerGUI::loadDatasetThumbnails()
{
// Upload the thumbnail images as textures to GPU memory.
if (app->numberOfDatasets() != datasetThumbList.size())
{
for (int idx = 0; idx < app->numberOfDatasets(); idx++)
{
cv::Mat& image = app->getDatasetFromList(idx).thumbImage;
app->thumbnails.push_back(image);
}
}
loadedDatasets = true;
}
void ViewerGUI::showDatasets()
{
// Upload the thumbnail images as textures to GPU memory.
if (app->numberOfDatasets() != datasetThumbList.size())
{
if (!loadedDatasets)
loadDatasetThumbnails();
for (int idx = 0; idx < app->numberOfDatasets(); idx++)
{
cv::Mat& image = app->thumbnails[idx];
//TODO: cast this into a "GLTexture" object using memory layouts etc.
GLuint texture;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.cols, image.rows, 0, GL_BGR, GL_UNSIGNED_BYTE, image.data);
datasetThumbList.push_back(reinterpret_cast<void*>(static_cast<intptr_t>(texture)));
}
}
IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing Dear ImGui context. Refer to examples app!");
// Create a new window to show dataset thumbnails
ImGui::Begin("Dataset List", &showDatasetWindow);
//ImGui::TextWrapped("Pressing the button to select the viewing dataset.");
for (int i = 0; i < app->numberOfDatasets(); i++)
{
ImGui::BeginGroup();
// Show dataset name
ImGui::TextWrapped(app->getDatasetFromList(i).name.c_str());
// Change the current/loading dataset visualisation.
static unsigned int counter = 0;
if (app->currentDatasetIdx == i)
{
std::string info = "(current)";
if (datasetLoading)
{
info = "- Loading ";
int dot_number = int(counter / 30) % 10;
for (int i = 0; i < dot_number; i++)
info += ".";
counter++;
}
ImGui::SameLine();
ImGui::TextWrapped(info.c_str());
}
// Add image button.
ImGui::PushID(i);
if (ImGui::ImageButton(datasetThumbList[i], ImVec2(240, 120)))
{
LOG(INFO) << "Selected dataset '" << app->getDatasetFromList(i).name << "' to be loaded";
counter = 0;
app->loadDatasetCPUAsync(i);
}
ImGui::PopID();
ImGui::EndGroup();
}
ImGui::End();
}
void ViewerGUI::showVisualisationTools()
{
// reset view button
if (ImGui::Button("Reset View"))
app->initGLCameraToCentre();
ImGui::SameLine();
helpMarker("Press this button, 'backspace' or 'numpad 1' to reset the view to the centre of the camera circle.");
ImGui::Checkbox("Show camera geometry", (bool*)&app->settings->showCameraGeometry);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("toggle with 'm'");
ImGui::Checkbox("Show fitted circle", (bool*)&app->settings->showFittedCircle);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("toggle with 'c'");
ImGui::Checkbox("Show world points", &app->settings->showWorldPoints);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("toggle with 'w'");
ImGui::Checkbox("Show radial lines", &app->settings->showRadialLines);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("toggle 'd'");
ImGui::Checkbox("Vertical translation", &app->mouse->freeTranslate);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("toggle with spacebar");
}
void ViewerGUI::helpMarker(const char* desc)
{
ImGui::TextDisabled("(?)");
if (ImGui::IsItemHovered())
{
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
ImGui::TextUnformatted(desc);
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
}
| [
"[email protected]"
] | |
6d02daca4dead55d5133e8e7705d4d97ddbf1c02 | 4c25432a6d82aaebd82fd48e927317b15a6bf6ab | /data/dataset_2017/dataset_2017_8_formatted/iwashi31/5304486_5697460110360576_iwashi31.cpp | d5785074734a818c846eb5e0a2ece5c507130019 | [] | no_license | wzj1988tv/code-imitator | dca9fb7c2e7559007e5dbadbbc0d0f2deeb52933 | 07a461d43e5c440931b6519c8a3f62e771da2fc2 | refs/heads/master | 2020-12-09T05:33:21.473300 | 2020-01-09T15:29:24 | 2020-01-09T15:29:24 | 231,937,335 | 1 | 0 | null | 2020-01-05T15:28:38 | 2020-01-05T15:28:37 | null | UTF-8 | C++ | false | false | 3,817 | cpp | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define int long long
#define MOD7 1000000007
#define MOD9 1000000009
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, -1, 0, 1};
int nextInt() {
int a;
cin >> a;
return a;
}
char nextChar() {
char a;
cin >> a;
return a;
}
double nextDouble() {
double a;
cin >> a;
return a;
}
string nextString() {
string a;
cin >> a;
return a;
}
template <class T> void inputVector(vector<T> &v, int n) {
v.resize(n);
for (int i = 0; i < v.size(); i++)
cin >> v[i];
}
class Graph {
private:
class Edge {
public:
int to;
int cap;
int rev;
Edge(int to, int cap, int rev) {
this->to = to;
this->cap = cap;
this->rev = rev;
}
};
int calcFlow(int s, int t, int left) {
if (s == t)
return left;
visited[s] = true;
rep(i, nextEdges[s].size()) {
Edge &edge = nextEdges[s][i];
if (edge.cap == 0)
continue;
if (visited[edge.to])
continue;
int flow = calcFlow(edge.to, t, min(left, edge.cap));
if (flow > 0) {
edge.cap -= flow;
nextEdges[edge.to][edge.rev].cap += flow;
return flow;
}
}
return 0;
}
vector<bool> visited;
vector<vector<Edge>> nextEdges, backUpNextEdges;
public:
Graph() {}
Graph(int n) {
nextEdges.resize(n);
visited.resize(n);
}
void addEdge(int node, int to, int cap) {
nextEdges[node].push_back(Edge(to, cap, nextEdges[to].size()));
nextEdges[to].push_back(Edge(node, 0, nextEdges[node].size() - 1));
}
int calcMaxFlow(int s, int t) {
backUpNextEdges = nextEdges;
int ret = 0;
while (true) {
rep(i, nextEdges.size()) visited[i] = false;
int flow = calcFlow(s, t, INT_MAX);
if (flow == 0)
break;
ret += flow;
}
nextEdges = backUpNextEdges;
return ret;
}
};
int p[60][60];
signed main() {
int T;
cin >> T;
ofstream out("output-B-small.txt");
REP(loop, 1, T) {
int N, P;
cin >> N >> P;
vector<int> w;
inputVector(w, N);
rep(i, N) rep(j, P) { cin >> p[i][j]; }
int ans = 0;
if (N == 2) {
Graph g(2 * P + 2);
rep(i, P) {
g.addEdge(0, i + 1, 1);
g.addEdge(P + i + 1, 2 * P + 1, 1);
}
rep(i, P) rep(j, P) {
REP(k, 1, 1000000) {
int y = w[0] * k;
int x = p[0][i];
if (x * 10 < y * 9)
continue;
if (x * 10 > y * 11)
continue;
y = w[1] * k;
x = p[1][j];
if (x * 10 < y * 9)
continue;
if (x * 10 > y * 11)
continue;
g.addEdge(i + 1, P + j + 1, 1);
break;
}
}
ans = g.calcMaxFlow(0, 2 * P + 1);
} else {
rep(i, P) {
REP(k, 1, 1000000) {
int y = w[0] * k;
int x = p[0][i];
if (x * 10 < y * 9)
continue;
if (x * 10 > y * 11)
continue;
ans++;
break;
}
}
}
cout << "Case #" << loop << ": " << ans << endl;
out << "Case #" << loop << ": " << ans << endl;
}
return 0;
}
| [
"[email protected]"
] | |
1a4e42ac1731c5f5662a2cdb001dd034ef0d3de3 | 6822d7a1de1268cdd7ad52b6a18c206a41077fbd | /aws-cpp-sdk-ec2/source/model/SpotPrice.cpp | 06a7dcc9c89f3b409d2c9b7b1fd6e0942a04e3ee | [
"Apache-2.0",
"JSON",
"MIT"
] | permissive | edolstra/aws-sdk-cpp | 57c924ef54f17a67a955c34239622851a9d52ed8 | b2d6affb450a7e276d39f1590bb644d73d721082 | refs/heads/master | 2020-04-05T14:25:50.895804 | 2016-02-16T02:04:09 | 2016-02-16T02:04:09 | 51,923,609 | 0 | 0 | null | 2016-02-17T13:15:00 | 2016-02-17T13:14:59 | null | UTF-8 | C++ | false | false | 4,756 | cpp | /*
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#include <aws/ec2/model/SpotPrice.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <utility>
using namespace Aws::EC2::Model;
using namespace Aws::Utils::Xml;
using namespace Aws::Utils;
SpotPrice::SpotPrice() :
m_instanceTypeHasBeenSet(false),
m_productDescriptionHasBeenSet(false),
m_spotPriceHasBeenSet(false),
m_timestamp(0.0),
m_timestampHasBeenSet(false),
m_availabilityZoneHasBeenSet(false)
{
}
SpotPrice::SpotPrice(const XmlNode& xmlNode) :
m_instanceTypeHasBeenSet(false),
m_productDescriptionHasBeenSet(false),
m_spotPriceHasBeenSet(false),
m_timestamp(0.0),
m_timestampHasBeenSet(false),
m_availabilityZoneHasBeenSet(false)
{
*this = xmlNode;
}
SpotPrice& SpotPrice::operator =(const XmlNode& xmlNode)
{
XmlNode resultNode = xmlNode;
if(!resultNode.IsNull())
{
XmlNode instanceTypeNode = resultNode.FirstChild("instanceType");
if(!instanceTypeNode.IsNull())
{
m_instanceType = InstanceTypeMapper::GetInstanceTypeForName(StringUtils::Trim(instanceTypeNode.GetText().c_str()).c_str());
m_instanceTypeHasBeenSet = true;
}
XmlNode productDescriptionNode = resultNode.FirstChild("productDescription");
if(!productDescriptionNode.IsNull())
{
m_productDescription = RIProductDescriptionMapper::GetRIProductDescriptionForName(StringUtils::Trim(productDescriptionNode.GetText().c_str()).c_str());
m_productDescriptionHasBeenSet = true;
}
XmlNode spotPriceNode = resultNode.FirstChild("spotPrice");
if(!spotPriceNode.IsNull())
{
m_spotPrice = StringUtils::Trim(spotPriceNode.GetText().c_str());
m_spotPriceHasBeenSet = true;
}
XmlNode timestampNode = resultNode.FirstChild("timestamp");
if(!timestampNode.IsNull())
{
m_timestamp = StringUtils::ConvertToDouble(StringUtils::Trim(timestampNode.GetText().c_str()).c_str());
m_timestampHasBeenSet = true;
}
XmlNode availabilityZoneNode = resultNode.FirstChild("availabilityZone");
if(!availabilityZoneNode.IsNull())
{
m_availabilityZone = StringUtils::Trim(availabilityZoneNode.GetText().c_str());
m_availabilityZoneHasBeenSet = true;
}
}
return *this;
}
void SpotPrice::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
{
if(m_instanceTypeHasBeenSet)
{
oStream << location << index << locationValue << ".InstanceType=" << InstanceTypeMapper::GetNameForInstanceType(m_instanceType) << "&";
}
if(m_productDescriptionHasBeenSet)
{
oStream << location << index << locationValue << ".ProductDescription=" << RIProductDescriptionMapper::GetNameForRIProductDescription(m_productDescription) << "&";
}
if(m_spotPriceHasBeenSet)
{
oStream << location << index << locationValue << ".SpotPrice=" << StringUtils::URLEncode(m_spotPrice.c_str()) << "&";
}
if(m_timestampHasBeenSet)
{
oStream << location << index << locationValue << ".Timestamp=" << StringUtils::URLEncode(m_timestamp) << "&";
}
if(m_availabilityZoneHasBeenSet)
{
oStream << location << index << locationValue << ".AvailabilityZone=" << StringUtils::URLEncode(m_availabilityZone.c_str()) << "&";
}
}
void SpotPrice::OutputToStream(Aws::OStream& oStream, const char* location) const
{
if(m_instanceTypeHasBeenSet)
{
oStream << location << ".InstanceType=" << InstanceTypeMapper::GetNameForInstanceType(m_instanceType) << "&";
}
if(m_productDescriptionHasBeenSet)
{
oStream << location << ".ProductDescription=" << RIProductDescriptionMapper::GetNameForRIProductDescription(m_productDescription) << "&";
}
if(m_spotPriceHasBeenSet)
{
oStream << location << ".SpotPrice=" << StringUtils::URLEncode(m_spotPrice.c_str()) << "&";
}
if(m_timestampHasBeenSet)
{
oStream << location << ".Timestamp=" << StringUtils::URLEncode(m_timestamp) << "&";
}
if(m_availabilityZoneHasBeenSet)
{
oStream << location << ".AvailabilityZone=" << StringUtils::URLEncode(m_availabilityZone.c_str()) << "&";
}
}
| [
"[email protected]"
] | |
a371f6732ce3b636b78c817d1c6c7151218cad82 | 98b1e51f55fe389379b0db00365402359309186a | /homework_6/problem_2/100x100/0.088/phi | d748c22723a761a1ab01f61518ad6e8b1b6ddf60 | [] | no_license | taddyb/597-009 | f14c0e75a03ae2fd741905c4c0bc92440d10adda | 5f67e7d3910e3ec115fb3f3dc89a21dcc9a1b927 | refs/heads/main | 2023-01-23T08:14:47.028429 | 2020-12-03T13:24:27 | 2020-12-03T13:24:27 | 311,713,551 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 142,976 | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class surfaceScalarField;
location "0.088";
object phi;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 3 -1 0 0 0 0];
internalField nonuniform List<scalar>
19800
(
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
)
;
boundaryField
{
left
{
type calculated;
value nonuniform List<scalar>
100
(
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
)
;
}
right
{
type calculated;
value nonuniform List<scalar>
100
(
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
)
;
}
up
{
type calculated;
value nonuniform List<scalar>
100
(
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
)
;
}
down
{
type calculated;
value nonuniform List<scalar>
100
(
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
)
;
}
frontAndBack
{
type empty;
value nonuniform List<scalar> 0();
}
}
// ************************************************************************* //
| [
"[email protected]"
] | ||
34872c1c35fd4e744d69eae1ba27edf5e592ca64 | bc3b1ee1674ab190e22376cfb17aad3eabed867e | /src/classifier/peg_classifier.cpp | 8b626175f5a2f697411839f9fbe4809a921fc031 | [] | no_license | gpldecha/plug_sensor_models | a7c710375aabe175e30db16802dd9d3b9c7cbfcc | 670fe5c9b15b26e7c92c893a73587cb60665c4bf | refs/heads/master | 2021-01-10T10:52:23.769948 | 2015-11-11T08:31:51 | 2015-11-11T08:31:51 | 44,486,940 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,609 | cpp | #include "peg_sensor/classifier/peg_classifier.h"
#include <optitrack_rviz/type_conversion.h>
namespace psm{
Peg_sensor_clasifier::Peg_sensor_clasifier(ros::NodeHandle& nh,
const std::string& fixed_frame,
const std::string& peg_link_name,
Sensor_manager& sensor_manager,
const std::string& ft_topic_name,
const std::string& y_topic_name):
peg_pos_listener(fixed_frame,peg_link_name),
sensor_manager(sensor_manager)
{
ft_sub = nh.subscribe<geometry_msgs::WrenchStamped>(ft_topic_name,1,&Peg_sensor_clasifier::ft_callback,this);
y_publisher = nh.advertise<std_msgs::Float32MultiArray>(y_topic_name,10);
}
void Peg_sensor_clasifier::ft_callback(const geometry_msgs::WrenchStamped::ConstPtr& msg){
ft_force(0) = msg->wrench.force.x;
ft_force(1) = msg->wrench.force.y;
ft_force(2) = msg->wrench.force.z;
ft_torque(0) = msg->wrench.torque.x;
ft_torque(1) = msg->wrench.torque.y;
ft_torque(2) = msg->wrench.torque.z;
}
void Peg_sensor_clasifier::update(){
peg_pos_listener.update(peg_origin_tf,peg_orient_tf);
opti_rviz::type_conv::tf2mat(peg_orient_tf,peg_orient);
opti_rviz::type_conv::tf2vec(peg_origin_tf,peg_origin);
sensor_manager.update_peg(Y,peg_origin,peg_orient);
y_msg.data.resize(Y.n_elem);
for(std::size_t i = 0; i < Y.n_elem;i++){
y_msg.data[i] = Y(i);
}
y_publisher.publish(y_msg);
}
}
| [
"[email protected]"
] | |
16d2ae304d552a5f639309df6f3a3e33e03b9364 | 2fb04334c0255546e8a2a9ccc9b0a0b14c5160dd | /main.cpp | eab0169bea15a6aac5c8627d9d4be0d98c829ba8 | [] | no_license | valerystromov/prac | 2036025117cc0bfd08de157716529c20861c293b | 3368d3e9aaa9f1fb1771dc13848f348a4fe1e3c3 | refs/heads/master | 2020-03-11T21:49:41.524169 | 2018-04-19T21:48:27 | 2018-04-19T21:48:27 | 130,275,840 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 348 | cpp | #include "http_server.h"
#include <iostream>
#include <memory>
int main(int argc, char** argv) {
if (argc < 2) {
std::cout << "Usage: http_server [port]" << std::endl;
return 0;
}
auto server = std::make_unique<THttpServer>(std::atol(argv[1]));
while (true) {
server->HandleQuery();
}
return 0;
}
| [
"[email protected]"
] | |
31d58f22fa0f0b368b317125b2fd1d5252bccd11 | f7cbdbb9cf3a721be3535af11f314c816e6f38c8 | /program1.cpp | eb86c292b45b5f0ba19d3d2243bf22ee93b769ea | [] | no_license | ugurcandemiir/Program | 886cc4f55f1f8b10fb3655b3dc3f72fd1fb8cbf6 | b78f58330f3294c03dd3c36ff8c02a09a025273f | refs/heads/master | 2020-04-30T11:43:11.998002 | 2019-03-20T20:04:58 | 2019-03-20T20:04:58 | 176,808,451 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,761 | cpp | #include "Star.h"
#include "Star.h"
#include "Planet.h"
#include "Planet.h"
#include "Vector.h"
#include "Vector.h"
#include "List.h"
#include "List.h"
#include <cassert>
#include <iostream>
#include <ctime>
#include <sys/time.h>
using namespace std;
bool unique(long int ids[], int size){
for (int i = 0; i < size - 1; i++) {
for (int j = i + 1; j < size; j++) {
if (ids[i] == ids[j]) {
return false;
}
}
}
return true;
}
int main(){
srand(time(NULL));
long id_list[200];
cerr << "\t-----------------------------------\n";
cerr << "\t- Part A: Vectors -\n";
cerr << "\t-----------------------------------\n";
cerr << "\n\t=========Test #1: Creating your Vector===========\n\n";
Vector *vect = new Vector();
assert(vect->size() == 0);
cerr << "\n\t=========Test #1 Passed... ===========\n\n";
cerr << "\n\t=========Test #2: Inserting 20 Planets into your Vector===========\n\n";
int i;
for(i = 0; i < 20 ; i++){
vect->insert(i, new Planet(0));
}
assert(vect->size() == 20);
cerr << "\n\t=========Test #2 Passed... ===========\n\n";
cerr << "\n\t=========Test #3: Inserting values into out of bounds index===========\n\n";
vect->insert(49, new Planet(0));
assert(vect->size() == 50);
vect->insert(40, new Planet(0));
assert(vect->size() == 51);
cerr << "\n\t=========Test #3 Passed... ===========\n\n";
cerr << "\n\t=========Test #4: Reading from your Vector===========\n\n";
Planet * p;
for(i = 0 ; i < 20 ; i++){
p = vect->read(i);
id_list[i] = p->getID();
}
assert(unique(id_list, i));
//the new index of planet 20 will be 50 because the previous insert would increment the index
p = vect->read(50);
id_list[i++] = p->getID();
p = vect->read(40);
id_list[i++] = p->getID();
assert(unique(id_list, i));
cerr << "\n\t=========Test #4 Passed... ===========\n\n";
cerr << "\n\t=========Test #5: Reading from unititialized vector index (should return NULL)===========\n\n";
assert(vect->read(45) == NULL);
cerr << "\n\t=========Test #5 Passed... ===========\n\n";
cerr << "\n\t=========Test #6: Attempting to read from out of bounds===========\n\n";
assert(vect->read(100) == NULL);
cerr << "\n\t=========Test #6 Passed... ===========\n\n";
cerr << "\n\t=========Test #7: Remove elements from the vector ===========\n\n";
//RemoveVector
vect->remove(50);
vect->remove(40);
cerr << vect->size() << endl;
assert(vect->size() == 49);
cerr << "\n\t=========Test #7 Passed... ===========\n\n";
cerr << "\n\t=========Test #8: Remove elements from the vector randomly ===========\n\n";
while(vect->size()){
vect->remove((rand()%5));
}
vect->remove(50);
cerr << "\n\t=========Test #8 Passed... ===========\n\n";
cerr << "\n\t=========Test #9: Delete the vector from memory ===========\n\n";
delete vect;
vect = NULL;
cerr << "\n\t=========Test #9 Passed... ===========\n\n";
cerr << "\t-----------------------------------\n";
cerr << "\t- Part B: Lists -\n";
cerr << "\t-----------------------------------\n";
cerr << "\n\t=========Test #10: Creating your Linked List===========\n\n";
List * list = new List();
cerr << "\n\t\tTest #10: Passed ...\n\n";
cerr << "\n\t=========Test #11: Linked List Insertion===========\n\n";
int index = 0;
//add elements to the list
for(int index = 0 ; index < 10 ; index++ ){
list->insert(index, new Planet(0));
}
assert(list->size() == 10);
//***** Test that out of bounds indexes are appended to the list ****/
list->insert(20, new Planet(0));
assert(list->size() == 11);
cerr << "\n\t\tTest #11: Passed ...\n\n";
cerr << "\n\t=========Test #12: Linked List Read===========\n\n";
for(i = 0 ; i < 11 ; i++){
p = list->read(i);
id_list[i] = p->getID();
}
unique(id_list, 11);
p = list->read(20);
assert(p == NULL);
cerr << "\n\t\tTest #12: Passed ...\n\n";
cerr << "\n\t=========Test #13: Linked List Remove===========\n\n";
for(index = 0; list->size() > 4; index++){
index = index % 4;
unsigned int s = list->size();
list->remove(index);
assert(list->size() == s-1);
}
assert(list->size() == 4);
delete list;
list = NULL;
cerr << "\n\t\tTest #13 Passed...\n\n";
cerr << "\n\t=========Test #14: Star Classes ===========\n\n";
Starlist * sl = new Starlist();
assert(sl->getCurrentNumPlanets() == 0);
id_list[0] = sl->addPlanet();
assert(sl->getCurrentNumPlanets() == 1);
p = sl->getPlanet(id_list[0]);
int pos = p->getPos();
sl->orbit();
assert(p->getPos() == (pos + 1) % 360);
Starvector * sv = new Starvector();
assert(sv->getCurrentNumPlanets() == 0);
id_list[1] = sv->addPlanet();
assert(sv->getCurrentNumPlanets() == 1);
p = sv->getPlanet(id_list[1]);
pos = p->getPos();
sv->orbit();
assert(p->getPos() == (pos + 1) % 360);
//add 200 more planets to each
for(int i = 0; i < 200; i+=2){
id_list[i] = sv->addPlanet();
id_list[i+1] = sl->addPlanet();
}
//delete 10 random planets in the sun
for(int i = 0; i < 50; i++){
int rand_id = (rand() % (200));
if(id_list[rand_id] == -1){
continue;
}else if(sv->removePlanet(id_list[rand_id]) ||
sl->removePlanet(id_list[rand_id])){
id_list[rand_id] = -1;
}else{
assert(false);
}
}
sv->printStarInfo();
sl->printStarInfo();
cerr << "\n\t\tTest #14 Passed...\n\n";
cerr << "\n\t=========Test #15: Star Delete ===========\n\n";
delete sl;
delete sv;
cerr << "\n\t\tTest #15 Passed (but check valgrind to be sure)...\n\n";
cerr << "Comparing performance of Vectors and Lists\n";
sl = new Starlist();
sv = new Starvector();
struct timeval start, stop;
float profile_time;
/************************ Starvector Performance Test *********************/
/** Testing performance of insert **/
gettimeofday(&start, NULL);
for(int i = 0; i < 200; i++){
id_list[i] = sv->addPlanet();
}
gettimeofday(&stop, NULL);
profile_time = ((stop.tv_sec* 1000000) + stop.tv_usec) - ((start.tv_sec* 1000000) + start.tv_usec);
printf("\tCompleted Starvector insert profile time = %lf\n", profile_time);
/** Testing performance of read **/
gettimeofday(&start, NULL);
for(int i = 0; i < 200; i++){
sv->getPlanet(id_list[i]);
}
gettimeofday(&stop, NULL);
profile_time = ((stop.tv_sec* 1000000) + stop.tv_usec) - ((start.tv_sec* 1000000) + start.tv_usec);
printf("\tCompleted Starvector read profile time = %lf\n", profile_time);
/** Testing performance of remove **/
gettimeofday(&start, NULL);
for(int i = 0; i < 200; i+=5){
sv->removePlanet(id_list[i]);
}
delete sv;
gettimeofday(&stop, NULL);
profile_time = ((stop.tv_sec* 1000000) + stop.tv_usec) - ((start.tv_sec* 1000000) + start.tv_usec);
printf("\tCompleted Starvector remove profile time = %lf\n", profile_time);
/************************ Starlist Performance Test *********************/
/** Testing performance of insert **/
gettimeofday(&start, NULL);
for(int i = 0; i < 200; i++){
id_list[i] = sl->addPlanet();
}
gettimeofday(&stop, NULL);
profile_time = ((stop.tv_sec* 1000000) + stop.tv_usec) - ((start.tv_sec* 1000000) + start.tv_usec);
printf("\tCompleted Starlist insert profile time = %lf\n", profile_time);
/** Testing performance of read **/
gettimeofday(&start, NULL);
for(int i = 0; i < 200; i++){
sl->getPlanet(id_list[i]);
}
gettimeofday(&stop, NULL);
profile_time = ((stop.tv_sec* 1000000) + stop.tv_usec) - ((start.tv_sec* 1000000) + start.tv_usec);
printf("\tCompleted Starlist read profile time = %lf\n", profile_time);
/** Testing performance of remove **/
gettimeofday(&start, NULL);
for(int i = 0; i < 200; i+=5){
sl->removePlanet(id_list[i]);
}
delete sl;
gettimeofday(&stop, NULL);
profile_time = ((stop.tv_sec* 1000000) + stop.tv_usec) - ((start.tv_sec* 1000000) + start.tv_usec);
printf("\tCompleted Starlist remove profile time = %lf\n", profile_time);
cerr << "\n\t========= Don't forget to submit your hash and check your code with Valgrind! ===========\n\n";
return 0;
}
| [
"[email protected]"
] | |
38e9fa207234079fbabe60394acd956a641a610c | 1d3dc598d1084025afbf681493b7987a4dcce62c | /qtfront/exam_view_sub/name_edit.h | df98212a376d4c49a14f64c656e9ace28fe38057 | [] | no_license | viaduct/exam_paper_editor | 0c9b291ebb99a2c5077c15af0870fe265f6bd781 | 1e964f18594dd95e8c71e679c4b079d51b4180b0 | refs/heads/master | 2020-04-09T10:48:02.489742 | 2018-12-06T04:08:05 | 2018-12-06T04:08:05 | 160,283,091 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 664 | h | #pragma once
#include <QLineEdit>
#include <boost/signals2.hpp>
#include "exam_view_context_holder.h"
namespace wally {
namespace data {
class Exam;
}
namespace qtfront {
namespace exam_view_sub {
class NameEdit : public QLineEdit,
public ExamViewContextHolder
{
public:
NameEdit(QWidget* parent = nullptr);
virtual ~NameEdit();
data::Exam* exam() const;
void setValidExam(data::Exam* one);
void setNullExam();
protected:
void initialized() override final;
void focusOutEvent(QFocusEvent* event) override final;
private:
void pullText();
void pushText();
boost::signals2::scoped_connection
m_con_nameUpdated;
data::Exam*
m_exam{};
};
}}}
| [
"[email protected]"
] | |
31b55bc806deab7baa5e56b6abad7ff6b8b240d9 | 3863e05824b0e07d70d4e2aa8e1908df3adb722c | /player.h | 59f2d4f19fd7fd832d7ce0197108f293569405e5 | [] | no_license | matthewdavidrodgers/what-the-duck | 81f8df27fdd60c258f7bed11226d35783ac28e25 | 4f202bfeb2dc106ad00fce903858be14732a5d6f | refs/heads/master | 2020-03-22T14:41:45.329674 | 2018-09-03T23:01:53 | 2018-09-03T23:01:53 | 140,198,160 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 797 | h | #ifndef PLAYER__H
#define PLAYER__H
#include "twowayMultisprite.h"
#include "enemy.h"
#include <list>
class Player : public TwoWayMultiSprite {
public:
Player(const std::string&);
Player(const Player&);
virtual void update(Uint32 ticks);
Player& operator=(const Player&);
void collided() { collision = true; }
void missed() { collision = false; }
void offPath();
void right();
void left();
void up();
void down();
void stop();
void attach(Enemy* e) { observers.push_back(e); }
void detach(Enemy* e);
void incrementEggCount() { eggCount++; }
int getEggCount() { return eggCount; }
void reset();
private:
std::string xmlName;
int eggCount;
bool collision;
Vector2f xmlVelocity;
std::list<Enemy *> observers;
};
#endif
| [
"[email protected]"
] | |
97e3383b34caf2577b22ad8204ed79f61d96d7e2 | aa05fdac446463f814bcea568989b3a6575d1ab2 | /Spread And Earn.cpp | dde9a5fc09f429e1300e095d858ab29ee6b0858d | [] | no_license | shubhamrajput0369/SEB273_HackerRank_Solutions | 6014ba371b5e571c1182e0c5f31d45f03cf22776 | 070bda7bd986979f42f8a8a8ec2a1eefd041dcd4 | refs/heads/master | 2022-10-19T22:52:05.821561 | 2020-06-08T17:56:51 | 2020-06-08T17:56:51 | 270,765,770 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 916 | cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int c, j;
cin >> c >> j;
int a[c], cost = 0, v[c] = {0}, c1, c2;
for (int i = 0; i < c; i++)
cin >> a[i];
for (int i = 0; i < j; i++)
{
cin >> c1 >> c2;
if (v[c1 - 1] == 0 && v[c2 - 1] == 0)
{
if (a[c1 - 1] > a[c2 - 1])
{
cost += a[c2 - 1];
}
else
{
cost += a[c1 - 1];
}
v[c1 - 1] = 1;
v[c2 - 1] = 1;
}
else
{
if (v[c2 - 1] == 0 && v[c1 - 1] == 1)
v[c2 - 1] = 1;
else
v[c1 - 1] = 1;
}
}
for (int i = 0; i < c; i++)
{
if (v[i] == 0)
{
cost += a[i];
}
}
cout << cost;
return 0;
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.