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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5d841d0392cee5fcb0b77cd9f911e4f0636104ae
|
bd80077d88df408cb453c90b8c957e81dcec9d6f
|
/google/protobuf/util/internal/testdata/wrappers.pb.h
|
e2a26c45340fd700e30f8d42587f214745ec0176
|
[] |
no_license
|
Zypper-V/ProtocolBuffer
|
c9a4e63a4d117c086088478365c899209da856eb
|
56e0aa7b10da4f9ac8db54829c76c574a9dfa0da
|
refs/heads/master
| 2020-05-17T00:37:39.145367 | 2019-09-11T11:59:41 | 2019-09-11T11:59:41 | 183,400,643 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | true | 116,010 |
h
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/util/internal/testdata/wrappers.proto
#ifndef PROTOBUF_INCLUDED_google_2fprotobuf_2futil_2finternal_2ftestdata_2fwrappers_2eproto
#define PROTOBUF_INCLUDED_google_2fprotobuf_2futil_2finternal_2ftestdata_2fwrappers_2eproto
#include <limits>
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3007000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 3007001 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
#endif
#include <google/protobuf/port_undef.inc>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/arena.h>
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
#include <google/protobuf/extension_set.h> // IWYU pragma: export
#include <google/protobuf/unknown_field_set.h>
#include <google/protobuf/wrappers.pb.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>
#define PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2futil_2finternal_2ftestdata_2fwrappers_2eproto
// Internal implementation detail -- do not use these members.
struct TableStruct_google_2fprotobuf_2futil_2finternal_2ftestdata_2fwrappers_2eproto {
static const ::google::protobuf::internal::ParseTableField entries[]
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::google::protobuf::internal::AuxillaryParseTableField aux[]
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::google::protobuf::internal::ParseTable schema[10]
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::google::protobuf::internal::FieldMetadata field_metadata[];
static const ::google::protobuf::internal::SerializationTable serialization_table[];
static const ::google::protobuf::uint32 offsets[];
};
void AddDescriptors_google_2fprotobuf_2futil_2finternal_2ftestdata_2fwrappers_2eproto();
namespace google {
namespace protobuf {
namespace testing {
class BoolWrapper;
class BoolWrapperDefaultTypeInternal;
extern BoolWrapperDefaultTypeInternal _BoolWrapper_default_instance_;
class BytesWrapper;
class BytesWrapperDefaultTypeInternal;
extern BytesWrapperDefaultTypeInternal _BytesWrapper_default_instance_;
class DoubleWrapper;
class DoubleWrapperDefaultTypeInternal;
extern DoubleWrapperDefaultTypeInternal _DoubleWrapper_default_instance_;
class FloatWrapper;
class FloatWrapperDefaultTypeInternal;
extern FloatWrapperDefaultTypeInternal _FloatWrapper_default_instance_;
class Int32Wrapper;
class Int32WrapperDefaultTypeInternal;
extern Int32WrapperDefaultTypeInternal _Int32Wrapper_default_instance_;
class Int64Wrapper;
class Int64WrapperDefaultTypeInternal;
extern Int64WrapperDefaultTypeInternal _Int64Wrapper_default_instance_;
class StringWrapper;
class StringWrapperDefaultTypeInternal;
extern StringWrapperDefaultTypeInternal _StringWrapper_default_instance_;
class UInt32Wrapper;
class UInt32WrapperDefaultTypeInternal;
extern UInt32WrapperDefaultTypeInternal _UInt32Wrapper_default_instance_;
class UInt64Wrapper;
class UInt64WrapperDefaultTypeInternal;
extern UInt64WrapperDefaultTypeInternal _UInt64Wrapper_default_instance_;
class WrappersTestCases;
class WrappersTestCasesDefaultTypeInternal;
extern WrappersTestCasesDefaultTypeInternal _WrappersTestCases_default_instance_;
} // namespace testing
template<> ::google::protobuf::testing::BoolWrapper* Arena::CreateMaybeMessage<::google::protobuf::testing::BoolWrapper>(Arena*);
template<> ::google::protobuf::testing::BytesWrapper* Arena::CreateMaybeMessage<::google::protobuf::testing::BytesWrapper>(Arena*);
template<> ::google::protobuf::testing::DoubleWrapper* Arena::CreateMaybeMessage<::google::protobuf::testing::DoubleWrapper>(Arena*);
template<> ::google::protobuf::testing::FloatWrapper* Arena::CreateMaybeMessage<::google::protobuf::testing::FloatWrapper>(Arena*);
template<> ::google::protobuf::testing::Int32Wrapper* Arena::CreateMaybeMessage<::google::protobuf::testing::Int32Wrapper>(Arena*);
template<> ::google::protobuf::testing::Int64Wrapper* Arena::CreateMaybeMessage<::google::protobuf::testing::Int64Wrapper>(Arena*);
template<> ::google::protobuf::testing::StringWrapper* Arena::CreateMaybeMessage<::google::protobuf::testing::StringWrapper>(Arena*);
template<> ::google::protobuf::testing::UInt32Wrapper* Arena::CreateMaybeMessage<::google::protobuf::testing::UInt32Wrapper>(Arena*);
template<> ::google::protobuf::testing::UInt64Wrapper* Arena::CreateMaybeMessage<::google::protobuf::testing::UInt64Wrapper>(Arena*);
template<> ::google::protobuf::testing::WrappersTestCases* Arena::CreateMaybeMessage<::google::protobuf::testing::WrappersTestCases>(Arena*);
} // namespace protobuf
} // namespace google
namespace google {
namespace protobuf {
namespace testing {
// ===================================================================
class WrappersTestCases :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.WrappersTestCases) */ {
public:
WrappersTestCases();
virtual ~WrappersTestCases();
WrappersTestCases(const WrappersTestCases& from);
inline WrappersTestCases& operator=(const WrappersTestCases& from) {
CopyFrom(from);
return *this;
}
#if LANG_CXX11
WrappersTestCases(WrappersTestCases&& from) noexcept
: WrappersTestCases() {
*this = ::std::move(from);
}
inline WrappersTestCases& operator=(WrappersTestCases&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
#endif
static const ::google::protobuf::Descriptor* descriptor() {
return default_instance().GetDescriptor();
}
static const WrappersTestCases& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const WrappersTestCases* internal_default_instance() {
return reinterpret_cast<const WrappersTestCases*>(
&_WrappersTestCases_default_instance_);
}
static constexpr int kIndexInFileMessages =
0;
void Swap(WrappersTestCases* other);
friend void swap(WrappersTestCases& a, WrappersTestCases& b) {
a.Swap(&b);
}
// implements Message ----------------------------------------------
inline WrappersTestCases* New() const final {
return CreateMaybeMessage<WrappersTestCases>(nullptr);
}
WrappersTestCases* New(::google::protobuf::Arena* arena) const final {
return CreateMaybeMessage<WrappersTestCases>(arena);
}
void CopyFrom(const ::google::protobuf::Message& from) final;
void MergeFrom(const ::google::protobuf::Message& from) final;
void CopyFrom(const WrappersTestCases& from);
void MergeFrom(const WrappersTestCases& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx);
::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; }
#else
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) final;
#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const final;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(WrappersTestCases* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::google::protobuf::Metadata GetMetadata() const final;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// .google.protobuf.testing.DoubleWrapper double_wrapper = 1;
bool has_double_wrapper() const;
void clear_double_wrapper();
static const int kDoubleWrapperFieldNumber = 1;
const ::google::protobuf::testing::DoubleWrapper& double_wrapper() const;
::google::protobuf::testing::DoubleWrapper* release_double_wrapper();
::google::protobuf::testing::DoubleWrapper* mutable_double_wrapper();
void set_allocated_double_wrapper(::google::protobuf::testing::DoubleWrapper* double_wrapper);
// .google.protobuf.testing.FloatWrapper float_wrapper = 2;
bool has_float_wrapper() const;
void clear_float_wrapper();
static const int kFloatWrapperFieldNumber = 2;
const ::google::protobuf::testing::FloatWrapper& float_wrapper() const;
::google::protobuf::testing::FloatWrapper* release_float_wrapper();
::google::protobuf::testing::FloatWrapper* mutable_float_wrapper();
void set_allocated_float_wrapper(::google::protobuf::testing::FloatWrapper* float_wrapper);
// .google.protobuf.testing.Int64Wrapper int64_wrapper = 3;
bool has_int64_wrapper() const;
void clear_int64_wrapper();
static const int kInt64WrapperFieldNumber = 3;
const ::google::protobuf::testing::Int64Wrapper& int64_wrapper() const;
::google::protobuf::testing::Int64Wrapper* release_int64_wrapper();
::google::protobuf::testing::Int64Wrapper* mutable_int64_wrapper();
void set_allocated_int64_wrapper(::google::protobuf::testing::Int64Wrapper* int64_wrapper);
// .google.protobuf.testing.UInt64Wrapper uint64_wrapper = 4;
bool has_uint64_wrapper() const;
void clear_uint64_wrapper();
static const int kUint64WrapperFieldNumber = 4;
const ::google::protobuf::testing::UInt64Wrapper& uint64_wrapper() const;
::google::protobuf::testing::UInt64Wrapper* release_uint64_wrapper();
::google::protobuf::testing::UInt64Wrapper* mutable_uint64_wrapper();
void set_allocated_uint64_wrapper(::google::protobuf::testing::UInt64Wrapper* uint64_wrapper);
// .google.protobuf.testing.Int32Wrapper int32_wrapper = 5;
bool has_int32_wrapper() const;
void clear_int32_wrapper();
static const int kInt32WrapperFieldNumber = 5;
const ::google::protobuf::testing::Int32Wrapper& int32_wrapper() const;
::google::protobuf::testing::Int32Wrapper* release_int32_wrapper();
::google::protobuf::testing::Int32Wrapper* mutable_int32_wrapper();
void set_allocated_int32_wrapper(::google::protobuf::testing::Int32Wrapper* int32_wrapper);
// .google.protobuf.testing.UInt32Wrapper uint32_wrapper = 6;
bool has_uint32_wrapper() const;
void clear_uint32_wrapper();
static const int kUint32WrapperFieldNumber = 6;
const ::google::protobuf::testing::UInt32Wrapper& uint32_wrapper() const;
::google::protobuf::testing::UInt32Wrapper* release_uint32_wrapper();
::google::protobuf::testing::UInt32Wrapper* mutable_uint32_wrapper();
void set_allocated_uint32_wrapper(::google::protobuf::testing::UInt32Wrapper* uint32_wrapper);
// .google.protobuf.testing.BoolWrapper bool_wrapper = 7;
bool has_bool_wrapper() const;
void clear_bool_wrapper();
static const int kBoolWrapperFieldNumber = 7;
const ::google::protobuf::testing::BoolWrapper& bool_wrapper() const;
::google::protobuf::testing::BoolWrapper* release_bool_wrapper();
::google::protobuf::testing::BoolWrapper* mutable_bool_wrapper();
void set_allocated_bool_wrapper(::google::protobuf::testing::BoolWrapper* bool_wrapper);
// .google.protobuf.testing.StringWrapper string_wrapper = 8;
bool has_string_wrapper() const;
void clear_string_wrapper();
static const int kStringWrapperFieldNumber = 8;
const ::google::protobuf::testing::StringWrapper& string_wrapper() const;
::google::protobuf::testing::StringWrapper* release_string_wrapper();
::google::protobuf::testing::StringWrapper* mutable_string_wrapper();
void set_allocated_string_wrapper(::google::protobuf::testing::StringWrapper* string_wrapper);
// .google.protobuf.testing.BytesWrapper bytes_wrapper = 9;
bool has_bytes_wrapper() const;
void clear_bytes_wrapper();
static const int kBytesWrapperFieldNumber = 9;
const ::google::protobuf::testing::BytesWrapper& bytes_wrapper() const;
::google::protobuf::testing::BytesWrapper* release_bytes_wrapper();
::google::protobuf::testing::BytesWrapper* mutable_bytes_wrapper();
void set_allocated_bytes_wrapper(::google::protobuf::testing::BytesWrapper* bytes_wrapper);
// .google.protobuf.testing.DoubleWrapper double_wrapper_default = 10;
bool has_double_wrapper_default() const;
void clear_double_wrapper_default();
static const int kDoubleWrapperDefaultFieldNumber = 10;
const ::google::protobuf::testing::DoubleWrapper& double_wrapper_default() const;
::google::protobuf::testing::DoubleWrapper* release_double_wrapper_default();
::google::protobuf::testing::DoubleWrapper* mutable_double_wrapper_default();
void set_allocated_double_wrapper_default(::google::protobuf::testing::DoubleWrapper* double_wrapper_default);
// .google.protobuf.testing.FloatWrapper float_wrapper_default = 11;
bool has_float_wrapper_default() const;
void clear_float_wrapper_default();
static const int kFloatWrapperDefaultFieldNumber = 11;
const ::google::protobuf::testing::FloatWrapper& float_wrapper_default() const;
::google::protobuf::testing::FloatWrapper* release_float_wrapper_default();
::google::protobuf::testing::FloatWrapper* mutable_float_wrapper_default();
void set_allocated_float_wrapper_default(::google::protobuf::testing::FloatWrapper* float_wrapper_default);
// .google.protobuf.testing.Int64Wrapper int64_wrapper_default = 12;
bool has_int64_wrapper_default() const;
void clear_int64_wrapper_default();
static const int kInt64WrapperDefaultFieldNumber = 12;
const ::google::protobuf::testing::Int64Wrapper& int64_wrapper_default() const;
::google::protobuf::testing::Int64Wrapper* release_int64_wrapper_default();
::google::protobuf::testing::Int64Wrapper* mutable_int64_wrapper_default();
void set_allocated_int64_wrapper_default(::google::protobuf::testing::Int64Wrapper* int64_wrapper_default);
// .google.protobuf.testing.UInt64Wrapper uint64_wrapper_default = 13;
bool has_uint64_wrapper_default() const;
void clear_uint64_wrapper_default();
static const int kUint64WrapperDefaultFieldNumber = 13;
const ::google::protobuf::testing::UInt64Wrapper& uint64_wrapper_default() const;
::google::protobuf::testing::UInt64Wrapper* release_uint64_wrapper_default();
::google::protobuf::testing::UInt64Wrapper* mutable_uint64_wrapper_default();
void set_allocated_uint64_wrapper_default(::google::protobuf::testing::UInt64Wrapper* uint64_wrapper_default);
// .google.protobuf.testing.Int32Wrapper int32_wrapper_default = 14;
bool has_int32_wrapper_default() const;
void clear_int32_wrapper_default();
static const int kInt32WrapperDefaultFieldNumber = 14;
const ::google::protobuf::testing::Int32Wrapper& int32_wrapper_default() const;
::google::protobuf::testing::Int32Wrapper* release_int32_wrapper_default();
::google::protobuf::testing::Int32Wrapper* mutable_int32_wrapper_default();
void set_allocated_int32_wrapper_default(::google::protobuf::testing::Int32Wrapper* int32_wrapper_default);
// .google.protobuf.testing.UInt32Wrapper uint32_wrapper_default = 15;
bool has_uint32_wrapper_default() const;
void clear_uint32_wrapper_default();
static const int kUint32WrapperDefaultFieldNumber = 15;
const ::google::protobuf::testing::UInt32Wrapper& uint32_wrapper_default() const;
::google::protobuf::testing::UInt32Wrapper* release_uint32_wrapper_default();
::google::protobuf::testing::UInt32Wrapper* mutable_uint32_wrapper_default();
void set_allocated_uint32_wrapper_default(::google::protobuf::testing::UInt32Wrapper* uint32_wrapper_default);
// .google.protobuf.testing.BoolWrapper bool_wrapper_default = 16;
bool has_bool_wrapper_default() const;
void clear_bool_wrapper_default();
static const int kBoolWrapperDefaultFieldNumber = 16;
const ::google::protobuf::testing::BoolWrapper& bool_wrapper_default() const;
::google::protobuf::testing::BoolWrapper* release_bool_wrapper_default();
::google::protobuf::testing::BoolWrapper* mutable_bool_wrapper_default();
void set_allocated_bool_wrapper_default(::google::protobuf::testing::BoolWrapper* bool_wrapper_default);
// .google.protobuf.testing.StringWrapper string_wrapper_default = 17;
bool has_string_wrapper_default() const;
void clear_string_wrapper_default();
static const int kStringWrapperDefaultFieldNumber = 17;
const ::google::protobuf::testing::StringWrapper& string_wrapper_default() const;
::google::protobuf::testing::StringWrapper* release_string_wrapper_default();
::google::protobuf::testing::StringWrapper* mutable_string_wrapper_default();
void set_allocated_string_wrapper_default(::google::protobuf::testing::StringWrapper* string_wrapper_default);
// .google.protobuf.testing.BytesWrapper bytes_wrapper_default = 18;
bool has_bytes_wrapper_default() const;
void clear_bytes_wrapper_default();
static const int kBytesWrapperDefaultFieldNumber = 18;
const ::google::protobuf::testing::BytesWrapper& bytes_wrapper_default() const;
::google::protobuf::testing::BytesWrapper* release_bytes_wrapper_default();
::google::protobuf::testing::BytesWrapper* mutable_bytes_wrapper_default();
void set_allocated_bytes_wrapper_default(::google::protobuf::testing::BytesWrapper* bytes_wrapper_default);
// @@protoc_insertion_point(class_scope:google.protobuf.testing.WrappersTestCases)
private:
class HasBitSetters;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::testing::DoubleWrapper* double_wrapper_;
::google::protobuf::testing::FloatWrapper* float_wrapper_;
::google::protobuf::testing::Int64Wrapper* int64_wrapper_;
::google::protobuf::testing::UInt64Wrapper* uint64_wrapper_;
::google::protobuf::testing::Int32Wrapper* int32_wrapper_;
::google::protobuf::testing::UInt32Wrapper* uint32_wrapper_;
::google::protobuf::testing::BoolWrapper* bool_wrapper_;
::google::protobuf::testing::StringWrapper* string_wrapper_;
::google::protobuf::testing::BytesWrapper* bytes_wrapper_;
::google::protobuf::testing::DoubleWrapper* double_wrapper_default_;
::google::protobuf::testing::FloatWrapper* float_wrapper_default_;
::google::protobuf::testing::Int64Wrapper* int64_wrapper_default_;
::google::protobuf::testing::UInt64Wrapper* uint64_wrapper_default_;
::google::protobuf::testing::Int32Wrapper* int32_wrapper_default_;
::google::protobuf::testing::UInt32Wrapper* uint32_wrapper_default_;
::google::protobuf::testing::BoolWrapper* bool_wrapper_default_;
::google::protobuf::testing::StringWrapper* string_wrapper_default_;
::google::protobuf::testing::BytesWrapper* bytes_wrapper_default_;
mutable ::google::protobuf::internal::CachedSize _cached_size_;
friend struct ::TableStruct_google_2fprotobuf_2futil_2finternal_2ftestdata_2fwrappers_2eproto;
};
// -------------------------------------------------------------------
class DoubleWrapper :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.DoubleWrapper) */ {
public:
DoubleWrapper();
virtual ~DoubleWrapper();
DoubleWrapper(const DoubleWrapper& from);
inline DoubleWrapper& operator=(const DoubleWrapper& from) {
CopyFrom(from);
return *this;
}
#if LANG_CXX11
DoubleWrapper(DoubleWrapper&& from) noexcept
: DoubleWrapper() {
*this = ::std::move(from);
}
inline DoubleWrapper& operator=(DoubleWrapper&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
#endif
static const ::google::protobuf::Descriptor* descriptor() {
return default_instance().GetDescriptor();
}
static const DoubleWrapper& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const DoubleWrapper* internal_default_instance() {
return reinterpret_cast<const DoubleWrapper*>(
&_DoubleWrapper_default_instance_);
}
static constexpr int kIndexInFileMessages =
1;
void Swap(DoubleWrapper* other);
friend void swap(DoubleWrapper& a, DoubleWrapper& b) {
a.Swap(&b);
}
// implements Message ----------------------------------------------
inline DoubleWrapper* New() const final {
return CreateMaybeMessage<DoubleWrapper>(nullptr);
}
DoubleWrapper* New(::google::protobuf::Arena* arena) const final {
return CreateMaybeMessage<DoubleWrapper>(arena);
}
void CopyFrom(const ::google::protobuf::Message& from) final;
void MergeFrom(const ::google::protobuf::Message& from) final;
void CopyFrom(const DoubleWrapper& from);
void MergeFrom(const DoubleWrapper& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx);
::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; }
#else
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) final;
#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const final;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(DoubleWrapper* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::google::protobuf::Metadata GetMetadata() const final;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// .google.protobuf.DoubleValue double = 1;
bool has_double_() const;
void clear_double_();
static const int kDoubleFieldNumber = 1;
const ::google::protobuf::DoubleValue& double_() const;
::google::protobuf::DoubleValue* release_double_();
::google::protobuf::DoubleValue* mutable_double_();
void set_allocated_double_(::google::protobuf::DoubleValue* double_);
// @@protoc_insertion_point(class_scope:google.protobuf.testing.DoubleWrapper)
private:
class HasBitSetters;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::DoubleValue* double__;
mutable ::google::protobuf::internal::CachedSize _cached_size_;
friend struct ::TableStruct_google_2fprotobuf_2futil_2finternal_2ftestdata_2fwrappers_2eproto;
};
// -------------------------------------------------------------------
class FloatWrapper :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.FloatWrapper) */ {
public:
FloatWrapper();
virtual ~FloatWrapper();
FloatWrapper(const FloatWrapper& from);
inline FloatWrapper& operator=(const FloatWrapper& from) {
CopyFrom(from);
return *this;
}
#if LANG_CXX11
FloatWrapper(FloatWrapper&& from) noexcept
: FloatWrapper() {
*this = ::std::move(from);
}
inline FloatWrapper& operator=(FloatWrapper&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
#endif
static const ::google::protobuf::Descriptor* descriptor() {
return default_instance().GetDescriptor();
}
static const FloatWrapper& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const FloatWrapper* internal_default_instance() {
return reinterpret_cast<const FloatWrapper*>(
&_FloatWrapper_default_instance_);
}
static constexpr int kIndexInFileMessages =
2;
void Swap(FloatWrapper* other);
friend void swap(FloatWrapper& a, FloatWrapper& b) {
a.Swap(&b);
}
// implements Message ----------------------------------------------
inline FloatWrapper* New() const final {
return CreateMaybeMessage<FloatWrapper>(nullptr);
}
FloatWrapper* New(::google::protobuf::Arena* arena) const final {
return CreateMaybeMessage<FloatWrapper>(arena);
}
void CopyFrom(const ::google::protobuf::Message& from) final;
void MergeFrom(const ::google::protobuf::Message& from) final;
void CopyFrom(const FloatWrapper& from);
void MergeFrom(const FloatWrapper& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx);
::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; }
#else
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) final;
#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const final;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(FloatWrapper* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::google::protobuf::Metadata GetMetadata() const final;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// .google.protobuf.FloatValue float = 1;
bool has_float_() const;
void clear_float_();
static const int kFloatFieldNumber = 1;
const ::google::protobuf::FloatValue& float_() const;
::google::protobuf::FloatValue* release_float_();
::google::protobuf::FloatValue* mutable_float_();
void set_allocated_float_(::google::protobuf::FloatValue* float_);
// @@protoc_insertion_point(class_scope:google.protobuf.testing.FloatWrapper)
private:
class HasBitSetters;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::FloatValue* float__;
mutable ::google::protobuf::internal::CachedSize _cached_size_;
friend struct ::TableStruct_google_2fprotobuf_2futil_2finternal_2ftestdata_2fwrappers_2eproto;
};
// -------------------------------------------------------------------
class Int64Wrapper :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.Int64Wrapper) */ {
public:
Int64Wrapper();
virtual ~Int64Wrapper();
Int64Wrapper(const Int64Wrapper& from);
inline Int64Wrapper& operator=(const Int64Wrapper& from) {
CopyFrom(from);
return *this;
}
#if LANG_CXX11
Int64Wrapper(Int64Wrapper&& from) noexcept
: Int64Wrapper() {
*this = ::std::move(from);
}
inline Int64Wrapper& operator=(Int64Wrapper&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
#endif
static const ::google::protobuf::Descriptor* descriptor() {
return default_instance().GetDescriptor();
}
static const Int64Wrapper& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Int64Wrapper* internal_default_instance() {
return reinterpret_cast<const Int64Wrapper*>(
&_Int64Wrapper_default_instance_);
}
static constexpr int kIndexInFileMessages =
3;
void Swap(Int64Wrapper* other);
friend void swap(Int64Wrapper& a, Int64Wrapper& b) {
a.Swap(&b);
}
// implements Message ----------------------------------------------
inline Int64Wrapper* New() const final {
return CreateMaybeMessage<Int64Wrapper>(nullptr);
}
Int64Wrapper* New(::google::protobuf::Arena* arena) const final {
return CreateMaybeMessage<Int64Wrapper>(arena);
}
void CopyFrom(const ::google::protobuf::Message& from) final;
void MergeFrom(const ::google::protobuf::Message& from) final;
void CopyFrom(const Int64Wrapper& from);
void MergeFrom(const Int64Wrapper& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx);
::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; }
#else
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) final;
#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const final;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Int64Wrapper* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::google::protobuf::Metadata GetMetadata() const final;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// .google.protobuf.Int64Value int64 = 1;
bool has_int64() const;
void clear_int64();
static const int kInt64FieldNumber = 1;
const ::google::protobuf::Int64Value& int64() const;
::google::protobuf::Int64Value* release_int64();
::google::protobuf::Int64Value* mutable_int64();
void set_allocated_int64(::google::protobuf::Int64Value* int64);
// @@protoc_insertion_point(class_scope:google.protobuf.testing.Int64Wrapper)
private:
class HasBitSetters;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::Int64Value* int64_;
mutable ::google::protobuf::internal::CachedSize _cached_size_;
friend struct ::TableStruct_google_2fprotobuf_2futil_2finternal_2ftestdata_2fwrappers_2eproto;
};
// -------------------------------------------------------------------
class UInt64Wrapper :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.UInt64Wrapper) */ {
public:
UInt64Wrapper();
virtual ~UInt64Wrapper();
UInt64Wrapper(const UInt64Wrapper& from);
inline UInt64Wrapper& operator=(const UInt64Wrapper& from) {
CopyFrom(from);
return *this;
}
#if LANG_CXX11
UInt64Wrapper(UInt64Wrapper&& from) noexcept
: UInt64Wrapper() {
*this = ::std::move(from);
}
inline UInt64Wrapper& operator=(UInt64Wrapper&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
#endif
static const ::google::protobuf::Descriptor* descriptor() {
return default_instance().GetDescriptor();
}
static const UInt64Wrapper& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const UInt64Wrapper* internal_default_instance() {
return reinterpret_cast<const UInt64Wrapper*>(
&_UInt64Wrapper_default_instance_);
}
static constexpr int kIndexInFileMessages =
4;
void Swap(UInt64Wrapper* other);
friend void swap(UInt64Wrapper& a, UInt64Wrapper& b) {
a.Swap(&b);
}
// implements Message ----------------------------------------------
inline UInt64Wrapper* New() const final {
return CreateMaybeMessage<UInt64Wrapper>(nullptr);
}
UInt64Wrapper* New(::google::protobuf::Arena* arena) const final {
return CreateMaybeMessage<UInt64Wrapper>(arena);
}
void CopyFrom(const ::google::protobuf::Message& from) final;
void MergeFrom(const ::google::protobuf::Message& from) final;
void CopyFrom(const UInt64Wrapper& from);
void MergeFrom(const UInt64Wrapper& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx);
::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; }
#else
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) final;
#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const final;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(UInt64Wrapper* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::google::protobuf::Metadata GetMetadata() const final;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// .google.protobuf.UInt64Value uint64 = 1;
bool has_uint64() const;
void clear_uint64();
static const int kUint64FieldNumber = 1;
const ::google::protobuf::UInt64Value& uint64() const;
::google::protobuf::UInt64Value* release_uint64();
::google::protobuf::UInt64Value* mutable_uint64();
void set_allocated_uint64(::google::protobuf::UInt64Value* uint64);
// @@protoc_insertion_point(class_scope:google.protobuf.testing.UInt64Wrapper)
private:
class HasBitSetters;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::UInt64Value* uint64_;
mutable ::google::protobuf::internal::CachedSize _cached_size_;
friend struct ::TableStruct_google_2fprotobuf_2futil_2finternal_2ftestdata_2fwrappers_2eproto;
};
// -------------------------------------------------------------------
class Int32Wrapper :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.Int32Wrapper) */ {
public:
Int32Wrapper();
virtual ~Int32Wrapper();
Int32Wrapper(const Int32Wrapper& from);
inline Int32Wrapper& operator=(const Int32Wrapper& from) {
CopyFrom(from);
return *this;
}
#if LANG_CXX11
Int32Wrapper(Int32Wrapper&& from) noexcept
: Int32Wrapper() {
*this = ::std::move(from);
}
inline Int32Wrapper& operator=(Int32Wrapper&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
#endif
static const ::google::protobuf::Descriptor* descriptor() {
return default_instance().GetDescriptor();
}
static const Int32Wrapper& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Int32Wrapper* internal_default_instance() {
return reinterpret_cast<const Int32Wrapper*>(
&_Int32Wrapper_default_instance_);
}
static constexpr int kIndexInFileMessages =
5;
void Swap(Int32Wrapper* other);
friend void swap(Int32Wrapper& a, Int32Wrapper& b) {
a.Swap(&b);
}
// implements Message ----------------------------------------------
inline Int32Wrapper* New() const final {
return CreateMaybeMessage<Int32Wrapper>(nullptr);
}
Int32Wrapper* New(::google::protobuf::Arena* arena) const final {
return CreateMaybeMessage<Int32Wrapper>(arena);
}
void CopyFrom(const ::google::protobuf::Message& from) final;
void MergeFrom(const ::google::protobuf::Message& from) final;
void CopyFrom(const Int32Wrapper& from);
void MergeFrom(const Int32Wrapper& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx);
::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; }
#else
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) final;
#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const final;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Int32Wrapper* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::google::protobuf::Metadata GetMetadata() const final;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// .google.protobuf.Int32Value int32 = 1;
bool has_int32() const;
void clear_int32();
static const int kInt32FieldNumber = 1;
const ::google::protobuf::Int32Value& int32() const;
::google::protobuf::Int32Value* release_int32();
::google::protobuf::Int32Value* mutable_int32();
void set_allocated_int32(::google::protobuf::Int32Value* int32);
// @@protoc_insertion_point(class_scope:google.protobuf.testing.Int32Wrapper)
private:
class HasBitSetters;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::Int32Value* int32_;
mutable ::google::protobuf::internal::CachedSize _cached_size_;
friend struct ::TableStruct_google_2fprotobuf_2futil_2finternal_2ftestdata_2fwrappers_2eproto;
};
// -------------------------------------------------------------------
class UInt32Wrapper :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.UInt32Wrapper) */ {
public:
UInt32Wrapper();
virtual ~UInt32Wrapper();
UInt32Wrapper(const UInt32Wrapper& from);
inline UInt32Wrapper& operator=(const UInt32Wrapper& from) {
CopyFrom(from);
return *this;
}
#if LANG_CXX11
UInt32Wrapper(UInt32Wrapper&& from) noexcept
: UInt32Wrapper() {
*this = ::std::move(from);
}
inline UInt32Wrapper& operator=(UInt32Wrapper&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
#endif
static const ::google::protobuf::Descriptor* descriptor() {
return default_instance().GetDescriptor();
}
static const UInt32Wrapper& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const UInt32Wrapper* internal_default_instance() {
return reinterpret_cast<const UInt32Wrapper*>(
&_UInt32Wrapper_default_instance_);
}
static constexpr int kIndexInFileMessages =
6;
void Swap(UInt32Wrapper* other);
friend void swap(UInt32Wrapper& a, UInt32Wrapper& b) {
a.Swap(&b);
}
// implements Message ----------------------------------------------
inline UInt32Wrapper* New() const final {
return CreateMaybeMessage<UInt32Wrapper>(nullptr);
}
UInt32Wrapper* New(::google::protobuf::Arena* arena) const final {
return CreateMaybeMessage<UInt32Wrapper>(arena);
}
void CopyFrom(const ::google::protobuf::Message& from) final;
void MergeFrom(const ::google::protobuf::Message& from) final;
void CopyFrom(const UInt32Wrapper& from);
void MergeFrom(const UInt32Wrapper& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx);
::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; }
#else
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) final;
#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const final;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(UInt32Wrapper* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::google::protobuf::Metadata GetMetadata() const final;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// .google.protobuf.UInt32Value uint32 = 1;
bool has_uint32() const;
void clear_uint32();
static const int kUint32FieldNumber = 1;
const ::google::protobuf::UInt32Value& uint32() const;
::google::protobuf::UInt32Value* release_uint32();
::google::protobuf::UInt32Value* mutable_uint32();
void set_allocated_uint32(::google::protobuf::UInt32Value* uint32);
// @@protoc_insertion_point(class_scope:google.protobuf.testing.UInt32Wrapper)
private:
class HasBitSetters;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::UInt32Value* uint32_;
mutable ::google::protobuf::internal::CachedSize _cached_size_;
friend struct ::TableStruct_google_2fprotobuf_2futil_2finternal_2ftestdata_2fwrappers_2eproto;
};
// -------------------------------------------------------------------
class BoolWrapper :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.BoolWrapper) */ {
public:
BoolWrapper();
virtual ~BoolWrapper();
BoolWrapper(const BoolWrapper& from);
inline BoolWrapper& operator=(const BoolWrapper& from) {
CopyFrom(from);
return *this;
}
#if LANG_CXX11
BoolWrapper(BoolWrapper&& from) noexcept
: BoolWrapper() {
*this = ::std::move(from);
}
inline BoolWrapper& operator=(BoolWrapper&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
#endif
static const ::google::protobuf::Descriptor* descriptor() {
return default_instance().GetDescriptor();
}
static const BoolWrapper& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const BoolWrapper* internal_default_instance() {
return reinterpret_cast<const BoolWrapper*>(
&_BoolWrapper_default_instance_);
}
static constexpr int kIndexInFileMessages =
7;
void Swap(BoolWrapper* other);
friend void swap(BoolWrapper& a, BoolWrapper& b) {
a.Swap(&b);
}
// implements Message ----------------------------------------------
inline BoolWrapper* New() const final {
return CreateMaybeMessage<BoolWrapper>(nullptr);
}
BoolWrapper* New(::google::protobuf::Arena* arena) const final {
return CreateMaybeMessage<BoolWrapper>(arena);
}
void CopyFrom(const ::google::protobuf::Message& from) final;
void MergeFrom(const ::google::protobuf::Message& from) final;
void CopyFrom(const BoolWrapper& from);
void MergeFrom(const BoolWrapper& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx);
::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; }
#else
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) final;
#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const final;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(BoolWrapper* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::google::protobuf::Metadata GetMetadata() const final;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// .google.protobuf.BoolValue bool = 1;
bool has_bool_() const;
void clear_bool_();
static const int kBoolFieldNumber = 1;
const ::google::protobuf::BoolValue& bool_() const;
::google::protobuf::BoolValue* release_bool_();
::google::protobuf::BoolValue* mutable_bool_();
void set_allocated_bool_(::google::protobuf::BoolValue* bool_);
// @@protoc_insertion_point(class_scope:google.protobuf.testing.BoolWrapper)
private:
class HasBitSetters;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::BoolValue* bool__;
mutable ::google::protobuf::internal::CachedSize _cached_size_;
friend struct ::TableStruct_google_2fprotobuf_2futil_2finternal_2ftestdata_2fwrappers_2eproto;
};
// -------------------------------------------------------------------
class StringWrapper :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.StringWrapper) */ {
public:
StringWrapper();
virtual ~StringWrapper();
StringWrapper(const StringWrapper& from);
inline StringWrapper& operator=(const StringWrapper& from) {
CopyFrom(from);
return *this;
}
#if LANG_CXX11
StringWrapper(StringWrapper&& from) noexcept
: StringWrapper() {
*this = ::std::move(from);
}
inline StringWrapper& operator=(StringWrapper&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
#endif
static const ::google::protobuf::Descriptor* descriptor() {
return default_instance().GetDescriptor();
}
static const StringWrapper& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const StringWrapper* internal_default_instance() {
return reinterpret_cast<const StringWrapper*>(
&_StringWrapper_default_instance_);
}
static constexpr int kIndexInFileMessages =
8;
void Swap(StringWrapper* other);
friend void swap(StringWrapper& a, StringWrapper& b) {
a.Swap(&b);
}
// implements Message ----------------------------------------------
inline StringWrapper* New() const final {
return CreateMaybeMessage<StringWrapper>(nullptr);
}
StringWrapper* New(::google::protobuf::Arena* arena) const final {
return CreateMaybeMessage<StringWrapper>(arena);
}
void CopyFrom(const ::google::protobuf::Message& from) final;
void MergeFrom(const ::google::protobuf::Message& from) final;
void CopyFrom(const StringWrapper& from);
void MergeFrom(const StringWrapper& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx);
::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; }
#else
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) final;
#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const final;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(StringWrapper* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::google::protobuf::Metadata GetMetadata() const final;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// .google.protobuf.StringValue string = 1;
bool has_string() const;
void clear_string();
static const int kStringFieldNumber = 1;
const ::google::protobuf::StringValue& string() const;
::google::protobuf::StringValue* release_string();
::google::protobuf::StringValue* mutable_string();
void set_allocated_string(::google::protobuf::StringValue* string);
// @@protoc_insertion_point(class_scope:google.protobuf.testing.StringWrapper)
private:
class HasBitSetters;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::StringValue* string_;
mutable ::google::protobuf::internal::CachedSize _cached_size_;
friend struct ::TableStruct_google_2fprotobuf_2futil_2finternal_2ftestdata_2fwrappers_2eproto;
};
// -------------------------------------------------------------------
class BytesWrapper :
public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.BytesWrapper) */ {
public:
BytesWrapper();
virtual ~BytesWrapper();
BytesWrapper(const BytesWrapper& from);
inline BytesWrapper& operator=(const BytesWrapper& from) {
CopyFrom(from);
return *this;
}
#if LANG_CXX11
BytesWrapper(BytesWrapper&& from) noexcept
: BytesWrapper() {
*this = ::std::move(from);
}
inline BytesWrapper& operator=(BytesWrapper&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
#endif
static const ::google::protobuf::Descriptor* descriptor() {
return default_instance().GetDescriptor();
}
static const BytesWrapper& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const BytesWrapper* internal_default_instance() {
return reinterpret_cast<const BytesWrapper*>(
&_BytesWrapper_default_instance_);
}
static constexpr int kIndexInFileMessages =
9;
void Swap(BytesWrapper* other);
friend void swap(BytesWrapper& a, BytesWrapper& b) {
a.Swap(&b);
}
// implements Message ----------------------------------------------
inline BytesWrapper* New() const final {
return CreateMaybeMessage<BytesWrapper>(nullptr);
}
BytesWrapper* New(::google::protobuf::Arena* arena) const final {
return CreateMaybeMessage<BytesWrapper>(arena);
}
void CopyFrom(const ::google::protobuf::Message& from) final;
void MergeFrom(const ::google::protobuf::Message& from) final;
void CopyFrom(const BytesWrapper& from);
void MergeFrom(const BytesWrapper& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx);
::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; }
#else
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) final;
#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const final;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(BytesWrapper* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::google::protobuf::Metadata GetMetadata() const final;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// .google.protobuf.BytesValue bytes = 1;
bool has_bytes() const;
void clear_bytes();
static const int kBytesFieldNumber = 1;
const ::google::protobuf::BytesValue& bytes() const;
::google::protobuf::BytesValue* release_bytes();
::google::protobuf::BytesValue* mutable_bytes();
void set_allocated_bytes(::google::protobuf::BytesValue* bytes);
// @@protoc_insertion_point(class_scope:google.protobuf.testing.BytesWrapper)
private:
class HasBitSetters;
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
::google::protobuf::BytesValue* bytes_;
mutable ::google::protobuf::internal::CachedSize _cached_size_;
friend struct ::TableStruct_google_2fprotobuf_2futil_2finternal_2ftestdata_2fwrappers_2eproto;
};
// ===================================================================
// ===================================================================
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif // __GNUC__
// WrappersTestCases
// .google.protobuf.testing.DoubleWrapper double_wrapper = 1;
inline bool WrappersTestCases::has_double_wrapper() const {
return this != internal_default_instance() && double_wrapper_ != nullptr;
}
inline void WrappersTestCases::clear_double_wrapper() {
if (GetArenaNoVirtual() == nullptr && double_wrapper_ != nullptr) {
delete double_wrapper_;
}
double_wrapper_ = nullptr;
}
inline const ::google::protobuf::testing::DoubleWrapper& WrappersTestCases::double_wrapper() const {
const ::google::protobuf::testing::DoubleWrapper* p = double_wrapper_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.double_wrapper)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::DoubleWrapper*>(
&::google::protobuf::testing::_DoubleWrapper_default_instance_);
}
inline ::google::protobuf::testing::DoubleWrapper* WrappersTestCases::release_double_wrapper() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.double_wrapper)
::google::protobuf::testing::DoubleWrapper* temp = double_wrapper_;
double_wrapper_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::DoubleWrapper* WrappersTestCases::mutable_double_wrapper() {
if (double_wrapper_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::DoubleWrapper>(GetArenaNoVirtual());
double_wrapper_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.double_wrapper)
return double_wrapper_;
}
inline void WrappersTestCases::set_allocated_double_wrapper(::google::protobuf::testing::DoubleWrapper* double_wrapper) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete double_wrapper_;
}
if (double_wrapper) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
double_wrapper = ::google::protobuf::internal::GetOwnedMessage(
message_arena, double_wrapper, submessage_arena);
}
} else {
}
double_wrapper_ = double_wrapper;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.double_wrapper)
}
// .google.protobuf.testing.FloatWrapper float_wrapper = 2;
inline bool WrappersTestCases::has_float_wrapper() const {
return this != internal_default_instance() && float_wrapper_ != nullptr;
}
inline void WrappersTestCases::clear_float_wrapper() {
if (GetArenaNoVirtual() == nullptr && float_wrapper_ != nullptr) {
delete float_wrapper_;
}
float_wrapper_ = nullptr;
}
inline const ::google::protobuf::testing::FloatWrapper& WrappersTestCases::float_wrapper() const {
const ::google::protobuf::testing::FloatWrapper* p = float_wrapper_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.float_wrapper)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::FloatWrapper*>(
&::google::protobuf::testing::_FloatWrapper_default_instance_);
}
inline ::google::protobuf::testing::FloatWrapper* WrappersTestCases::release_float_wrapper() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.float_wrapper)
::google::protobuf::testing::FloatWrapper* temp = float_wrapper_;
float_wrapper_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::FloatWrapper* WrappersTestCases::mutable_float_wrapper() {
if (float_wrapper_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::FloatWrapper>(GetArenaNoVirtual());
float_wrapper_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.float_wrapper)
return float_wrapper_;
}
inline void WrappersTestCases::set_allocated_float_wrapper(::google::protobuf::testing::FloatWrapper* float_wrapper) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete float_wrapper_;
}
if (float_wrapper) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
float_wrapper = ::google::protobuf::internal::GetOwnedMessage(
message_arena, float_wrapper, submessage_arena);
}
} else {
}
float_wrapper_ = float_wrapper;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.float_wrapper)
}
// .google.protobuf.testing.Int64Wrapper int64_wrapper = 3;
inline bool WrappersTestCases::has_int64_wrapper() const {
return this != internal_default_instance() && int64_wrapper_ != nullptr;
}
inline void WrappersTestCases::clear_int64_wrapper() {
if (GetArenaNoVirtual() == nullptr && int64_wrapper_ != nullptr) {
delete int64_wrapper_;
}
int64_wrapper_ = nullptr;
}
inline const ::google::protobuf::testing::Int64Wrapper& WrappersTestCases::int64_wrapper() const {
const ::google::protobuf::testing::Int64Wrapper* p = int64_wrapper_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.int64_wrapper)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::Int64Wrapper*>(
&::google::protobuf::testing::_Int64Wrapper_default_instance_);
}
inline ::google::protobuf::testing::Int64Wrapper* WrappersTestCases::release_int64_wrapper() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.int64_wrapper)
::google::protobuf::testing::Int64Wrapper* temp = int64_wrapper_;
int64_wrapper_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::Int64Wrapper* WrappersTestCases::mutable_int64_wrapper() {
if (int64_wrapper_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::Int64Wrapper>(GetArenaNoVirtual());
int64_wrapper_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.int64_wrapper)
return int64_wrapper_;
}
inline void WrappersTestCases::set_allocated_int64_wrapper(::google::protobuf::testing::Int64Wrapper* int64_wrapper) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete int64_wrapper_;
}
if (int64_wrapper) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
int64_wrapper = ::google::protobuf::internal::GetOwnedMessage(
message_arena, int64_wrapper, submessage_arena);
}
} else {
}
int64_wrapper_ = int64_wrapper;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.int64_wrapper)
}
// .google.protobuf.testing.UInt64Wrapper uint64_wrapper = 4;
inline bool WrappersTestCases::has_uint64_wrapper() const {
return this != internal_default_instance() && uint64_wrapper_ != nullptr;
}
inline void WrappersTestCases::clear_uint64_wrapper() {
if (GetArenaNoVirtual() == nullptr && uint64_wrapper_ != nullptr) {
delete uint64_wrapper_;
}
uint64_wrapper_ = nullptr;
}
inline const ::google::protobuf::testing::UInt64Wrapper& WrappersTestCases::uint64_wrapper() const {
const ::google::protobuf::testing::UInt64Wrapper* p = uint64_wrapper_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.uint64_wrapper)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::UInt64Wrapper*>(
&::google::protobuf::testing::_UInt64Wrapper_default_instance_);
}
inline ::google::protobuf::testing::UInt64Wrapper* WrappersTestCases::release_uint64_wrapper() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.uint64_wrapper)
::google::protobuf::testing::UInt64Wrapper* temp = uint64_wrapper_;
uint64_wrapper_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::UInt64Wrapper* WrappersTestCases::mutable_uint64_wrapper() {
if (uint64_wrapper_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::UInt64Wrapper>(GetArenaNoVirtual());
uint64_wrapper_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.uint64_wrapper)
return uint64_wrapper_;
}
inline void WrappersTestCases::set_allocated_uint64_wrapper(::google::protobuf::testing::UInt64Wrapper* uint64_wrapper) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete uint64_wrapper_;
}
if (uint64_wrapper) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
uint64_wrapper = ::google::protobuf::internal::GetOwnedMessage(
message_arena, uint64_wrapper, submessage_arena);
}
} else {
}
uint64_wrapper_ = uint64_wrapper;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.uint64_wrapper)
}
// .google.protobuf.testing.Int32Wrapper int32_wrapper = 5;
inline bool WrappersTestCases::has_int32_wrapper() const {
return this != internal_default_instance() && int32_wrapper_ != nullptr;
}
inline void WrappersTestCases::clear_int32_wrapper() {
if (GetArenaNoVirtual() == nullptr && int32_wrapper_ != nullptr) {
delete int32_wrapper_;
}
int32_wrapper_ = nullptr;
}
inline const ::google::protobuf::testing::Int32Wrapper& WrappersTestCases::int32_wrapper() const {
const ::google::protobuf::testing::Int32Wrapper* p = int32_wrapper_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.int32_wrapper)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::Int32Wrapper*>(
&::google::protobuf::testing::_Int32Wrapper_default_instance_);
}
inline ::google::protobuf::testing::Int32Wrapper* WrappersTestCases::release_int32_wrapper() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.int32_wrapper)
::google::protobuf::testing::Int32Wrapper* temp = int32_wrapper_;
int32_wrapper_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::Int32Wrapper* WrappersTestCases::mutable_int32_wrapper() {
if (int32_wrapper_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::Int32Wrapper>(GetArenaNoVirtual());
int32_wrapper_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.int32_wrapper)
return int32_wrapper_;
}
inline void WrappersTestCases::set_allocated_int32_wrapper(::google::protobuf::testing::Int32Wrapper* int32_wrapper) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete int32_wrapper_;
}
if (int32_wrapper) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
int32_wrapper = ::google::protobuf::internal::GetOwnedMessage(
message_arena, int32_wrapper, submessage_arena);
}
} else {
}
int32_wrapper_ = int32_wrapper;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.int32_wrapper)
}
// .google.protobuf.testing.UInt32Wrapper uint32_wrapper = 6;
inline bool WrappersTestCases::has_uint32_wrapper() const {
return this != internal_default_instance() && uint32_wrapper_ != nullptr;
}
inline void WrappersTestCases::clear_uint32_wrapper() {
if (GetArenaNoVirtual() == nullptr && uint32_wrapper_ != nullptr) {
delete uint32_wrapper_;
}
uint32_wrapper_ = nullptr;
}
inline const ::google::protobuf::testing::UInt32Wrapper& WrappersTestCases::uint32_wrapper() const {
const ::google::protobuf::testing::UInt32Wrapper* p = uint32_wrapper_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.uint32_wrapper)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::UInt32Wrapper*>(
&::google::protobuf::testing::_UInt32Wrapper_default_instance_);
}
inline ::google::protobuf::testing::UInt32Wrapper* WrappersTestCases::release_uint32_wrapper() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.uint32_wrapper)
::google::protobuf::testing::UInt32Wrapper* temp = uint32_wrapper_;
uint32_wrapper_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::UInt32Wrapper* WrappersTestCases::mutable_uint32_wrapper() {
if (uint32_wrapper_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::UInt32Wrapper>(GetArenaNoVirtual());
uint32_wrapper_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.uint32_wrapper)
return uint32_wrapper_;
}
inline void WrappersTestCases::set_allocated_uint32_wrapper(::google::protobuf::testing::UInt32Wrapper* uint32_wrapper) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete uint32_wrapper_;
}
if (uint32_wrapper) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
uint32_wrapper = ::google::protobuf::internal::GetOwnedMessage(
message_arena, uint32_wrapper, submessage_arena);
}
} else {
}
uint32_wrapper_ = uint32_wrapper;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.uint32_wrapper)
}
// .google.protobuf.testing.BoolWrapper bool_wrapper = 7;
inline bool WrappersTestCases::has_bool_wrapper() const {
return this != internal_default_instance() && bool_wrapper_ != nullptr;
}
inline void WrappersTestCases::clear_bool_wrapper() {
if (GetArenaNoVirtual() == nullptr && bool_wrapper_ != nullptr) {
delete bool_wrapper_;
}
bool_wrapper_ = nullptr;
}
inline const ::google::protobuf::testing::BoolWrapper& WrappersTestCases::bool_wrapper() const {
const ::google::protobuf::testing::BoolWrapper* p = bool_wrapper_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.bool_wrapper)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::BoolWrapper*>(
&::google::protobuf::testing::_BoolWrapper_default_instance_);
}
inline ::google::protobuf::testing::BoolWrapper* WrappersTestCases::release_bool_wrapper() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.bool_wrapper)
::google::protobuf::testing::BoolWrapper* temp = bool_wrapper_;
bool_wrapper_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::BoolWrapper* WrappersTestCases::mutable_bool_wrapper() {
if (bool_wrapper_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::BoolWrapper>(GetArenaNoVirtual());
bool_wrapper_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.bool_wrapper)
return bool_wrapper_;
}
inline void WrappersTestCases::set_allocated_bool_wrapper(::google::protobuf::testing::BoolWrapper* bool_wrapper) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete bool_wrapper_;
}
if (bool_wrapper) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
bool_wrapper = ::google::protobuf::internal::GetOwnedMessage(
message_arena, bool_wrapper, submessage_arena);
}
} else {
}
bool_wrapper_ = bool_wrapper;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.bool_wrapper)
}
// .google.protobuf.testing.StringWrapper string_wrapper = 8;
inline bool WrappersTestCases::has_string_wrapper() const {
return this != internal_default_instance() && string_wrapper_ != nullptr;
}
inline void WrappersTestCases::clear_string_wrapper() {
if (GetArenaNoVirtual() == nullptr && string_wrapper_ != nullptr) {
delete string_wrapper_;
}
string_wrapper_ = nullptr;
}
inline const ::google::protobuf::testing::StringWrapper& WrappersTestCases::string_wrapper() const {
const ::google::protobuf::testing::StringWrapper* p = string_wrapper_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.string_wrapper)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::StringWrapper*>(
&::google::protobuf::testing::_StringWrapper_default_instance_);
}
inline ::google::protobuf::testing::StringWrapper* WrappersTestCases::release_string_wrapper() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.string_wrapper)
::google::protobuf::testing::StringWrapper* temp = string_wrapper_;
string_wrapper_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::StringWrapper* WrappersTestCases::mutable_string_wrapper() {
if (string_wrapper_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::StringWrapper>(GetArenaNoVirtual());
string_wrapper_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.string_wrapper)
return string_wrapper_;
}
inline void WrappersTestCases::set_allocated_string_wrapper(::google::protobuf::testing::StringWrapper* string_wrapper) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete string_wrapper_;
}
if (string_wrapper) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
string_wrapper = ::google::protobuf::internal::GetOwnedMessage(
message_arena, string_wrapper, submessage_arena);
}
} else {
}
string_wrapper_ = string_wrapper;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.string_wrapper)
}
// .google.protobuf.testing.BytesWrapper bytes_wrapper = 9;
inline bool WrappersTestCases::has_bytes_wrapper() const {
return this != internal_default_instance() && bytes_wrapper_ != nullptr;
}
inline void WrappersTestCases::clear_bytes_wrapper() {
if (GetArenaNoVirtual() == nullptr && bytes_wrapper_ != nullptr) {
delete bytes_wrapper_;
}
bytes_wrapper_ = nullptr;
}
inline const ::google::protobuf::testing::BytesWrapper& WrappersTestCases::bytes_wrapper() const {
const ::google::protobuf::testing::BytesWrapper* p = bytes_wrapper_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.bytes_wrapper)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::BytesWrapper*>(
&::google::protobuf::testing::_BytesWrapper_default_instance_);
}
inline ::google::protobuf::testing::BytesWrapper* WrappersTestCases::release_bytes_wrapper() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.bytes_wrapper)
::google::protobuf::testing::BytesWrapper* temp = bytes_wrapper_;
bytes_wrapper_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::BytesWrapper* WrappersTestCases::mutable_bytes_wrapper() {
if (bytes_wrapper_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::BytesWrapper>(GetArenaNoVirtual());
bytes_wrapper_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.bytes_wrapper)
return bytes_wrapper_;
}
inline void WrappersTestCases::set_allocated_bytes_wrapper(::google::protobuf::testing::BytesWrapper* bytes_wrapper) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete bytes_wrapper_;
}
if (bytes_wrapper) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
bytes_wrapper = ::google::protobuf::internal::GetOwnedMessage(
message_arena, bytes_wrapper, submessage_arena);
}
} else {
}
bytes_wrapper_ = bytes_wrapper;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.bytes_wrapper)
}
// .google.protobuf.testing.DoubleWrapper double_wrapper_default = 10;
inline bool WrappersTestCases::has_double_wrapper_default() const {
return this != internal_default_instance() && double_wrapper_default_ != nullptr;
}
inline void WrappersTestCases::clear_double_wrapper_default() {
if (GetArenaNoVirtual() == nullptr && double_wrapper_default_ != nullptr) {
delete double_wrapper_default_;
}
double_wrapper_default_ = nullptr;
}
inline const ::google::protobuf::testing::DoubleWrapper& WrappersTestCases::double_wrapper_default() const {
const ::google::protobuf::testing::DoubleWrapper* p = double_wrapper_default_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.double_wrapper_default)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::DoubleWrapper*>(
&::google::protobuf::testing::_DoubleWrapper_default_instance_);
}
inline ::google::protobuf::testing::DoubleWrapper* WrappersTestCases::release_double_wrapper_default() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.double_wrapper_default)
::google::protobuf::testing::DoubleWrapper* temp = double_wrapper_default_;
double_wrapper_default_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::DoubleWrapper* WrappersTestCases::mutable_double_wrapper_default() {
if (double_wrapper_default_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::DoubleWrapper>(GetArenaNoVirtual());
double_wrapper_default_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.double_wrapper_default)
return double_wrapper_default_;
}
inline void WrappersTestCases::set_allocated_double_wrapper_default(::google::protobuf::testing::DoubleWrapper* double_wrapper_default) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete double_wrapper_default_;
}
if (double_wrapper_default) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
double_wrapper_default = ::google::protobuf::internal::GetOwnedMessage(
message_arena, double_wrapper_default, submessage_arena);
}
} else {
}
double_wrapper_default_ = double_wrapper_default;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.double_wrapper_default)
}
// .google.protobuf.testing.FloatWrapper float_wrapper_default = 11;
inline bool WrappersTestCases::has_float_wrapper_default() const {
return this != internal_default_instance() && float_wrapper_default_ != nullptr;
}
inline void WrappersTestCases::clear_float_wrapper_default() {
if (GetArenaNoVirtual() == nullptr && float_wrapper_default_ != nullptr) {
delete float_wrapper_default_;
}
float_wrapper_default_ = nullptr;
}
inline const ::google::protobuf::testing::FloatWrapper& WrappersTestCases::float_wrapper_default() const {
const ::google::protobuf::testing::FloatWrapper* p = float_wrapper_default_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.float_wrapper_default)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::FloatWrapper*>(
&::google::protobuf::testing::_FloatWrapper_default_instance_);
}
inline ::google::protobuf::testing::FloatWrapper* WrappersTestCases::release_float_wrapper_default() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.float_wrapper_default)
::google::protobuf::testing::FloatWrapper* temp = float_wrapper_default_;
float_wrapper_default_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::FloatWrapper* WrappersTestCases::mutable_float_wrapper_default() {
if (float_wrapper_default_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::FloatWrapper>(GetArenaNoVirtual());
float_wrapper_default_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.float_wrapper_default)
return float_wrapper_default_;
}
inline void WrappersTestCases::set_allocated_float_wrapper_default(::google::protobuf::testing::FloatWrapper* float_wrapper_default) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete float_wrapper_default_;
}
if (float_wrapper_default) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
float_wrapper_default = ::google::protobuf::internal::GetOwnedMessage(
message_arena, float_wrapper_default, submessage_arena);
}
} else {
}
float_wrapper_default_ = float_wrapper_default;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.float_wrapper_default)
}
// .google.protobuf.testing.Int64Wrapper int64_wrapper_default = 12;
inline bool WrappersTestCases::has_int64_wrapper_default() const {
return this != internal_default_instance() && int64_wrapper_default_ != nullptr;
}
inline void WrappersTestCases::clear_int64_wrapper_default() {
if (GetArenaNoVirtual() == nullptr && int64_wrapper_default_ != nullptr) {
delete int64_wrapper_default_;
}
int64_wrapper_default_ = nullptr;
}
inline const ::google::protobuf::testing::Int64Wrapper& WrappersTestCases::int64_wrapper_default() const {
const ::google::protobuf::testing::Int64Wrapper* p = int64_wrapper_default_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.int64_wrapper_default)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::Int64Wrapper*>(
&::google::protobuf::testing::_Int64Wrapper_default_instance_);
}
inline ::google::protobuf::testing::Int64Wrapper* WrappersTestCases::release_int64_wrapper_default() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.int64_wrapper_default)
::google::protobuf::testing::Int64Wrapper* temp = int64_wrapper_default_;
int64_wrapper_default_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::Int64Wrapper* WrappersTestCases::mutable_int64_wrapper_default() {
if (int64_wrapper_default_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::Int64Wrapper>(GetArenaNoVirtual());
int64_wrapper_default_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.int64_wrapper_default)
return int64_wrapper_default_;
}
inline void WrappersTestCases::set_allocated_int64_wrapper_default(::google::protobuf::testing::Int64Wrapper* int64_wrapper_default) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete int64_wrapper_default_;
}
if (int64_wrapper_default) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
int64_wrapper_default = ::google::protobuf::internal::GetOwnedMessage(
message_arena, int64_wrapper_default, submessage_arena);
}
} else {
}
int64_wrapper_default_ = int64_wrapper_default;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.int64_wrapper_default)
}
// .google.protobuf.testing.UInt64Wrapper uint64_wrapper_default = 13;
inline bool WrappersTestCases::has_uint64_wrapper_default() const {
return this != internal_default_instance() && uint64_wrapper_default_ != nullptr;
}
inline void WrappersTestCases::clear_uint64_wrapper_default() {
if (GetArenaNoVirtual() == nullptr && uint64_wrapper_default_ != nullptr) {
delete uint64_wrapper_default_;
}
uint64_wrapper_default_ = nullptr;
}
inline const ::google::protobuf::testing::UInt64Wrapper& WrappersTestCases::uint64_wrapper_default() const {
const ::google::protobuf::testing::UInt64Wrapper* p = uint64_wrapper_default_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.uint64_wrapper_default)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::UInt64Wrapper*>(
&::google::protobuf::testing::_UInt64Wrapper_default_instance_);
}
inline ::google::protobuf::testing::UInt64Wrapper* WrappersTestCases::release_uint64_wrapper_default() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.uint64_wrapper_default)
::google::protobuf::testing::UInt64Wrapper* temp = uint64_wrapper_default_;
uint64_wrapper_default_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::UInt64Wrapper* WrappersTestCases::mutable_uint64_wrapper_default() {
if (uint64_wrapper_default_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::UInt64Wrapper>(GetArenaNoVirtual());
uint64_wrapper_default_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.uint64_wrapper_default)
return uint64_wrapper_default_;
}
inline void WrappersTestCases::set_allocated_uint64_wrapper_default(::google::protobuf::testing::UInt64Wrapper* uint64_wrapper_default) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete uint64_wrapper_default_;
}
if (uint64_wrapper_default) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
uint64_wrapper_default = ::google::protobuf::internal::GetOwnedMessage(
message_arena, uint64_wrapper_default, submessage_arena);
}
} else {
}
uint64_wrapper_default_ = uint64_wrapper_default;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.uint64_wrapper_default)
}
// .google.protobuf.testing.Int32Wrapper int32_wrapper_default = 14;
inline bool WrappersTestCases::has_int32_wrapper_default() const {
return this != internal_default_instance() && int32_wrapper_default_ != nullptr;
}
inline void WrappersTestCases::clear_int32_wrapper_default() {
if (GetArenaNoVirtual() == nullptr && int32_wrapper_default_ != nullptr) {
delete int32_wrapper_default_;
}
int32_wrapper_default_ = nullptr;
}
inline const ::google::protobuf::testing::Int32Wrapper& WrappersTestCases::int32_wrapper_default() const {
const ::google::protobuf::testing::Int32Wrapper* p = int32_wrapper_default_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.int32_wrapper_default)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::Int32Wrapper*>(
&::google::protobuf::testing::_Int32Wrapper_default_instance_);
}
inline ::google::protobuf::testing::Int32Wrapper* WrappersTestCases::release_int32_wrapper_default() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.int32_wrapper_default)
::google::protobuf::testing::Int32Wrapper* temp = int32_wrapper_default_;
int32_wrapper_default_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::Int32Wrapper* WrappersTestCases::mutable_int32_wrapper_default() {
if (int32_wrapper_default_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::Int32Wrapper>(GetArenaNoVirtual());
int32_wrapper_default_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.int32_wrapper_default)
return int32_wrapper_default_;
}
inline void WrappersTestCases::set_allocated_int32_wrapper_default(::google::protobuf::testing::Int32Wrapper* int32_wrapper_default) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete int32_wrapper_default_;
}
if (int32_wrapper_default) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
int32_wrapper_default = ::google::protobuf::internal::GetOwnedMessage(
message_arena, int32_wrapper_default, submessage_arena);
}
} else {
}
int32_wrapper_default_ = int32_wrapper_default;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.int32_wrapper_default)
}
// .google.protobuf.testing.UInt32Wrapper uint32_wrapper_default = 15;
inline bool WrappersTestCases::has_uint32_wrapper_default() const {
return this != internal_default_instance() && uint32_wrapper_default_ != nullptr;
}
inline void WrappersTestCases::clear_uint32_wrapper_default() {
if (GetArenaNoVirtual() == nullptr && uint32_wrapper_default_ != nullptr) {
delete uint32_wrapper_default_;
}
uint32_wrapper_default_ = nullptr;
}
inline const ::google::protobuf::testing::UInt32Wrapper& WrappersTestCases::uint32_wrapper_default() const {
const ::google::protobuf::testing::UInt32Wrapper* p = uint32_wrapper_default_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.uint32_wrapper_default)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::UInt32Wrapper*>(
&::google::protobuf::testing::_UInt32Wrapper_default_instance_);
}
inline ::google::protobuf::testing::UInt32Wrapper* WrappersTestCases::release_uint32_wrapper_default() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.uint32_wrapper_default)
::google::protobuf::testing::UInt32Wrapper* temp = uint32_wrapper_default_;
uint32_wrapper_default_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::UInt32Wrapper* WrappersTestCases::mutable_uint32_wrapper_default() {
if (uint32_wrapper_default_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::UInt32Wrapper>(GetArenaNoVirtual());
uint32_wrapper_default_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.uint32_wrapper_default)
return uint32_wrapper_default_;
}
inline void WrappersTestCases::set_allocated_uint32_wrapper_default(::google::protobuf::testing::UInt32Wrapper* uint32_wrapper_default) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete uint32_wrapper_default_;
}
if (uint32_wrapper_default) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
uint32_wrapper_default = ::google::protobuf::internal::GetOwnedMessage(
message_arena, uint32_wrapper_default, submessage_arena);
}
} else {
}
uint32_wrapper_default_ = uint32_wrapper_default;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.uint32_wrapper_default)
}
// .google.protobuf.testing.BoolWrapper bool_wrapper_default = 16;
inline bool WrappersTestCases::has_bool_wrapper_default() const {
return this != internal_default_instance() && bool_wrapper_default_ != nullptr;
}
inline void WrappersTestCases::clear_bool_wrapper_default() {
if (GetArenaNoVirtual() == nullptr && bool_wrapper_default_ != nullptr) {
delete bool_wrapper_default_;
}
bool_wrapper_default_ = nullptr;
}
inline const ::google::protobuf::testing::BoolWrapper& WrappersTestCases::bool_wrapper_default() const {
const ::google::protobuf::testing::BoolWrapper* p = bool_wrapper_default_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.bool_wrapper_default)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::BoolWrapper*>(
&::google::protobuf::testing::_BoolWrapper_default_instance_);
}
inline ::google::protobuf::testing::BoolWrapper* WrappersTestCases::release_bool_wrapper_default() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.bool_wrapper_default)
::google::protobuf::testing::BoolWrapper* temp = bool_wrapper_default_;
bool_wrapper_default_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::BoolWrapper* WrappersTestCases::mutable_bool_wrapper_default() {
if (bool_wrapper_default_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::BoolWrapper>(GetArenaNoVirtual());
bool_wrapper_default_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.bool_wrapper_default)
return bool_wrapper_default_;
}
inline void WrappersTestCases::set_allocated_bool_wrapper_default(::google::protobuf::testing::BoolWrapper* bool_wrapper_default) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete bool_wrapper_default_;
}
if (bool_wrapper_default) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
bool_wrapper_default = ::google::protobuf::internal::GetOwnedMessage(
message_arena, bool_wrapper_default, submessage_arena);
}
} else {
}
bool_wrapper_default_ = bool_wrapper_default;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.bool_wrapper_default)
}
// .google.protobuf.testing.StringWrapper string_wrapper_default = 17;
inline bool WrappersTestCases::has_string_wrapper_default() const {
return this != internal_default_instance() && string_wrapper_default_ != nullptr;
}
inline void WrappersTestCases::clear_string_wrapper_default() {
if (GetArenaNoVirtual() == nullptr && string_wrapper_default_ != nullptr) {
delete string_wrapper_default_;
}
string_wrapper_default_ = nullptr;
}
inline const ::google::protobuf::testing::StringWrapper& WrappersTestCases::string_wrapper_default() const {
const ::google::protobuf::testing::StringWrapper* p = string_wrapper_default_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.string_wrapper_default)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::StringWrapper*>(
&::google::protobuf::testing::_StringWrapper_default_instance_);
}
inline ::google::protobuf::testing::StringWrapper* WrappersTestCases::release_string_wrapper_default() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.string_wrapper_default)
::google::protobuf::testing::StringWrapper* temp = string_wrapper_default_;
string_wrapper_default_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::StringWrapper* WrappersTestCases::mutable_string_wrapper_default() {
if (string_wrapper_default_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::StringWrapper>(GetArenaNoVirtual());
string_wrapper_default_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.string_wrapper_default)
return string_wrapper_default_;
}
inline void WrappersTestCases::set_allocated_string_wrapper_default(::google::protobuf::testing::StringWrapper* string_wrapper_default) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete string_wrapper_default_;
}
if (string_wrapper_default) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
string_wrapper_default = ::google::protobuf::internal::GetOwnedMessage(
message_arena, string_wrapper_default, submessage_arena);
}
} else {
}
string_wrapper_default_ = string_wrapper_default;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.string_wrapper_default)
}
// .google.protobuf.testing.BytesWrapper bytes_wrapper_default = 18;
inline bool WrappersTestCases::has_bytes_wrapper_default() const {
return this != internal_default_instance() && bytes_wrapper_default_ != nullptr;
}
inline void WrappersTestCases::clear_bytes_wrapper_default() {
if (GetArenaNoVirtual() == nullptr && bytes_wrapper_default_ != nullptr) {
delete bytes_wrapper_default_;
}
bytes_wrapper_default_ = nullptr;
}
inline const ::google::protobuf::testing::BytesWrapper& WrappersTestCases::bytes_wrapper_default() const {
const ::google::protobuf::testing::BytesWrapper* p = bytes_wrapper_default_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.WrappersTestCases.bytes_wrapper_default)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::testing::BytesWrapper*>(
&::google::protobuf::testing::_BytesWrapper_default_instance_);
}
inline ::google::protobuf::testing::BytesWrapper* WrappersTestCases::release_bytes_wrapper_default() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.WrappersTestCases.bytes_wrapper_default)
::google::protobuf::testing::BytesWrapper* temp = bytes_wrapper_default_;
bytes_wrapper_default_ = nullptr;
return temp;
}
inline ::google::protobuf::testing::BytesWrapper* WrappersTestCases::mutable_bytes_wrapper_default() {
if (bytes_wrapper_default_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::testing::BytesWrapper>(GetArenaNoVirtual());
bytes_wrapper_default_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.WrappersTestCases.bytes_wrapper_default)
return bytes_wrapper_default_;
}
inline void WrappersTestCases::set_allocated_bytes_wrapper_default(::google::protobuf::testing::BytesWrapper* bytes_wrapper_default) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete bytes_wrapper_default_;
}
if (bytes_wrapper_default) {
::google::protobuf::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
bytes_wrapper_default = ::google::protobuf::internal::GetOwnedMessage(
message_arena, bytes_wrapper_default, submessage_arena);
}
} else {
}
bytes_wrapper_default_ = bytes_wrapper_default;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.WrappersTestCases.bytes_wrapper_default)
}
// -------------------------------------------------------------------
// DoubleWrapper
// .google.protobuf.DoubleValue double = 1;
inline bool DoubleWrapper::has_double_() const {
return this != internal_default_instance() && double__ != nullptr;
}
inline const ::google::protobuf::DoubleValue& DoubleWrapper::double_() const {
const ::google::protobuf::DoubleValue* p = double__;
// @@protoc_insertion_point(field_get:google.protobuf.testing.DoubleWrapper.double)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::DoubleValue*>(
&::google::protobuf::_DoubleValue_default_instance_);
}
inline ::google::protobuf::DoubleValue* DoubleWrapper::release_double_() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.DoubleWrapper.double)
::google::protobuf::DoubleValue* temp = double__;
double__ = nullptr;
return temp;
}
inline ::google::protobuf::DoubleValue* DoubleWrapper::mutable_double_() {
if (double__ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::DoubleValue>(GetArenaNoVirtual());
double__ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.DoubleWrapper.double)
return double__;
}
inline void DoubleWrapper::set_allocated_double_(::google::protobuf::DoubleValue* double_) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete reinterpret_cast< ::google::protobuf::MessageLite*>(double__);
}
if (double_) {
::google::protobuf::Arena* submessage_arena =
reinterpret_cast<::google::protobuf::MessageLite*>(double_)->GetArena();
if (message_arena != submessage_arena) {
double_ = ::google::protobuf::internal::GetOwnedMessage(
message_arena, double_, submessage_arena);
}
} else {
}
double__ = double_;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.DoubleWrapper.double)
}
// -------------------------------------------------------------------
// FloatWrapper
// .google.protobuf.FloatValue float = 1;
inline bool FloatWrapper::has_float_() const {
return this != internal_default_instance() && float__ != nullptr;
}
inline const ::google::protobuf::FloatValue& FloatWrapper::float_() const {
const ::google::protobuf::FloatValue* p = float__;
// @@protoc_insertion_point(field_get:google.protobuf.testing.FloatWrapper.float)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::FloatValue*>(
&::google::protobuf::_FloatValue_default_instance_);
}
inline ::google::protobuf::FloatValue* FloatWrapper::release_float_() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.FloatWrapper.float)
::google::protobuf::FloatValue* temp = float__;
float__ = nullptr;
return temp;
}
inline ::google::protobuf::FloatValue* FloatWrapper::mutable_float_() {
if (float__ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::FloatValue>(GetArenaNoVirtual());
float__ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.FloatWrapper.float)
return float__;
}
inline void FloatWrapper::set_allocated_float_(::google::protobuf::FloatValue* float_) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete reinterpret_cast< ::google::protobuf::MessageLite*>(float__);
}
if (float_) {
::google::protobuf::Arena* submessage_arena =
reinterpret_cast<::google::protobuf::MessageLite*>(float_)->GetArena();
if (message_arena != submessage_arena) {
float_ = ::google::protobuf::internal::GetOwnedMessage(
message_arena, float_, submessage_arena);
}
} else {
}
float__ = float_;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.FloatWrapper.float)
}
// -------------------------------------------------------------------
// Int64Wrapper
// .google.protobuf.Int64Value int64 = 1;
inline bool Int64Wrapper::has_int64() const {
return this != internal_default_instance() && int64_ != nullptr;
}
inline const ::google::protobuf::Int64Value& Int64Wrapper::int64() const {
const ::google::protobuf::Int64Value* p = int64_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.Int64Wrapper.int64)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::Int64Value*>(
&::google::protobuf::_Int64Value_default_instance_);
}
inline ::google::protobuf::Int64Value* Int64Wrapper::release_int64() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.Int64Wrapper.int64)
::google::protobuf::Int64Value* temp = int64_;
int64_ = nullptr;
return temp;
}
inline ::google::protobuf::Int64Value* Int64Wrapper::mutable_int64() {
if (int64_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::Int64Value>(GetArenaNoVirtual());
int64_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.Int64Wrapper.int64)
return int64_;
}
inline void Int64Wrapper::set_allocated_int64(::google::protobuf::Int64Value* int64) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete reinterpret_cast< ::google::protobuf::MessageLite*>(int64_);
}
if (int64) {
::google::protobuf::Arena* submessage_arena =
reinterpret_cast<::google::protobuf::MessageLite*>(int64)->GetArena();
if (message_arena != submessage_arena) {
int64 = ::google::protobuf::internal::GetOwnedMessage(
message_arena, int64, submessage_arena);
}
} else {
}
int64_ = int64;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.Int64Wrapper.int64)
}
// -------------------------------------------------------------------
// UInt64Wrapper
// .google.protobuf.UInt64Value uint64 = 1;
inline bool UInt64Wrapper::has_uint64() const {
return this != internal_default_instance() && uint64_ != nullptr;
}
inline const ::google::protobuf::UInt64Value& UInt64Wrapper::uint64() const {
const ::google::protobuf::UInt64Value* p = uint64_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.UInt64Wrapper.uint64)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::UInt64Value*>(
&::google::protobuf::_UInt64Value_default_instance_);
}
inline ::google::protobuf::UInt64Value* UInt64Wrapper::release_uint64() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.UInt64Wrapper.uint64)
::google::protobuf::UInt64Value* temp = uint64_;
uint64_ = nullptr;
return temp;
}
inline ::google::protobuf::UInt64Value* UInt64Wrapper::mutable_uint64() {
if (uint64_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::UInt64Value>(GetArenaNoVirtual());
uint64_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.UInt64Wrapper.uint64)
return uint64_;
}
inline void UInt64Wrapper::set_allocated_uint64(::google::protobuf::UInt64Value* uint64) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete reinterpret_cast< ::google::protobuf::MessageLite*>(uint64_);
}
if (uint64) {
::google::protobuf::Arena* submessage_arena =
reinterpret_cast<::google::protobuf::MessageLite*>(uint64)->GetArena();
if (message_arena != submessage_arena) {
uint64 = ::google::protobuf::internal::GetOwnedMessage(
message_arena, uint64, submessage_arena);
}
} else {
}
uint64_ = uint64;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.UInt64Wrapper.uint64)
}
// -------------------------------------------------------------------
// Int32Wrapper
// .google.protobuf.Int32Value int32 = 1;
inline bool Int32Wrapper::has_int32() const {
return this != internal_default_instance() && int32_ != nullptr;
}
inline const ::google::protobuf::Int32Value& Int32Wrapper::int32() const {
const ::google::protobuf::Int32Value* p = int32_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.Int32Wrapper.int32)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::Int32Value*>(
&::google::protobuf::_Int32Value_default_instance_);
}
inline ::google::protobuf::Int32Value* Int32Wrapper::release_int32() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.Int32Wrapper.int32)
::google::protobuf::Int32Value* temp = int32_;
int32_ = nullptr;
return temp;
}
inline ::google::protobuf::Int32Value* Int32Wrapper::mutable_int32() {
if (int32_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::Int32Value>(GetArenaNoVirtual());
int32_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.Int32Wrapper.int32)
return int32_;
}
inline void Int32Wrapper::set_allocated_int32(::google::protobuf::Int32Value* int32) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete reinterpret_cast< ::google::protobuf::MessageLite*>(int32_);
}
if (int32) {
::google::protobuf::Arena* submessage_arena =
reinterpret_cast<::google::protobuf::MessageLite*>(int32)->GetArena();
if (message_arena != submessage_arena) {
int32 = ::google::protobuf::internal::GetOwnedMessage(
message_arena, int32, submessage_arena);
}
} else {
}
int32_ = int32;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.Int32Wrapper.int32)
}
// -------------------------------------------------------------------
// UInt32Wrapper
// .google.protobuf.UInt32Value uint32 = 1;
inline bool UInt32Wrapper::has_uint32() const {
return this != internal_default_instance() && uint32_ != nullptr;
}
inline const ::google::protobuf::UInt32Value& UInt32Wrapper::uint32() const {
const ::google::protobuf::UInt32Value* p = uint32_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.UInt32Wrapper.uint32)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::UInt32Value*>(
&::google::protobuf::_UInt32Value_default_instance_);
}
inline ::google::protobuf::UInt32Value* UInt32Wrapper::release_uint32() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.UInt32Wrapper.uint32)
::google::protobuf::UInt32Value* temp = uint32_;
uint32_ = nullptr;
return temp;
}
inline ::google::protobuf::UInt32Value* UInt32Wrapper::mutable_uint32() {
if (uint32_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::UInt32Value>(GetArenaNoVirtual());
uint32_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.UInt32Wrapper.uint32)
return uint32_;
}
inline void UInt32Wrapper::set_allocated_uint32(::google::protobuf::UInt32Value* uint32) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete reinterpret_cast< ::google::protobuf::MessageLite*>(uint32_);
}
if (uint32) {
::google::protobuf::Arena* submessage_arena =
reinterpret_cast<::google::protobuf::MessageLite*>(uint32)->GetArena();
if (message_arena != submessage_arena) {
uint32 = ::google::protobuf::internal::GetOwnedMessage(
message_arena, uint32, submessage_arena);
}
} else {
}
uint32_ = uint32;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.UInt32Wrapper.uint32)
}
// -------------------------------------------------------------------
// BoolWrapper
// .google.protobuf.BoolValue bool = 1;
inline bool BoolWrapper::has_bool_() const {
return this != internal_default_instance() && bool__ != nullptr;
}
inline const ::google::protobuf::BoolValue& BoolWrapper::bool_() const {
const ::google::protobuf::BoolValue* p = bool__;
// @@protoc_insertion_point(field_get:google.protobuf.testing.BoolWrapper.bool)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::BoolValue*>(
&::google::protobuf::_BoolValue_default_instance_);
}
inline ::google::protobuf::BoolValue* BoolWrapper::release_bool_() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.BoolWrapper.bool)
::google::protobuf::BoolValue* temp = bool__;
bool__ = nullptr;
return temp;
}
inline ::google::protobuf::BoolValue* BoolWrapper::mutable_bool_() {
if (bool__ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::BoolValue>(GetArenaNoVirtual());
bool__ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.BoolWrapper.bool)
return bool__;
}
inline void BoolWrapper::set_allocated_bool_(::google::protobuf::BoolValue* bool_) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete reinterpret_cast< ::google::protobuf::MessageLite*>(bool__);
}
if (bool_) {
::google::protobuf::Arena* submessage_arena =
reinterpret_cast<::google::protobuf::MessageLite*>(bool_)->GetArena();
if (message_arena != submessage_arena) {
bool_ = ::google::protobuf::internal::GetOwnedMessage(
message_arena, bool_, submessage_arena);
}
} else {
}
bool__ = bool_;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.BoolWrapper.bool)
}
// -------------------------------------------------------------------
// StringWrapper
// .google.protobuf.StringValue string = 1;
inline bool StringWrapper::has_string() const {
return this != internal_default_instance() && string_ != nullptr;
}
inline const ::google::protobuf::StringValue& StringWrapper::string() const {
const ::google::protobuf::StringValue* p = string_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.StringWrapper.string)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::StringValue*>(
&::google::protobuf::_StringValue_default_instance_);
}
inline ::google::protobuf::StringValue* StringWrapper::release_string() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.StringWrapper.string)
::google::protobuf::StringValue* temp = string_;
string_ = nullptr;
return temp;
}
inline ::google::protobuf::StringValue* StringWrapper::mutable_string() {
if (string_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::StringValue>(GetArenaNoVirtual());
string_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.StringWrapper.string)
return string_;
}
inline void StringWrapper::set_allocated_string(::google::protobuf::StringValue* string) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete reinterpret_cast< ::google::protobuf::MessageLite*>(string_);
}
if (string) {
::google::protobuf::Arena* submessage_arena =
reinterpret_cast<::google::protobuf::MessageLite*>(string)->GetArena();
if (message_arena != submessage_arena) {
string = ::google::protobuf::internal::GetOwnedMessage(
message_arena, string, submessage_arena);
}
} else {
}
string_ = string;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.StringWrapper.string)
}
// -------------------------------------------------------------------
// BytesWrapper
// .google.protobuf.BytesValue bytes = 1;
inline bool BytesWrapper::has_bytes() const {
return this != internal_default_instance() && bytes_ != nullptr;
}
inline const ::google::protobuf::BytesValue& BytesWrapper::bytes() const {
const ::google::protobuf::BytesValue* p = bytes_;
// @@protoc_insertion_point(field_get:google.protobuf.testing.BytesWrapper.bytes)
return p != nullptr ? *p : *reinterpret_cast<const ::google::protobuf::BytesValue*>(
&::google::protobuf::_BytesValue_default_instance_);
}
inline ::google::protobuf::BytesValue* BytesWrapper::release_bytes() {
// @@protoc_insertion_point(field_release:google.protobuf.testing.BytesWrapper.bytes)
::google::protobuf::BytesValue* temp = bytes_;
bytes_ = nullptr;
return temp;
}
inline ::google::protobuf::BytesValue* BytesWrapper::mutable_bytes() {
if (bytes_ == nullptr) {
auto* p = CreateMaybeMessage<::google::protobuf::BytesValue>(GetArenaNoVirtual());
bytes_ = p;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.testing.BytesWrapper.bytes)
return bytes_;
}
inline void BytesWrapper::set_allocated_bytes(::google::protobuf::BytesValue* bytes) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete reinterpret_cast< ::google::protobuf::MessageLite*>(bytes_);
}
if (bytes) {
::google::protobuf::Arena* submessage_arena =
reinterpret_cast<::google::protobuf::MessageLite*>(bytes)->GetArena();
if (message_arena != submessage_arena) {
bytes = ::google::protobuf::internal::GetOwnedMessage(
message_arena, bytes, submessage_arena);
}
} else {
}
bytes_ = bytes;
// @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.BytesWrapper.bytes)
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// @@protoc_insertion_point(namespace_scope)
} // namespace testing
} // namespace protobuf
} // namespace google
// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
#endif // PROTOBUF_INCLUDED_google_2fprotobuf_2futil_2finternal_2ftestdata_2fwrappers_2eproto
|
[
"[email protected]"
] | |
dec565a9513f5e14d2caabd25bd6b244237957c4
|
b1bb61f23f983e37487b371d4a19b2bfdbeed673
|
/dp/minimumsubarraylen/test/minimumsubarraylen_test.cpp
|
be3fbde74229aabbfad91b1ca0bdd9a8c667b88f
|
[] |
no_license
|
jiguosong/InterViewCoding
|
225b41eee7d65d422a6c5361e074b7d286de86b6
|
41204d7f106d5b90b2545e4920022838bfc2a8b3
|
refs/heads/master
| 2021-05-01T23:56:05.256320 | 2017-02-16T06:18:54 | 2017-02-16T06:18:54 | 78,148,555 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 4,315 |
cpp
|
/* googletest unit test for C++ */
#include "gtest/gtest.h"
#include <iostream>
// uncomment to disable assert()
// #define NDEBUG
#include <cassert>
#include <array>
#include <vector>
#include <forward_list>
#include <list>
#include <deque>
#include <set> // multiset is also defined here
#include <map> // multimap is also defined here
#include <unordered_set> // unordered_multiset is also defined here
#include <unordered_map> // unordered_multimap is also defined here
/*
* stack - use standard containers std::vector, std::deque and std::list
* queue - use standard containers std::deque and std::list
* priority_queue - use standard containers std::vector and std::deque
* */
#include <stack> // stack
#include <queue> // queue + priority_queue
#include <algorithm>
#include <random>
#include <string>
#include <memory>
#include <random>
// hackerrank header
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <unordered_map>
using namespace std;
// UVA header examples
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <cassert>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <unordered_map>
#include <sstream>
#include <cmath>
#include <bitset>
#include <utility>
#include <set>
#include <unordered_set>
#include <numeric>
#include <time.h>
#include <fstream>
#include <limits>
#include <iomanip>
#include <iterator>
#define INT_MAX 2147483647
#define INT_MIN -2147483648
#define pi acos(-1.0)
#define E 2.71828182845904523536
using namespace std;
#include "../src/minimumsubarraylen.h"
/*
Choose auto x when you want to work with copies.
Choose auto &x when you want to work with original items and may modify them.
Choose auto const &x when you want to work with original items and will not modify them
*/
template<class T>
void PrintVector(const vector<T> &vec)
{
for(auto const &v:vec) cout << v << ' ';
cout << endl;
}
template<class T>
void PrintVectorVector(const vector<vector<T>> &vec)
{
for(auto const &v:vec) PrintVector(v);
}
template<class T>
bool CompareVectorVector(const vector<T> &v1, const vector<T> &v2)
{
if (v1.size() != v2.size())
return false;
std::multiset<T> s1(v1.begin(), v1.end());
std::multiset<T> s2(v2.begin(), v2.end());
std::vector<T> v3;
std::set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(),
std::back_inserter(v3));
return (v3.size() == v1.size());
}
static int getRandom(int lower, int upper)
{
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<int> dist(lower, upper);
return dist(gen);
}
// first way to generate random string of len
string getRandomString(int len)
{
string str(len, ' ');
for (int i = 0; i < len; ++i) {
int randchar =
getRandom(0, std::numeric_limits<int>::max()) % (26 + 26 + 10);
if (randchar < 26) {
str[i] = 'a' + randchar;
} else if (randchar < 26 + 26) {
str[i] = 'A' + randchar - 26;
} else {
str[i] = '0' + randchar - 26 - 26;
}
}
return str;
}
// second way to generate random string of len
string gen_random(const int len)
{
static const char alphanum[] = "0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
string str(len, ' ');
for (int i = 0; i < len; ++i) {
str[i] =
alphanum[getRandom(0, std::numeric_limits<int>::max()) % (sizeof(alphanum) - 1)];
}
return str;
}
TEST(minimumsubarraylen, normal1)
{
minimumsubarraylen tc;
vector<int> nums = {2,3,1,2,4,3};
ASSERT_EQ(2, tc.minSubArrayLen(7, nums));
}
TEST(minimumsubarraylen, normal2)
{
minimumsubarraylen tc;
vector<int> nums = {20};
ASSERT_EQ(1, tc.minSubArrayLen(7, nums));
}
TEST(minimumsubarraylen, normal3)
{
minimumsubarraylen tc;
vector<int> nums = {1,1};
ASSERT_EQ(0, tc.minSubArrayLen(7, nums));
}
GTEST_API_ int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
|
[
"[email protected]"
] | |
43cf5de50091d8daf3d644256378260fa2aa93e6
|
b7a1176ba248bb728cc4fe8a9842022e348d818f
|
/src/EQZoneToolApp/Urho3DQtMainWindow.cpp
|
7fa8517768940fa7b4836a7020cd633f41948623
|
[
"MIT"
] |
permissive
|
brainiac/EQZoneTool
|
bf8a2e528e5f020f292ffef2b901c3bb0d96fe64
|
99d5c1087bfa06a81d94d8a2479b8b18a7fee348
|
refs/heads/master
| 2021-01-11T22:50:10.410110 | 2017-01-11T07:28:06 | 2017-01-11T07:28:19 | 78,508,727 | 1 | 2 | null | null | null | null |
UTF-8
|
C++
| false | false | 981 |
cpp
|
#include "pch.h"
#include "Urho3DQtMainWindow.h"
#include "Urho3DWidget.h"
#include <QMenuBar>
#include <QMenu>
#include <QToolBar>
Urho3DQtMainWindow::Urho3DQtMainWindow(Urho3D::Context* context, QWidget* parent, Qt::WindowFlags flags)
: QMainWindow(parent, flags)
{
// Set window icon
setWindowIcon(QIcon(":/Icons/AppIcon32.png"));
Urho3DWidget* urhoWidget = new Urho3DWidget(context);
//urhoWidget->Setup();
//urhoWidget->Start();
//urhoWidget->resize(1024, 768);
//urhoWidget->show();
// Set central widget
setCentralWidget(urhoWidget);
// Create menu
QMenu* menu = menuBar()->addMenu(tr("&File"));
// Create menu actions
QAction* newAction = menu->addAction(QIcon(":/Images/filenew.png"), tr("New..."));
QAction* openAction = menu->addAction(QIcon(":/Images/fileopen.png"), tr("Open ..."));
QAction* saveAction = menu->addAction(QIcon(":/Images/filesave.png"), tr("Save ..."));
// Show window
show();
}
Urho3DQtMainWindow::~Urho3DQtMainWindow()
{
}
|
[
"[email protected]"
] | |
ad10927900b6bdfce8a296111bf6b77bae6e5f11
|
15736c955a83aff301bf9d3ef049767918d8c998
|
/llvm/.svn/pristine/ad/ad10927900b6bdfce8a296111bf6b77bae6e5f11.svn-base
|
dc9628f183e7f3996f1a408f26502a14e0afeafd
|
[
"NCSA"
] |
permissive
|
sangeeta0201/fpsanitizer
|
02f2aa40cb9341b625893840d8f81cf2fc8d368a
|
402467edf31f3f70b4cb3f52ec27cbdc50cebf9f
|
refs/heads/master
| 2020-03-19T02:22:02.058623 | 2019-09-30T18:41:59 | 2019-09-30T18:41:59 | 135,622,400 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 11,700 |
//===---- IndirectionUtils.cpp - Utilities for call indirection in Orc ----===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/IndirectionUtils.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ExecutionEngine/Orc/OrcABISupport.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/Support/Format.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include <sstream>
using namespace llvm;
using namespace llvm::orc;
namespace {
class CompileCallbackMaterializationUnit : public orc::MaterializationUnit {
public:
using CompileFunction = JITCompileCallbackManager::CompileFunction;
CompileCallbackMaterializationUnit(SymbolStringPtr Name,
CompileFunction Compile)
: MaterializationUnit(SymbolFlagsMap({{Name, JITSymbolFlags::Exported}})),
Name(std::move(Name)), Compile(std::move(Compile)) {}
private:
void materialize(MaterializationResponsibility R) {
SymbolMap Result;
Result[Name] = JITEvaluatedSymbol(Compile(), JITSymbolFlags::Exported);
R.resolve(Result);
R.finalize();
}
void discard(const VSO &V, SymbolStringPtr Name) {
llvm_unreachable("Discard should never occur on a LMU?");
}
SymbolStringPtr Name;
CompileFunction Compile;
};
} // namespace
namespace llvm {
namespace orc {
void JITCompileCallbackManager::anchor() {}
void IndirectStubsManager::anchor() {}
Expected<JITTargetAddress>
JITCompileCallbackManager::getCompileCallback(CompileFunction Compile) {
if (auto TrampolineAddr = getAvailableTrampolineAddr()) {
auto CallbackName = ES.getSymbolStringPool().intern(
std::string("cc") + std::to_string(++NextCallbackId));
std::lock_guard<std::mutex> Lock(CCMgrMutex);
AddrToSymbol[*TrampolineAddr] = CallbackName;
cantFail(CallbacksVSO.define(
llvm::make_unique<CompileCallbackMaterializationUnit>(
std::move(CallbackName), std::move(Compile))));
return *TrampolineAddr;
} else
return TrampolineAddr.takeError();
}
JITTargetAddress JITCompileCallbackManager::executeCompileCallback(
JITTargetAddress TrampolineAddr) {
SymbolStringPtr Name;
{
std::unique_lock<std::mutex> Lock(CCMgrMutex);
auto I = AddrToSymbol.find(TrampolineAddr);
// If this address is not associated with a compile callback then report an
// error to the execution session and return ErrorHandlerAddress to the
// callee.
if (I == AddrToSymbol.end()) {
Lock.unlock();
std::string ErrMsg;
{
raw_string_ostream ErrMsgStream(ErrMsg);
ErrMsgStream << "No compile callback for trampoline at "
<< format("0x%016x", TrampolineAddr);
}
ES.reportError(
make_error<StringError>(std::move(ErrMsg), inconvertibleErrorCode()));
return ErrorHandlerAddress;
} else
Name = I->second;
}
if (auto Sym = lookup({&CallbacksVSO}, Name))
return Sym->getAddress();
else {
// If anything goes wrong materializing Sym then report it to the session
// and return the ErrorHandlerAddress;
ES.reportError(Sym.takeError());
return ErrorHandlerAddress;
}
}
std::unique_ptr<JITCompileCallbackManager>
createLocalCompileCallbackManager(const Triple &T, ExecutionSession &ES,
JITTargetAddress ErrorHandlerAddress) {
switch (T.getArch()) {
default: return nullptr;
case Triple::aarch64: {
typedef orc::LocalJITCompileCallbackManager<orc::OrcAArch64> CCMgrT;
return llvm::make_unique<CCMgrT>(ES, ErrorHandlerAddress);
}
case Triple::x86: {
typedef orc::LocalJITCompileCallbackManager<orc::OrcI386> CCMgrT;
return llvm::make_unique<CCMgrT>(ES, ErrorHandlerAddress);
}
case Triple::x86_64: {
if ( T.getOS() == Triple::OSType::Win32 ) {
typedef orc::LocalJITCompileCallbackManager<orc::OrcX86_64_Win32> CCMgrT;
return llvm::make_unique<CCMgrT>(ES, ErrorHandlerAddress);
} else {
typedef orc::LocalJITCompileCallbackManager<orc::OrcX86_64_SysV> CCMgrT;
return llvm::make_unique<CCMgrT>(ES, ErrorHandlerAddress);
}
}
}
}
std::function<std::unique_ptr<IndirectStubsManager>()>
createLocalIndirectStubsManagerBuilder(const Triple &T) {
switch (T.getArch()) {
default:
return [](){
return llvm::make_unique<
orc::LocalIndirectStubsManager<orc::OrcGenericABI>>();
};
case Triple::aarch64:
return [](){
return llvm::make_unique<
orc::LocalIndirectStubsManager<orc::OrcAArch64>>();
};
case Triple::x86:
return [](){
return llvm::make_unique<
orc::LocalIndirectStubsManager<orc::OrcI386>>();
};
case Triple::x86_64:
if (T.getOS() == Triple::OSType::Win32) {
return [](){
return llvm::make_unique<
orc::LocalIndirectStubsManager<orc::OrcX86_64_Win32>>();
};
} else {
return [](){
return llvm::make_unique<
orc::LocalIndirectStubsManager<orc::OrcX86_64_SysV>>();
};
}
}
}
Constant* createIRTypedAddress(FunctionType &FT, JITTargetAddress Addr) {
Constant *AddrIntVal =
ConstantInt::get(Type::getInt64Ty(FT.getContext()), Addr);
Constant *AddrPtrVal =
ConstantExpr::getCast(Instruction::IntToPtr, AddrIntVal,
PointerType::get(&FT, 0));
return AddrPtrVal;
}
GlobalVariable* createImplPointer(PointerType &PT, Module &M,
const Twine &Name, Constant *Initializer) {
auto IP = new GlobalVariable(M, &PT, false, GlobalValue::ExternalLinkage,
Initializer, Name, nullptr,
GlobalValue::NotThreadLocal, 0, true);
IP->setVisibility(GlobalValue::HiddenVisibility);
return IP;
}
void makeStub(Function &F, Value &ImplPointer) {
assert(F.isDeclaration() && "Can't turn a definition into a stub.");
assert(F.getParent() && "Function isn't in a module.");
Module &M = *F.getParent();
BasicBlock *EntryBlock = BasicBlock::Create(M.getContext(), "entry", &F);
IRBuilder<> Builder(EntryBlock);
LoadInst *ImplAddr = Builder.CreateLoad(&ImplPointer);
std::vector<Value*> CallArgs;
for (auto &A : F.args())
CallArgs.push_back(&A);
CallInst *Call = Builder.CreateCall(ImplAddr, CallArgs);
Call->setTailCall();
Call->setAttributes(F.getAttributes());
if (F.getReturnType()->isVoidTy())
Builder.CreateRetVoid();
else
Builder.CreateRet(Call);
}
// Utility class for renaming global values and functions during partitioning.
class GlobalRenamer {
public:
static bool needsRenaming(const Value &New) {
return !New.hasName() || New.getName().startswith("\01L");
}
const std::string& getRename(const Value &Orig) {
// See if we have a name for this global.
{
auto I = Names.find(&Orig);
if (I != Names.end())
return I->second;
}
// Nope. Create a new one.
// FIXME: Use a more robust uniquing scheme. (This may blow up if the user
// writes a "__orc_anon[[:digit:]]* method).
unsigned ID = Names.size();
std::ostringstream NameStream;
NameStream << "__orc_anon" << ID++;
auto I = Names.insert(std::make_pair(&Orig, NameStream.str()));
return I.first->second;
}
private:
DenseMap<const Value*, std::string> Names;
};
static void raiseVisibilityOnValue(GlobalValue &V, GlobalRenamer &R) {
if (V.hasLocalLinkage()) {
if (R.needsRenaming(V))
V.setName(R.getRename(V));
V.setLinkage(GlobalValue::ExternalLinkage);
V.setVisibility(GlobalValue::HiddenVisibility);
}
V.setUnnamedAddr(GlobalValue::UnnamedAddr::None);
assert(!R.needsRenaming(V) && "Invalid global name.");
}
void makeAllSymbolsExternallyAccessible(Module &M) {
GlobalRenamer Renamer;
for (auto &F : M)
raiseVisibilityOnValue(F, Renamer);
for (auto &GV : M.globals())
raiseVisibilityOnValue(GV, Renamer);
for (auto &A : M.aliases())
raiseVisibilityOnValue(A, Renamer);
}
Function* cloneFunctionDecl(Module &Dst, const Function &F,
ValueToValueMapTy *VMap) {
Function *NewF =
Function::Create(cast<FunctionType>(F.getValueType()),
F.getLinkage(), F.getName(), &Dst);
NewF->copyAttributesFrom(&F);
if (VMap) {
(*VMap)[&F] = NewF;
auto NewArgI = NewF->arg_begin();
for (auto ArgI = F.arg_begin(), ArgE = F.arg_end(); ArgI != ArgE;
++ArgI, ++NewArgI)
(*VMap)[&*ArgI] = &*NewArgI;
}
return NewF;
}
void moveFunctionBody(Function &OrigF, ValueToValueMapTy &VMap,
ValueMaterializer *Materializer,
Function *NewF) {
assert(!OrigF.isDeclaration() && "Nothing to move");
if (!NewF)
NewF = cast<Function>(VMap[&OrigF]);
else
assert(VMap[&OrigF] == NewF && "Incorrect function mapping in VMap.");
assert(NewF && "Function mapping missing from VMap.");
assert(NewF->getParent() != OrigF.getParent() &&
"moveFunctionBody should only be used to move bodies between "
"modules.");
SmallVector<ReturnInst *, 8> Returns; // Ignore returns cloned.
CloneFunctionInto(NewF, &OrigF, VMap, /*ModuleLevelChanges=*/true, Returns,
"", nullptr, nullptr, Materializer);
OrigF.deleteBody();
}
GlobalVariable* cloneGlobalVariableDecl(Module &Dst, const GlobalVariable &GV,
ValueToValueMapTy *VMap) {
GlobalVariable *NewGV = new GlobalVariable(
Dst, GV.getValueType(), GV.isConstant(),
GV.getLinkage(), nullptr, GV.getName(), nullptr,
GV.getThreadLocalMode(), GV.getType()->getAddressSpace());
NewGV->copyAttributesFrom(&GV);
if (VMap)
(*VMap)[&GV] = NewGV;
return NewGV;
}
void moveGlobalVariableInitializer(GlobalVariable &OrigGV,
ValueToValueMapTy &VMap,
ValueMaterializer *Materializer,
GlobalVariable *NewGV) {
assert(OrigGV.hasInitializer() && "Nothing to move");
if (!NewGV)
NewGV = cast<GlobalVariable>(VMap[&OrigGV]);
else
assert(VMap[&OrigGV] == NewGV &&
"Incorrect global variable mapping in VMap.");
assert(NewGV->getParent() != OrigGV.getParent() &&
"moveGlobalVariable should only be used to move initializers between "
"modules");
NewGV->setInitializer(MapValue(OrigGV.getInitializer(), VMap, RF_None,
nullptr, Materializer));
}
GlobalAlias* cloneGlobalAliasDecl(Module &Dst, const GlobalAlias &OrigA,
ValueToValueMapTy &VMap) {
assert(OrigA.getAliasee() && "Original alias doesn't have an aliasee?");
auto *NewA = GlobalAlias::create(OrigA.getValueType(),
OrigA.getType()->getPointerAddressSpace(),
OrigA.getLinkage(), OrigA.getName(), &Dst);
NewA->copyAttributesFrom(&OrigA);
VMap[&OrigA] = NewA;
return NewA;
}
void cloneModuleFlagsMetadata(Module &Dst, const Module &Src,
ValueToValueMapTy &VMap) {
auto *MFs = Src.getModuleFlagsMetadata();
if (!MFs)
return;
for (auto *MF : MFs->operands())
Dst.addModuleFlag(MapMetadata(MF, VMap));
}
} // End namespace orc.
} // End namespace llvm.
|
[
"[email protected]"
] | ||
05a69801c5fae81448f72eae94a9f4a5055ab284
|
09926b0af44213f5be9a8e494485e42406cf2b02
|
/ConsoleApplication1.cpp
|
3f68af3ccb0561be8a682a42744d1c0baeff5fa2
|
[] |
no_license
|
yufangtongqin/Acced
|
f5cf5bebfb1f672d3a1d71e3bf62671e623cd122
|
42aba7a14fef30407ab152b49e8e9803462b2b19
|
refs/heads/master
| 2020-06-02T10:11:43.682793 | 2019-06-10T08:05:15 | 2019-06-10T08:05:15 | 191,124,067 | 0 | 0 | null | null | null | null |
GB18030
|
C++
| false | false | 424 |
cpp
|
// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream>
using namespace std;
class CBase
{
protected:
int a;
public:
CBase()
{
int a;
}
CBase(int c)
{
a = c;
}
};
class CYF :CBase
{
public:
CYF()
{
a = 0;
}
CYF(int c)
{
a = c;
}
void display()
{
cout << "a=" << a << endl;
}
};
int main()
{
CYF obj(100);
obj.display();
return 0;
}
|
[
"[email protected]"
] | |
8aca94e1d7973f8613c3a690d3279f6b1c484e70
|
99158922c5a3b69d0cf496268f2330e7b0564386
|
/SortIt/SortBase.h
|
2cf71d81baac1ef9b937e234f5aa795bacaabece
|
[] |
no_license
|
dicer2000/SortItApp
|
634a16cd1110dba4b2d05be8742511b1ddb9a1e4
|
05bbd4a74b17c6c7400b5530e1eb0cbc73e32177
|
refs/heads/master
| 2022-04-17T00:10:30.193758 | 2020-04-13T21:48:00 | 2020-04-13T21:48:00 | 255,448,467 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 539 |
h
|
#pragma once
#include <iostream>
#include <vector>
using namespace std;
class SortBase
{
protected:
vector<int> _mainVector;
public:
SortBase() {};
virtual ~SortBase() {};
// Copy Constructor
SortBase(const SortBase& old) { this->_mainVector = old._mainVector; };
virtual void addItem(int item) { _mainVector.push_back(item); }
virtual void dequeueItem() { _mainVector.front(); }
virtual void sort() = 0;
virtual void printVector()
{
for (auto& iterator : _mainVector)
cout << iterator << " ";
cout << endl;
}
};
|
[
"[email protected]"
] | |
f4756b3348d6a179f733af0274979ab83152b702
|
5ec148a0d62d0761a4c097184d30e3a12fb514f7
|
/Doom/src/Doom/OpenGl/IndexBuffer.cpp
|
2b190fb9976e9ec897beba6d337b7f87807b8783
|
[
"MIT"
] |
permissive
|
AvikDasAnimato/OpenGL_Engine
|
acd4d9461af937fd39f5465aae4d26ce9f1dbaf8
|
6e6570f8dd9000724274942fff5a100f0998b780
|
refs/heads/master
| 2023-06-22T03:57:10.647484 | 2021-07-20T13:52:19 | 2021-07-20T13:52:19 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 635 |
cpp
|
#include "../pch.h"
#include "IndexBuffer.h"
using namespace Doom;
void Doom::IndexBuffer::Init(const uint32_t * data, uint32_t count)
{
m_count = count;
glGenBuffers(1, &m_RendererID);
Bind();
glBufferData(GL_ELEMENT_ARRAY_BUFFER, count * sizeof(uint32), data, GL_DYNAMIC_DRAW);
}
void Doom::IndexBuffer::Clear()
{
m_RendererID = UINT32_MAX;
m_count = 0;
glDeleteBuffers(1, &m_RendererID);
}
Doom::IndexBuffer::~IndexBuffer()
{
Clear();
}
void Doom::IndexBuffer::Bind() const
{
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_RendererID);
}
void Doom::IndexBuffer::UnBind() const
{
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
|
[
"[email protected]"
] | |
6689cf4eaec12707dd3ec47f348fea595eecc35a
|
26922ce0f33589caea1bdaae0aacc972d4bbb167
|
/microchip library/apps/usb/device/cdc_basic/utilities/src/vc++2008/USB_Serial_Terminal/AboutDialog.cpp
|
755ca8e9c1665ebf919fffd381c6392ac7787c24
|
[] |
no_license
|
alexandrequ/scalar4
|
d3afe3b09faf6731009593b71bf971d9d862d44d
|
deda54a12a635720f79fee3b7ce710b124fda087
|
refs/heads/main
| 2023-03-04T09:03:20.256507 | 2021-02-15T20:05:24 | 2021-02-15T20:05:24 | 339,189,700 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 49 |
cpp
|
#include "StdAfx.h"
#include "AboutDialog.h"
|
[
"[email protected]"
] | |
4c2328197c1c6df7d186d783841db72330f19875
|
6ad6179c2c6b7282b4c9fec4ef057ac78f83f1e8
|
/include/FileLog.h
|
ba9c5f301cee4d2266f2defa74bc1ea3af8f74cb
|
[] |
no_license
|
liwooood/MonitorAgentWin
|
d6ff3b2e31af068efdff28df718b4020e9b918d5
|
44d2edbba89c19f1884c444767cab55f77e12a93
|
refs/heads/master
| 2020-04-10T22:05:58.208586 | 2014-12-25T03:57:57 | 2014-12-25T03:57:57 | null | 0 | 0 | null | null | null | null |
GB18030
|
C++
| false | false | 445 |
h
|
#ifndef _FILE_LOG_
#define _FILE_LOG_
#include <string>
#include <boost/thread/detail/singleton.hpp>
/*
将来采用boost::log代替
*/
#define LOG_LEVEL_DEBUG 0
#define LOG_LEVEL_INFO 1
#define LOG_LEVEL_WARN 2
#define LOG_LEVEL_ERROR 3
class FileLog
{
public:
FileLog(void);
~FileLog(void);
void Log(int logLevel, std::string log, std::string file="debug.log");
};
typedef boost::detail::thread::singleton<FileLog> gFileLog;
#endif
|
[
"[email protected]"
] | |
0d1555fbe3a41dacf91400e23272cda55b3e4e84
|
bd1fea86d862456a2ec9f56d57f8948456d55ee6
|
/000/088/941/CWE197_Numeric_Truncation_Error__int_large_to_char_82a.cpp
|
89e1a2d92dd5e398999343c5a86a05b060a85675
|
[] |
no_license
|
CU-0xff/juliet-cpp
|
d62b8485104d8a9160f29213368324c946f38274
|
d8586a217bc94cbcfeeec5d39b12d02e9c6045a2
|
refs/heads/master
| 2021-03-07T15:44:19.446957 | 2020-03-10T12:45:40 | 2020-03-10T12:45:40 | 246,275,244 | 0 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,370 |
cpp
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE197_Numeric_Truncation_Error__int_large_to_char_82a.cpp
Label Definition File: CWE197_Numeric_Truncation_Error__int.label.xml
Template File: sources-sink-82a.tmpl.cpp
*/
/*
* @description
* CWE: 197 Numeric Truncation Error
* BadSource: large Set data to a number larger than SHRT_MAX
* GoodSource: Less than CHAR_MAX
* Sinks: to_char
* BadSink : Convert data to a char
* Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer
*
* */
#include "std_testcase.h"
#include "CWE197_Numeric_Truncation_Error__int_large_to_char_82.h"
namespace CWE197_Numeric_Truncation_Error__int_large_to_char_82
{
#ifndef OMITBAD
void bad()
{
int data;
/* Initialize data */
data = -1;
/* FLAW: Use a number larger than SHRT_MAX */
data = SHRT_MAX + 5;
CWE197_Numeric_Truncation_Error__int_large_to_char_82_base* baseObject = new CWE197_Numeric_Truncation_Error__int_large_to_char_82_bad;
baseObject->action(data);
delete baseObject;
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
int data;
/* Initialize data */
data = -1;
/* FIX: Use a positive integer less than CHAR_MAX*/
data = CHAR_MAX-5;
CWE197_Numeric_Truncation_Error__int_large_to_char_82_base* baseObject = new CWE197_Numeric_Truncation_Error__int_large_to_char_82_goodG2B;
baseObject->action(data);
delete baseObject;
}
void good()
{
goodG2B();
}
#endif /* OMITGOOD */
} /* close namespace */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
using namespace CWE197_Numeric_Truncation_Error__int_large_to_char_82; /* so that we can use good and bad easily */
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
[
"[email protected]"
] | |
40d7f6b43520b4a1f7b0def034fb33eb0e7f1f03
|
b71b5d68eb9d564d61c89ddb111660efa92842d0
|
/Components/AudioDevice/AudioIn.cpp
|
e21e5edb2d7079119aefcfe97c6737f9b4fea53c
|
[] |
no_license
|
liuxw7/dspatchables
|
16b82cc2d3dada3bf848235bcca9ef042d95f630
|
f36eed1a91217fac1fc40a68c092bd9a787e711e
|
refs/heads/master
| 2023-07-31T00:12:43.139889 | 2021-07-28T19:21:28 | 2021-07-28T19:21:28 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 171 |
cpp
|
#include <AudioDevice.h>
using namespace DSPatch;
using namespace DSPatchables;
EXPORT_PLUGIN( AudioDevice, false, std::vector<std::string>{ "Built-in" }, true, false )
|
[
"[email protected]"
] | |
9ddce3c6ad651e4a79689dd47859fc478cddb948
|
04ed3f0a425f83b41344359ea585d64c18f6a7bc
|
/src/getCQITable.cpp
|
5072b6154d5d45d42841a4bee62d2faefafc43b1
|
[] |
no_license
|
5G-Beam-Forming/LLS_DownLink_SUMIMO
|
79ee9a9279fc4c27f118872bcb01e65f52a17f32
|
733cf589eb44655f35e9cef36dd7cde237ef31ff
|
refs/heads/master
| 2023-01-28T02:14:44.892395 | 2020-12-06T18:19:06 | 2020-12-06T18:26:31 | 319,100,900 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 34,318 |
cpp
|
/*
* loadCQITable.cpp - load CQI_Table from the CQI_Table_new.mat file.
*
* Converted C++ code from MATLAB script code.
* Converted by PJW
* Last Updated: 2018-10-01
*
* Copyright(c) 2016-2018 KAIST. All rights reserved.
*/
#include <cstdio>
#include <cstring>
#include <cstdarg>
#include <cstdlib>
#include <complex>
#include <armadillo>
#include "getCQITable.h"
using namespace std;
using namespace arma;
CQI_Table_n CQI_Table_1;
CQI_Table_n CQI_Table_2;
field<cx_rowvec> modulation_mapping(16);
field<imat> modulation_mapping_bittable(16);
/*
* getCQITable() - return CQI Table value
*/
void getCQITable() {
uword numElem = 15;
CQI_Table_1.CQI << 1.0 << 2.0 << 3.0 << 4.0 << 5.0 << 6.0 << 7.0 << 8.0 << 9.0 << 10.0 << 11.0 << 12.0 << 13.0 << 14.0 << 15.0 << endr;
CQI_Table_1.order << 2.0 << 2.0 << 2.0 << 2.0 << 2.0 << 2.0 << 4.0 << 4.0 << 4.0 << 6.0 << 6.0 << 6.0 << 6.0 << 6.0 << 6.0 << endr;
CQI_Table_1.code_rate << 78.0 << 120.0 << 193.0 << 308.0 << 449.0 << 602.0 << 378.0 << 490.0 << 616.0 << 466.0 << 567.0 << 666.0 << 772.0 << 873.0 << 948.0 << endr;
CQI_Table_1.efficiency << 0.1523 << 0.2344 << 0.3770 << 0.6016 << 0.8770 << 1.1758 << 1.4766 << 1.9141 << 2.4063 << 2.7305 << 3.3223 << 3.9023 << 4.5234 << 5.1152 << 5.5547 << endr;
CQI_Table_2.CQI << 1.0 << 2.0 << 3.0 << 4.0 << 5.0 << 6.0 << 7.0 << 8.0 << 9.0 << 10.0 << 11.0 << 12.0 << 13.0 << 14.0 << 15.0 << endr;
CQI_Table_2.order << 0.0 << 2.0 << 2.0 << 2.0 << 4.0 << 4.0 << 4.0 << 6.0 << 6.0 << 6.0 << 6.0 << 6.0 << 8.0 << 8.0 << 8.0 << 8.0 << endr;
CQI_Table_2.code_rate << 78.0 << 193.0 << 449.0 << 378.0 << 490.0 << 616.0 << 466.0 << 567.0 << 666.0 << 772.0 << 873.0 << 711.0 << 797.0 << 885.0 << 948.0 << endr;
CQI_Table_2.efficiency << 0.1523 << 0.3770 << 0.8770 << 1.4766 << 1.9141 << 2.4063 << 2.7305 << 3.3223 << 3.9023 << 4.5234 << 5.1152 << 5.5547 << 6.2266 << 6.9141 << 7.4063 << endr;
modulation_mapping(0) << cx_double(0.707106781186548, 0.707106781186548) << cx_double(-0.707106781186548, -0.707106781186548) << endr;
modulation_mapping(1) << cx_double(0.707106781186548, 0.707106781186548) << cx_double(0.707106781186548, -0.707106781186548) << cx_double(-0.707106781186548, 0.707106781186548) << cx_double(-0.707106781186548, -0.707106781186548) << endr;
modulation_mapping(2) << NULL << endr;
modulation_mapping(3) << cx_double(0.316227766016838, 0.316227766016838) << cx_double(0.316227766016838, 0.948683298050514) << cx_double(0.948683298050514, 0.316227766016838) << cx_double(0.948683298050514, 0.948683298050514)
<< cx_double(0.316227766016838, -0.316227766016838) << cx_double(0.316227766016838, -0.948683298050514) << cx_double(0.948683298050514, -0.316227766016838) << cx_double(0.948683298050514, -0.948683298050514)
<< cx_double(-0.316227766016838, 0.316227766016838) << cx_double(-0.316227766016838, 0.948683298050514) << cx_double(-0.948683298050514, 0.316227766016838) << cx_double(-0.948683298050514, 0.948683298050514)
<< cx_double(-0.316227766016838, -0.316227766016838) << cx_double(-0.316227766016838, -0.948683298050514) << cx_double(-0.948683298050514, -0.316227766016838) << cx_double(-0.948683298050514, -0.948683298050514) << endr;
modulation_mapping(4) << NULL << endr;
modulation_mapping(5) << cx_double(0.462910049886276, 0.462910049886276) << cx_double(0.462910049886276, 0.154303349962092) << cx_double(0.154303349962092, 0.462910049886276) << cx_double(0.154303349962092, 0.154303349962092)
<< cx_double(0.462910049886276, 0.771516749810460) << cx_double(0.462910049886276, 1.08012344973464) << cx_double(0.154303349962092, 0.771516749810460) << cx_double(0.154303349962092, 1.08012344973464)
<< cx_double(0.771516749810460, 0.462910049886276) << cx_double(0.771516749810460, 0.154303349962092) << cx_double(1.08012344973464, 0.462910049886276) << cx_double(1.08012344973464, 0.154303349962092)
<< cx_double(0.771516749810460, 0.771516749810460) << cx_double(0.771516749810460, 1.08012344973464) << cx_double(1.08012344973464, 0.771516749810460) << cx_double(1.08012344973464, 1.08012344973464)
<< cx_double(0.462910049886276, -0.462910049886276) << cx_double(0.462910049886276, -0.154303349962092) << cx_double(0.154303349962092, -0.462910049886276) << cx_double(0.154303349962092, -0.154303349962092)
<< cx_double(0.462910049886276, -0.771516749810460) << cx_double(0.462910049886276, -1.08012344973464) << cx_double(0.154303349962092, -0.771516749810460) << cx_double(0.154303349962092, -1.08012344973464)
<< cx_double(0.771516749810460, -0.462910049886276) << cx_double(0.771516749810460, -0.154303349962092) << cx_double(1.08012344973464, -0.462910049886276) << cx_double(1.08012344973464, -0.154303349962092)
<< cx_double(0.771516749810460, -0.771516749810460) << cx_double(0.771516749810460, -1.08012344973464) << cx_double(1.08012344973464, -0.771516749810460) << cx_double(1.08012344973464, -1.08012344973464)
<< cx_double(-0.462910049886276, 0.462910049886276) << cx_double(-0.462910049886276, 0.154303349962092) << cx_double(-0.154303349962092, 0.462910049886276) << cx_double(-0.154303349962092, 0.154303349962092)
<< cx_double(-0.462910049886276, 0.771516749810460) << cx_double(-0.462910049886276, 1.08012344973464) << cx_double(-0.154303349962092, 0.771516749810460) << cx_double(-0.154303349962092, 1.08012344973464)
<< cx_double(-0.771516749810460, 0.462910049886276) << cx_double(-0.771516749810460, 0.154303349962092) << cx_double(-1.08012344973464, 0.462910049886276) << cx_double(-1.08012344973464, 0.154303349962092)
<< cx_double(-0.771516749810460, 0.771516749810460) << cx_double(-0.771516749810460, 1.08012344973464) << cx_double(-1.08012344973464, 0.771516749810460) << cx_double(-1.08012344973464, 1.08012344973464)
<< cx_double(-0.462910049886276, -0.462910049886276) << cx_double(-0.462910049886276, -0.154303349962092) << cx_double(-0.154303349962092, -0.462910049886276) << cx_double(-0.154303349962092, -0.154303349962092)
<< cx_double(-0.462910049886276, -0.771516749810460) << cx_double(-0.462910049886276, -1.08012344973464) << cx_double(-0.154303349962092, -0.771516749810460) << cx_double(-0.154303349962092, -1.08012344973464)
<< cx_double(-0.771516749810460, -0.462910049886276) << cx_double(-0.771516749810460, -0.154303349962092) << cx_double(-1.08012344973464, -0.462910049886276) << cx_double(-1.08012344973464, -0.154303349962092)
<< cx_double(-0.771516749810460, -0.771516749810460) << cx_double(-0.771516749810460, -1.08012344973464) << cx_double(-1.08012344973464, -0.771516749810460) << cx_double(-1.08012344973464, -1.08012344973464) << endr;
modulation_mapping(6) << NULL << endr;
modulation_mapping(7) << cx_double(0.383482494423685, 0.383482494423685) << cx_double(0.383482494423685, 0.536875492193159) << cx_double(0.536875492193159, 0.383482494423685) << cx_double(0.536875492193159, 0.536875492193159)
<< cx_double(0.383482494423685, 0.230089496654211) << cx_double(0.383482494423685, 0.0766964988847370) << cx_double(0.536875492193159, 0.230089496654211) << cx_double(0.536875492193159, 0.0766964988847370)
<< cx_double(0.230089496654211, 0.383482494423685) << cx_double(0.230089496654211, 0.536875492193159) << cx_double(0.0766964988847370, 0.383482494423685) << cx_double(0.0766964988847370, 0.536875492193159)
<< cx_double(0.230089496654211, 0.230089496654211) << cx_double(0.230089496654211, 0.0766964988847370) << cx_double(0.0766964988847370, 0.230089496654211) << cx_double(0.0766964988847370, 0.0766964988847370)
<< cx_double(0.383482494423685, 0.843661487732108) << cx_double(0.383482494423685, 0.690268489962633) << cx_double(0.536875492193159, 0.843661487732108) << cx_double(0.536875492193159, 0.690268489962633)
<< cx_double(0.383482494423685, 0.997054485501582) << cx_double(0.383482494423685, 1.15044748327106) << cx_double(0.536875492193159, 0.997054485501582) << cx_double(0.536875492193159, 1.15044748327106)
<< cx_double(0.230089496654211, 0.843661487732108) << cx_double(0.230089496654211, 0.690268489962633) << cx_double(0.0766964988847370, 0.843661487732108) << cx_double(0.0766964988847370, 0.690268489962633)
<< cx_double(0.230089496654211, 0.997054485501582) << cx_double(0.230089496654211, 1.15044748327106) << cx_double(0.0766964988847370, 0.997054485501582) << cx_double(0.0766964988847370, 1.15044748327106)
<< cx_double(0.843661487732108, 0.383482494423685) << cx_double(0.843661487732108, 0.536875492193159) << cx_double(0.690268489962633, 0.383482494423685) << cx_double(0.690268489962633, 0.536875492193159)
<< cx_double(0.843661487732108, 0.230089496654211) << cx_double(0.843661487732108, 0.0766964988847370) << cx_double(0.690268489962633, 0.230089496654211) << cx_double(0.690268489962633, 0.0766964988847370)
<< cx_double(0.997054485501582, 0.383482494423685) << cx_double(0.997054485501582, 0.536875492193159) << cx_double(1.15044748327106, 0.383482494423685) << cx_double(1.15044748327106, 0.536875492193159)
<< cx_double(0.997054485501582, 0.230089496654211) << cx_double(0.997054485501582, 0.0766964988847370) << cx_double(1.15044748327106, 0.230089496654211) << cx_double(1.15044748327106, 0.0766964988847370)
<< cx_double(0.843661487732108, 0.843661487732108) << cx_double(0.843661487732108, 0.690268489962633) << cx_double(0.690268489962633, 0.843661487732108) << cx_double(0.690268489962633, 0.690268489962633)
<< cx_double(0.843661487732108, 0.997054485501582) << cx_double(0.843661487732108, 1.15044748327106) << cx_double(0.690268489962633, 0.997054485501582) << cx_double(0.690268489962633, 1.15044748327106)
<< cx_double(0.997054485501582, 0.843661487732108) << cx_double(0.997054485501582, 0.690268489962633) << cx_double(1.15044748327106, 0.843661487732108) << cx_double(1.15044748327106, 0.690268489962633)
<< cx_double(0.997054485501582, 0.997054485501582) << cx_double(0.997054485501582, 1.15044748327106) << cx_double(1.15044748327106, 0.997054485501582) << cx_double(1.15044748327106, 1.15044748327106)
<< cx_double(0.383482494423685, 0.383482494423685) << cx_double(0.383482494423685, -0.536875492193159) << cx_double(0.536875492193159, -0.383482494423685) << cx_double(0.536875492193159, -0.536875492193159)
<< cx_double(0.383482494423685, -0.230089496654211) << cx_double(0.383482494423685, -0.0766964988847370) << cx_double(0.536875492193159, -0.230089496654211) << cx_double(0.536875492193159, -0.0766964988847370)
<< cx_double(0.230089496654211, -0.383482494423685) << cx_double(0.230089496654211, -0.536875492193159) << cx_double(0.0766964988847370, -0.383482494423685) << cx_double(0.0766964988847370, -0.536875492193159)
<< cx_double(0.230089496654211, -0.230089496654211) << cx_double(0.230089496654211, -0.0766964988847370) << cx_double(0.0766964988847370, -0.230089496654211) << cx_double(0.0766964988847370, -0.0766964988847370)
<< cx_double(0.383482494423685, -0.843661487732108) << cx_double(0.383482494423685, -0.690268489962633) << cx_double(0.536875492193159, -0.843661487732108) << cx_double(0.536875492193159, -0.690268489962633)
<< cx_double(0.383482494423685, -0.997054485501582) << cx_double(0.383482494423685, -1.15044748327106) << cx_double(0.536875492193159, -0.997054485501582) << cx_double(0.536875492193159, -1.15044748327106)
<< cx_double(0.230089496654211, -0.843661487732108) << cx_double(0.230089496654211, -0.690268489962633) << cx_double(0.0766964988847370, -0.843661487732108) << cx_double(0.0766964988847370, -0.690268489962633)
<< cx_double(0.230089496654211, -0.997054485501582) << cx_double(0.230089496654211, -1.15044748327106) << cx_double(0.0766964988847370, -0.997054485501582) << cx_double(0.0766964988847370, -1.15044748327106)
<< cx_double(0.843661487732108, -0.383482494423685) << cx_double(0.843661487732108, -0.536875492193159) << cx_double(0.690268489962633, -0.383482494423685) << cx_double(0.690268489962633, -0.536875492193159)
<< cx_double(0.843661487732108, -0.230089496654211) << cx_double(0.843661487732108, -0.0766964988847370) << cx_double(0.690268489962633, -0.230089496654211) << cx_double(0.690268489962633, -0.0766964988847370)
<< cx_double(0.997054485501582, -0.383482494423685) << cx_double(0.997054485501582, -0.536875492193159) << cx_double(1.15044748327106, -0.383482494423685) << cx_double(1.15044748327106, -0.536875492193159)
<< cx_double(0.997054485501582, -0.230089496654211) << cx_double(0.997054485501582, -0.0766964988847370) << cx_double(1.15044748327106, -0.230089496654211) << cx_double(1.15044748327106, -0.0766964988847370)
<< cx_double(0.843661487732108, -0.843661487732108) << cx_double(0.843661487732108, -0.690268489962633) << cx_double(0.690268489962633, -0.843661487732108) << cx_double(0.690268489962633, -0.690268489962633)
<< cx_double(0.843661487732108, -0.997054485501582) << cx_double(0.843661487732108, -1.15044748327106) << cx_double(0.690268489962633, -0.997054485501582) << cx_double(0.690268489962633, -1.15044748327106)
<< cx_double(0.997054485501582, -0.843661487732108) << cx_double(0.997054485501582, -0.690268489962633) << cx_double(1.15044748327106, -0.843661487732108) << cx_double(1.15044748327106, -0.690268489962633)
<< cx_double(0.997054485501582, -0.997054485501582) << cx_double(0.997054485501582, -1.15044748327106) << cx_double(1.15044748327106, -0.997054485501582) << cx_double(1.15044748327106, -1.15044748327106)
<< cx_double(-0.383482494423685, 0.383482494423685) << cx_double(-0.383482494423685, 0.536875492193159) << cx_double(-0.536875492193159, 0.383482494423685) << cx_double(-0.536875492193159, 0.536875492193159)
<< cx_double(-0.383482494423685, 0.230089496654211) << cx_double(-0.383482494423685, 0.0766964988847370) << cx_double(-0.536875492193159, 0.230089496654211) << cx_double(-0.536875492193159, 0.0766964988847370)
<< cx_double(-0.230089496654211, 0.383482494423685) << cx_double(-0.230089496654211, 0.536875492193159) << cx_double(-0.0766964988847370, 0.383482494423685) << cx_double(-0.0766964988847370, 0.536875492193159)
<< cx_double(-0.230089496654211, 0.230089496654211) << cx_double(-0.230089496654211, 0.0766964988847370) << cx_double(-0.0766964988847370, 0.230089496654211) << cx_double(-0.0766964988847370, 0.0766964988847370)
<< cx_double(-0.383482494423685, 0.843661487732108) << cx_double(-0.383482494423685, 0.690268489962633) << cx_double(-0.536875492193159, 0.843661487732108) << cx_double(-0.536875492193159, 0.690268489962633)
<< cx_double(-0.383482494423685, 0.997054485501582) << cx_double(-0.383482494423685, 1.15044748327106) << cx_double(-0.536875492193159, 0.997054485501582) << cx_double(-0.536875492193159, 1.15044748327106)
<< cx_double(-0.230089496654211, 0.843661487732108) << cx_double(-0.230089496654211, 0.690268489962633) << cx_double(-0.0766964988847370, 0.843661487732108) << cx_double(-0.0766964988847370, 0.690268489962633)
<< cx_double(-0.230089496654211, 0.997054485501582) << cx_double(-0.230089496654211, 1.15044748327106) << cx_double(-0.0766964988847370, 0.997054485501582) << cx_double(-0.0766964988847370, 1.15044748327106)
<< cx_double(-0.843661487732108, 0.383482494423685) << cx_double(-0.843661487732108, 0.536875492193159) << cx_double(-0.690268489962633, 0.383482494423685) << cx_double(-0.690268489962633, 0.536875492193159)
<< cx_double(-0.843661487732108, 0.230089496654211) << cx_double(-0.843661487732108, 0.0766964988847370) << cx_double(-0.690268489962633, 0.230089496654211) << cx_double(-0.690268489962633, 0.0766964988847370)
<< cx_double(-0.997054485501582, 0.383482494423685) << cx_double(-0.997054485501582, 0.536875492193159) << cx_double(-1.15044748327106, 0.383482494423685) << cx_double(-1.15044748327106, 0.536875492193159)
<< cx_double(-0.997054485501582, 0.230089496654211) << cx_double(-0.997054485501582, 0.0766964988847370) << cx_double(-1.15044748327106, 0.230089496654211) << cx_double(-1.15044748327106, 0.0766964988847370)
<< cx_double(-0.843661487732108, 0.843661487732108) << cx_double(-0.843661487732108, 0.690268489962633) << cx_double(-0.690268489962633, 0.843661487732108) << cx_double(-0.690268489962633, 0.690268489962633)
<< cx_double(-0.843661487732108, 0.997054485501582) << cx_double(-0.843661487732108, 1.15044748327106) << cx_double(-0.690268489962633, 0.997054485501582) << cx_double(-0.690268489962633, 1.15044748327106)
<< cx_double(-0.997054485501582, 0.843661487732108) << cx_double(-0.997054485501582, 0.690268489962633) << cx_double(-1.15044748327106, 0.843661487732108) << cx_double(-1.15044748327106, 0.690268489962633)
<< cx_double(-0.997054485501582, 0.997054485501582) << cx_double(-0.997054485501582, 1.15044748327106) << cx_double(-1.15044748327106, 0.997054485501582) << cx_double(-1.15044748327106, 1.15044748327106)
<< cx_double(-0.383482494423685, -0.383482494423685) << cx_double(-0.383482494423685, -0.536875492193159) << cx_double(-0.536875492193159, -0.383482494423685) << cx_double(-0.536875492193159, -0.536875492193159)
<< cx_double(-0.383482494423685, -0.230089496654211) << cx_double(-0.383482494423685, -0.0766964988847370) << cx_double(-0.536875492193159, -0.230089496654211) << cx_double(-0.536875492193159, -0.0766964988847370)
<< cx_double(-0.230089496654211, -0.383482494423685) << cx_double(-0.230089496654211, -0.536875492193159) << cx_double(-0.0766964988847370, -0.383482494423685) << cx_double(-0.0766964988847370, -0.536875492193159)
<< cx_double(-0.230089496654211, -0.230089496654211) << cx_double(-0.230089496654211, -0.0766964988847370) << cx_double(-0.0766964988847370, -0.230089496654211) << cx_double(-0.0766964988847370, -0.0766964988847370)
<< cx_double(-0.383482494423685, -0.843661487732108) << cx_double(-0.383482494423685, -0.690268489962633) << cx_double(-0.536875492193159, -0.843661487732108) << cx_double(-0.536875492193159, -0.690268489962633)
<< cx_double(-0.383482494423685, -0.997054485501582) << cx_double(-0.383482494423685, -1.15044748327106) << cx_double(-0.536875492193159, -0.997054485501582) << cx_double(-0.536875492193159, -1.15044748327106)
<< cx_double(-0.230089496654211, -0.843661487732108) << cx_double(-0.230089496654211, -0.690268489962633) << cx_double(-0.0766964988847370, -0.843661487732108) << cx_double(-0.0766964988847370, -0.690268489962633)
<< cx_double(-0.230089496654211, -0.997054485501582) << cx_double(-0.230089496654211, -1.15044748327106) << cx_double(-0.0766964988847370, -0.997054485501582) << cx_double(-0.0766964988847370, -1.15044748327106)
<< cx_double(-0.843661487732108, -0.383482494423685) << cx_double(-0.843661487732108, -0.536875492193159) << cx_double(-0.690268489962633, -0.383482494423685) << cx_double(-0.690268489962633, -0.536875492193159)
<< cx_double(-0.843661487732108, -0.230089496654211) << cx_double(-0.843661487732108, -0.0766964988847370) << cx_double(-0.690268489962633, -0.230089496654211) << cx_double(-0.690268489962633, -0.0766964988847370)
<< cx_double(-0.997054485501582, -0.383482494423685) << cx_double(-0.997054485501582, -0.536875492193159) << cx_double(-1.15044748327106, -0.383482494423685) << cx_double(-1.15044748327106, -0.536875492193159)
<< cx_double(-0.997054485501582, -0.230089496654211) << cx_double(-0.997054485501582, -0.0766964988847370) << cx_double(-1.15044748327106, -0.230089496654211) << cx_double(-1.15044748327106, -0.0766964988847370)
<< cx_double(-0.843661487732108, -0.843661487732108) << cx_double(-0.843661487732108, -0.690268489962633) << cx_double(-0.690268489962633, -0.843661487732108) << cx_double(-0.690268489962633, -0.690268489962633)
<< cx_double(-0.843661487732108, -0.997054485501582) << cx_double(-0.843661487732108, -1.15044748327106) << cx_double(-0.690268489962633, -0.997054485501582) << cx_double(-0.690268489962633, -1.15044748327106)
<< cx_double(-0.997054485501582, -0.843661487732108) << cx_double(-0.997054485501582, -0.690268489962633) << cx_double(-1.15044748327106, -0.843661487732108) << cx_double(-1.15044748327106, -0.690268489962633)
<< cx_double(-0.997054485501582, -0.997054485501582) << cx_double(-0.997054485501582, -1.15044748327106) << cx_double(-1.15044748327106, -0.997054485501582) << cx_double(-1.15044748327106, -1.15044748327106) << endr;
modulation_mapping(8) << NULL << endr;
modulation_mapping(9) << NULL << endr;
modulation_mapping(10) << NULL << endr;
modulation_mapping(11) << NULL << endr;
modulation_mapping(12) << NULL << endr;
modulation_mapping(13) << NULL << endr;
modulation_mapping(14) << NULL << endr;
modulation_mapping(15) << NULL << endr;
modulation_mapping_bittable(0) << 0 << 1 << endr;
modulation_mapping_bittable(1) << 0 << 1 << 0 << 1 << endr << 0 << 0 << 1 << 1 << endr;
modulation_mapping_bittable(2) << NULL << endr;
modulation_mapping_bittable(3) << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << endr
<< 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << endr
<< 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << endr
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << endr;
modulation_mapping_bittable(4) << NULL << endr;
modulation_mapping_bittable(5) << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0
<< 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << endr
<< 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0
<< 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << endr
<< 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0
<< 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << endr
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << endr
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << endr
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1
<< 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << endr;
modulation_mapping_bittable(6) << NULL << endr;
modulation_mapping_bittable(7) << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0
<< 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0
<< 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0
<< 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0
<< 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0
<< 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0
<< 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0
<< 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << 0 << 1 << endr
<< 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0
<< 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1
<< 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0
<< 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1
<< 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0
<< 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1
<< 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0
<< 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << 0 << 0 << 1 << 1 << endr
<< 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0
<< 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0
<< 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1
<< 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1
<< 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0
<< 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0
<< 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1
<< 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << endr
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0
<< 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0
<< 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
<< 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1
<< 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1
<< 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1
<< 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << endr
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
<< 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
<< 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << endr
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1
<< 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1
<< 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1
<< 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1
<< 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << endr
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1
<< 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1
<< 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1
<< 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1
<< 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << endr
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1
<< 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1
<< 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1
<< 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1
<< 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << endr;
modulation_mapping_bittable(8) << NULL << endr;
modulation_mapping_bittable(9) << NULL << endr;
modulation_mapping_bittable(10) << NULL << endr;
modulation_mapping_bittable(11) << NULL << endr;
modulation_mapping_bittable(12) << NULL << endr;
modulation_mapping_bittable(13) << NULL << endr;
modulation_mapping_bittable(14) << NULL << endr;
modulation_mapping_bittable(15) << NULL << endr;
} /* end of getCQITable() */
/* end of getCQItable.cpp */
|
[
"[email protected]"
] | |
3630d5d7dcc578d28d910d85e3bc1f4996ca5c0b
|
962111f42e0b3eb528a4a30ffe027cd4782adf0c
|
/1035 - Intelligent Factorial Factorization.cpp
|
2113f676e35271c25459f98ad7eacd73ecc7d0c7
|
[] |
no_license
|
opi919/LightOj
|
78ba447859c005d561056b2f87547037ff95aece
|
20a96b01cd2768555be861572c48445b06632a0b
|
refs/heads/main
| 2023-01-20T13:25:29.903110 | 2020-11-24T08:00:25 | 2020-11-24T08:00:25 | 315,558,380 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,068 |
cpp
|
#include<iostream>
#include<bits/stdc++.h>
//#include<cstring>
//#include<stack>
//#include<deque>
//#include<vector>
//#include<cmath>
//#define pi acos(-1)
using namespace std;
int main()
{
int i,j,k=0,l,n,m,t,s,max=0,q;
int a[100],b[100];
// a[100]= {0};
for(i=2;i<100;i++){
a[i]=0;
//printf("%d\n",a[i]);
}
for(i=2; i<100; i++)
{
if(a[i]==0)
{
for(j=i*2; j<100; j+=i)
{
a[j]=1;
}
b[k++]=i;
}
}
// for(i=0;i<k;i++)
// printf("%d\n",b[i]);
cin>>t;
for(i=1; i<=t; i++)
{
cin>>n;
if(n==2) {
printf("Case %d: 2 = 2 (1)\n",i);
}
else {
int c[100]= {0};
max=0;
c[2]=1;
l=0;
//s=0;
for(j=3; j<=n; j++)
{
l=0;
s=j;
while(1)
{
if(s%b[l]==0)
{
s=s/b[l];
c[b[l]]++;
}
else
l++;
if(s==1)
break;
if(l==k)
break;
}
if(b[l]>max) max=b[l];
}
// for(j=0;j<=max;j++)
// printf("%d\n",c[j]);
//max=b[l-1];
// printf("max=%d\n",max);
q=0;
printf("Case %d: ",i);
for(j=0; j<=max; j++)
{
if(q==0)
{
if(j==max)
{
printf("%d = %d (%d)\n",n,j,c[j]);
q=1;
}
else if(c[j]!=0)
{
printf("%d = %d (%d) * ",n,j,c[j]);
q=1;
}
}
else if(j==max) {printf("%d (%d)\n",j,c[j]);}
else if(c[j]!=0)
printf("%d (%d) * ",j,c[j]);
}
}
}
return 0;
}
|
[
"[email protected]"
] | |
c1914941b9561c60c90996fb3112c0e80a3e63d4
|
33ed9c43c50d10154f781f09766c7ddf8a231d1c
|
/stopPair/DYJetsToLL_mc/DYJetsToLL_tauTau_mc_fakeRate.cc
|
f5ee018c2adcfeb07f13fcc93b648373d273f20b
|
[] |
no_license
|
SohamBhattacharya/StopPairToTau_analysis
|
56a6f144f5fdcd29b8d57d1d97b5f50620745516
|
40dd6098dfacebc84cbe9015859a1768a288b624
|
refs/heads/master
| 2023-03-22T21:11:23.883429 | 2021-03-03T09:41:42 | 2021-03-03T09:41:42 | 329,220,151 | 0 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,629 |
cc
|
# include <iostream>
# include <fstream>
# include <string>
# include <vector>
# include <CLHEP/Vector/LorentzVector.h>
# include <TFile.h>
# include <TH1F.h>
# include <TTable.h>
# include <TTree.h>
# include <TVector.h>
# include "HeaderFiles/Common.h"
# include "HeaderFiles/FakeRate_tauTau.h"
int main()
{
std::string process = "@process@";
std::string dir = "@dir@";
std::string otherInfoDir = "@otherInfoDir@";
std::string sourceFileName = "@sourceFileName@";
std::string era = "@era@";
if(
!process.compare(Common::process_str_template) ||
!dir.compare(Common::dir_str_template) ||
!otherInfoDir.compare(Common::otherInfoDir_str_template) ||
!sourceFileName.compare(Common::sourceFileName_str_template)
)
{
std::printf("Warning!!! \n");
std::printf("Invalid configuration. Using default options. \n\n");
process = "DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_Summer16";
dir = "DYJetsToLL_mc/output_tauTau_fakeRate/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_Summer16_tauTau_fakeRate";
otherInfoDir = "DYJetsToLL_mc";
sourceFileName = "sourceFiles/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_Summer16/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_Summer16_custom.txt";
era = "2016";
}
bool isMC = true;
FakeRate_tauTau::initialize(
process,
dir,
otherInfoDir,
sourceFileName,
isMC,
era,
Common::m_eventWeight_nJetBin_DYJetsToLL.at(era)
);
return 0;
}
|
[
"[email protected]"
] | |
ab5c2369d515bdd25d1998d5ae249f8a8772c1dd
|
66263a415339473ad1f4f9e32cc102b9d23fdc37
|
/CodeForces/ACM USICT-1/F_Directional_Move.cpp
|
9996b6a8b4e1f5e04a5fc0724b885bcc4c738e52
|
[] |
no_license
|
leetcode-notes/Competitive-Programming-2
|
b08b3e4dd437e2d146cb90522713821a4852a5fe
|
c0efb523340d09a901c53b33b40875d102108768
|
refs/heads/master
| 2023-04-03T22:31:13.628879 | 2021-04-19T13:34:11 | 2021-04-19T13:34:11 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,049 |
cpp
|
//------------------------------------------------------------------------------
#include <iostream>
#include <vector>
// #include <bits/stdc++.h>
// #include <cmath>
// #include <algorithm>
// #include <unordered_map>
// #include <map>
// #include <set>
// #include <unordered_set>
//------------------------------------------------------------------------------
using namespace std;
//------------------------------------------------------------------------------
#define FastIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define v(Type) vector<Type>
#define w(T) \
int T; \
cin >> T; \
while (T--)
#define int long long int
#define mod 1000000007ll
#define endl "\n"
//------------------------------------------------------------------------------
// Any fucntion can be called using Math.function_name();
//------------------------------------------------------------------------------
class Math
{
public:
//Returns gcd of two numbers
int gcd(int a, int b)
{
return (a % b == 0) ? b : gcd(b, a % b);
}
//Returns lcm of two numbers
int lcm(int a, int b)
{
return a * (b / gcd(a, b));
}
// Returns flag array isPrime
// isPrime[i] = true (if i is Prime)
// isPrime[i] = false (if i is not Prime)
vector<bool> *seiveOfEratosthenes(const int N)
{
vector<bool> *isPrime = new vector<bool>(N + 1, true);
(*isPrime)[0] = (*isPrime)[1] = false;
for (int i = 2; i * i <= N; ++i)
if ((*isPrime)[i])
for (int j = i * i; j <= N; j += i)
(*isPrime)[j] = false;
return isPrime;
}
//Returns (x ^ n)
int pow(const int &x, int n)
{
if (n == 0)
return 1;
int h = pow(x, n / 2);
return (n & 1) ? h * h * x : h * h;
}
//Returns (x ^ n) % M
int pow(const int &x, int n, const int &M)
{
if (n == 0)
return 1;
int h = pow(x, n / 2) % M;
return (n & 1) ? (h * h * x) % M : (h * h) % M;
}
//Returns all Primes <= N
vector<int> *primesUptoN(const int N)
{
vector<bool> *isPrime = seiveOfEratosthenes(N);
vector<int> *Primes = new vector<int>;
if (2 <= N)
(*Primes).push_back(2);
for (int i = 3; i <= N; i += 2)
if ((*isPrime)[i])
(*Primes).push_back(i);
return Primes;
}
} Math;
//------------------------------------------------------------------------------
void solve()
{
char T[] = {'E', 'S', 'W', 'N'};
int n;
cin >> n;
string s;
cin >> s;
int x = 0;
for (char ch : s)
{
if (ch == '1')
x--;
else
x++;
x = (x + 4) % 4;
}
cout << T[x] << endl;
}
//------------------------------------------------------------------------------
int32_t main()
{
FastIO;
w(T)
solve();
return 0;
}
//------------------------------------------------------------------------------
|
[
"[email protected]"
] | |
1820ee79fef502cfe656452300406673463efc38
|
770fc08a3570bc8c9efec748ba781721025f7991
|
/Introduction/QVariantTest/mainwindow.cpp
|
7140377e2c427de86728543692da88b52365b29b
|
[
"MIT"
] |
permissive
|
mwt-0722/QtStudy
|
0a940f5e6a515d7f0f604728a06ea72699b31867
|
34d24affada2a10c901fb9571473a33c871201fa
|
refs/heads/master
| 2023-06-03T20:01:51.191351 | 2021-06-25T13:36:21 | 2021-06-25T13:36:21 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,427 |
cpp
|
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
// 此处用到了c++中的隐式类型转换
// 整形数
int value = dataPlus(10, 20).toInt();
// 字符串
QString str = dataPlus("hello ", "world").toString();
qDebug() << "int value: " << value;
qDebug() << "string value: " << str;
// 创建Person对象
Person p;
p.id = 250;
p.name = "张三丰";
// 将自定义数据类型转换成QVariant对象,有两种方法
// 成员方法
#if 0
QVariant v;
v.setValue(p);
#else
// 静态方法
QVariant v = QVariant::fromValue(p);
#endif
// 取出v对象中的数据,用canConvert对数据类型进行转换
if (v.canConvert<Person>())
{
Person tmp = v.value<Person>();
qDebug() << "id: " << tmp.id << ", name: " << tmp.name;
}
}
MainWindow::~MainWindow()
{
delete ui;
}
QVariant MainWindow::dataPlus(QVariant a, QVariant b)
{
QVariant ret;
// 判断当前参数的类型是字符串还是整形数
if (a.type() == QVariant::Int && b.type() == QVariant::Int)
{
ret = QVariant(a.toInt() + b.toInt());
}
else if (a.type() == QVariant::String && b.type() == QVariant::String)
{
ret.setValue(a.toString() + b.toString());
}
return ret;
}
|
[
"[email protected]"
] | |
2e8cb9893932fea8c007333457d5b19573ad54c0
|
5ae308aaa7bb2e60b1ddff28fcaf39567da1b6ae
|
/LCP/lcp_107.cpp
|
24eb4eaf4acec45a77b4685ac4a7cc68745efc0f
|
[] |
no_license
|
jiahonglin/LCP
|
55cde187f98b8a013544f95aea6087df92516fc3
|
1805972511193dd91103ced834bdd35302481e98
|
refs/heads/master
| 2023-08-17T06:59:00.287333 | 2023-08-16T15:34:14 | 2023-08-16T15:34:14 | 189,690,649 | 2 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,007 |
cpp
|
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
* };
*/
class Solution {
public:
vector<vector<int>> levelOrderBottom(TreeNode* root) {
//stack<vector<int>> st;
vector<vector<int>>sol;
vector<vector<int>>sol2;
levelOrder(root,0,sol);
for(int i=sol.size()-1;i>=0;i--){
sol2.push_back(sol[i]);
}
return sol2;
}
void levelOrder(TreeNode* root, int level, vector<vector<int>>& sol){
if(!root) return;
if(sol.size() == level) sol.push_back({});
sol[level].push_back(root->val);
if(root->left) levelOrder(root->left,level+1,sol);
if(root->right) levelOrder(root->right,level+1,sol);
}
};
|
[
"[email protected]"
] | |
7923bd9a0a053eddef832f18c6ba1dcb77703523
|
bc677ff45c44383cfe9b4f3233d33c5dd6283dbc
|
/手套/源.cpp
|
1da41e854cdb8964ac76d4cb15c431fd99aa8b24
|
[] |
no_license
|
zh593245631/nowcoder
|
16a168fb470cb9134bfb2fb9ce764aecb559e670
|
695ca9f2c45a888bfb5d04d8ae416d3b0a0a6659
|
refs/heads/master
| 2022-02-22T02:51:03.570356 | 2019-09-11T10:15:24 | 2019-09-11T10:15:24 | 191,264,578 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 539 |
cpp
|
class Gloves {
public:
int findMinimum(int n, vector<int> left, vector<int> right) {
// write code here
int ret = 0;
int leftmin = INT_MAX;
int rightmin = INT_MAX;
int leftnum = 0;
int rightnum = 0;
for (int i = 0; i < n; ++i)
{
if (left[i] * right[i] == 0) {
ret += left[i] + right[i];
}
else {
leftnum += left[i];
rightnum += right[i];
leftmin = min(leftmin, left[i]);
rightmin = min(rightmin, right[i]);
}
}
return ret + min(leftnum - leftmin + 1, rightnum - rightmin + 1) + 1;
}
};
|
[
"[email protected]"
] | |
07fb64ac61a417053d10f8a815189174af73ce12
|
031c4d63c0741b25cb1f961288736d5adb395863
|
/iChicken/Util.cpp
|
83cb4741717b58cac70a3eee75294e57da4ec3be
|
[
"WTFPL"
] |
permissive
|
zulc22/iChicken
|
dce073a9c2a29334b54b807957fca8968e474f40
|
8da17cdb9f53793b7c2c18cb8a69e15bf45cfee9
|
refs/heads/master
| 2023-02-11T04:09:24.038306 | 2021-01-08T18:31:53 | 2021-01-08T18:31:53 | 324,917,278 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 655 |
cpp
|
#include "globals.h"
#include "Util.h"
namespace Util {
std::string concatstrs(int argnum, ...) {
va_list valist;
va_start(valist, argnum);
std::string output;
for (int vli = 0; vli < argnum; vli++) {
output.append(va_arg(valist, std::string));
}
va_end(valist);
return output;
}
// curdir() adapted from Anvi Jain's article on tutorialspoint
// https://www.tutorialspoint.com/find-out-the-current-working-directory-in-c-cplusplus
std::string curdir() {
char buf[CURDIR_dirbufsize];
char* cdbo = curdirbuf(buf, CURDIR_dirbufsize);
ERRIF(cdbo == NULL, "Couldn't get current directory");
return std::string(buf);
}
}
|
[
"[email protected]"
] | |
adcb91b72d146bc7e6afa8e92d7fb84da3048b1a
|
d9dd9374c9828ee894fbe55dc0424eb4bac045b7
|
/lframework/src/physics/Quadtree.cpp
|
d4c1606064ab90cd94afdd1c877f348ca303f4d6
|
[] |
no_license
|
taqu/lime
|
60cd884e8ce4ce44d00bfa2c31dfdff52357c355
|
af4ca1aa9f6e28fb9547088cca5b9e3fced49ed7
|
refs/heads/master
| 2020-12-24T14:10:26.711762 | 2018-10-07T23:10:36 | 2018-10-07T23:10:36 | 34,679,770 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 5,529 |
cpp
|
/**
@file Quadtree.cpp
@author t-sakai
@date 2016/12/19 create
*/
#include "physics/Quadtree.h"
namespace lfw
{
const s32 Quadtree::LevelIndexStart[MaxLevels] =
{
0,
1,
5,
21,
};
u32 Quadtree::separateBy1(u32 x)
{
x = (x | (x << 8)) & 0x00FF00FFU;
x = (x | (x << 4)) & 0x0F0F0F0FU;
x = (x | (x << 2)) & 0x33333333U;
x = (x | (x << 1)) & 0x55555555U;
return x;
}
u32 Quadtree::mortonCode2(u32 x, u32 y)
{
return Quadtree::separateBy1(x) | (Quadtree::separateBy1(y) << 1);
}
void Quadtree::calcContains2(s32& level, s32& childIndex, u32 minCode, u32 maxCode)
{
u32 x = minCode ^ maxCode;
level = 0;
childIndex = 0;
s32 index = 0;
for(s32 i=0; i<Quadtree::MaxLevels; ++i){
u32 n = x & 0x03U;
if(n != 0){
level = Quadtree::MaxLevels - i - 1;
index = i;
}
x >>= 2;
}
childIndex = (maxCode >> (level*2))&0x03U;
}
s32 Quadtree::calcIndex2(s32 level, s32 childIndex)
{
LASSERT(0<=level && level<MaxLevels);
return Quadtree::LevelIndexStart[level] + childIndex;
}
s32 Quadtree::getParentIndex(s32 index)
{
return (index-1)>>2;
}
s32 Quadtree::getChildStartIndex(s32 index)
{
return (index<<2) + 1;
}
Quadtree::Quadtree()
{
bmin_ = lmath::Vector2::zero();
bmax_ = lmath::Vector2::zero();
invUnit_ = lmath::Vector2::one();
numSplits_ = 1;
for(s32 i=0; i<MaxLevels; ++i){
numSplits_ <<= 1;
}
clear();
}
Quadtree::~Quadtree()
{
}
void Quadtree::clear()
{
for(s32 i=0; i<NumNodes; ++i){
nodeTops_[i] = ColliderBase::Invalid;
}
colliderBases_.clear();
}
void Quadtree::reset()
{
for(s32 i=0; i<NumNodes; ++i){
nodeTops_[i] = ColliderBase::Invalid;
}
for(s32 i=0; i<colliderBases_.size(); ++i){
recalc(reinterpret_cast<ColliderBase2D*>(colliderBases_[i]));
}
}
void Quadtree::setRange(const lmath::Vector2& bmin, const lmath::Vector2& bmax)
{
bmin_ = bmin;
bmax_ = bmax;
invUnit_ = bmax_;
invUnit_ -= bmin_;
for(s32 i=0; i<2; ++i){
invUnit_[i] = static_cast<f32>(numSplits_)/invUnit_[i];
}
}
u32 Quadtree::calcMortonCode2(const lmath::Vector2& position)
{
u32 v[2];
for(s32 i=0; i<2; ++i){
v[i] = static_cast<u32>((position[i] - bmin_[i])*invUnit_[i]);
v[i] = (v[i]<static_cast<u32>(numSplits_))? v[i] : numSplits_-1;
}
return Quadtree::mortonCode2(v[0], v[1]);
}
void Quadtree::add(ColliderBase2D* node)
{
LASSERT(NULL != node);
LASSERT(colliderBases_.size()<MaxColliders);
lmath::Vector2 bmin, bmax;
node->getBoundingBox(bmin, bmax);
u32 minCode = calcMortonCode2(bmin);
u32 maxCode = calcMortonCode2(bmax);
s32 level;
s32 childIndex;
calcContains2(level, childIndex, minCode, maxCode);
s32 index = calcIndex2(level, childIndex);
node->setID(static_cast<u16>(colliderBases_.size()));
node->setNext(ColliderBase::Invalid);
colliderBases_.push_back(node);
push(node, index);
}
void Quadtree::recalc(ColliderBase2D* node)
{
lmath::Vector2 bmin, bmax;
node->getBoundingBox(bmin, bmax);
u32 minCode = calcMortonCode2(bmin);
u32 maxCode = calcMortonCode2(bmax);
s32 level;
s32 childIndex;
calcContains2(level, childIndex, minCode, maxCode);
s32 index = calcIndex2(level, childIndex);
node->setID(static_cast<u16>(colliderBases_.size()));
node->setNext(ColliderBase::Invalid);
push(node, index);
}
void Quadtree::collideAll(CollisionPairArray& collisions)
{
depth_ = 0;
innerCollideAll(0, collisions);
}
void Quadtree::push(ColliderBase2D* node, s32 index)
{
node->setNext(nodeTops_[index]);
nodeTops_[index] = node->getID();
}
void Quadtree::innerCollideAll(s32 nodeIndex, CollisionPairArray& collisions)
{
u16 nid0 = nodeTops_[nodeIndex];
while(ColliderBase::Invalid != nid0){
u16 nid1 = colliderBases_[nid0]->getNext();
while(ColliderBase::Invalid != nid1){
collisions.push_back(CollisionPair::construct(colliderBases_[nid0], colliderBases_[nid1]));
nid1 = colliderBases_[nid1]->getNext();
}
for(s32 i=0; i<depth_; ++i){
nid1 = nodeTops_[ancestorStack_[i]];
nid1 = colliderBases_[nid1]->getNext();
while(ColliderBase::Invalid != nid1){
collisions.push_back(CollisionPair::construct(colliderBases_[nid0], colliderBases_[nid1]));
nid1 = colliderBases_[nid1]->getNext();
}
}
nid0 = colliderBases_[nid0]->getNext();
}
if((MaxLevels-1)<=depth_){
return;
}
ancestorStack_[depth_] = nodeIndex;
++depth_;
s32 nextIndex = getChildStartIndex(nodeIndex);
for(s32 i=0; i<4; ++i){
innerCollideAll(nextIndex+i, collisions);
}
--depth_;
}
}
|
[
"[email protected]"
] | |
6528c5cd048c42e34aaf575868cb183e380e1334
|
420f84f9c8d3edbe4ae1d19b8c18b4fcb558d048
|
/windows/runner/main.cpp
|
e8b807c6364d66a87d63ef337221ba7320a67877
|
[] |
no_license
|
adarsh-technocrat/Restaurant-Food-App-UI
|
24c7a304138bac7b2f0254cf1ab702027d71d031
|
d2486e3a6127a11f98cb277eb39adfe75a1c73b1
|
refs/heads/master
| 2023-01-08T23:19:29.334598 | 2020-11-12T12:01:25 | 2020-11-12T12:01:25 | 312,263,040 | 1 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,063 |
cpp
|
#include <flutter/dart_project.h>
#include <flutter/flutter_view_controller.h>
#include <windows.h>
#include "flutter_window.h"
#include "run_loop.h"
#include "utils.h"
int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
_In_ wchar_t *command_line, _In_ int show_command) {
// Attach to console when present (e.g., 'flutter run') or create a
// new console when running with a debugger.
if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
CreateAndAttachConsole();
}
// Initialize COM, so that it is available for use in the library and/or
// plugins.
::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
RunLoop run_loop;
flutter::DartProject project(L"data");
FlutterWindow window(&run_loop, project);
Win32Window::Point origin(10, 10);
Win32Window::Size size(1280, 720);
if (!window.CreateAndShow(L"restaurantfoodapp", origin, size)) {
return EXIT_FAILURE;
}
window.SetQuitOnClose(true);
run_loop.Run();
::CoUninitialize();
return EXIT_SUCCESS;
}
|
[
"[email protected]"
] | |
071466d96c18a67a3a08fe7012327bcd63309652
|
e785c89990cfa92e03e5c67ade86becc46db9f47
|
/math/medium/trainPlatforms.cpp
|
ba435d35cad03fbb4333f02d71fa15407608bc76
|
[] |
no_license
|
DmitriiKostrov/algo
|
c358e59b575a20a3481ffa910d64f9d2cadbd36c
|
2f8c33991086ffd9a82bf03c56fa32ea75ba17dc
|
refs/heads/master
| 2022-11-08T05:41:30.372746 | 2022-10-25T19:56:18 | 2022-10-25T19:56:18 | 154,929,633 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,636 |
cpp
|
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;
//https://practice.geeksforgeeks.org/problems/minimum-platforms/0
size_t minTrainPlatforms(const vector<int> &arriv, const vector<int> &depar)
{
vector<int> all = arriv;
all.insert(all.begin(), depar.begin(), depar.end());
sort(all.begin(), all.end());
map<int,int> dmap;
for (auto a: depar)
{
auto it = dmap.find(a);
if (it == end(dmap))
dmap[a] = 1;
else
it->second++;
}
size_t max = 0;
size_t plat = 0;
for(const auto a: all)
{
auto it_d = dmap.find(a);
if (it_d != end(dmap) && it_d->second > 0) {
plat--;
it_d->second--;
}
else {
plat++;
if (plat > max)
max = plat;
}
}
return max;
}
void test(const vector<int> &arriv, const vector<int> &depar) {
size_t res = minTrainPlatforms(arriv, depar);
printf("Res: %d\n", (int)res);
}
int main() {
test({900, 940, 950, 1100, 1500, 1800},
{910, 1200, 1120, 1130, 1900, 2000});
test({635, 1032, 632, 940, 1141, 1509, 1359, 128, 123, 626, 313, 350,
853, 1551, 54, 123, 357, 1500, 334, 1315, 131, 1008, 33, 926,
907, 932, 452, 127, 704, 1854, 1718, 1924, 1337, 623, 720},
{1202, 2100, 2151, 941, 1751, 1549, 1411, 949, 1500, 647, 2105,
1350, 1552, 2300, 2022, 1238, 2013, 1543, 2300, 1332, 2125,
1300, 200, 941, 924, 1030, 800, 2010, 755, 1857, 1829, 2335,
1348, 1700, 1500});
return 0;
}
|
[
"[email protected]"
] | |
7f2a932ccfbccedce19adf936a84eb9a08f71e1d
|
59f65aebb677f7a80cd97b4cecd1e5bc34b767d4
|
/src/qt/sendcoinsentry.cpp
|
fcd8a6ee56001e37bde151d30f01517050eb0c81
|
[
"MIT"
] |
permissive
|
nikulyak1980/TAL
|
615aaef60c2afe6a5656fa416fe0f645f4a72a69
|
956f77b0cfdf1812c88555395e91c12dc2b10a8c
|
refs/heads/master
| 2020-03-28T20:42:53.035817 | 2018-07-04T09:55:08 | 2018-07-04T09:55:08 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 7,457 |
cpp
|
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The DASH developers
// Copyright (c) 2015-2017 The PIVX developers
// Copyright (c) 2018 The TALUS developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "sendcoinsentry.h"
#include "ui_sendcoinsentry.h"
#include "addressbookpage.h"
#include "addresstablemodel.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "walletmodel.h"
#include <QApplication>
#include <QClipboard>
SendCoinsEntry::SendCoinsEntry(QWidget* parent) : QStackedWidget(parent),
ui(new Ui::SendCoinsEntry),
model(0)
{
ui->setupUi(this);
setCurrentWidget(ui->SendCoins);
#ifdef Q_OS_MAC
ui->payToLayout->setSpacing(4);
#endif
#if QT_VERSION >= 0x040700
ui->addAsLabel->setPlaceholderText(tr("Enter a label for this address to add it to your address book"));
#endif
// normal tal address field
GUIUtil::setupAddressWidget(ui->payTo, this);
// just a label for displaying tal address(es)
ui->payTo_is->setFont(GUIUtil::bitcoinAddressFont());
// Connect signals
connect(ui->payAmount, SIGNAL(valueChanged()), this, SIGNAL(payAmountChanged()));
connect(ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteClicked()));
connect(ui->deleteButton_is, SIGNAL(clicked()), this, SLOT(deleteClicked()));
connect(ui->deleteButton_s, SIGNAL(clicked()), this, SLOT(deleteClicked()));
}
SendCoinsEntry::~SendCoinsEntry()
{
delete ui;
}
void SendCoinsEntry::on_pasteButton_clicked()
{
// Paste text from clipboard into recipient field
ui->payTo->setText(QApplication::clipboard()->text());
}
void SendCoinsEntry::on_addressBookButton_clicked()
{
if (!model)
return;
AddressBookPage dlg(AddressBookPage::ForSelection, AddressBookPage::SendingTab, this);
dlg.setModel(model->getAddressTableModel());
if (dlg.exec()) {
ui->payTo->setText(dlg.getReturnValue());
ui->payAmount->setFocus();
}
}
void SendCoinsEntry::on_payTo_textChanged(const QString& address)
{
updateLabel(address);
}
void SendCoinsEntry::setModel(WalletModel* model)
{
this->model = model;
if (model && model->getOptionsModel())
connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
clear();
}
void SendCoinsEntry::clear()
{
// clear UI elements for normal payment
ui->payTo->clear();
ui->addAsLabel->clear();
ui->payAmount->clear();
ui->messageTextLabel->clear();
ui->messageTextLabel->hide();
ui->messageLabel->hide();
// clear UI elements for insecure payment request
ui->payTo_is->clear();
ui->memoTextLabel_is->clear();
ui->payAmount_is->clear();
// clear UI elements for secure payment request
ui->payTo_s->clear();
ui->memoTextLabel_s->clear();
ui->payAmount_s->clear();
// update the display unit, to not use the default ("BTC")
updateDisplayUnit();
}
void SendCoinsEntry::deleteClicked()
{
emit removeEntry(this);
}
bool SendCoinsEntry::validate()
{
if (!model)
return false;
// Check input validity
bool retval = true;
// Skip checks for payment request
if (recipient.paymentRequest.IsInitialized())
return retval;
if (!model->validateAddress(ui->payTo->text())) {
ui->payTo->setValid(false);
retval = false;
}
if (!ui->payAmount->validate()) {
retval = false;
}
// Sending a zero amount is invalid
if (ui->payAmount->value(0) <= 0) {
ui->payAmount->setValid(false);
retval = false;
}
// Reject dust outputs:
if (retval && GUIUtil::isDust(ui->payTo->text(), ui->payAmount->value())) {
ui->payAmount->setValid(false);
retval = false;
}
return retval;
}
SendCoinsRecipient SendCoinsEntry::getValue()
{
// Payment request
if (recipient.paymentRequest.IsInitialized())
return recipient;
// Normal payment
recipient.address = ui->payTo->text();
recipient.label = ui->addAsLabel->text();
recipient.amount = ui->payAmount->value();
recipient.message = ui->messageTextLabel->text();
return recipient;
}
QWidget* SendCoinsEntry::setupTabChain(QWidget* prev)
{
QWidget::setTabOrder(prev, ui->payTo);
QWidget::setTabOrder(ui->payTo, ui->addAsLabel);
QWidget* w = ui->payAmount->setupTabChain(ui->addAsLabel);
QWidget::setTabOrder(w, ui->addressBookButton);
QWidget::setTabOrder(ui->addressBookButton, ui->pasteButton);
QWidget::setTabOrder(ui->pasteButton, ui->deleteButton);
return ui->deleteButton;
}
void SendCoinsEntry::setValue(const SendCoinsRecipient& value)
{
recipient = value;
if (recipient.paymentRequest.IsInitialized()) // payment request
{
if (recipient.authenticatedMerchant.isEmpty()) // insecure
{
ui->payTo_is->setText(recipient.address);
ui->memoTextLabel_is->setText(recipient.message);
ui->payAmount_is->setValue(recipient.amount);
ui->payAmount_is->setReadOnly(true);
setCurrentWidget(ui->SendCoins_InsecurePaymentRequest);
} else // secure
{
ui->payTo_s->setText(recipient.authenticatedMerchant);
ui->memoTextLabel_s->setText(recipient.message);
ui->payAmount_s->setValue(recipient.amount);
ui->payAmount_s->setReadOnly(true);
setCurrentWidget(ui->SendCoins_SecurePaymentRequest);
}
} else // normal payment
{
// message
ui->messageTextLabel->setText(recipient.message);
ui->messageTextLabel->setVisible(!recipient.message.isEmpty());
ui->messageLabel->setVisible(!recipient.message.isEmpty());
ui->addAsLabel->clear();
ui->payTo->setText(recipient.address); // this may set a label from addressbook
if (!recipient.label.isEmpty()) // if a label had been set from the addressbook, dont overwrite with an empty label
ui->addAsLabel->setText(recipient.label);
ui->payAmount->setValue(recipient.amount);
}
}
void SendCoinsEntry::setAddress(const QString& address)
{
ui->payTo->setText(address);
ui->payAmount->setFocus();
}
bool SendCoinsEntry::isClear()
{
return ui->payTo->text().isEmpty() && ui->payTo_is->text().isEmpty() && ui->payTo_s->text().isEmpty();
}
void SendCoinsEntry::setFocus()
{
ui->payTo->setFocus();
}
void SendCoinsEntry::updateDisplayUnit()
{
if (model && model->getOptionsModel()) {
// Update payAmount with the current unit
ui->payAmount->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
ui->payAmount_is->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
ui->payAmount_s->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
}
}
bool SendCoinsEntry::updateLabel(const QString& address)
{
if (!model)
return false;
// Fill in label from address book, if address has an associated label
QString associatedLabel = model->getAddressTableModel()->labelForAddress(address);
if (!associatedLabel.isEmpty()) {
ui->addAsLabel->setText(associatedLabel);
return true;
}
return false;
}
|
[
"[email protected]"
] | |
29ac06993b0fa0a9adc519198b3d3f28179f0332
|
b6ed2145ed73919ec42f3d34ccb67a7ecc621b3a
|
/c++/C++primer/1/1.16.cpp
|
d44a45bf6c26891e71e8db99a52ce5226a59109b
|
[] |
no_license
|
gilsaia/college-study
|
26d9813ab5e5f125618aec787c942e442b0fb630
|
66d2dda1b322077fd58abe56ba602da5260856be
|
refs/heads/master
| 2021-06-03T06:23:05.770868 | 2019-09-22T14:22:22 | 2019-09-22T14:22:22 | 138,689,516 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 159 |
cpp
|
#include<iostream>
int main()
{
int t,sum=0;
while(std::cin>>t)
{
sum+=t;
}
std::cout<<"The Sum is "<<t<<std::endl;
return 0;
}
|
[
"[email protected]"
] | |
64af091cbcf44d3b576c36517ccaa9de84c9cbb1
|
89107378d223c946af22f9f0fa2151b2a34d4a0d
|
/demo-simple-atm/Commands/Login.cpp
|
3e597a0be213b755179c609fcbb2392c7c6d1b03
|
[] |
no_license
|
GregorSuperSamsa/demo-simple-atm
|
789d76399b4c98e12c42a87b91f002cbc64ab51a
|
e75d7efdefcba7ee02c63289e848a19ced9a749e
|
refs/heads/master
| 2022-06-05T12:30:05.297677 | 2020-04-20T21:54:30 | 2020-04-20T21:54:30 | 255,420,817 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,003 |
cpp
|
#include "Login.h"
#include <algorithm>
#include "../Utils/Debug.h"
const bool dbg = false;
Login::Login(std::string cmd_string, std::string cmd_description)
: string(cmd_string), description(cmd_description)
{
auto thread_id = std::this_thread::get_id();
DEBUG(dbg, __PRETTY_FUNCTION__, "Thread id:", thread_id);
}
void Login::Initialize(const std::shared_ptr<Account>& account)
{
this->account = account;
}
void Login::Execute(std::vector<std::string> params, std::string& output)
{
output.clear();
if (2 == params.size())
{
std::string username = params.at(0);
std::string password = params.at(1);
if (account->Login(username, password))
output = "Wellcome, " + username + "!";
else
output = "Error! Unable to login.";
}
else
output = "Error! Invalid parameters.";
}
std::string Login::String() const
{
return string;
}
std::string Login::Description() const
{
return description;
}
|
[
"[email protected]"
] | |
7407fb2601ecbf889668b80e1bedb03344dbf7ae
|
9c358fda081f82f0efc020f854db89948e63046f
|
/Classes/Scenes/SceneStyle.h
|
1b0853a168ac14b2e100efee903b63a665755979
|
[] |
no_license
|
seagullua/MathIsFun2
|
3ceabce4e5198b4224d3ad6cc87a943e1d8b879d
|
b9db27d8fa7b32e5e0fd55e1f8e67d5faaa64cc9
|
refs/heads/master
| 2020-04-15T16:13:45.774871 | 2015-06-28T10:50:54 | 2015-06-28T10:50:54 | 20,071,840 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 473 |
h
|
#ifndef SCENESTYLE_H
#define SCENESTYLE_H
#include "cocos2d.h"
#include <ADLib.h>
#include "GameInfo.h"
#ifndef WIN32
#define final
#endif
class SceneStyle : public cocos2d::CCLayer, public HasSlots
{
public:
typedef ADCallFunc::Action Action;
void simulateBackClick();
protected:
SceneStyle();
bool init();
ADPopUpWindowManager _pop_up_manager;
virtual void onBackClick()=0;
private:
void keyBackClicked() final;
};
#endif // SCENESTYLE_H
|
[
"[email protected]"
] | |
f4b0b43b3642f270f75006aa075052c9b6838edb
|
6ce1fbc94f784a315838bd3617ce69695cbc8eeb
|
/main.cpp
|
09e77f785c9d181fe98acd90601c5f441ac4699c
|
[] |
no_license
|
TheTobias1/Platformer-Demo
|
1038dab75c4c36132906a82318185ebf1008854f
|
bf723451b5e49a9b655317a05479b0cd644206ad
|
refs/heads/master
| 2022-12-29T20:33:40.604836 | 2020-10-18T17:18:30 | 2020-10-18T17:18:30 | 305,155,380 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 104 |
cpp
|
#include "GameLoop.h"
#include <iostream>
int main(int argc, char* argv[])
{
RunGame();
return 0;
}
|
[
"[email protected]"
] | |
6290b94052232c9d660d5c839369e690a9737a98
|
0bf1f7b901118b5cbe3d51bbc5885fcb634419c5
|
/Cpp/SDK/MoviePlayer_structs.h
|
6e913be97f38b0fd7d5c8800f98639c5c554cd18
|
[] |
no_license
|
zH4x-SDK/zMCDungeons-SDK
|
3a90a959e4a72f4007fc749c53b8775b7155f3da
|
ab9d8f0ab04b215577dd2eb067e65015b5a70521
|
refs/heads/main
| 2023-07-15T15:43:17.217894 | 2021-08-27T13:49:22 | 2021-08-27T13:49:22 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 633 |
h
|
#pragma once
// Name: DBZKakarot, Version: 1.0.3
/*!!DEFINE!!*/
/*!!HELPER_DEF!!*/
/*!!HELPER_INC!!*/
#ifdef _MSC_VER
#pragma pack(push, 0x01)
#endif
namespace CG
{
//---------------------------------------------------------------------------
// Enums
//---------------------------------------------------------------------------
// Enum MoviePlayer.EMoviePlaybackType
enum class MoviePlayer_EMoviePlaybackType : uint8_t
{
MT_Normal = 0,
MT_Looped = 1,
MT_LoadingLoop = 2,
MT_MAX = 3,
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
|
[
"[email protected]"
] | |
5c4989e40df6b41293241b540825f0930fa502ac
|
9e74431aad030b9d10b8aa0118b77d1ad1551293
|
/src/dxvk/vulkan/dxvk_vulkan_names.h
|
502a7c2f8becf87ed969bb4c9060eb2d97c64731
|
[
"Zlib",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
ah-/dxvk
|
3905b4bd8821bb27359928523f4252e8b84a044a
|
da486c99cb4e3ac5321846843dfcdf13c0167cb0
|
refs/heads/master
| 2020-04-01T11:08:54.745212 | 2018-10-15T16:52:10 | 2018-10-15T16:52:10 | 153,149,447 | 0 | 0 |
NOASSERTION
| 2018-10-15T16:51:40 | 2018-10-15T16:51:40 | null |
UTF-8
|
C++
| false | false | 922 |
h
|
#pragma once
#include <ostream>
#include "../../util/util_enum.h"
#include "dxvk_vulkan_loader_fn.h"
std::ostream& operator << (std::ostream& os, VkPipelineCacheHeaderVersion e);
std::ostream& operator << (std::ostream& os, VkResult e);
std::ostream& operator << (std::ostream& os, VkFormat e);
std::ostream& operator << (std::ostream& os, VkImageType e);
std::ostream& operator << (std::ostream& os, VkImageTiling e);
std::ostream& operator << (std::ostream& os, VkImageLayout e);
std::ostream& operator << (std::ostream& os, VkImageViewType e);
std::ostream& operator << (std::ostream& os, VkPresentModeKHR e);
std::ostream& operator << (std::ostream& os, VkColorSpaceKHR e);
std::ostream& operator << (std::ostream& os, VkOffset2D e);
std::ostream& operator << (std::ostream& os, VkOffset3D e);
std::ostream& operator << (std::ostream& os, VkExtent2D e);
std::ostream& operator << (std::ostream& os, VkExtent3D e);
|
[
"[email protected]"
] | |
bc18d803a4d950b776af9ee41bc422156e73a39c
|
5f83aa869b612478bd9b873e76117b0d1a9015ae
|
/VisionWrapper/VisionWrapper.h
|
27045b060ce4561aa0eadb98f8b50a9c5ccf9bd1
|
[] |
no_license
|
jzzfreedom/Repo
|
9a0bb890865cce53f07ac852ce2b804e62b74666
|
7a1633b6ac35fcaddd51d03bf094277f40d8eae2
|
refs/heads/master
| 2021-01-10T09:38:42.276001 | 2015-11-12T05:52:18 | 2015-11-12T05:52:18 | 44,028,960 | 0 | 0 | null | null | null | null |
GB18030
|
C++
| false | false | 205 |
h
|
// VisionWrapper.h
#pragma once
//#include <cv.h>
using namespace System;
//using namespace cv;
namespace VisionWrapper {
public ref class Class1
{
// TODO: 在此处添加此类的方法。
};
}
|
[
"[email protected]"
] | |
3729c04e418292d9bee382c2efbdb34b5c91906f
|
8dbcef241b16387a73090f308e51759c7849c928
|
/renderer/SphericLight.h
|
a06bfe1f77e6f03e5d275ecc255e9aa3e3a2d901
|
[] |
no_license
|
Khallimero/myrt_tuple
|
0e0974cfbbe48b9a2fb494799063346df99ae730
|
94d37996d58f6eea709519656a66d6db06a8df81
|
refs/heads/master
| 2023-06-07T23:31:01.281161 | 2023-06-04T12:55:08 | 2023-06-04T12:55:08 | 216,005,146 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 480 |
h
|
#pragma once
#include "PointLight.h"
class SphericLight:public PointLight
{
public:
SphericLight(double r,const Point& p,const Color& c);
virtual ~SphericLight();
public:
virtual NestedIterator<double,2>* getIterator(int ph)const;
virtual Ray getRay(const Shape* s,const Point& p,const Point& o,const NestedIterator<double,2>* it)const;
virtual const Sphere* getBox()const
{
return box;
}
protected:
double r;
const Sphere* box;
};
|
[
"kortex@opteron"
] |
kortex@opteron
|
4ce24a67b78c80793dccf73861eee1c94fd1541e
|
cb2e9817c84dd6e25bd37273ec9d14e2d08f7fd0
|
/Functions.cpp
|
dd6d5183baa483c87f8b53093f678f0ae4abb87d
|
[
"MIT"
] |
permissive
|
JSLucena/VMcode
|
c06a3c8f3a24e737192e3c010b833378093029e7
|
1038850635a4fac788ed768a32f1247cb5fdb460
|
refs/heads/master
| 2020-04-29T05:57:50.851653 | 2019-12-03T16:47:44 | 2019-12-03T16:47:44 | 175,901,150 | 0 | 0 |
MIT
| 2019-12-03T16:47:45 | 2019-03-15T22:52:03 |
C++
|
UTF-8
|
C++
| false | false | 3,131 |
cpp
|
#include "Functions.h"
//Feito por Joaquim Lucena e Christian Bobsin
unsigned int GetR1(unsigned int instReg, std::string inst)
{
unsigned int aux;
aux = instReg << 5;
aux = aux >> 29;
return aux;
}
unsigned int getR2_IMM(unsigned int instReg, std::string inst)
{
unsigned int aux;
if (inst == "JMP" || inst == "ADDI" || inst == "SUBI" || inst == "ANDI" || inst == "ORI" || inst == "LDI" || inst == "LDD" || inst == "STD")
{
aux = instReg << 16;
aux = aux >> 16;
}
else
{
aux = instReg << 8;
aux = aux >> 29;
}
return aux;
}
void limpamem(unsigned int* memoria, unsigned int tamanho)
{
int i;
for (i = 0; i < tamanho; i++)
memoria[i] = 0;
return;
}
unsigned int IFetch(unsigned int PC, unsigned int* mem)
{
return mem[PC];
}
std::string decode(unsigned int instR)
{
instR = instR >> 27;
switch (instR)
{
case 0: return "JMP";
case 1: return "JMPI";
case 2: return "JMPIG";
case 3: return "JMPIL";
case 4: return "JMPIE";
case 5: return "TRAP";
case 8: return "ADDI";
case 9: return "SUBI";
case 10: return "ANDI";
case 11: return "ORI";
case 12: return "LDI";
case 13: return "LDD";
case 14: return "STD";
case 16: return "ADD";
case 17: return "SUB";
case 18: return "AND";
case 19: return "OR";
case 20: return "LDX";
case 21: return "STX";
case 24: return "NOT";
case 25: return "SHL";
case 26: return "SHR";
case 27: return "SWAP";
case 28: return "MULT";
case 31: return "STOP";
default: return "INVALID_INSTRUCTION";
}
}
void MemOps(int& reg, std::string instrucao, unsigned int address, unsigned int* memoria)
{
if (instrucao == "LDD" || instrucao == "LDX")
reg = memoria[address];
else if (instrucao == "STD" || instrucao == "STX")
memoria[address] = reg;
else return;
}
bool Branch(int rs, int rc, std::string instrucao)
{
if (instrucao == "JMP" || instrucao == "JMPI")
return true;
else if (instrucao == "JMPIG" && rc > 0)
return true;
else if (instrucao == "JMPIL" && rc < 0)
return true;
else if (instrucao == "JMPIE" && rc == 0)
return true;
else return false;
}
void ULA(int& op1, unsigned int op2, std::string instrucao)
{
if (instrucao == "ADD" || instrucao == "ADDI")
op1 = op1 + op2;
else if (instrucao == "SUBI" || instrucao == "SUB")
op1 = op1 - op2;
else if (instrucao == "AND" || instrucao == "ANDI")
op1 = op1 & op2;
else if (instrucao == "OR" || instrucao == "ORI")
op1 = op1 | op2;
else if (instrucao == "MULT")
op1 = op1 * op2;
else if (instrucao == "NOT")
op1 = ~op1;
else if (instrucao == "SHL")
op1 = op1 << 1;
else if (instrucao == "SHR")
op1 = op1 >> 1;
else if (instrucao == "SWAP")
std::cout << "swap ainda nao funciona!" << std::endl;
else if (instrucao == "LDI")
op1 = op2;
else
return;
return;
}
void dumpmem(unsigned int* mem)
{
int i;
int viewcounter = 0;
for (i = 0; i <= 1023; i++)
{
printf("%d ", mem[i]);
viewcounter++;
if (viewcounter == 8)
{
std::cout << std::endl;
viewcounter = 0;
}
}
}
|
[
"[email protected]"
] | |
da7e2fe2869c2a29dd8bec8570d06d50710b02b4
|
34c465f970bc113a93c3f29573344b4569233510
|
/IsoMetricTile/Header.cpp
|
28731241be264316ec7b8f80fcd644f604437b73
|
[] |
no_license
|
901po3/IsoMetricMapTool
|
cd03e5303fbdc836d2bd6fccf86539672ac023f5
|
c105029e82ad529aeb01710204129f1dd483ad05
|
refs/heads/master
| 2021-07-09T21:10:57.417965 | 2017-10-08T19:38:54 | 2017-10-08T19:38:54 | 106,203,731 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 868 |
cpp
|
#include"Header.h"
CGPoint MakePoint(float x, float y)
{
CGPoint pos;
pos.x = x;
pos.y = y;
return pos;
}
VectorInfo Distance(CGPoint p1, CGPoint p2)
{
VectorInfo v1;
v1.vector = MakePoint(p2.x - p1.x, p2.y - p1.y);
v1.distance = sqrtf((v1.vector.x * v1.vector.x)
+ (v1.vector.y * v1.vector.y));
return v1;
}
int RandomRange(int min, int max)
{
return rand() % (max-min) + min;
}
float Clamp(float value, float min, float max)
{
if(value < min ) value = min;
if(value > max ) value = max;
return value;
}
CGPoint IsoTo2D(CGPoint pos)
{
CGPoint tpos = MakePoint(0.f, 0.f);
tpos.x = (2 * pos.y + pos.x) / 2;
tpos.y = (2 * pos.y - pos.x) / 2;
return tpos;
}
CGPoint twoDToIso(CGPoint pos)
{
CGPoint tpos = MakePoint(0.f, 0.f);
tpos.x = pos.x - pos.y;
tpos.y = (pos.x + pos.y) / 2;
return tpos;
}
|
[
"[email protected]"
] | |
d72869edd624041071e67809f8d2ca97d0da5fb1
|
3d3755305f1071914295aaf5d7e0d74934e42d02
|
/globalundoredo.h
|
4d181e8622ecd0535e4924786b3b1cd0a5c6f3ab
|
[
"MIT"
] |
permissive
|
tanminggang/virtualglass
|
7569ee0786ff737b7775819697340b025008ad28
|
f81f2d13e12f80d3bdbff802f72570e9e3e77f21
|
refs/heads/master
| 2021-09-20T18:28:30.749849 | 2018-08-13T23:52:40 | 2018-08-13T23:52:40 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 858 |
h
|
#ifndef GLOBALUNDOREDO_H
#define GLOBALUNDOREDO_H
class UndoRedo;
class MainWindow;
class GlassColor;
class Cane;
class Piece;
namespace GlobalUndoRedo
{
void setMainWindow(MainWindow* mw);
void undo();
void redo();
void addedGlassColor(GlassColor* gc, unsigned int index);
void deletedGlassColor(GlassColor* gc, unsigned int index);
void modifiedGlassColor(GlassColor* gc);
void movedGlassColor(unsigned int index, int direction);
void addedCane(Cane* c, unsigned int index);
void deletedCane(Cane* c, unsigned int index);
void modifiedCane(Cane* c);
void movedCane(unsigned int index, int direction);
void addedPiece(Piece* p, unsigned int index);
void deletedPiece(Piece* p, unsigned int index);
void modifiedPiece(Piece* p);
void movedPiece(unsigned int index, int direction);
void noPriorUndo();
void clearHistory();
}
#endif
|
[
"[email protected]"
] | |
4913fdf5bf62e7b3c1cfec1bf534114bd3c076b6
|
8d8964688ca00eed8d253998c4f1888287b78fd1
|
/TriangleObject/SmartPoint/SmartPoint.cpp
|
13751b1eaa3f629c4c99606bea1a98f70ed087be
|
[
"MIT"
] |
permissive
|
valerydol/drone_vision
|
061a117e92466bf15db9feae3906d5be2d77f2f0
|
ecb4ea9c17159c7cf72d1f3ab8b1ee9bf2adda71
|
refs/heads/master
| 2020-09-13T08:33:02.539931 | 2019-11-19T14:16:05 | 2019-11-19T14:16:05 | 222,711,786 | 2 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 823 |
cpp
|
#include "SmartPoint.h"
SmartPoint::SmartPoint( SmartPoint &rhPoint)
:point(0, 0)
{
SetPoint(rhPoint.GetPoint());
}
//ANTI - CLOCKWISE ROTATION OF Point ABOUT ORIGIN
// Rotate point ( degree )
void SmartPoint::Rotate(float _angle)
{
//cout << _angle << endl;
float xTemp = point.x;
float yTemp = point.y;
float theta = (float)( ((float)_angle )* CV_PI / 180.0F);
float c = cos(theta);
float s = sin(theta);
point.x = xTemp * c - yTemp * s;
point.y = xTemp * s + yTemp * c;
}
Point2f SmartPoint::GetPoint()const
{
return point;
}
//Translate this point
void SmartPoint::Translate(float _x, float _y)
{
point.x += _x;
point.y += _y;
}
//set point
void SmartPoint::SetPoint(const Point2f &_newPoint)
{
point.x = _newPoint.x;
point.y = _newPoint.y;
}
|
[
"[email protected]"
] | |
db27363eeee9b801d8525dd362c8678c725f237b
|
530acdb16aaf24b40eff6f1027e0c262e74e69db
|
/C++/Time.cpp
|
0f9ecede60790fdbb3f431eeeaed51442e2cbc26
|
[] |
no_license
|
visha09/Hacktoberfest-Simple-Practice-Programmes
|
af9c48e4b4142b4088f0683d81d0d7c15616c326
|
46cd5aa339328327d5a61bcf1c91be4e2fad7042
|
refs/heads/main
| 2023-09-06T02:09:42.920968 | 2021-10-27T15:46:45 | 2021-10-27T15:46:45 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,401 |
cpp
|
xample: Program to Time Difference
// Computes time difference of two time period
// Time periods are entered by the user
#include <iostream>
using namespace std;
struct TIME
{
int seconds;
int minutes;
int hours;
};
void computeTimeDifference(struct TIME, struct TIME, struct TIME *);
int main()
{
struct TIME t1, t2, difference;
cout << "Enter start time." << endl;
cout << "Enter hours, minutes and seconds respectively: ";
cin >> t1.hours >> t1.minutes >> t1.seconds;
cout << "Enter stop time." << endl;
cout << "Enter hours, minutes and seconds respectively: ";
cin >> t2.hours >> t2.minutes >> t2.seconds;
computeTimeDifference(t1, t2, &difference);
cout << endl << "TIME DIFFERENCE: " << t1.hours << ":" << t1.minutes << ":" << t1.seconds;
cout << " - " << t2.hours << ":" << t2.minutes << ":" << t2.seconds;
cout << " = " << difference.hours << ":" << difference.minutes << ":" << difference.seconds;
return 0;
}
void computeTimeDifference(struct TIME t1, struct TIME t2, struct TIME *difference){
if(t2.seconds > t1.seconds)
{
--t1.minutes;
t1.seconds += 60;
}
difference->seconds = t1.seconds - t2.seconds;
if(t2.minutes > t1.minutes)
{
--t1.hours;
t1.minutes += 60;
}
difference->minutes = t1.minutes-t2.minutes;
difference->hours = t1.hours-t2.hours;
}
|
[
"[email protected]"
] | |
b88fc4d41bdaec5b7f8de55b612763652ef198b3
|
4857048794d0ae67de0a9400f9966ebd459f46c6
|
/ZS_Main/ZS_Main/modules/juce_tracktion_marketplace/marketplace/juce_OnlineUnlockStatus.h
|
80f31d1b3936a8c4c9cbc788a6c87d38677233b3
|
[] |
no_license
|
TowaStudio/ZitherSword
|
cf8bf12d6f1d6541d5bebd02d95c9878e46fc715
|
2c2612c55f4e6c93ccb46cae77060e361e17aa3a
|
refs/heads/master
| 2021-01-12T10:24:42.214755 | 2017-05-15T04:56:29 | 2017-05-15T04:56:29 | 76,450,403 | 0 | 1 | null | 2017-05-14T17:28:10 | 2016-12-14T10:41:40 |
C++
|
UTF-8
|
C++
| false | false | 10,732 |
h
|
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2015 - ROLI Ltd.
Permission is granted to use this software under the terms of either:
a) the GPL v2 (or any later version)
b) the Affero GPL v3
Details of these licenses can be found at: www.gnu.org/licenses
JUCE 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.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.juce.com for more information.
==============================================================================
*/
/**
A base class for online unlocking systems.
This class stores information about whether your app has been unlocked for the
current machine, and handles communication with a web-store to perform the
unlock procedure.
You probably won't ever use this base class directly, but rather a store-specific
subclass such as TracktionMarketplaceStatus, which knows how to talk to the particular
online store that you're using.
To use it, you create a subclass which implements all the pure virtual methods
(see their comments to find out what you'll need to make them do).
Then you can create an instance of your subclass which will hold the registration
state. Typically, you'll want to just keep a single instance of the class around for
the duration of your app. You can then call its methods to handle the various
registration tasks.
Areas of your code that need to know whether the user is registered (e.g. to decide
whether a particular feature is available) should call isUnlocked() to find out.
If you want to create a GUI that allows your users to enter their details and
register, see the OnlineUnlockForm class.
@see OnlineUnlockForm, KeyGeneration
*/
class JUCE_API OnlineUnlockStatus
{
public:
OnlineUnlockStatus();
/** Destructor. */
virtual ~OnlineUnlockStatus();
//==============================================================================
/** This must return your product's ID, as allocated by the store. */
virtual String getProductID() = 0;
/** This must check whether a product ID string that the server returned is OK for
unlocking the current app.
*/
virtual bool doesProductIDMatch (const String& returnedIDFromServer) = 0;
/** This must return the RSA public key for authenticating responses from
the server for this app. You can get this key from your marketplace
account page.
*/
virtual RSAKey getPublicKey() = 0;
/** This method must store the given string somewhere in your app's
persistent properties, so it can be retrieved later by getState().
*/
virtual void saveState (const String&) = 0;
/** This method must retrieve the last state that was provided by the
saveState method.
On first-run, it should just return an empty string.
*/
virtual String getState() = 0;
/** Returns the name of the web-store website, not for communication, but for
presenting to the user.
*/
virtual String getWebsiteName() = 0;
/** Returns the URL of the authentication API. */
virtual URL getServerAuthenticationURL() = 0;
/** Subclasses that talk to a particular web-store will implement this method
to contact their webserver and attempt to unlock the current machine for
the given username and password. The return value is the XML text from the
server which contains error information and/or the encrypted keyfile.
*/
virtual String readReplyFromWebserver (const String& email, const String& password) = 0;
/** Returns a list of strings, any of which should be unique to this
physical computer.
When testing whether the user is allowed to use the product on this
machine, this list of tokens is compared to the ones that were stored
on the webserver.
The default implementation of this method will simply call
MachineIDUtilities::getLocalMachineIDs(), which provides a default
version of this functionality.
*/
virtual StringArray getLocalMachineIDs();
//==============================================================================
// The following methods can be called by your app:
/** Returns true if the product has been successfully authorised for this machine.
The reason it returns a variant rather than a bool is just to make it marginally
more tedious for crackers to work around. Hopefully if this method gets inlined
they'll need to hack all the places where you call it, rather than just the
function itself.
Bear in mind that each place where you check this return value will need to be
changed by a cracker in order to unlock your app, so the more places you call this
method, the more hassle it will be for them to find and crack them all.
*/
inline var isUnlocked() const { return status[unlockedProp]; }
/** Returns the Time when the keyfile expires.
If a the key file obtained has an expiry time, isUnlocked will return false and this
will return a non-zero time. The interpretation of this is up to your app but could
be used for subscription based models or trial periods.
*/
inline Time getExpiryTime() const { return Time (static_cast<int64> (status[expiryTimeProp])); }
/** Optionally allows the app to provide the user's email address if
it is known.
You don't need to call this, but if you do it may save the user
typing it in.
*/
void setUserEmail (const String& usernameOrEmail);
/** Returns the user's email address if known. */
String getUserEmail() const;
/** Attempts to perform an unlock using a block of key-file data provided.
You may wish to use this as a way of allowing a user to unlock your app
by drag-and-dropping a file containing the key data, or by letting them
select such a file. This is often needed for allowing registration on
machines without internet access.
*/
bool applyKeyFile (String keyFileContent);
/** This provides some details about the reply that the server gave in a call
to attemptWebserverUnlock().
*/
struct UnlockResult
{
/** If an unlock operation fails, this is the error message that the webserver
supplied (or a message saying that the server couldn't be contacted)
*/
String errorMessage;
/** This is a message that the webserver returned, and which the user should
be shown.
It's not necessarily an error message, e.g. it might say that there's a
new version of the app available or some other status update.
*/
String informativeMessage;
/** If the webserver wants the user to be directed to a web-page for further
information, this is the URL that it would like them to go to.
*/
String urlToLaunch;
/** If the unlock operation succeeded, this will be set to true. */
bool succeeded;
};
/** Contacts the webserver and attempts to perform a registration with the
given user details.
The return value will either be a success, or a failure with an error message
from the server, so you should show this message to your user.
Because this method blocks while it contacts the server, you must run it on
a background thread, not on the message thread. For an easier way to create
a GUI to do the unlocking, see OnlineUnlockForm.
*/
UnlockResult attemptWebserverUnlock (const String& email, const String& password);
/** Attempts to load the status from the state retrieved by getState().
Call this somewhere in your app's startup code.
*/
void load();
/** Triggers a call to saveState which you can use to store the current unlock status
in your app's settings.
*/
void save();
/** This class contains some utility functions that might help with machine ID generation. */
struct MachineIDUtilities
{
/** Returns a character that represents the current OS.
E.g. 'M' for Mac, 'W' for windows, etc
*/
static char getPlatformPrefix();
/** Returns an encoded hash string from the given input string, prefixing it with
a letter to represent the current OS type.
*/
static String getEncodedIDString (const String& inputString);
/** Utility function that you may want to use in your machine-ID generation code.
This adds an ID string to the given array which is a hash of the filesystem ID of the
given file.
*/
static bool addFileIDToList (StringArray& result, const File& file);
/** Utility function that you may want to use in your machine-ID generation code.
This adds some ID strings to the given array which represent each MAC address of the machine.
*/
static void addMACAddressesToList (StringArray& result);
/** This method calculates some machine IDs based on things like network
MAC addresses, hard-disk IDs, etc, but if you want, you can overload
it to generate your own list of IDs.
The IDs that are returned should be short alphanumeric strings
without any punctuation characters. Since users may need to type
them, case is ignored when comparing them.
Note that the first item in the list is considered to be the
"main" ID, and this will be the one that is displayed to the user
and registered with the marketplace webserver. Subsequent IDs are
just used as fallback to avoid false negatives when checking for
registration on machines which have had hardware added/removed
since the product was first registered.
*/
static StringArray getLocalMachineIDs();
};
private:
ValueTree status;
UnlockResult handleXmlReply (XmlElement);
UnlockResult handleFailedConnection();
static const char* unlockedProp;
static const char* expiryTimeProp;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OnlineUnlockStatus)
};
|
[
"ec,[email protected]"
] | |
08a2d632e4fa0a2f13578d29599f3519bde983be
|
49906d811a847436862f8144a29e097be0943623
|
/hip/hip/fem/conform.cpp
|
4f20a7200368eac307e966defbdcdb051687b2c6
|
[
"BSD-2-Clause"
] |
permissive
|
avinmoharana/Laghos
|
947f59c50a563d22ec7294831a28334c06a3aef1
|
3382674d97c61f9301622a99f0dc562f902aa9a7
|
refs/heads/master
| 2022-12-26T07:41:59.179470 | 2020-03-19T20:47:18 | 2020-03-19T20:47:18 | 250,295,335 | 0 | 0 |
BSD-2-Clause
| 2020-03-26T15:23:04 | 2020-03-26T15:23:04 | null |
UTF-8
|
C++
| false | false | 9,399 |
cpp
|
// Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
// the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
// reserved. See file COPYRIGHT for details.
//
// This file is part of the MFEM library. For more information and source code
// availability see http://mfem.org.
//
// MFEM 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) version 2.1 dated February 1999.
#include "../hip.hpp"
namespace mfem
{
// ***************************************************************************
// * HipConformingProlongationOperator
// ***************************************************************************
HipConformingProlongationOperator::HipConformingProlongationOperator
(ParFiniteElementSpace &pfes): HipOperator(pfes.GetVSize(),
pfes.GetTrueVSize()),
external_ldofs(),
d_external_ldofs(Height()-Width()), // size can be 0 here
gc(new HipCommD(pfes)),
kMaxTh(0)
{
Array<int> ldofs;
Table &group_ldof = gc->GroupLDofTable();
external_ldofs.Reserve(Height()-Width());
for (int gr = 1; gr < group_ldof.Size(); gr++)
{
if (!gc->GetGroupTopology().IAmMaster(gr))
{
ldofs.MakeRef(group_ldof.GetRow(gr), group_ldof.RowSize(gr));
external_ldofs.Append(ldofs);
}
}
external_ldofs.Sort();
const int HmW=Height()-Width();
if (HmW>0)
{
d_external_ldofs=external_ldofs;
}
assert(external_ldofs.Size() == Height()-Width());
const int m = external_ldofs.Size();
int j = 0;
for (int i = 0; i < m; i++)
{
const int end = external_ldofs[i];
const int size = end-j;
if (size>kMaxTh) { kMaxTh=size; }
j = end+1;
}
}
// ***************************************************************************
// * ~HipConformingProlongationOperator
// ***************************************************************************
HipConformingProlongationOperator::~HipConformingProlongationOperator()
{
delete gc;
}
// ***************************************************************************
// * HIP Error Status Check
// ***************************************************************************
void hipLastCheck()
{
hipError_t hipStatus = hipGetLastError();
if (hipStatus != hipSuccess)
exit(fprintf(stderr, "\n\t\033[31;1m[hipLastCheck] failed: %s\033[m\n",
hipGetErrorString(hipStatus)));
}
// ***************************************************************************
// * k_Mult
// ***************************************************************************
static __global__
void k_Mult(double *y, const double *x,
const int *external_ldofs, const int m)
{
const int i = blockDim.x * blockIdx.x + threadIdx.x;
if (i>=m) { return; }
const int j = (i>0)?external_ldofs[i-1]+1:0;
const int end = external_ldofs[i];
for (int k=0; k<(end-j); k+=1)
{
y[j+k]=x[j-i+k];
}
}
static __global__
void k_Mult2(double *y, const double *x, const int *external_ldofs,
const int m, const int base)
{
const int i = base+threadIdx.x;
const int j = (i>0)?external_ldofs[i-1]+1:0;
const int end = external_ldofs[i];
const int k = blockIdx.x;
if (k>=(end-j)) { return; }
y[j+k]=x[j-i+k];
}
// ***************************************************************************
// * Device Mult
// ***************************************************************************
void HipConformingProlongationOperator::d_Mult(const HipVector &x,
HipVector &y) const
{
const double *d_xdata = x.GetData();
const int in_layout = 2; // 2 - input is ltdofs array
gc->d_BcastBegin(const_cast<double*>(d_xdata), in_layout);
double *d_ydata = y.GetData();
int j = 0;
const int m = external_ldofs.Size();
if (m>0)
{
const int maxXThDim = rconfig::Get().MaxXThreadsDim();
if (m>maxXThDim)
{
const int kTpB=64;
hipLaunchKernelGGL((k_Mult), dim3((m+kTpB-1)/kTpB), dim3(kTpB), 0, 0,
d_ydata,d_xdata,d_external_ldofs.ptr(),m);
hipLastCheck();
}
else
{
assert((m/maxXThDim)==0);
assert(kMaxTh<rconfig::Get().MaxXGridSize());
for (int of7=0; of7<m/maxXThDim; of7+=1)
{
const int base = of7*maxXThDim;
hipLaunchKernelGGL((k_Mult2),dim3(kMaxTh),dim3(maxXThDim), 0, 0,
d_ydata,d_xdata,d_external_ldofs.ptr(),m,base);
hipLastCheck();
}
hipLaunchKernelGGL((k_Mult2),dim3(kMaxTh),dim3(m%maxXThDim), 0, 0,
d_ydata,d_xdata,d_external_ldofs.ptr(),m,0);
hipLastCheck();
}
j = external_ldofs[m-1]+1;
}
rmemcpy::rDtoD(d_ydata+j,d_xdata+j-m,(Width()+m-j)*sizeof(double));
const int out_layout = 0; // 0 - output is ldofs array
gc->d_BcastEnd(d_ydata, out_layout);
}
// ***************************************************************************
// * k_Mult
// ***************************************************************************
static __global__
void k_MultTranspose(double *y, const double *x,
const int *external_ldofs, const int m)
{
const int i = blockDim.x * blockIdx.x + threadIdx.x;
if (i>=m) { return; }
const int j = (i>0)?external_ldofs[i-1]+1:0;
const int end = external_ldofs[i];
for (int k=0; k<(end-j); k+=1)
{
y[j-i+k]=x[j+k];
}
}
static __global__
void k_MultTranspose2(double *y, const double *x,
const int *external_ldofs,
const int m, const int base)
{
const int i = base+threadIdx.x;
const int j = (i>0)?external_ldofs[i-1]+1:0;
const int end = external_ldofs[i];
const int k = blockIdx.x;
if (k>=(end-j)) { return; }
y[j-i+k]=x[j+k];
}
// ***************************************************************************
// * Device MultTranspose
// ***************************************************************************
void HipConformingProlongationOperator::d_MultTranspose(const HipVector &x,
HipVector &y) const
{
const double *d_xdata = x.GetData();
gc->d_ReduceBegin(d_xdata);
double *d_ydata = y.GetData();
int j = 0;
const int m = external_ldofs.Size();
if (m>0)
{
const int maxXThDim = rconfig::Get().MaxXThreadsDim();
if (m>maxXThDim)
{
const int kTpB=64;
hipLaunchKernelGGL((k_MultTranspose), dim3((m+kTpB-1)/kTpB),dim3(kTpB), 0, 0,
d_ydata,d_xdata,d_external_ldofs.ptr(),m);
hipLastCheck();
}
else
{
// const int TpB = rconfig::Get().MaxXThreadsDim();
assert(kMaxTh<rconfig::Get().MaxXGridSize());
for (int of7=0; of7<m/maxXThDim; of7+=1)
{
const int base = of7*maxXThDim;
hipLaunchKernelGGL((k_MultTranspose2), dim3(kMaxTh),dim3(maxXThDim), 0, 0,
d_ydata,d_xdata,d_external_ldofs.ptr(),m,base);
hipLastCheck();
}
hipLaunchKernelGGL((k_MultTranspose2), dim3(kMaxTh),dim3(m%maxXThDim), 0, 0,
d_ydata,d_xdata,d_external_ldofs.ptr(),m,0);
hipLastCheck();
}
j = external_ldofs[m-1]+1;
}
rmemcpy::rDtoD(d_ydata+j-m,d_xdata+j,(Height()-j)*sizeof(double));
const int out_layout = 2; // 2 - output is an array on all ltdofs
gc->d_ReduceEnd<double>(d_ydata, out_layout, GroupCommunicator::Sum);
}
// ***************************************************************************
// * Host Mult
// ***************************************************************************
void HipConformingProlongationOperator::h_Mult(const Vector &x,
Vector &y) const
{
const double *xdata = x.GetData();
double *ydata = y.GetData();
const int m = external_ldofs.Size();
const int in_layout = 2; // 2 - input is ltdofs array
gc->BcastBegin(const_cast<double*>(xdata), in_layout);
int j = 0;
for (int i = 0; i < m; i++)
{
const int end = external_ldofs[i];
std::copy(xdata+j-i, xdata+end-i, ydata+j);
j = end+1;
}
std::copy(xdata+j-m, xdata+Width(), ydata+j);
const int out_layout = 0; // 0 - output is ldofs array
gc->BcastEnd(ydata, out_layout);
}
// ***************************************************************************
// * Host MultTranspose
// ***************************************************************************
void HipConformingProlongationOperator::h_MultTranspose(const Vector &x,
Vector &y) const
{
const double *xdata = x.GetData();
double *ydata = y.GetData();
const int m = external_ldofs.Size();
gc->ReduceBegin(xdata);
int j = 0;
for (int i = 0; i < m; i++)
{
const int end = external_ldofs[i];
std::copy(xdata+j, xdata+end, ydata+j-i);
j = end+1;
}
std::copy(xdata+j, xdata+Height(), ydata+j-m);
const int out_layout = 2; // 2 - output is an array on all ltdofs
gc->ReduceEnd<double>(ydata, out_layout, GroupCommunicator::Sum);
}
} // namespace mfem
|
[
"[email protected]"
] | |
728776f321ec83accbdb4d6cf5135d4635a6e06e
|
c9ea5032ed7cc12e2e34a7484e3c16e6fefa8043
|
/ABEditor/mainwindow.cpp
|
5993714027b0e6aec211c70a815088cac6de8841
|
[] |
no_license
|
cuttenEDU/Coursework_Antivirus
|
ab8500d512f5d3072800bb54903a6f7876698cd7
|
06b0e75d04711462cfbc4dc0edcba7b20f7dcb8c
|
refs/heads/master
| 2022-06-22T20:38:10.358979 | 2020-05-14T15:20:36 | 2020-05-14T15:20:36 | 263,963,038 | 0 | 1 | null | 2020-05-14T16:08:56 | 2020-05-14T16:08:55 | null |
UTF-8
|
C++
| false | false | 7,478 |
cpp
|
#include "mainwindow.h"
#include <QLabel>
#include <QMessageBox>
#include <QProgressBar>
#include "abrecordtokenizer.h"
#include "recordviewmodel.h"
#include "editrecorddialog.h"
#include "ui_mainwindow.h"
#include <QtConcurrent/QtConcurrent>
void MainWindow::disableButtons(bool yes) {
ui->addButton->setDisabled(yes);
ui->editButton->setDisabled(yes);
ui->delButton->setDisabled(yes);
}
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) {
ui->setupUi(this);
saved = true;
newBase = false;
operating = false;
recordView = new RecordViewModel(ui->centralwidget);
statusOpenLabel = new QLabel("Файл базы данных не открыт", ui->statusbar);
statusSaveLabel = new QLabel(ui->statusbar);
statusProgressBar = new QProgressBar(ui->statusbar);
statusProgressBar->setRange(0, 1);
statusProgressBar->setValue(0);
ui->statusbar->addWidget(statusOpenLabel);
ui->statusbar->addWidget(statusSaveLabel);
ui->statusbar->addPermanentWidget(statusProgressBar);
ui->tableView->setModel(recordView);
ui->tableView->resizeColumnsToContents();
disableButtons(true);
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
connect(ui->addButton, SIGNAL(clicked()), SLOT(showAddDialog()));
connect(ui->editButton, SIGNAL(clicked()),SLOT(showEditDialog()));
connect(ui->delButton, SIGNAL(clicked()), SLOT(showDelDialog()));
connect(ui->createFile, SIGNAL(triggered()), SLOT(newBaseOpen()));
connect(ui->openFile, SIGNAL(triggered()), SLOT(showOpenDialog()));
connect(ui->saveFile, SIGNAL(triggered()), SLOT(saveBase()));
connect(ui->saveFileAs, SIGNAL(triggered()), SLOT(showSaveDialog()));
connect(ui->closeAll, SIGNAL(triggered()), this, SLOT(exit()));
}
MainWindow::~MainWindow() {
delete ui;
}
void MainWindow::showAddDialog() {
EditRecordDialog dialog;
if (dialog.exec()) {
SignatureRecord *record = dialog.getRecord();
int size = recordView->getRecords().count();
for (int i = 0; i < size; ++i) {
if (*recordView->getRecords().at(i) == *record) {
QMessageBox::warning(this, "Совпадение", "Данная сигнатура уже существует в базе сигнатур антивируса!",
"Ок");
return;
}
}
recordView->addRecord(record);
ui->tableView->resizeColumnsToContents();
saved = false;
statusSaveLabel->setText("");
}
}
void MainWindow::showEditDialog() {
QModelIndexList list = ui->tableView->selectionModel()->selectedRows();
if (list.empty())
return;
int row = list.at(0).row();
SignatureRecord *record = recordView->getRecords().at(row);
EditRecordDialog dialog(record);
if (dialog.exec()) {
recordView->updateRow(row);
ui->tableView->resizeColumnsToContents();
saved = false;
statusSaveLabel->setText("");
}
}
void MainWindow::showDelDialog() {
QModelIndexList list = ui->tableView->selectionModel()->selectedRows();
if (list.empty())
return;
int row = list.at(0).row();
recordView->removeRow(row);
saved = false;
statusSaveLabel->setText("");
}
void MainWindow::newBaseOpen() {
// Если файл не сохранили, спросить, надо ли сохранить. Если да, но не сохранился, отмена операции
if (operating)
return;
if (!saved && confirmSave() && !saved)
return;
newBase = true;
saved = true;
recordView->clear();
tokenizer.close();
disableButtons(false);
statusOpenLabel->setText("Новый файл");
statusProgressBar->setMaximum(1);
statusProgressBar->setValue(1);
}
void MainWindow::showOpenDialog() {
if (operating)
return;
if (!saved && confirmSave() && !saved)
return;
QFileDialog fileDialog;
fileDialog.setWindowTitle("Открыть файл");
fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true);
fileDialog.setFilter(QDir::Readable | QDir::Executable);
fileDialog.setNameFilter("ADB file (*.adb)");
if (fileDialog.exec()) {
QStringList list = fileDialog.selectedFiles();
if (list.size() == 0)
return;
recordView->clear();
tokenizer.close();
disableButtons(true);
tokenizer.setBaseFile(list.at(0));
int count = tokenizer.startRead();
if (count == -1) {
statusSaveLabel->setText("Файл повреждён");
} else {
statusProgressBar->setMaximum(count - 1);
operating = true;
int number;
SignatureRecord *record;
while ((record = tokenizer.nextRecord(number)) != nullptr) {
recordView->addRecord(record);
statusProgressBar->setValue(number);
if (number % 10 == 0)
QApplication::processEvents(QEventLoop::AllEvents, 500);
}
ui->tableView->resizeColumnsToContents();
operating = false;
}
disableButtons(false);
statusOpenLabel->setText(list.at(0).right(list.at(0).size() - list.at(0).lastIndexOf("/") - 1));
newBase = false;
saved = true;
}
}
void MainWindow::saveBase() {
if (operating)
return;
if (newBase)
showSaveDialog();
else {
operating = true;
disableButtons(true);
tokenizer.startWrite(recordView->getRecords().size());
statusProgressBar->setRange(0, recordView->getRecords().size() - 1);
for (int i = 0; i < recordView->getRecords().size(); ++i) {
statusProgressBar->setValue(i);
tokenizer.writeRecord(*recordView->getRecords().at(i));
if (i % 10 == 0)
QApplication::processEvents(QEventLoop::AllEvents, 500);
}
saved = true;
operating = false;
disableButtons(false);
statusSaveLabel->setText("Сохранено");
}
}
void MainWindow::showSaveDialog() {
if (operating)
return;
QFileDialog fileDialog;
fileDialog.setWindowTitle("Сохранить файл");
fileDialog.setAcceptMode(QFileDialog::AcceptSave);
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, false);
fileDialog.setFilter(QDir::Readable | QDir::Executable);
fileDialog.setNameFilter("ADB file (*.adb)");
if (fileDialog.exec()) {
QStringList list = fileDialog.selectedFiles();
if (list.empty())
return;
tokenizer.close();
tokenizer.setBaseFile(list.at(0));
newBase = false;
saved = true;
statusOpenLabel->setText(list.at(0).right(list.at(0).size() - list.at(0).lastIndexOf("/") - 1));
statusProgressBar->setValue(0);
newBase = false;
saveBase();
}
}
void MainWindow::exit() {
if (operating)
return;
if (!saved && confirmSave() && !saved)
return;
QApplication::exit(0);
}
bool MainWindow::confirmSave() {
if (!QMessageBox::question(this, "Файл не сохранён", "Файл не был сохранён. Сохранить?", "Да", "Нет")) {
saveBase();
return true;
};
return false;
}
|
[
"[email protected]"
] | |
7e921e98c892fc95b16b224c03178e13fad65ad5
|
93b24e6296dade8306b88395648377e1b2a7bc8c
|
/client/wxWidgets/wx/generic/prntdlgg.h
|
c73686c0fe056a1ee8bbb07b9ca9baccf08422df
|
[] |
no_license
|
dahahua/pap_wclinet
|
79c5ac068cd93cbacca5b3d0b92e6c9cba11a893
|
d0cde48be4d63df4c4072d4fde2e3ded28c5040f
|
refs/heads/master
| 2022-01-19T21:41:22.000190 | 2013-10-12T04:27:59 | 2013-10-12T04:27:59 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 8,215 |
h
|
/////////////////////////////////////////////////////////////////////////////
// Name: prntdlgg.h
// Purpose: wxGenericPrintDialog, wxGenericPrintSetupDialog,
// wxGenericPageSetupDialog
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id: prntdlgg.h,v 1.28 2005/05/04 18:52:32 JS Exp $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __PRINTDLGH_G_
#define __PRINTDLGH_G_
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "prntdlgg.h"
#endif
#include "wx/defs.h"
#if wxUSE_PRINTING_ARCHITECTURE
#include "wx/dialog.h"
#include "wx/cmndata.h"
#include "wx/prntbase.h"
#include "wx/printdlg.h"
#include "wx/listctrl.h"
#if wxUSE_POSTSCRIPT
#include "wx/dcps.h"
#endif
class WXDLLEXPORT wxTextCtrl;
class WXDLLEXPORT wxButton;
class WXDLLEXPORT wxCheckBox;
class WXDLLEXPORT wxComboBox;
class WXDLLEXPORT wxStaticText;
class WXDLLEXPORT wxRadioBox;
class WXDLLEXPORT wxPageSetupData;
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// This is not clear why all these enums start with 10 or 30 but do not change it
// without good reason to avoid some subtle backwards compatibility breakage
enum
{
wxPRINTID_STATIC = 10,
wxPRINTID_RANGE,
wxPRINTID_FROM,
wxPRINTID_TO,
wxPRINTID_COPIES,
wxPRINTID_PRINTTOFILE,
wxPRINTID_SETUP
};
enum
{
wxPRINTID_LEFTMARGIN = 30,
wxPRINTID_RIGHTMARGIN,
wxPRINTID_TOPMARGIN,
wxPRINTID_BOTTOMMARGIN
};
enum
{
wxPRINTID_PRINTCOLOUR = 10,
wxPRINTID_ORIENTATION,
wxPRINTID_COMMAND,
wxPRINTID_OPTIONS,
wxPRINTID_PAPERSIZE,
wxPRINTID_PRINTER
};
#if wxUSE_POSTSCRIPT
//----------------------------------------------------------------------------
// wxPostScriptNativeData
//----------------------------------------------------------------------------
class WXDLLEXPORT wxPostScriptPrintNativeData: public wxPrintNativeDataBase
{
public:
wxPostScriptPrintNativeData();
virtual ~wxPostScriptPrintNativeData();
virtual bool TransferTo( wxPrintData &data );
virtual bool TransferFrom( const wxPrintData &data );
virtual bool Ok() const { return true; }
const wxString& GetPrinterCommand() const { return m_printerCommand; }
const wxString& GetPrinterOptions() const { return m_printerOptions; }
const wxString& GetPreviewCommand() const { return m_previewCommand; }
const wxString& GetFontMetricPath() const { return m_afmPath; }
double GetPrinterScaleX() const { return m_printerScaleX; }
double GetPrinterScaleY() const { return m_printerScaleY; }
long GetPrinterTranslateX() const { return m_printerTranslateX; }
long GetPrinterTranslateY() const { return m_printerTranslateY; }
void SetPrinterCommand(const wxString& command) { m_printerCommand = command; }
void SetPrinterOptions(const wxString& options) { m_printerOptions = options; }
void SetPreviewCommand(const wxString& command) { m_previewCommand = command; }
void SetFontMetricPath(const wxString& path) { m_afmPath = path; }
void SetPrinterScaleX(double x) { m_printerScaleX = x; }
void SetPrinterScaleY(double y) { m_printerScaleY = y; }
void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; }
void SetPrinterTranslateX(long x) { m_printerTranslateX = x; }
void SetPrinterTranslateY(long y) { m_printerTranslateY = y; }
void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; }
#if wxUSE_STREAMS
wxOutputStream *GetOutputStream() { return m_outputStream; }
void SetOutputStream( wxOutputStream *output ) { m_outputStream = output; }
#endif
private:
wxString m_printerCommand;
wxString m_previewCommand;
wxString m_printerOptions;
wxString m_afmPath;
double m_printerScaleX;
double m_printerScaleY;
long m_printerTranslateX;
long m_printerTranslateY;
#if wxUSE_STREAMS
wxOutputStream *m_outputStream;
#endif
private:
DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData)
};
// ----------------------------------------------------------------------------
// Simulated Print and Print Setup dialogs for non-Windows platforms (and
// Windows using PostScript print/preview)
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxGenericPrintDialog : public wxPrintDialogBase
{
public:
wxGenericPrintDialog(wxWindow *parent,
wxPrintDialogData* data = (wxPrintDialogData*)NULL);
wxGenericPrintDialog(wxWindow *parent, wxPrintData* data);
virtual ~wxGenericPrintDialog();
void OnSetup(wxCommandEvent& event);
void OnRange(wxCommandEvent& event);
void OnOK(wxCommandEvent& event);
virtual bool TransferDataFromWindow();
virtual bool TransferDataToWindow();
virtual int ShowModal();
wxPrintData& GetPrintData()
{ return m_printDialogData.GetPrintData(); }
wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
wxDC *GetPrintDC();
public:
// wxStaticText* m_printerMessage;
wxButton* m_setupButton;
// wxButton* m_helpButton;
wxRadioBox* m_rangeRadioBox;
wxTextCtrl* m_fromText;
wxTextCtrl* m_toText;
wxTextCtrl* m_noCopiesText;
wxCheckBox* m_printToFileCheckBox;
// wxCheckBox* m_collateCopiesCheckBox;
wxPrintDialogData m_printDialogData;
protected:
void Init(wxWindow *parent);
private:
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog)
};
class WXDLLEXPORT wxGenericPrintSetupDialog : public wxDialog
{
public:
// There are no configuration options for the dialog, so we
// just pass the wxPrintData object (no wxPrintSetupDialogData class needed)
wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data);
virtual ~wxGenericPrintSetupDialog();
void Init(wxPrintData* data);
void OnPrinter(wxListEvent& event);
virtual bool TransferDataFromWindow();
virtual bool TransferDataToWindow();
virtual wxComboBox *CreatePaperTypeChoice();
public:
wxListCtrl* m_printerListCtrl;
wxRadioBox* m_orientationRadioBox;
wxTextCtrl* m_printerCommandText;
wxTextCtrl* m_printerOptionsText;
wxCheckBox* m_colourCheckBox;
wxComboBox* m_paperTypeChoice;
wxPrintData m_printData;
wxPrintData& GetPrintData() { return m_printData; }
// After pressing OK, write data here.
wxPrintData* m_targetData;
private:
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxGenericPrintSetupDialog)
};
#endif
// wxUSE_POSTSCRIPT
class WXDLLEXPORT wxGenericPageSetupDialog : public wxPageSetupDialogBase
{
public:
wxGenericPageSetupDialog(wxWindow *parent = NULL,
wxPageSetupDialogData* data = NULL);
virtual ~wxGenericPageSetupDialog();
virtual bool TransferDataFromWindow();
virtual bool TransferDataToWindow();
virtual wxPageSetupDialogData& GetPageSetupDialogData();
void OnPrinter(wxCommandEvent& event);
wxComboBox *CreatePaperTypeChoice(int* x, int* y);
public:
wxButton* m_printerButton;
wxRadioBox* m_orientationRadioBox;
wxTextCtrl* m_marginLeftText;
wxTextCtrl* m_marginTopText;
wxTextCtrl* m_marginRightText;
wxTextCtrl* m_marginBottomText;
wxComboBox* m_paperTypeChoice;
wxPageSetupDialogData m_pageData;
private:
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog)
};
#endif
#endif
// __PRINTDLGH_G_
|
[
"[email protected]"
] | |
5534b320c8f86c17d9df4d2ac3affa84366a0659
|
60b76e96900e47c00c78e858c65df0fdef538b96
|
/db/src/ClientManagerGuild.cpp
|
fd50b20fdf834db04ac9a8960c8c96cbd103d144
|
[] |
no_license
|
UnknownUserTM/Server
|
9b19ef477639b75a3b968ac635d9a3942ed9fefd
|
035e28e28fb5c5afa1206db08a365058bdfa6da8
|
refs/heads/master
| 2021-06-27T16:38:18.049805 | 2021-01-07T02:05:11 | 2021-01-07T02:05:11 | 202,987,474 | 1 | 0 | null | null | null | null |
UHC
|
C++
| false | false | 8,892 |
cpp
|
// vim:ts=4 sw=4
#include "stdafx.h"
#include "ClientManager.h"
#include "Main.h"
#include "Config.h"
#include "DBManager.h"
#include "QID.h"
#include "GuildManager.h"
void CClientManager::GuildCreate(CPeer * peer, DWORD dwGuildID)
{
sys_log(0, "GuildCreate %u", dwGuildID);
ForwardPacket(HEADER_DG_GUILD_LOAD, &dwGuildID, sizeof(DWORD));
CGuildManager::instance().Load(dwGuildID);
}
void CClientManager::GuildChangeGrade(CPeer* peer, TPacketGuild* p)
{
sys_log(0, "GuildChangeGrade %u %u", p->dwGuild, p->dwInfo);
ForwardPacket(HEADER_DG_GUILD_CHANGE_GRADE, p, sizeof(TPacketGuild));
}
void CClientManager::GuildAddMember(CPeer* peer, TPacketGDGuildAddMember * p)
{
CGuildManager::instance().TouchGuild(p->dwGuild);
sys_log(0, "GuildAddMember %u %u", p->dwGuild, p->dwPID);
char szQuery[512];
snprintf(szQuery, sizeof(szQuery),
"INSERT INTO guild_member%s VALUES(%u, %u, %d, 0, 0)",
GetTablePostfix(), p->dwPID, p->dwGuild, p->bGrade);
std::unique_ptr<SQLMsg> pmsg_insert(CDBManager::instance().DirectQuery(szQuery));
snprintf(szQuery, sizeof(szQuery),
"SELECT pid, grade, is_general, offer, level, job, name FROM guild_member%s, player%s WHERE guild_id = %u and pid = id and pid = %u", GetTablePostfix(), GetTablePostfix(), p->dwGuild, p->dwPID);
std::unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
if (pmsg->Get()->uiNumRows == 0)
{
sys_err("Query failed when getting guild member data %s", pmsg->stQuery.c_str());
return;
}
MYSQL_ROW row = mysql_fetch_row(pmsg->Get()->pSQLResult);
if (!row[0] || !row[1])
return;
TPacketDGGuildMember dg;
dg.dwGuild = p->dwGuild;
str_to_number(dg.dwPID, row[0]);
str_to_number(dg.bGrade, row[1]);
str_to_number(dg.isGeneral, row[2]);
str_to_number(dg.dwOffer, row[3]);
str_to_number(dg.bLevel, row[4]);
str_to_number(dg.bJob, row[5]);
strlcpy(dg.szName, row[6], sizeof(dg.szName));
ForwardPacket(HEADER_DG_GUILD_ADD_MEMBER, &dg, sizeof(TPacketDGGuildMember));
}
void CClientManager::GuildRemoveMember(CPeer* peer, TPacketGuild* p)
{
sys_log(0, "GuildRemoveMember %u %u", p->dwGuild, p->dwInfo);
char szQuery[512];
snprintf(szQuery, sizeof(szQuery), "DELETE FROM guild_member%s WHERE pid=%u and guild_id=%u", GetTablePostfix(), p->dwInfo, p->dwGuild);
CDBManager::instance().AsyncQuery(szQuery);
// @fixme202 new_+withdraw_time
snprintf(szQuery, sizeof(szQuery), "REPLACE INTO quest%s (dwPID, szName, szState, lValue) VALUES(%u, 'guild_manage', 'new_withdraw_time', %u)", GetTablePostfix(), p->dwInfo, (DWORD) GetCurrentTime());
CDBManager::instance().AsyncQuery(szQuery);
ForwardPacket(HEADER_DG_GUILD_REMOVE_MEMBER, p, sizeof(TPacketGuild));
}
void CClientManager::GuildSkillUpdate(CPeer* peer, TPacketGuildSkillUpdate* p)
{
sys_log(0, "GuildSkillUpdate %d", p->amount);
ForwardPacket(HEADER_DG_GUILD_SKILL_UPDATE, p, sizeof(TPacketGuildSkillUpdate));
}
void CClientManager::GuildExpUpdate(CPeer* peer, TPacketGuildExpUpdate* p)
{
sys_log(0, "GuildExpUpdate %d", p->amount);
ForwardPacket(HEADER_DG_GUILD_EXP_UPDATE, p, sizeof(TPacketGuildExpUpdate), 0, peer);
}
void CClientManager::GuildChangeMemberData(CPeer* peer, TPacketGuildChangeMemberData* p)
{
sys_log(0, "GuildChangeMemberData %u %u %d %d", p->pid, p->offer, p->level, p->grade);
ForwardPacket(HEADER_DG_GUILD_CHANGE_MEMBER_DATA, p, sizeof(TPacketGuildChangeMemberData), 0, peer);
}
void CClientManager::GuildDisband(CPeer* peer, TPacketGuild* p)
{
sys_log(0, "GuildDisband %u", p->dwGuild);
char szQuery[512];
snprintf(szQuery, sizeof(szQuery), "DELETE FROM guild%s WHERE id=%u", GetTablePostfix(), p->dwGuild);
CDBManager::instance().AsyncQuery(szQuery);
snprintf(szQuery, sizeof(szQuery), "DELETE FROM guild_grade%s WHERE guild_id=%u", GetTablePostfix(), p->dwGuild);
CDBManager::instance().AsyncQuery(szQuery);
// @fixme401 (withdraw -> new_disband)_time
snprintf(szQuery, sizeof(szQuery), "REPLACE INTO quest%s (dwPID, szName, szState, lValue) SELECT pid, 'guild_manage', 'new_disband_time', %u FROM guild_member%s WHERE guild_id = %u", GetTablePostfix(), (DWORD) GetCurrentTime(), GetTablePostfix(), p->dwGuild);
CDBManager::instance().AsyncQuery(szQuery);
snprintf(szQuery, sizeof(szQuery), "DELETE FROM guild_member%s WHERE guild_id=%u", GetTablePostfix(), p->dwGuild);
CDBManager::instance().AsyncQuery(szQuery);
snprintf(szQuery, sizeof(szQuery), "DELETE FROM guild_comment%s WHERE guild_id=%u", GetTablePostfix(), p->dwGuild);
CDBManager::instance().AsyncQuery(szQuery);
ForwardPacket(HEADER_DG_GUILD_DISBAND, p, sizeof(TPacketGuild));
}
const char* __GetWarType(int n)
{
switch (n)
{
case 0 :
return "Field";
case 1 :
return "Theater";
case 2 :
return "CTF"; //Capture The Flag
default :
return "Wrong number";
}
}
void CClientManager::GuildWar(CPeer* peer, TPacketGuildWar* p)
{
switch (p->bWar)
{
case GUILD_WAR_SEND_DECLARE:
sys_log(0, "GuildWar: GUILD_WAR_SEND_DECLARE type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo);
CGuildManager::instance().AddDeclare(p->bType, p->dwGuildFrom, p->dwGuildTo);
break;
case GUILD_WAR_REFUSE:
sys_log(0, "GuildWar: GUILD_WAR_REFUSE type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo);
CGuildManager::instance().RemoveDeclare(p->dwGuildFrom, p->dwGuildTo);
break;
/*
case GUILD_WAR_WAIT_START:
CGuildManager::instance().RemoveDeclare(p->dwGuildFrom, p->dwGuildTo);
if (!CGuildManager::instance().WaitStart(p))
p->bWar = GUILD_WAR_CANCEL;
break;
*/
case GUILD_WAR_WAIT_START:
sys_log(0, "GuildWar: GUILD_WAR_WAIT_START type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo);
case GUILD_WAR_RESERVE: // 길드전 예약
if (p->bWar != GUILD_WAR_WAIT_START)
sys_log(0, "GuildWar: GUILD_WAR_RESERVE type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo);
CGuildManager::instance().RemoveDeclare(p->dwGuildFrom, p->dwGuildTo);
if (!CGuildManager::instance().ReserveWar(p))
p->bWar = GUILD_WAR_CANCEL;
else
p->bWar = GUILD_WAR_RESERVE;
break;
case GUILD_WAR_ON_WAR: // 길드전을 시작 시킨다. (필드전은 바로 시작 됨)
sys_log(0, "GuildWar: GUILD_WAR_ON_WAR type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo);
CGuildManager::instance().RemoveDeclare(p->dwGuildFrom, p->dwGuildTo);
CGuildManager::instance().StartWar(p->bType, p->dwGuildFrom, p->dwGuildTo);
break;
case GUILD_WAR_OVER: // 길드전 정상 종료
sys_log(0, "GuildWar: GUILD_WAR_OVER type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo);
CGuildManager::instance().RecvWarOver(p->dwGuildFrom, p->dwGuildTo, p->bType, p->lWarPrice);
break;
case GUILD_WAR_END: // 길드전 비정상 종료
sys_log(0, "GuildWar: GUILD_WAR_END type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo);
CGuildManager::instance().RecvWarEnd(p->dwGuildFrom, p->dwGuildTo);
return; // NOTE: RecvWarEnd에서 패킷을 보내므로 따로 브로드캐스팅 하지 않는다.
case GUILD_WAR_CANCEL :
sys_log(0, "GuildWar: GUILD_WAR_CANCEL type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo);
CGuildManager::instance().CancelWar(p->dwGuildFrom, p->dwGuildTo);
break;
}
ForwardPacket(HEADER_DG_GUILD_WAR, p, sizeof(TPacketGuildWar));
}
void CClientManager::GuildWarScore(CPeer* peer, TPacketGuildWarScore * p)
{
CGuildManager::instance().UpdateScore(p->dwGuildGainPoint, p->dwGuildOpponent, p->lScore, p->lBetScore);
}
void CClientManager::GuildChangeLadderPoint(TPacketGuildLadderPoint* p)
{
sys_log(0, "GuildChangeLadderPoint Recv %u %d", p->dwGuild, p->lChange);
CGuildManager::instance().ChangeLadderPoint(p->dwGuild, p->lChange);
}
void CClientManager::GuildUseSkill(TPacketGuildUseSkill* p)
{
sys_log(0, "GuildUseSkill Recv %u %d", p->dwGuild, p->dwSkillVnum);
CGuildManager::instance().UseSkill(p->dwGuild, p->dwSkillVnum, p->dwCooltime);
SendGuildSkillUsable(p->dwGuild, p->dwSkillVnum, false);
}
void CClientManager::SendGuildSkillUsable(DWORD guild_id, DWORD dwSkillVnum, bool bUsable)
{
sys_log(0, "SendGuildSkillUsable Send %u %d %s", guild_id, dwSkillVnum, bUsable?"true":"false");
TPacketGuildSkillUsableChange p;
p.dwGuild = guild_id;
p.dwSkillVnum = dwSkillVnum;
p.bUsable = bUsable;
ForwardPacket(HEADER_DG_GUILD_SKILL_USABLE_CHANGE, &p, sizeof(TPacketGuildSkillUsableChange));
}
void CClientManager::GuildChangeMaster(TPacketChangeGuildMaster* p)
{
if (CGuildManager::instance().ChangeMaster(p->dwGuildID, p->idFrom, p->idTo) == true)
{
TPacketChangeGuildMaster packet;
packet.dwGuildID = p->dwGuildID;
packet.idFrom = 0;
packet.idTo = 0;
ForwardPacket(HEADER_DG_ACK_CHANGE_GUILD_MASTER, &packet, sizeof(packet));
}
}
|
[
"schindeleandre@gmail"
] |
schindeleandre@gmail
|
387cf64d26f54f8ac0b84e0badd5d0fa1d737bca
|
56728ca1ee9f571235723a68c658f94ee8aebb88
|
/windows/commng/vsthost/vsteditwnd.h
|
f091d367ceedec44ebf57d9dc9e9beedec5cbb2e
|
[
"MIT",
"GPL-1.0-or-later"
] |
permissive
|
libretro/NP2kai
|
4b5867622a790649840bc62ce751e762e4c75e74
|
749d88e5a49c625a340275a9eaa33830f1602bbb
|
refs/heads/master
| 2023-06-10T03:56:51.304948 | 2023-05-28T04:00:22 | 2023-05-28T04:00:22 | 121,966,104 | 10 | 16 |
MIT
| 2023-05-28T04:00:23 | 2018-02-18T15:56:05 |
C
|
UTF-8
|
C++
| false | false | 1,487 |
h
|
/**
* @file vsteditwnd.h
* @brief VST edit ウィンドウ クラスの宣言およびインターフェイスの定義をします
*/
#pragma once
#include <map>
#include "vsteditwndbase.h"
class CVstEffect;
/**
* @brief VST effect ウィンドウ クラス
*/
class CVstEditWnd : public IVstEditWnd
{
public:
static bool Initialize(HINSTANCE hInstance);
static void OnIdle();
CVstEditWnd();
virtual ~CVstEditWnd();
bool Create(CVstEffect* pEffect, LPCTSTR lpszWindowName, DWORD dwStyle, LONG x = CW_USEDEFAULT, LONG y = CW_USEDEFAULT);
void Destroy();
virtual bool OnResize(int nWidth, int nHeight);
virtual bool OnUpdateDisplay();
HWND GetHWnd();
CVstEffect* GetEffect();
protected:
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
int OnCreate(LPCREATESTRUCT lpCreateStruct);
private:
static HINSTANCE sm_hInstance; /*!< The instance */
static std::map<HWND, CVstEditWnd*> sm_wndMap; /*!< Wnd map */
HWND m_hWnd; /*!< The handle of window */
CVstEffect* m_pEffect; /*!< Effect */
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
};
/**
* ウィンドウ ハンドルを得る
* @return ウィンドウ ハンドル
*/
inline HWND CVstEditWnd::GetHWnd()
{
return m_hWnd;
}
/**
* エフェクトを得る
* @return エフェクト
*/
inline CVstEffect* CVstEditWnd::GetEffect()
{
return m_pEffect;
}
|
[
"[email protected]"
] | |
4d45f07a31d98ce1df2a4a31c43fae747b23e510
|
1d09964b0e2ca86545bab6dc97015ad533d9e188
|
/dmanager/main.cpp
|
2d2c50747e89bdc2423128fb61bb9c699316d3c4
|
[] |
no_license
|
basmarle/dmanager
|
4528b18f8b0cea6d0b3b1913c807a722961a040c
|
c0e4c12d45acede7cd4102aa5eb4791f9f99b4f5
|
refs/heads/master
| 2021-01-10T14:03:10.490509 | 2015-10-05T09:54:18 | 2015-10-05T09:54:18 | 43,675,067 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 168 |
cpp
|
#include "dmanager.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Dmanager w;
w.show();
return a.exec();
}
|
[
"[email protected]"
] | |
c46b5559959960acaa971ffd63f431c180301c6b
|
051839cfdc698f7dc53c08de696c925dc3cde79e
|
/CCMP2013/ccmp2013-2/dolls/dolls_ng.cpp
|
d7c218b23321043fd56c0ff6b83ae0cc2742a668
|
[] |
no_license
|
juangil/programmingContests
|
37645ba582921cb104a66cd5332dfd94d59a9deb
|
dc0e7b11003411ebfee8f4fcb4024a10e5649b07
|
refs/heads/master
| 2021-01-17T13:40:07.398771 | 2016-07-13T15:25:50 | 2016-07-13T15:25:50 | 10,767,650 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,422 |
cpp
|
#include <algorithm>
#include <cstdio>
#include <set>
#include <vector>
using namespace std;
const int MAX_m = 10000;
struct Doll {
int w, h;
Doll(int _w, int _h) { w = _w; h = _h; }
};
bool cmpWinc(const Doll& a, const Doll& b) { return a.w < b.w; }
struct cmpHdec {
bool operator()(const Doll& a, const Doll& b) { return a.h > b.h; }
};
int main() {
int C; scanf("%d", &C);
for (int c = 0; c < C; c++) {
int m; scanf("%d", &m);
vector<Doll> SW;
for (int i = 0; i < m; i++) {
int w, h; scanf("%d %d", &w, &h);
SW.push_back(Doll(w, h));
}
sort(SW.begin(), SW.end(), cmpWinc);
multiset<Doll,cmpHdec> SH;
vector<Doll> N;
int a = m;
// Look at dolls from narrowest to widest
for (int p = 0; p < m; p++) {
// Find a tallest shorter doll from the narrower dolls
if (SH.upper_bound(SW[p]) != SH.end()) {
// Put it inside this doll
SH.erase(SH.upper_bound(SW[p]));
a--;
}
N.push_back(SW[p]);
// If the next doll is wider,
// enter all seen dolls into set of dolls to consider for insertion
if (p+1 < m && SW[p].w < SW[p+1].w) {
SH.insert(N.begin(), N.end());
N.clear();
}
}
printf("%d\n", a);
}
}
|
[
"[email protected]"
] | |
d22b0b3bf3ed5f323223acf6e76be663ad056330
|
7e4aae07d5be40f983946e3b0d7c058ee11a5d86
|
/RenderPackDemo1/KinectSensor.h
|
8b65a2898d852f946ce3778babae02c447e76aaa
|
[] |
no_license
|
leakoe/RenderPackDemo1
|
6e60c68590440db65eb3faa70c7375127c888353
|
63c019e6a535851a7cddadd8e65fe5fd62cee6b4
|
refs/heads/master
| 2020-05-20T13:24:58.506621 | 2012-10-31T16:28:23 | 2012-10-31T16:28:23 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,288 |
h
|
//------------------------------------------------------------------------------
// <copyright file="KinectSensor.h" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
#pragma once
#include <FaceTrackLib.h>
#include <NuiApi.h>
class KinectSensor
{
public:
KinectSensor();
~KinectSensor();
HRESULT Init(NUI_IMAGE_TYPE depthType, NUI_IMAGE_RESOLUTION depthRes, BOOL bNearMode, BOOL bFallbackToDefault, NUI_IMAGE_TYPE colorType, NUI_IMAGE_RESOLUTION colorRes, BOOL bSeatedSkeletonMode);
void Release();
HRESULT GetVideoConfiguration(FT_CAMERA_CONFIG* videoConfig);
HRESULT GetDepthConfiguration(FT_CAMERA_CONFIG* depthConfig);
IFTImage* GetVideoBuffer(){ return(m_VideoBuffer); };
IFTImage* GetDepthBuffer(){ return(m_DepthBuffer); };
float GetZoomFactor() { return(m_ZoomFactor); };
POINT* GetViewOffSet() { return(&m_ViewOffset); };
HRESULT GetClosestHint(FT_VECTOR3D* pHint3D);
void SetViewOffset(float xO, float yO);
bool IsTracked(UINT skeletonId) { return(m_SkeletonTracked[skeletonId]);};
FT_VECTOR3D NeckPoint(UINT skeletonId) { return(m_NeckPoint[skeletonId]);};
FT_VECTOR3D HeadPoint(UINT skeletonId) { return(m_HeadPoint[skeletonId]);};
private:
IFTImage* m_VideoBuffer;
IFTImage* m_DepthBuffer;
FT_VECTOR3D m_NeckPoint[NUI_SKELETON_COUNT];
FT_VECTOR3D m_HeadPoint[NUI_SKELETON_COUNT];
bool m_SkeletonTracked[NUI_SKELETON_COUNT];
FLOAT m_ZoomFactor; // video frame zoom factor (it is 1.0f if there is no zoom)
POINT m_ViewOffset; // Offset of the view from the top left corner.
HANDLE m_hNextDepthFrameEvent;
HANDLE m_hNextVideoFrameEvent;
HANDLE m_hNextSkeletonEvent;
HANDLE m_pDepthStreamHandle;
HANDLE m_pVideoStreamHandle;
HANDLE m_hThNuiProcess;
HANDLE m_hEvNuiProcessStop;
bool m_bNuiInitialized;
int m_FramesTotal;
int m_SkeletonTotal;
static DWORD WINAPI ProcessThread(PVOID pParam);
void GotVideoAlert();
void GotDepthAlert();
void GotSkeletonAlert();
};
|
[
"[email protected]"
] | |
25f2c79a6c6b20cd8ae0d314cdfa91b5f210c83e
|
1ae022fe5cd1bea904b0632da89249d1d4eb1925
|
/src/header_this.h
|
471d44d9f8b440c782857a3aecc5aeadb4330bde
|
[
"MIT"
] |
permissive
|
NathanHuang1999/APBOHCA
|
3e8284b4d901e20f75d8d91bf572f8ac92bd0bf2
|
e6c1926e7f12a15f1087356a6fd29ef86fe519e1
|
refs/heads/master
| 2022-04-21T20:08:13.885310 | 2020-04-21T09:40:30 | 2020-04-21T09:40:30 | 222,444,515 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,189 |
h
|
#pragma once
#pragma warning(disable : 4996)
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
using namespace std;
// 宏定义引用
#include"macro.h"
//其它类的头文件引用
#include"FreqTable.h"
#include"HuffmanTree.h"
#include"Heap.h"
#include"CodeTable.h"
//函数声明
void compress();
void decompress();
char* text_input(char* path, size_file_t* size);
void binary_output(char* filename, int mark, size_file_t size_of_former_file, vector<record>* freq_table,
vector<char>* compressed_data, int valid);
void binary_input(char* filename, record** freq_table, int* num_of_valid_digit,
char** compressed_data, int* size_of_table, size_file_t* size_of_data, size_file_t* size_of_former_file);
void text_output(char* filename, char* out_file, size_file_t size);
vector<HuffmanTree<char>> buildForest(record* freq_table, int count);
void fillCodeTable(HuffmanNode<char>* root, string code, vector<record_CodeTable>* codeTable);
int coding(char* input_string, size_file_t size, vector<record_CodeTable>* codeTable, vector<char>* code);
char* decoding(char* data, size_file_t size, int valid, size_file_t length, HuffmanTree<char>* tree);
|
[
"[email protected]"
] | |
52104a24c795567952dbad4c48a976f873eb6fbc
|
de5e094c678b91959915ae6e33e77df11c443c40
|
/SDA Homework/SDA Tasks/Polish Notation/PolishNotation.cpp
|
041088d750b3a37830e2720905b48b43b2915223
|
[] |
no_license
|
Fluctuationqt/DSAHomework
|
497afde3f15ee0093492ab5d9fdc6170e3e2a1ad
|
3dd538f514ae6bbae5e98a5a7f291b1708ba7ffc
|
refs/heads/master
| 2020-08-08T01:47:43.282887 | 2019-10-08T15:05:22 | 2019-10-08T15:05:22 | 213,664,791 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 5,879 |
cpp
|
// PolishNotation.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "LStack.hpp"
#include "LQueue.hpp"
#include <string>
#include <iostream>
// Is char a single digit number?
bool isDigit(char ch)
{
if (ch <= '9' && ch >= '0')
return true;
else
return false;
}
// Convert char, that is a digit to integer single digit number
int parseDigit(char ch)
{
if (ch <= '9' && ch >= '0')
return ch - '0';
}
// Is char an accepted operator (One of: +-/*) ?
bool isOperator(char ch)
{
if (ch == '+' || ch == '-' || ch == '*' || ch == '/')
return true;
else
return false;
}
/*
Evaluates a postfix notation expression.
Limitation: Only single digit whole numbers
allowed in the postfix notation expression!
Example expresion: "123+-7/"
*/
double EvaluatePostfixNotation(std::string postfixExpr)
{
LStack<double> operands;
for (int i = 0; i < postfixExpr.length(); i++)
{
char current = postfixExpr[i];
if (isDigit(current))
{
operands.Push(parseDigit(current));
}
else
{
double a, b;
switch (current)
{
case '+':
{
a = operands.Pop();
b = operands.Pop();
operands.Push(a + b);
} break;
case '-':
{
a = operands.Pop();
b = operands.Pop();
operands.Push(b - a);
} break;
case '*':
{
a = operands.Pop();
b = operands.Pop();
operands.Push(a * b);
} break;
case '/':
{
a = operands.Pop();
b = operands.Pop();
operands.Push(b / a);
} break;
}
}
}
double result = operands.Pop();
return result;
}
/*
Evaluates a prefix notation expression.
Limitation: Only single digit whole numbers
allowed in the prefix notation expression!
Example expresion: "123+-7/"
*/
double EvaluatePrefixNotation(std::string prefixExpr)
{
LStack<double> operands;
for (int i = prefixExpr.length(); i >= 0; i--)
{
char current = prefixExpr[i];
if (isDigit(current))
{
operands.Push(parseDigit(current));
}
else
{
double a, b;
switch (current)
{
case '+':
{
a = operands.Pop();
b = operands.Pop();
operands.Push(a + b);
} break;
case '-':
{
a = operands.Pop();
b = operands.Pop();
operands.Push(b - a);
} break;
case '*':
{
a = operands.Pop();
b = operands.Pop();
operands.Push(a * b);
} break;
case '/':
{
a = operands.Pop();
b = operands.Pop();
operands.Push(b / a);
} break;
}
}
}
double result = operands.Pop();
return result;
}
/*
Parses string with single digit whole numbers in prefix notation
to equivalent postfix notation.
*/
std::string PrefixToPostfix(std::string prefixExpr)
{
LStack<std::string> st;
for(int i = prefixExpr.length(); i >= 0; i--)
{
char current = prefixExpr[i];
if (isDigit(current))
{
st.Push(std::string(1, current));
}
else if(isOperator(current))
{
std::string a = st.Pop();
std::string b = st.Pop();
std::string op = std::string(1, current);
st.Push(a + b + op);
}
}
return st.Pop();
}
/*
Parses string with single digit whole numbers in postfix notation
to equivalent prefix notation.
*/
std::string PostfixToPrefix(std::string postfixExpr)
{
LStack<std::string> st;
for (int i = 0; i < postfixExpr.length(); i++)
{
char current = postfixExpr[i];
if (isDigit(current))
{
st.Push(std::string(1, current));
}
else if (isOperator(current))
{
std::string a = st.Pop();
std::string b = st.Pop();
std::string op = std::string(1, current);
st.Push(a + b + op);
}
}
std::string result = st.Pop();
std::reverse(result.begin(), result.end());
return result;
}
int getWeight(char x)
{
switch (x)
{
case '+': return 2;
case '-': return 2;
case '*': return 1;
case '/': return 1;
case '^': return 0;
}
}
void print(LStack<char> st)
{
while (!st.isEmpty())
{
std::cout<< st.Pop()<< " ";
}
std::cout << std::endl;
}
// infix to postifx
std::string InfixToPostfix(char *source)
{
LQueue<char> result;
LStack<char> st;
st.Push('(');
char ch, temp = 'a';
for (int i = 0; i < strlen(source); i++)
{
ch = source[i];
if (isDigit(ch))
{
result.push(ch);
}
else if (ch == '(')
{
st.Push(ch);
}
else if (ch == ')')
{
while (temp != '(')
{
temp = st.Pop();
result.push(temp);
}
}
else if (isOperator(ch))
{
while (temp != '(' && getWeight(ch) >= getWeight(temp))
{
temp = st.Pop();
result.push(temp);
}
st.Push(temp);
st.Push(ch);
}
}
// add leftover to result stack
while (!st.isEmpty())
{
temp = st.Pop();
if(temp != '(' && temp != 'a')
result.push(temp);
}
// convert result queue to string
std::string output = "";
while (result.pop(ch))
output.push_back(ch);
return output;
}
// Some examples...
int main()
{
std::string Postfix_expr = "45+3*7-";
double result = EvaluatePostfixNotation(Postfix_expr);
std::cout << Postfix_expr << " is equal to " << result << std::endl;
std::string Prefix_expr = "*+123";
Postfix_expr = PrefixToPostfix(Prefix_expr);
std::cout << Prefix_expr << " converted to postfix is: " << Postfix_expr << std::endl;
std::cout << "and back again to prefix:"<< PostfixToPrefix(Postfix_expr) << std::endl;
std::cout << Prefix_expr << " is equal to " << EvaluatePrefixNotation(Prefix_expr) << std::endl;
std::cout << PrefixToPostfix(Prefix_expr) << " is equal to " << EvaluatePostfixNotation(PrefixToPostfix(Prefix_expr)) << std::endl;
std::cout << "this:" << InfixToPostfix("(1+2)-3")<<std::endl;
return 0;
}
|
[
"[email protected]"
] | |
11996fa9c6c3e0128ed20097b127f942b031c695
|
fd32e9f2550c982dd99dd257302b810b1728d090
|
/lab4/GeomFigure/GeomFigure/CTriangle.cpp
|
84d69a142740e409c4b3e5b305ef2831a25e9b2e
|
[] |
no_license
|
islamov-jahja/OOP_Universit
|
892ece67a8c393fbf2de5fdfb18b3653790f7f76
|
5e341f4454a6202edd792559d464fc080bc77a57
|
refs/heads/master
| 2020-03-16T04:53:59.081402 | 2018-10-17T18:30:43 | 2018-10-17T18:30:43 | 132,521,522 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,465 |
cpp
|
#include "CTriangle.h"
#include"stdafx.h"
CTriangle::CTriangle(CPoints vertex1, CPoints vertex2, CPoints vertex3)
: m_side1(vertex1, vertex2), m_side2(vertex1, vertex3), m_side3(vertex2, vertex3),
m_vertex1(vertex1), m_vertex2(vertex2), m_vertex3(vertex3)
{
}
CTriangle::CTriangle(CPoints vertex1, CPoints vertex2, CPoints vertex3, string outLineColor, string fillColor)
: m_side1(vertex1, vertex2, outLineColor), m_side2(vertex1, vertex3, outLineColor), m_side3(vertex2, vertex3, outLineColor),
m_vertex1(vertex1), m_vertex2(vertex2), m_vertex3(vertex3), m_fillColor(fillColor), m_outLineColor(outLineColor)
{
}
CTriangle::~CTriangle()
{
}
double CTriangle::GetArea()const
{
double semiPerimeter = GetPerimeter() / 2;
double area = sqrt(semiPerimeter*(semiPerimeter - m_side1.GetPerimeter())*
(semiPerimeter - m_side2.GetPerimeter())*(semiPerimeter - m_side3.GetPerimeter()));
return area;
}
double CTriangle::GetPerimeter() const
{
return m_side1.GetPerimeter() + m_side2.GetPerimeter() + m_side3.GetPerimeter();
}
string CTriangle::ToString() const
{
return string("Triangle");
}
string CTriangle::GetOutLineColor() const
{
return string(m_outLineColor);
}
string CTriangle::GetFillColor() const
{
return string(m_fillColor);
}
CPoints CTriangle::GetVertex1() const
{
return CPoints(m_vertex1);
}
CPoints CTriangle::GetVertex2() const
{
return CPoints(m_vertex2);
}
CPoints CTriangle::GetVertex3() const
{
return CPoints(m_vertex3);
}
|
[
"[email protected]"
] | |
9de0600de4f8666bf2db4b2e66ba7113277a848c
|
a3e1d1ee2f891cf0ee9eadd9120ebbc9d0a597dc
|
/src/leetcode/balance-a-binary-search-tree.h
|
618604e0c747de05e02a55ed31f773b5b19d4361
|
[] |
no_license
|
ygalkin/coding-challenges
|
4feeddef2b4793bdad066b5f89d0ce7fdca9292b
|
283b6c89d37a7ddc9e34081c76f6b4fa757c9962
|
refs/heads/main
| 2023-05-20T14:44:57.186146 | 2021-06-13T19:16:53 | 2021-06-13T19:16:53 | 353,363,568 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,402 |
h
|
// https://leetcode.com/problems/balance-a-binary-search-tree/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
* };
*/
class Solution {
void for_each_node(TreeNode* parent, std::function<void(TreeNode*)> f) {
if (parent == nullptr) {
return;
}
for_each_node(parent->left, f);
f(parent);
for_each_node(parent->right, f);
}
TreeNode* reconstruct_tree(std::vector<TreeNode*>& nodes, size_t left, size_t right) {
const size_t middle = left + ((right - left) / 2);
TreeNode* current = nodes[middle];
current->left = left == middle ? nullptr : reconstruct_tree(nodes, left, middle - 1);
current->right = right == middle ? nullptr : reconstruct_tree(nodes, middle + 1, right);
return current;
}
public:
TreeNode* balanceBST(TreeNode* root) {
if (root == nullptr) {
return nullptr;
}
std::vector<TreeNode*> nodes;
for_each_node(root, [&nodes](auto i) { nodes.push_back(i); });
return reconstruct_tree(nodes, 0, nodes.size() - 1);
}
};
|
[
"[email protected]"
] | |
477dd1a5fac5b3c0057f9ae7510053cc7a5edbd9
|
3b9b4049a8e7d38b49e07bb752780b2f1d792851
|
/src/third_party/webrtc/base/unixfilesystem.cc
|
b4743241925e166fd92db83371203259d06aa12b
|
[
"BSD-3-Clause",
"Apache-2.0",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"LicenseRef-scancode-google-patent-license-webrtc",
"LicenseRef-scancode-unknown-license-reference",
"BSL-1.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown",
"MS-LPL",
"LicenseRef-scancode-takuya-ooura"
] |
permissive
|
webosce/chromium53
|
f8e745e91363586aee9620c609aacf15b3261540
|
9171447efcf0bb393d41d1dc877c7c13c46d8e38
|
refs/heads/webosce
| 2020-03-26T23:08:14.416858 | 2018-08-23T08:35:17 | 2018-09-20T14:25:18 | 145,513,343 | 0 | 2 |
Apache-2.0
| 2019-08-21T22:44:55 | 2018-08-21T05:52:31 | null |
UTF-8
|
C++
| false | false | 17,417 |
cc
|
/*
* Copyright 2004 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/base/unixfilesystem.h"
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
#include <Carbon/Carbon.h>
#include <IOKit/IOCFBundle.h>
#include <sys/statvfs.h>
#include "webrtc/base/macutils.h"
#endif // WEBRTC_MAC && !defined(WEBRTC_IOS)
#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
#include <sys/types.h>
#if defined(WEBRTC_ANDROID)
#include <sys/statfs.h>
#elif !defined(__native_client__)
#include <sys/statvfs.h>
#endif // !defined(__native_client__)
#include <limits.h>
#include <pwd.h>
#include <stdio.h>
#endif // WEBRTC_POSIX && !WEBRTC_MAC || WEBRTC_IOS
#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
#include <ctype.h>
#include <algorithm>
#endif
#if defined(__native_client__) && !defined(__GLIBC__)
#include <sys/syslimits.h>
#endif
#include "webrtc/base/arraysize.h"
#include "webrtc/base/fileutils.h"
#include "webrtc/base/pathutils.h"
#include "webrtc/base/stream.h"
#include "webrtc/base/stringutils.h"
#if defined(WEBRTC_IOS)
// Defined in iosfilesystem.mm. No header file to discourage use
// elsewhere; other places should use GetApp{Data,Temp}Folder() in
// this file. Don't copy/paste. I mean it.
char* IOSDataDirectory();
char* IOSTempDirectory();
void IOSAppName(rtc::Pathname* path);
#endif
namespace rtc {
#if !defined(WEBRTC_ANDROID) && !defined(WEBRTC_IOS)
char* UnixFilesystem::app_temp_path_ = NULL;
#else
char* UnixFilesystem::provided_app_data_folder_ = NULL;
char* UnixFilesystem::provided_app_temp_folder_ = NULL;
void UnixFilesystem::SetAppDataFolder(const std::string& folder) {
delete [] provided_app_data_folder_;
provided_app_data_folder_ = CopyString(folder);
}
void UnixFilesystem::SetAppTempFolder(const std::string& folder) {
delete [] provided_app_temp_folder_;
provided_app_temp_folder_ = CopyString(folder);
}
#endif
UnixFilesystem::UnixFilesystem() {
#if defined(WEBRTC_IOS)
if (!provided_app_data_folder_)
provided_app_data_folder_ = IOSDataDirectory();
if (!provided_app_temp_folder_)
provided_app_temp_folder_ = IOSTempDirectory();
#endif
}
UnixFilesystem::~UnixFilesystem() {}
bool UnixFilesystem::CreateFolder(const Pathname &path, mode_t mode) {
std::string pathname(path.pathname());
int len = pathname.length();
if ((len == 0) || (pathname[len - 1] != '/'))
return false;
struct stat st;
int res = ::stat(pathname.c_str(), &st);
if (res == 0) {
// Something exists at this location, check if it is a directory
return S_ISDIR(st.st_mode) != 0;
} else if (errno != ENOENT) {
// Unexpected error
return false;
}
// Directory doesn't exist, look up one directory level
do {
--len;
} while ((len > 0) && (pathname[len - 1] != '/'));
if (!CreateFolder(Pathname(pathname.substr(0, len)), mode)) {
return false;
}
LOG(LS_INFO) << "Creating folder: " << pathname;
return (0 == ::mkdir(pathname.c_str(), mode));
}
bool UnixFilesystem::CreateFolder(const Pathname &path) {
return CreateFolder(path, 0755);
}
FileStream *UnixFilesystem::OpenFile(const Pathname &filename,
const std::string &mode) {
FileStream *fs = new FileStream();
if (fs && !fs->Open(filename.pathname().c_str(), mode.c_str(), NULL)) {
delete fs;
fs = NULL;
}
return fs;
}
bool UnixFilesystem::CreatePrivateFile(const Pathname &filename) {
int fd = open(filename.pathname().c_str(),
O_RDWR | O_CREAT | O_EXCL,
S_IRUSR | S_IWUSR);
if (fd < 0) {
LOG_ERR(LS_ERROR) << "open() failed.";
return false;
}
// Don't need to keep the file descriptor.
if (close(fd) < 0) {
LOG_ERR(LS_ERROR) << "close() failed.";
// Continue.
}
return true;
}
bool UnixFilesystem::DeleteFile(const Pathname &filename) {
LOG(LS_INFO) << "Deleting file:" << filename.pathname();
if (!IsFile(filename)) {
ASSERT(IsFile(filename));
return false;
}
return ::unlink(filename.pathname().c_str()) == 0;
}
bool UnixFilesystem::DeleteEmptyFolder(const Pathname &folder) {
LOG(LS_INFO) << "Deleting folder" << folder.pathname();
if (!IsFolder(folder)) {
ASSERT(IsFolder(folder));
return false;
}
std::string no_slash(folder.pathname(), 0, folder.pathname().length()-1);
return ::rmdir(no_slash.c_str()) == 0;
}
bool UnixFilesystem::GetTemporaryFolder(Pathname &pathname, bool create,
const std::string *append) {
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
FSRef fr;
if (0 != FSFindFolder(kOnAppropriateDisk, kTemporaryFolderType,
kCreateFolder, &fr))
return false;
unsigned char buffer[NAME_MAX+1];
if (0 != FSRefMakePath(&fr, buffer, arraysize(buffer)))
return false;
pathname.SetPathname(reinterpret_cast<char*>(buffer), "");
#elif defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
ASSERT(provided_app_temp_folder_ != NULL);
pathname.SetPathname(provided_app_temp_folder_, "");
#else // !WEBRTC_MAC || WEBRTC_IOS && !WEBRTC_ANDROID
if (const char* tmpdir = getenv("TMPDIR")) {
pathname.SetPathname(tmpdir, "");
} else if (const char* tmp = getenv("TMP")) {
pathname.SetPathname(tmp, "");
} else {
#ifdef P_tmpdir
pathname.SetPathname(P_tmpdir, "");
#else // !P_tmpdir
pathname.SetPathname("/tmp/", "");
#endif // !P_tmpdir
}
#endif // !WEBRTC_MAC || WEBRTC_IOS && !WEBRTC_ANDROID
if (append) {
ASSERT(!append->empty());
pathname.AppendFolder(*append);
}
return !create || CreateFolder(pathname);
}
std::string UnixFilesystem::TempFilename(const Pathname &dir,
const std::string &prefix) {
int len = dir.pathname().size() + prefix.size() + 2 + 6;
char *tempname = new char[len];
snprintf(tempname, len, "%s/%sXXXXXX", dir.pathname().c_str(),
prefix.c_str());
int fd = ::mkstemp(tempname);
if (fd != -1)
::close(fd);
std::string ret(tempname);
delete[] tempname;
return ret;
}
bool UnixFilesystem::MoveFile(const Pathname &old_path,
const Pathname &new_path) {
if (!IsFile(old_path)) {
ASSERT(IsFile(old_path));
return false;
}
LOG(LS_VERBOSE) << "Moving " << old_path.pathname()
<< " to " << new_path.pathname();
if (rename(old_path.pathname().c_str(), new_path.pathname().c_str()) != 0) {
if (errno != EXDEV)
return false;
if (!CopyFile(old_path, new_path))
return false;
if (!DeleteFile(old_path))
return false;
}
return true;
}
bool UnixFilesystem::MoveFolder(const Pathname &old_path,
const Pathname &new_path) {
if (!IsFolder(old_path)) {
ASSERT(IsFolder(old_path));
return false;
}
LOG(LS_VERBOSE) << "Moving " << old_path.pathname()
<< " to " << new_path.pathname();
if (rename(old_path.pathname().c_str(), new_path.pathname().c_str()) != 0) {
if (errno != EXDEV)
return false;
if (!CopyFolder(old_path, new_path))
return false;
if (!DeleteFolderAndContents(old_path))
return false;
}
return true;
}
bool UnixFilesystem::IsFolder(const Pathname &path) {
struct stat st;
if (stat(path.pathname().c_str(), &st) < 0)
return false;
return S_ISDIR(st.st_mode);
}
bool UnixFilesystem::CopyFile(const Pathname &old_path,
const Pathname &new_path) {
LOG(LS_VERBOSE) << "Copying " << old_path.pathname()
<< " to " << new_path.pathname();
char buf[256];
size_t len;
StreamInterface *source = OpenFile(old_path, "rb");
if (!source)
return false;
StreamInterface *dest = OpenFile(new_path, "wb");
if (!dest) {
delete source;
return false;
}
while (source->Read(buf, sizeof(buf), &len, NULL) == SR_SUCCESS)
dest->Write(buf, len, NULL, NULL);
delete source;
delete dest;
return true;
}
bool UnixFilesystem::IsTemporaryPath(const Pathname& pathname) {
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
ASSERT(provided_app_temp_folder_ != NULL);
#endif
const char* const kTempPrefixes[] = {
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
provided_app_temp_folder_,
#else
"/tmp/", "/var/tmp/",
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
"/private/tmp/", "/private/var/tmp/", "/private/var/folders/",
#endif // WEBRTC_MAC && !defined(WEBRTC_IOS)
#endif // WEBRTC_ANDROID || WEBRTC_IOS
};
for (size_t i = 0; i < arraysize(kTempPrefixes); ++i) {
if (0 == strncmp(pathname.pathname().c_str(), kTempPrefixes[i],
strlen(kTempPrefixes[i])))
return true;
}
return false;
}
bool UnixFilesystem::IsFile(const Pathname& pathname) {
struct stat st;
int res = ::stat(pathname.pathname().c_str(), &st);
// Treat symlinks, named pipes, etc. all as files.
return res == 0 && !S_ISDIR(st.st_mode);
}
bool UnixFilesystem::IsAbsent(const Pathname& pathname) {
struct stat st;
int res = ::stat(pathname.pathname().c_str(), &st);
// Note: we specifically maintain ENOTDIR as an error, because that implies
// that you could not call CreateFolder(pathname).
return res != 0 && ENOENT == errno;
}
bool UnixFilesystem::GetFileSize(const Pathname& pathname, size_t *size) {
struct stat st;
if (::stat(pathname.pathname().c_str(), &st) != 0)
return false;
*size = st.st_size;
return true;
}
bool UnixFilesystem::GetFileTime(const Pathname& path, FileTimeType which,
time_t* time) {
struct stat st;
if (::stat(path.pathname().c_str(), &st) != 0)
return false;
switch (which) {
case FTT_CREATED:
*time = st.st_ctime;
break;
case FTT_MODIFIED:
*time = st.st_mtime;
break;
case FTT_ACCESSED:
*time = st.st_atime;
break;
default:
return false;
}
return true;
}
bool UnixFilesystem::GetAppPathname(Pathname* path) {
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
ProcessSerialNumber psn = { 0, kCurrentProcess };
CFDictionaryRef procinfo = ProcessInformationCopyDictionary(&psn,
kProcessDictionaryIncludeAllInformationMask);
if (NULL == procinfo)
return false;
CFStringRef cfpath = (CFStringRef) CFDictionaryGetValue(procinfo,
kIOBundleExecutableKey);
std::string path8;
bool success = ToUtf8(cfpath, &path8);
CFRelease(procinfo);
if (success)
path->SetPathname(path8);
return success;
#elif defined(__native_client__)
return false;
#elif WEBRTC_IOS
IOSAppName(path);
return true;
#else // WEBRTC_MAC && !defined(WEBRTC_IOS)
char buffer[PATH_MAX + 2];
ssize_t len = readlink("/proc/self/exe", buffer, arraysize(buffer) - 1);
if ((len <= 0) || (len == PATH_MAX + 1))
return false;
buffer[len] = '\0';
path->SetPathname(buffer);
return true;
#endif // WEBRTC_MAC && !defined(WEBRTC_IOS)
}
bool UnixFilesystem::GetAppDataFolder(Pathname* path, bool per_user) {
ASSERT(!organization_name_.empty());
ASSERT(!application_name_.empty());
// First get the base directory for app data.
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
if (per_user) {
// Use ~/Library/Application Support/<orgname>/<appname>/
FSRef fr;
if (0 != FSFindFolder(kUserDomain, kApplicationSupportFolderType,
kCreateFolder, &fr))
return false;
unsigned char buffer[NAME_MAX+1];
if (0 != FSRefMakePath(&fr, buffer, arraysize(buffer)))
return false;
path->SetPathname(reinterpret_cast<char*>(buffer), "");
} else {
// TODO
return false;
}
#elif defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) // && !WEBRTC_MAC || WEBRTC_IOS
ASSERT(provided_app_data_folder_ != NULL);
path->SetPathname(provided_app_data_folder_, "");
#elif defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) // && !WEBRTC_MAC && !WEBRTC_IOS && !WEBRTC_ANDROID
if (per_user) {
// We follow the recommendations in
// http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
// It specifies separate directories for data and config files, but
// GetAppDataFolder() does not distinguish. We just return the config dir
// path.
const char* xdg_config_home = getenv("XDG_CONFIG_HOME");
if (xdg_config_home) {
path->SetPathname(xdg_config_home, "");
} else {
// XDG says to default to $HOME/.config. We also support falling back to
// other synonyms for HOME if for some reason it is not defined.
const char* homedir;
if (const char* home = getenv("HOME")) {
homedir = home;
} else if (const char* dotdir = getenv("DOTDIR")) {
homedir = dotdir;
} else if (passwd* pw = getpwuid(geteuid())) {
homedir = pw->pw_dir;
} else {
return false;
}
path->SetPathname(homedir, "");
path->AppendFolder(".config");
}
} else {
// XDG does not define a standard directory for writable global data. Let's
// just use this.
path->SetPathname("/var/cache/", "");
}
#endif // !WEBRTC_MAC && !WEBRTC_LINUX
// Now add on a sub-path for our app.
#if defined(WEBRTC_MAC) || defined(WEBRTC_ANDROID)
path->AppendFolder(organization_name_);
path->AppendFolder(application_name_);
#elif defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
// XDG says to use a single directory level, so we concatenate the org and app
// name with a hyphen. We also do the Linuxy thing and convert to all
// lowercase with no spaces.
std::string subdir(organization_name_);
subdir.append("-");
subdir.append(application_name_);
replace_substrs(" ", 1, "", 0, &subdir);
std::transform(subdir.begin(), subdir.end(), subdir.begin(), ::tolower);
path->AppendFolder(subdir);
#endif
if (!CreateFolder(*path, 0700)) {
return false;
}
#if !defined(__native_client__)
// If the folder already exists, it may have the wrong mode or be owned by
// someone else, both of which are security problems. Setting the mode
// avoids both issues since it will fail if the path is not owned by us.
if (0 != ::chmod(path->pathname().c_str(), 0700)) {
LOG_ERR(LS_ERROR) << "Can't set mode on " << path;
return false;
}
#endif
return true;
}
bool UnixFilesystem::GetAppTempFolder(Pathname* path) {
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
ASSERT(provided_app_temp_folder_ != NULL);
path->SetPathname(provided_app_temp_folder_);
return true;
#else
ASSERT(!application_name_.empty());
// TODO: Consider whether we are worried about thread safety.
if (app_temp_path_ != NULL && strlen(app_temp_path_) > 0) {
path->SetPathname(app_temp_path_);
return true;
}
// Create a random directory as /tmp/<appname>-<pid>-<timestamp>
char buffer[128];
sprintfn(buffer, arraysize(buffer), "-%d-%d",
static_cast<int>(getpid()),
static_cast<int>(time(0)));
std::string folder(application_name_);
folder.append(buffer);
if (!GetTemporaryFolder(*path, true, &folder))
return false;
delete [] app_temp_path_;
app_temp_path_ = CopyString(path->pathname());
// TODO: atexit(DeleteFolderAndContents(app_temp_path_));
return true;
#endif
}
bool UnixFilesystem::GetDiskFreeSpace(const Pathname& path,
int64_t* freebytes) {
#ifdef __native_client__
return false;
#else // __native_client__
ASSERT(NULL != freebytes);
// TODO: Consider making relative paths absolute using cwd.
// TODO: When popping off a symlink, push back on the components of the
// symlink, so we don't jump out of the target disk inadvertently.
Pathname existing_path(path.folder(), "");
while (!existing_path.folder().empty() && IsAbsent(existing_path)) {
existing_path.SetFolder(existing_path.parent_folder());
}
#if defined(WEBRTC_ANDROID)
struct statfs vfs;
memset(&vfs, 0, sizeof(vfs));
if (0 != statfs(existing_path.pathname().c_str(), &vfs))
return false;
#else
struct statvfs vfs;
memset(&vfs, 0, sizeof(vfs));
if (0 != statvfs(existing_path.pathname().c_str(), &vfs))
return false;
#endif // WEBRTC_ANDROID
#if defined(WEBRTC_LINUX)
*freebytes = static_cast<int64_t>(vfs.f_bsize) * vfs.f_bavail;
#elif defined(WEBRTC_MAC)
*freebytes = static_cast<int64_t>(vfs.f_frsize) * vfs.f_bavail;
#endif
return true;
#endif // !__native_client__
}
Pathname UnixFilesystem::GetCurrentDirectory() {
Pathname cwd;
char buffer[PATH_MAX];
char *path = getcwd(buffer, PATH_MAX);
if (!path) {
LOG_ERR(LS_ERROR) << "getcwd() failed";
return cwd; // returns empty pathname
}
cwd.SetFolder(std::string(path));
return cwd;
}
char* UnixFilesystem::CopyString(const std::string& str) {
size_t size = str.length() + 1;
char* buf = new char[size];
if (!buf) {
return NULL;
}
strcpyn(buf, size, str.c_str());
return buf;
}
} // namespace rtc
#if defined(__native_client__)
extern "C" int __attribute__((weak))
link(const char* oldpath, const char* newpath) {
errno = EACCES;
return -1;
}
#endif
|
[
"[email protected]"
] | |
c30c56a9503037171aebd68664b8dc3c321bc2f4
|
d0686759ef564c29894cb81d2b3cf200106bf80d
|
/data.cpp
|
84029da4228b07fc00fa5f938d6fca4daaca9a93
|
[] |
no_license
|
OrangeDS/PacketTraceExplorer
|
455dd8d30e350eef745ec2401e59355025515a46
|
90e35ef168a79b0ef2516c0776200a511386e65f
|
refs/heads/master
| 2021-01-09T06:33:50.640621 | 2014-06-15T09:34:16 | 2014-06-15T09:34:16 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 41,695 |
cpp
|
//
// data.cpp
// PacketTraceExplorer
//
// Created by Junxian Huang on 11/18/12.
// Copyright (c) 2012 Junxian Huang. All rights reserved.
//
#include "data.h"
using namespace std;
pcap_dumper_t *dumper;
uint64 packet_count;
uint64 no_ip_count;
uint64 tcp_count;
uint64 udp_count;
uint64 tcp_up_bytes;
uint64 tcp_down_bytes;
uint64 udp_up_bytes;
uint64 udp_down_bytes;
uint64 http_up_bytes;
uint64 http_down_bytes;
uint64 icmp_count;
uint64 ignore_count1;
uint64 ignore_count2;
uint64 flow_count;
att_ether_hdr *peth;
ip *pip;
tcphdr *ptcp;
udphdr *pudp;
bool b1, b2;
bool is_first;
uint64 start_time_sec;
uint64 last_time_sec;
uint64 end_time_sec;
u_int ip1, ip2;
u_int ip_clt, ip_svr;
u_short port_clt, port_svr;
u_short payload_len;
double ts;
double last_prune_time;
double last_sample_time;
double ack_delay;
u_int expected_ack;
u_int *opt_ts;
u_short opt_len;
u_int window_scale;
__gnu_cxx::hash_set<u_int> enb_ip;
__gnu_cxx::hash_set<u_int> core_ip;
__gnu_cxx::hash_map<u_int, u_int> enb_load;
__gnu_cxx::hash_map<u_int, u_int>::iterator itmap;
map<uint64, tcp_flow>::iterator flow_it;
map<uint64, tcp_flow>::iterator flow_it_tmp;
map<uint64, tcp_flow> client_flows;
map<string, pair<double, double> > big_flows;
map<string, pair<double, double> >::iterator big_flow_it_tmp;
map<u_int, user> users;
map<u_int, user>::iterator user_it;
map<u_short, tcp_flow*>::iterator uval_it;
map<u_int, u_int> cip;
map<u_int, u_int> sip;
map<u_int, u_int>::iterator csit;
uint64 flow_index;
string big_flow_index;
bool is_target_flow;
tcp_flow *flow = NULL;
user *userp = NULL;
client_bw *bw_udp = NULL;
client_bw *bw_tcp = NULL;
char *payload;
string payload_str;
size_t start_pos;
size_t end_pos;
u_int jump;
void dispatcher_handler(u_char *c, const struct pcap_pkthdr *header, const u_char *pkt_data) {
//c is not used
packet_count++;
//cout << header->len << " " << header->caplen << " time " << (header->ts.tv_sec) << endl;
//record time
if (is_first) {
is_first = false;
start_time_sec = header->ts.tv_sec;
last_time_sec = start_time_sec;
end_time_sec = start_time_sec;
if (RUNNING_LOCATION == RLOC_CONTROL_SERVER || RUNNING_LOCATION == RLOC_CONTROL_CLIENT) {
TIME_BASE = (double)(header->ts.tv_sec) + (double)header->ts.tv_usec / (double)USEC_PER_SEC;
}
cout << "TIME_BASE " << fixed << TIME_BASE << endl;
} else {
end_time_sec = header->ts.tv_sec;
}
ts = ((double)(header->ts.tv_sec) + (double)header->ts.tv_usec / (double)USEC_PER_SEC) - TIME_BASE;
peth = (att_ether_hdr *)pkt_data;
if (*((u_short *)(pkt_data + ETHER_HDR_LEN - 2)) == ETHERTYPE_IP) {
//all IP
pip = (ip *)(pkt_data + ETHER_HDR_LEN);
b1 = isClient(pip->ip_src);
b2 = isClient(pip->ip_dst);
if ((b1 && !b2) || (!b1 && b2)) { //uplink or downlink
if (b1 && !b2) { // uplink
ip1 = peth->src_ip;
ip2 = peth->dst_ip;
ip_clt = pip->ip_src.s_addr;
ip_svr = pip->ip_dst.s_addr;
} else { //downlink
ip1 = peth->dst_ip;
ip2 = peth->src_ip;
ip_clt = pip->ip_dst.s_addr;
ip_svr = pip->ip_src.s_addr;
}
//enb_ip.insert(ip1);
//core_ip.insert(ip2);
/* //ENB load info
enb_load[ip1]++;
if (end_time_sec - LOAD_SAMPLE_PERIOD >= last_time_sec) {
last_time_sec = end_time_sec;
for (itmap = enb_load.begin() ; itmap != enb_load.end() ; itmap++) {
cout << "ENBLOAD " << ConvertIPToString(itmap->first) << " " <<
end_time_sec << " " << itmap->second << endl;
}
cout << endl;
enb_load.clear();
}//*/
} else if (b1 && b2) { //ignore 1, both are client IP
ignore_count1++;
} else { //ignore 2, none are client IP
ignore_count2++;
}
//init userp
userp = &users[ip_clt];
if (userp->start_time == 0) {
//init
userp->start_time = ts;
}
switch (pip->ip_p) {
case IPPROTO_TCP:
//break; //TODO only look at UDP now
tcp_count++;
ptcp = (tcphdr *)((u_char *)pip + BYTES_PER_32BIT_WORD * pip->ip_hl); //cast of u_char* is necessary
payload_len = bswap16(pip->ip_len) - BYTES_PER_32BIT_WORD * (pip->ip_hl + ptcp->th_off);
opt_len = BYTES_PER_32BIT_WORD * ptcp->th_off - 20;
opt_ts = (u_int *)((u_char *)ptcp + 20);
window_scale = 0;
while (opt_len >= 10) { //Timestamps option at least 10 bytes
if ((*((u_char *)opt_ts)) == 0x08 && (*(((u_char *)opt_ts) + 1)) == 0x0a) {
opt_ts = (u_int *)((u_char *)opt_ts + 2);
opt_len = 100;
break;
} else if ((*((u_char *)opt_ts)) == 0x00 || (*((u_char *)opt_ts)) == 0x01) {
//NOP
opt_ts = (u_int *)((u_char *)opt_ts + 1); //opt_ts + 1 is length field
opt_len--;
} else {
if ((*((u_char *)opt_ts)) == 0x03) {
//window scale option in the SYN packet
window_scale = (1 << (*((u_int *)((u_char *)opt_ts + 2))));
}
jump = (u_int)(*((u_char *)opt_ts + 1));
if (jump > opt_len || jump <= 0) {
//something weird happens
opt_len = 0;
break;
}
opt_len -= jump;
opt_ts = (u_int *)((u_char *)opt_ts + jump); //opt_ts + 1 is length field
}
}
if (RUNNING_LOCATION == RLOC_CONTROL_CLIENT) {
//TCP client side throughput sampling
if (b1 && !b2 && bw_tcp == NULL && (ptcp->th_flags & TH_SYN) != 0) {
bw_tcp = new client_bw(ts, 1.0);
}
//BW estimation ground truth
if (!b1 && b2) { //downlink
//sample throughput here, using differnt time window
bw_tcp->add_packet(payload_len, ts);
}//*/
//G value ground truth
/*if (b1 && !b2) { // uplink
if ((ptcp->th_flags & TH_ACK) != 0) {
opt_ts = (u_int *)((u_char *)ptcp + 24);
if (double_start < 0) {
u_int_start = bswap32(*opt_ts);
double_start = ts;
} else {
cout << "G_GROUNDTRUTH " << (ts - double_start) / (bswap32(*opt_ts) - u_int_start) << endl;
}
}
}//*/
//analyze client trace to understand the delay between data and ack
/*if (b1 && !b2) { // uplink
if (ack_delay >= 0 && expected_ack == bswap32(ptcp->th_ack)) {
cout << "ACK_DELAY " << ts - ack_delay << endl;
ack_delay = -1;
} else if (ack_delay >= 0 && expected_ack < bswap32(ptcp->th_ack)) {
//abandon this sample
ack_delay = -1;
}
} else if (!b1 && b2) { //downlink
if (ack_delay < 0 && payload_len > 0) {
ack_delay = ts;
expected_ack = bswap32(ptcp->th_seq) + payload_len;
}
}*/
} else if (RUNNING_LOCATION == RLOC_ATT_SERVER ||
RUNNING_LOCATION == RLOC_ATT_CLIENT ||
RUNNING_LOCATION == RLOC_CONTROL_SERVER) {
if (b1 && !b2) { // uplink
port_clt = bswap16(ptcp->th_sport);
port_svr = bswap16(ptcp->th_dport);
tcp_up_bytes += payload_len;
if (port_svr == 80 || port_svr == 8080) {
http_up_bytes += payload_len;
}
} else if (!b1 && b2) { //downlink
port_clt = bswap16(ptcp->th_dport);
port_svr = bswap16(ptcp->th_sport);
tcp_down_bytes += payload_len;
if (port_svr == 80 || port_svr == 8080) {
http_down_bytes += payload_len;
}
} else {
break;
}
/*//count CS IPs
cip[ip_clt]++;
sip[ip_svr]++;
break;*/
/*//dump concurrency results
if (ts - last_sample_time > 100.0) {
last_sample_time = ts;
for (user_it = users.begin() ; user_it != users.end() ; user_it++) {
//for each user
int concurrency = 0;
for (uval_it = (*user_it).second.tcp_flows.begin() ; uval_it != (*user_it).second.tcp_flows.end() ; uval_it++) {
if (uval_it->second->last_byte_time > ts - 1.0)
concurrency++;
}
if (concurrency > 0)
printf("CC %.4lf %d\n", ts, concurrency);
}
}//*/
//sequence number ACK number plot
/*bool isUplink = true; //true for ACK, false for SEQ
if (RUNNING_LOCATION == RLOC_CONTROL_SERVER) {
if (b1 && !b2 && isUplink) { // uplink, for ack
cout << ts << " " << packet_count;
cout << " src " << ConvertIPToString(pip->ip_src.s_addr) << " ";
cout << " dst " << ConvertIPToString(pip->ip_dst.s_addr) << " ";
cout << bswap32(ptcp->th_ack) << endl;//
} else if (!b1 && b2 && !isUplink) { //downlink, for seq
cout << ts << " " << packet_count;
cout << " src " << ConvertIPToString(pip->ip_src.s_addr) << " ";
cout << " dst " << ConvertIPToString(pip->ip_dst.s_addr) << " ";
cout << bswap32(ptcp->th_seq) << endl;//
}
}//*/
/*//netflix study, this should be commented out for all other analysis
//check whether current packet has TCP payload
if (ETHER_HDR_LEN + BYTES_PER_32BIT_WORD * (pip->ip_hl + ptcp->th_off) < header->caplen)
payload = (char *)((char *)ptcp + BYTES_PER_32BIT_WORD * ptcp->th_off);
else
payload = (char *)"";
payload_str = string(payload);
big_flow_index = ConvertIPToString(ip_clt) + string("_");
big_flow_index += ConvertIPToString(ip_svr) + string("_");
big_flow_index += NumberToString(port_clt) + string("_") + NumberToString(port_svr);
if ((payload_str.find("GET ") == 0 || payload_str.find("HEAD ") == 0 ||
payload_str.find("POST ") == 0 || payload_str.find("PUT ") == 0 ||
payload_str.find("DELETE ") == 0 || payload_str.find("TRACE ") == 0 ||
payload_str.find("OPTIONS ") == 0 || payload_str.find("CONNECT ") == 0 ||
payload_str.find("PATCH ") == 0) && (b1 && !b2)) {
//uplink HTTP request
//output existing HTTP info
if (big_flows[big_flow_index].first >= 0 && big_flows[big_flow_index].second > 0) {
cout << big_flows[big_flow_index].first << " " << big_flows[big_flow_index].second;
cout << " src " << ConvertIPToString(pip->ip_src.s_addr) << " ";
cout << " dst " << ConvertIPToString(pip->ip_dst.s_addr) << " ";
cout << port_clt << endl;
}
big_flows[big_flow_index] = make_pair(ts, 0);
//} else if (payload_str.find("HTTP/1.") == 0 && (!b1 && b2)) {
//downlink HTTP response
// size_t start_pos = payload_str.find("Content-Length: ");
// size_t end_pos = payload_str.find("\r\n", start_pos);
// int content_len = 0;
// if (start_pos != string::npos && end_pos > start_pos + 16)
// content_len = StringToNumber<int>(payload_str.substr(start_pos + 16, end_pos - start_pos - 16));
} else if (payload_len > 0 && (!b1 && b2)) {
big_flows[big_flow_index].second = ts;
} else if ((ptcp->th_flags & TH_FIN) != 0 || (ptcp->th_flags & TH_RST) != 0) {
//output existing HTTP info
if (big_flows[big_flow_index].first >= 0 && big_flows[big_flow_index].second > 0) {
cout << big_flows[big_flow_index].first << " " << big_flows[big_flow_index].second;
cout << " src " << ConvertIPToString(pip->ip_src.s_addr) << " ";
cout << " dst " << ConvertIPToString(pip->ip_dst.s_addr) << " ";
cout << port_clt << endl;
}
big_flows[big_flow_index] = make_pair(-1, 0);
}
//use UDP flow to calculate aggregate throughput
if (!b1 && b2) { //downlink
//sample throughput here, using differnt time window
if (bw_udp == NULL) {
bw_udp = new client_bw(ts, 0.1);
}
bw_udp->add_packet(payload_len, ts);
}//
break;//*/
//dump interested flow
/*if (//big_flow_index.compare("10.134.12.177_96.17.164.36_1556_1935") == 0 ||
//big_flow_index.compare("10.34.229.236_90.84.51.8_40214_80") == 0 ||
//big_flow_index.compare("10.8.102.148_107.14.33.153_2463_80") == 0 ||
//big_flow_index.compare("10.9.63.12_68.142.123.131_1216_80") == 0 ||
//big_flow_index.compare("10.9.63.12_8.254.15.254_1504_80") == 0) {
big_flow_index.compare("10.46.6.151_74.125.227.65_54587_80") == 0 //Youtube traffic, reusing flow
//1231 180724 1350088578.551052 10.46.6.151 54587 74.125.227.65 80 Host: 3.bp.blogspot.com User-Agent: Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25 Referer: http://jenniferstano.blogspot.com/search?updated-max=2012-08-07T15:28:00-07:00&max-results=20&start=3&by-date=false Http Len: 22746
||
big_flow_index.compare("10.9.131.253_74.125.215.179_51071_80") == 0 //iPad, AppleCoreMedia
//12601 1219331 1350876729.943984 10.9.131.253 51071 74.125.215.179 80 Host: r4---sn-a5m7zu7d.c.youtube.com User-Agent: AppleCoreMedia/1.0.0.9B206 (iPad; U; CPU OS 5_1_1 like Mac OS X; en_us) NULL Http Len: 22747
) {
pcap_dump((u_char *)dumper, header, pkt_data);
pcap_dump_flush(dumper);
}//*/
//flow statistics analysis
flow_index = port_clt * (((uint64)1) << 32) + ip_clt;
flow_it_tmp = client_flows.find(flow_index);
if (flow_it_tmp != client_flows.end()) {
//found flow
} else if (flow_it_tmp == client_flows.end() && (ptcp->th_flags & TH_SYN) != 0 && (b1 && !b2)) {
//no flow found, now uplink SYN packet
/*//big flow analysis
big_flow_index = ConvertIPToString(ip_clt) + string("_");
big_flow_index += ConvertIPToString(ip_svr) + string("_");
big_flow_index += NumberToString(port_clt) + string("_");
big_flow_index += NumberToString(port_svr);
big_flow_it_tmp = big_flows.find(big_flow_index);
is_target_flow = false;
if (big_flow_it_tmp != big_flows.end()) {
//found big flow
if (ts >= big_flows[big_flow_index].first && ts <= big_flows[big_flow_index].first + big_flows[big_flow_index].second) {
//target flow found
is_target_flow = true;
}
}
if (!is_target_flow) {
break;
}
//*/
client_flows[flow_index].clt_ip = ip_clt; //init a flow
flow_count++;
flow = &client_flows[flow_index];
userp->tcp_flows[port_clt] = flow;
flow->idle_time_before_syn = ts - userp->last_packet_time;
flow->svr_ip = ip_svr;
flow->clt_port = port_clt;
flow->svr_port = port_svr;
flow->start_time = ts;
flow->end_time = ts;
if (RUNNING_LOCATION == RLOC_ATT_SERVER) {
if (client_flows.size() >= 100000 && ts - last_prune_time >= FLOW_MAX_IDLE_TIME / 2) {
//if (ts - last_prune_time >= FLOW_MAX_IDLE_TIME) {
cout << "Flowsize " << ts << " " << client_flows.size() << endl;
last_prune_time = ts; //only prune once for every 100 seconds
for (flow_it = client_flows.begin() ; flow_it != client_flows.end() ; ) {
flow_it_tmp = flow_it;
flow_it++;
if (flow_it_tmp->second.end_time < ts - FLOW_MAX_IDLE_TIME) {
//delete a flow
flow_it_tmp->second.print(-1 * ptcp->th_flags);
users[flow_it_tmp->second.clt_ip].tcp_flows.erase(flow_it_tmp->second.clt_port);
client_flows.erase(flow_it_tmp);
}
}//*/
}
}//*/
} else {
//no flow found and not link SYN packet
//could be ACKs after RST/FIN packets
//could be packets for long lived TCP flow
//just ignore
break;
}
flow = &client_flows[flow_index];
flow->end_time = ts;
flow->packet_count++; //should be before the SYN-RTT analysis
//if a terminate flow packet is here, terminate flow and output flow statistics
if ((ptcp->th_flags & TH_FIN) != 0 || (ptcp->th_flags & TH_RST) != 0) {
flow->print((ptcp->th_flags & TH_FIN) | (ptcp->th_flags & TH_RST));
//delete this flow
userp->tcp_flows.erase(port_clt);
client_flows.erase(flow_index);
break;
} else { // all packets of this flow goes to here except for the FIN and RST packets
if (b1 && !b2) { // uplink
if (payload_len > 0) {
flow->total_up_payloads += payload_len;
}
if (opt_len == 100) {
//there is TCP timestamp options
flow->has_ts_option_clt = true;
if (flow->packet_count == 1 && (ptcp->th_flags & TH_SYN) != 0) {
//SYN
flow->promotion_delay = -1 * bswap32(*opt_ts);
flow->window_scale = window_scale;
} else if (flow->packet_count == 3 && (ptcp->th_flags & TH_SYN) == 0 && flow->promotion_delay < 0) {
//this is not a repeated SYN
//ACK 3
flow->promotion_delay += bswap32(*opt_ts);
flow->window_initial_size = flow->window_scale * bswap16(ptcp->th_win);
}
}
} else if (!b1 && b2) { //downlink
if (payload_len > 0) {
flow->total_down_payloads += payload_len;
flow->last_byte_time = ts;
if (flow->first_byte_time == 0) {
flow->first_byte_time = ts;
}
}
if (opt_len == 100) //there is TCP timestamp options
flow->has_ts_option_svr = true;
}
}
//RTT and TCP pattern analysis
if (ip_clt == flow->clt_ip &&
ip_svr == flow->svr_ip &&
port_clt == flow->clt_port &&
port_svr == flow->svr_port) {
if (b1 && !b2) { // uplink
flow->window_size = flow->window_scale * bswap16(ptcp->th_win); //only update receiver's window
flow->update_ack_x(bswap32(ptcp->th_ack), payload_len, ts);
} else if (!b1 && b2) { //downlink
flow->update_seq_x(bswap32(ptcp->th_seq), payload_len, ts);
}
//cout << "EMPTY_WINDOW " << ts << " " << flow->window_size - flow->bytes_in_fly << endl;
//sample bytes_in_fly
//if ((SAMPLES++) % SAMPLE_CYCLE == 0)
// cout << "BF " << flow->bytes_in_fly << endl;
}//*/
//HTTP analysis
/*if (ETHER_HDR_LEN + BYTES_PER_32BIT_WORD * (pip->ip_hl + ptcp->th_off) < header->caplen) {
//has TCP payload
payload = (char *)((char *)ptcp + BYTES_PER_32BIT_WORD * ptcp->th_off);
payload_str = string(payload);
if (b1 && !b2) {
//UPLINK
if (payload_str.find("GET ") == 0 || payload_str.find("HEAD ") == 0 ||
payload_str.find("POST ") == 0 || payload_str.find("PUT ") == 0 ||
payload_str.find("DELETE ") == 0 || payload_str.find("TRACE ") == 0 ||
payload_str.find("OPTIONS ") == 0 || payload_str.find("CONNECT ") == 0 ||
payload_str.find("PATCH ") == 0) {
//uplink HTTP request
flow->http_request_count++;
if (flow->user_agent.length() == 0) {
//only record the first user agent
start_pos = payload_str.find("User-Agent: ");
end_pos = payload_str.find("\r\n", start_pos);
if (start_pos != string::npos && end_pos > start_pos + 12)
flow->user_agent = compress_user_agent(payload_str.substr(start_pos + 12, end_pos - start_pos - 12));
}
if (flow->host.length() == 0) {
//only record the first user agent
start_pos = payload_str.find("Host: ");
end_pos = payload_str.find("\r\n", start_pos);
if (start_pos != string::npos && end_pos > start_pos + 6)
flow->host = payload_str.substr(start_pos + 6, end_pos - start_pos - 6);
}
}
} else if (!b1 && b2) {
//DOWNLINK
if (payload_str.find("HTTP/1.1 200 OK") == 0 || payload_str.find("HTTP/1.0 200 OK") == 0) {
//downlink HTTP 200 OK
if (flow->content_type.length() == 0) {
//only record the first content type
start_pos = payload_str.find("Content-Type: ");
end_pos = payload_str.find("\r\n", start_pos);
if (start_pos != string::npos && end_pos > start_pos + 14)
flow->content_type = process_content_type(payload_str.substr(start_pos + 14, end_pos - start_pos - 14));
}
start_pos = payload_str.find("Content-Length: ");
end_pos = payload_str.find("\r\n", start_pos);
if (start_pos != string::npos && end_pos > start_pos + 16)
flow->total_content_length += StringToNumber<int>(payload_str.substr(start_pos + 16, end_pos - start_pos - 16));
//} else if (payload_str.find("HTTP/") == 0 && payload_str.find("200 OK") != -1) {
// cout << "HTTP_RESPONSE_SPECIAL " << payload_str << endl;
}
}
}//*/
//BWE analysis, the first part can be used for G inference only
if (flow->gval < 0) {
//do G inference for BW estimate
if (b1 && !b2) { // uplink
if ((ptcp->th_flags & TH_ACK) != 0) {
if (opt_len == 100) {
if (flow->double_start < 0) {
flow->u_int_start = bswap32(*opt_ts);
flow->double_start = ts;
//cout << "TCP header length of the first uplink ACK " << BYTES_PER_32BIT_WORD * ptcp->th_off << endl;
} else if (flow->double_start > 0 && ts - flow->double_start > GVAL_TIME) {
flow->gval = (ts - flow->double_start) / (bswap32(*opt_ts) - flow->u_int_start);
//cout << "G_INFER " << " t_off " << (ts - flow->double_start) << " G: " << flow->gval << " s/tick" << endl;
}
}
}
}
}/* else {
//do BW estimation
if (ip_clt == flow->clt_ip && ip_svr == flow->svr_ip &&
port_clt == flow->clt_port && port_svr == flow->svr_port) {
if (b1 && !b2) { // uplink
if ((ptcp->th_flags & TH_ACK) != 0) {
flow->update_ack(bswap32(ptcp->th_ack), payload_len, flow->gval * bswap32(*opt_ts), ts);
}
} else if (!b1 && b2) { //downlink
//payload_len > < 0 check inside update_seq
flow->update_seq(bswap32(ptcp->th_seq), payload_len, ts);
}
}
}//*/
/*//G inference
if (RUNNING_LOCATION == RLOC_CONTROL_SERVER) {
if (b1 && !b2) { // uplink
if ((ptcp->th_flags & TH_ACK) != 0) {
if (flow->double_start < 0 && ts > 100) {
flow->u_int_start = bswap32(*opt_ts);
flow->double_start = ts;
} else if (flow->double_start > 0) {
flow->gval = (ts - flow->double_start) / (bswap32(*opt_ts) - flow->u_int_start);
if (packet_count % 3 == 0)
cout << "G_INFERENCE " << (ts - flow->double_start) << " " << flow->gval << endl;
}
}
}
}//*/
/*if (packet_count == 38084) {
cout << "create flow here" << endl;
flow = new tcp_flow(ip_svr, ip_clt, port_svr, port_clt);
}
if (packet_count >= 38084) {
//flow is not null
if (ip_clt == flow->clt_ip &&
ip_svr == flow->svr_ip &&
port_clt == flow->clt_port &&
port_svr == flow->svr_port) {
if (b1 && !b2) { // uplink
//cout << "target uplink packet " << packet_count << endl;
//target flow, ack packets
if (bswap32(ptcp->th_ack) > 0) {
flow->update_ack(bswap32(ptcp->th_ack), ts);
}
} else if (!b1 && b2) { //downlink
//cout << "target downlink packet " << packet_count << endl;
//target flow
if (payload_len >= TCP_MAX_PAYLOAD) {
flow->update_seq(bswap32(ptcp->th_seq), payload_len, ts);
}
}
}
}//*/
}
break;
case IPPROTO_UDP:
udp_count++;
pudp = (udphdr *)((u_char *)pip + sizeof(ip));
payload_len = bswap16(pudp->uh_ulen) - UDP_HDR_LEN;
if (b1 && !b2) { // uplink
ip_clt = pip->ip_src.s_addr;
ip_svr = pip->ip_dst.s_addr;
udp_up_bytes += payload_len;
} else if (!b1 && b2) { //downlink
ip_clt = pip->ip_dst.s_addr;
ip_svr = pip->ip_src.s_addr;
udp_down_bytes += payload_len;
} else {
break;
}
/*//count CS IPs
cip[ip_clt]++;
sip[ip_svr]++;*/
if (RUNNING_LOCATION == RLOC_CONTROL_CLIENT) {
//UDP client side throughput sampling
if (!b1 && b2) { //downlink
//sample throughput here, using differnt time window
if (bw_udp == NULL) {
bw_udp = new client_bw(ts, 0.5);
}
bw_udp->add_packet(payload_len, ts);
}
}
/*//DNS analysis
if (b1 && !b2) { // uplink
ip_clt = pip->ip_src.s_addr;
ip_svr = pip->ip_dst.s_addr;
port_clt = bswap16(pudp->uh_sport);
port_svr = bswap16(pudp->uh_dport);
} else if (!b1 && b2) { //downlink
ip_clt = pip->ip_dst.s_addr;
ip_svr = pip->ip_src.s_addr;
port_clt = bswap16(pudp->uh_dport);
port_svr = bswap16(pudp->uh_sport);
} else {
break;
}
if (port_svr == 53) {
//UDP flow statistics analysis
flow_index = port_clt * (((uint64)1) << 32) + ip_clt;
flow_it_tmp = client_flows.find(flow_index);
if (flow_it_tmp != client_flows.end()) {
//found flow
} else if (flow_it_tmp == client_flows.end() && (b1 && !b2)) {
client_flows[flow_index].clt_ip = ip_clt;
flow_count++;
flow = &client_flows[flow_index];
flow->svr_ip = ip_svr;
flow->clt_port = port_clt;
flow->svr_port = port_svr;
flow->start_time = ts;
flow->end_time = ts;
if (RUNNING_LOCATION == RLOC_ATT_SERVER) {
if (client_flows.size() >= 100000 && ts - last_prune_time >= FLOW_MAX_IDLE_TIME / 2) {
//if (ts - last_prune_time >= FLOW_MAX_IDLE_TIME) {
cout << "Flowsize " << ts << " " << client_flows.size() << endl;
last_prune_time = ts; //only prune once for every 100 seconds
for (flow_it = client_flows.begin() ; flow_it != client_flows.end() ; ) {
flow_it_tmp = flow_it;
flow_it++;
if (flow_it_tmp->second.end_time < ts - FLOW_MAX_IDLE_TIME)
client_flows.erase(flow_it_tmp);
}//
}
}//
} else {
break;
}
flow = &client_flows[flow_index];
if (b1 && !b2) { // uplink
flow->end_time = ts;
} else if (!b1 && b2) { //downlink
cout << "D " << ConvertIPToString(flow->svr_ip) << " " << (ts - flow->end_time) << endl;
client_flows.erase(flow_index);
}
}//*/
//cout << "UDP src port " << bswap16(pudp->uh_sport) << " dst port " << bswap16(pudp->uh_dport) << endl;
break;
case IPPROTO_ICMP:
icmp_count++;
break;
default:
break;
}
//everything is in IP
if (userp->last_packet_time > 0 && ts > userp->last_packet_time + 1.0) {
//printf("UI %.4lf\n", ts - userp->last_packet_time);
}
userp->last_packet_time = ts;
} else {
no_ip_count++;
//cout << "Packet " << packet_count << " not IP " << peth->ether_type << endl;
}
//if (packet_count > 1000)
// exit(0);
}
//called for each trace file, should not reset persistent variables across different traces here
int init_global() {
is_first = true;
start_time_sec = 0;
last_time_sec = 0;
end_time_sec = 0;
packet_count = 0;
no_ip_count = 0;
tcp_count = 0;
udp_count = 0;
icmp_count = 0;
ignore_count1 = 0;
ignore_count2 = 0;
flow_count = 0;
tcp_up_bytes = 0;
tcp_down_bytes = 0;
udp_up_bytes = 0;
udp_down_bytes = 0;
http_up_bytes = 0;
http_down_bytes = 0;
ack_delay = -1;
enb_ip.clear();
core_ip.clear();
enb_load.clear();
client_flows.clear();
last_prune_time = 0;
last_sample_time = 0;
cip.clear();
sip.clear();
big_flow_index = "default";
big_flows.clear();
/*if (RUNNING_LOCATION == RLOC_ATT_SERVER || RUNNING_LOCATION == RLOC_ATT_CLIENT) {
//readin big flow data
const char *big_flow_path;
if (RUNNING_LOCATION == RLOC_ATT_SERVER) {
big_flow_path = "/q/gp13/dpi/tcprx/work/data/flow_target.data";
} else if (RUNNING_LOCATION == RLOC_ATT_CLIENT) {
big_flow_path = "/Users/hjx/Documents/4G/figures/traffic/data/flow_target.data";
}
string key;
double start, duration;
ifstream ifs(big_flow_path);
while (ifs >> key >> start >> duration) {
big_flows[key] = make_pair(start, duration);
//big_flows[key] = pair<double, double>(start, duration); //the same
}
}//*/
cout << "BIG_FLOWS size " << big_flows.size() << endl;
//dump interest.pcap
pcap_t *px = pcap_open_dead(DLT_EN10MB, 64);
dumper = pcap_dump_open(px, "interest.pcap");
SAMPLES = 0;
}
int read_pcap_trace(const char * filename) {
char errbuf[PCAP_ERRBUF_SIZE];
pcap_t *fp;
/* Open the capture file */
if ((fp = pcap_open_offline(filename, errbuf)) == NULL) {
fprintf(stderr,"Unable to open the file %s\n", filename);
return 0;
}
if (pcap_datalink(fp) == DLT_LINUX_SLL) {
ETHER_HDR_LEN = 16;
} else {
ETHER_HDR_LEN = 14;
}
/* read and dispatch packets until EOF is reached */
pcap_loop(fp, 0, dispatcher_handler, NULL);
pcap_close(fp);
/*__gnu_cxx::hash_set<u_int>::iterator it;
for (it = enb_ip.begin() ; it != enb_ip.end() ; it++)
cout << "ENB " << ConvertIPToString(*it) << endl;
for (it = core_ip.begin() ; it != core_ip.end() ; it++)
cout << "CORE " << ConvertIPToString(*it) << endl;//*/
/*//count CS IPs
cout << "CIPCount " << cip.size() << " " << filename << endl;
cout << "SIPCount " << sip.size() << " " << filename << endl;
if (strcmp(filename, "/q/gp13/dpi/tcprx/work/raw/t1012.2781.pcap.hdr.pcap") == 0) {
for (csit = cip.begin() ; csit != cip.end() ; csit++)
cout << "CIP " << ConvertIPToString((*csit).first) << " " << (*csit).second << endl;
for (csit = sip.begin() ; csit != sip.end() ; csit++)
cout << "SIP " << ConvertIPToString((*csit).first) << " " << (*csit).second << endl;
}//*/
cout << "PacketCount " << packet_count << endl;
cout << "NoIpCount " << no_ip_count << endl;
cout << "TcpCount " << tcp_count << endl;
cout << "UdpCount " << udp_count << endl;
cout << "IcmpCount " << icmp_count << endl;
cout << "IgnoreCount1 " << ignore_count1 << endl;
cout << "IgnoreCount2 " << ignore_count2 << endl;
cout << "FlowCount " << flow_count << endl; // count of all flows, some may not closed at all
cout << "tcp_up_bytes " << tcp_up_bytes << endl;
cout << "tcp_down_bytes " << tcp_down_bytes << endl;
cout << "udp_up_bytes " << udp_up_bytes << endl;
cout << "udp_down_bytes " << udp_down_bytes << endl;
cout << "http_up_bytes " << http_up_bytes << endl;
cout << "http_down_bytes " << http_down_bytes << endl;
cout << "StartTime " << start_time_sec << endl;
cout << "EndTime " << end_time_sec << endl;
cout << "Duration " << end_time_sec - start_time_sec << endl;
return 1;
}
|
[
"[email protected]"
] | |
6c90638de86e0309d0ffff9afe118a9b44a0768a
|
0758066960d0990bd4ce76805f93d9bc7c2b9b0f
|
/SDL Work/String Editor/LeftView.h
|
24d7456781cce7b209a4e3b1f247dc9124cba3d7
|
[] |
no_license
|
mrsalt/USU
|
4acf7ecf84663491582a834f31f69cfd17938d58
|
49cbc7bbc597f6780338f11bf341c86579bb3c02
|
refs/heads/master
| 2020-08-26T22:39:36.728764 | 2019-10-24T00:50:08 | 2019-10-24T02:18:11 | 217,167,673 | 0 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,810 |
h
|
// LeftView.h : interface of the CLeftView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_LEFTVIEW_H__16E7BB91_9EBD_11D4_98E8_00A076801ACD__INCLUDED_)
#define AFX_LEFTVIEW_H__16E7BB91_9EBD_11D4_98E8_00A076801ACD__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CStringEditorDoc;
class CLeftView : public CTreeView
{
protected: // create from serialization only
CLeftView();
DECLARE_DYNCREATE(CLeftView)
// Attributes
public:
CStringEditorDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CLeftView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void OnInitialUpdate(); // called first time after construct
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CLeftView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CLeftView)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // debug version in LeftView.cpp
inline CStringEditorDoc* CLeftView::GetDocument()
{ return (CStringEditorDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_LEFTVIEW_H__16E7BB91_9EBD_11D4_98E8_00A076801ACD__INCLUDED_)
|
[
"[email protected]"
] | |
a851ec2f6bd4759eaf53ce154b5cae57b6661ed2
|
d00f4a09a0d6e9269dcba4ade632fae344d8930b
|
/benchmarks/module/core/fdim/regular/fdim.hpp
|
e3add139666868d0500779bbd2f7ade1941257f2
|
[
"MIT"
] |
permissive
|
mfkiwl/eve
|
b1e1e623b5d170a885f555906f4dc2faadcc626c
|
961749111b4edd78e4f69c6e2c5e4b1a9088a19a
|
refs/heads/main
| 2023-04-29T04:00:38.030889 | 2020-09-17T15:58:21 | 2020-09-17T15:58:21 | 355,671,435 | 0 | 0 |
MIT
| 2021-04-07T20:17:04 | 2021-04-07T20:17:03 | null |
UTF-8
|
C++
| false | false | 1,075 |
hpp
|
//==================================================================================================
/**
EVE - Expressive Vector Engine
Copyright 2020 Joel FALCOU
Copyright 2020 Jean-Thierry LAPRESTE
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
SPDX-License-Identifier: MIT
**/
//==================================================================================================
#include <eve/function/fdim.hpp>
#include <eve/constant/valmin.hpp>
#include <eve/constant/valmax.hpp>
#include <numeric>
int main()
{
auto lmin = eve::valmin(eve::as<EVE_VALUE>());
auto lmax = eve::valmax(eve::as<EVE_VALUE>());
auto arg0 = eve::bench::random_<EVE_VALUE>(lmin,lmax);
auto arg1 = eve::bench::random_<EVE_VALUE>(lmin,lmax);
auto std__fdim = [](EVE_VALUE x, EVE_VALUE y){return EVE_VALUE(std::fdim(x, y)); };
eve::bench::experiment xp;
run<EVE_VALUE>(EVE_NAME(std__fdim) , xp, std__fdim, arg0, arg1);
run<EVE_VALUE>(EVE_NAME(fdim) , xp, eve::fdim, arg0, arg1);
run<EVE_TYPE> (EVE_NAME(fdim) , xp, eve::fdim, arg0, arg1);
}
|
[
"[email protected]"
] | |
63fcc75503133a925a3c7372c9669c24d479ef89
|
f27905a766d8bab0fb85bda4921e0bcf40c2d247
|
/algo/src/flow/C/solution.cpp
|
ae8c692d118a69752e1415d739ad06e15a994d24
|
[] |
no_license
|
SerTelnov/labs
|
507865dc016479208af1a246da83a31d55e5b4fd
|
51af13579f63e1f80a92977d144eee1a05a7f814
|
refs/heads/master
| 2021-10-16T10:14:37.927615 | 2019-02-10T10:40:46 | 2019-02-10T10:40:46 | 109,322,002 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 2,983 |
cpp
|
#include <iostream>
#include <stdio.h>
#include <unordered_map>
#include <vector>
#include <queue>
using namespace std;
const int MAX_SIZE = 100000;
const int MAX_VALUE = MAX_SIZE * 2;
unordered_map<int, int> graph[MAX_SIZE];
unordered_map<int, int> flows[MAX_SIZE];
FILE * output;
bool printFlow(int curr, int end) {
fprintf(output, "%d ", curr + 1);
if (curr != end) {
for (auto next : graph[curr]) {
if (flows[curr][next.first] > 0 && next.second >= 1) {
graph[curr][next.first]--;
if (printFlow(next.first, end)) {
return true;
}
}
}
} else {
return true;
}
return false;
}
int run_flow(int s, int t, const int n) {
vector<int> path(n);
queue<int> q;
while (true) {
fill(path.begin(), path.end(), -1);
while (!q.empty())
q.pop();
q.push(s);
path[s] = 0;
while (!q.empty()) {
const int curr = q.front();
q.pop();
if (curr == t)
break;
if (graph[curr].size() == 0)
continue;
for (auto next : graph[curr]) {
if (next.second - flows[curr][next.first] > 0) {
if (path[next.first] == -1) {
path[next.first] = curr;
q.push(next.first);
}
}
}
}
int curr = t;
if (path[curr] == -1) {
break;
}
int min = MAX_VALUE;
while (curr != s) {
const int prev = path[curr];
if (min > graph[prev][curr] - flows[prev][curr]) {
min = graph[prev][curr] - flows[prev][curr];
}
curr = prev;
}
curr = t;
while (curr != s) {
const int prev = path[curr];
flows[prev][curr] += min;
flows[curr][prev] -= min;
if (graph[curr][prev] - flows[curr][prev] > 0) {
graph[curr][prev] -= flows[curr][prev];
}
curr = prev;
}
}
int flow = 0;
for (auto it : graph[s]) {
flow += flows[s][it.first];
}
return flow;
}
int main() {
FILE * input = fopen("snails.in", "r");
int n, m, s, t;
fscanf(input, "%d%d%d%d", &n, &m, &s, &t);
--s;
--t;
for (int i = 0; i != m; ++i) {
int to, from;
fscanf(input, "%d%d", &from, &to);
if (from != to) {
graph[from - 1][to - 1]++;
}
}
fclose(input);
output = fopen("snails.out", "w");
const int flow = run_flow(s, t, n);
if (flow < 2) {
fprintf(output, "NO");
} else {
fprintf(output, "YES\n");
printFlow(s, t);
fprintf(output, "\n");
printFlow(s, t);
}
fclose(output);
return 0;
}
|
[
"[email protected]"
] | |
d29ee42189b88d334317237fad0d99c294028a1b
|
10f64b4878f2368d67a0b7c96de740bea6c9ccac
|
/include/util.h
|
d1e7e24ba89309c3a5510ba6985c5c2ca35990a4
|
[
"MIT"
] |
permissive
|
thuanvh/eye-gaze
|
511a3885a160c1003420073021a314270ece014f
|
af62cf4e7fec5645a4a880e3ad32790cb25b4e0a
|
refs/heads/master
| 2020-03-08T02:58:21.750670 | 2018-04-03T08:34:09 | 2018-04-03T08:34:09 | 127,876,748 | 1 | 0 | null | 2018-04-03T08:33:00 | 2018-04-03T08:33:00 | null |
UTF-8
|
C++
| false | false | 1,073 |
h
|
#ifndef UTIL_H
#define UTIL_H
void log_vec(std::string str, std::vector<double> vec);
void read_vector_from_file(char* file_name, std::vector<std::vector<double> >& arr);
void blow_up_rect(cv::Rect& rect, double f);
void show_images(int e ,int l, int h, std::vector<cv::Mat> imgs);
double get_distance(cv::Point p1, cv::Point p2);
cv::Point get_mid_point(cv::Point p1, cv::Point p2);
double get_vector_magnitude(double vec[], int size);
void compute_vector_sum(std::vector<double> vec1, std::vector<double> vec2, std::vector<double>& vec_sum);
double get_angle_between(cv::Point pt1, cv::Point pt2);
void make_unit_vector(std::vector<double> vec, std::vector<double>& unit_vector);
double scalar_product(std::vector<double> vec1, std::vector<double> vec2);
cv::Mat get_rotation_matrix_z(double theta);
void get_rotated_vector(std::vector<double> vec, std::vector<double>& vec_rot);
void get_reverse_vector(std::vector<double> vec, std::vector<double>& vec_rot);
void cross_product(std::vector<double> vec1, std::vector<double> vec2, std::vector<double>& product);
#endif
|
[
"[email protected]"
] | |
711cfba96fe8fcbda1aacb4ef1d3cd543f1a99be
|
aadf84f38c77e9b0894492301499e8f95e1ef114
|
/array/stack.cpp
|
69e0944a231fdcf424ac4223c4b4b66207a317c2
|
[] |
no_license
|
linrakesh/cpp
|
9310c8d28d488c42b93c0552c08d1ec2f4c25c4f
|
d176d9c42502d315d931600cabaf01dad54d9d7a
|
refs/heads/master
| 2020-03-11T23:42:27.246353 | 2019-12-18T14:45:48 | 2019-12-18T14:45:48 | 130,329,672 | 0 | 2 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,016 |
cpp
|
#include<iostream>
#include<iomanip>
using namespace std;
void push(int x[],int n, int &m, int value){
if(m>=n){
cout<<"\n Stack full. Can not Push another element";
}
else{
x[m]=value;
m= m+1;
}
}
void pop(int x[], int &m){
if(m<=0){
cout<<"\n Stack Empty.Can not Pop element";
}
else
{
cout<<"Popped Value :"<<x[m-1];
m= m-1;
}
}
void display(int x[],int m){
if(m<=0){
cout<<"\n Stack Empty";
}
else{
for(int i=0;i<m;i++)
cout<<setw(6)<<x[i];
}
}
int main(){
int x[10],m,choice,value;
m=0;
do{
cout<<"\n\n STACK MENU";
cout<<"\n1. Push";
cout<<"\n2. Pop";
cout<<"\n3. Display";
cout<<"\n4. Exit";
cout<<"\n\n Enter your choice (1..4):";
cin>>choice;
switch(choice){
case 1:
cout<<"\n Enter value :";
cin>>value;
push(x,10,m,value);
break;
case 2:
pop(x,m);
break;
case 3:
display(x,m);
break;
case 4:
break;
default:
cout<<"\nWrong Choice....Try again";
}
}while(choice!=4);
return 0;
}
|
[
"[email protected]"
] | |
4131f57a68396b764d53e119ba4b3eb7fd0e4f67
|
075a754ec1aa1a8c051a9dac7824149ec772682f
|
/D2D1/D2D1MidCircle/ImageRenderer.cpp
|
ab41f1ed42be64ef5e38fb4295df0df81b8f3557
|
[] |
no_license
|
dustpg/NoteFL
|
3381b8a462d391e32770b2b074fe1872f82c6e08
|
b51ff05424228013799fa72cc7d0c63c353fa966
|
refs/heads/master
| 2021-01-21T04:41:05.050416 | 2018-08-06T23:51:00 | 2018-08-06T23:51:00 | 36,517,641 | 9 | 10 | null | null | null | null |
UTF-8
|
C++
| false | false | 16,210 |
cpp
|
#include "stdafx.h"
#include "included.h"
// ImageRenderer类构造函数
ImageRenderer::ImageRenderer() {
m_parameters.DirtyRectsCount = 0;
m_parameters.pDirtyRects = nullptr;
m_parameters.pScrollRect = nullptr;
m_parameters.pScrollOffset = nullptr;
::InitializeCriticalSection(&m_cs);
}
// 创建设备无关资源
HRESULT ImageRenderer::CreateDeviceIndependentResources() {
// 创建D2D工厂
D2D1_FACTORY_OPTIONS options = { D2D1_DEBUG_LEVEL_NONE };
#ifdef _DEBUG
options.debugLevel = D2D1_DEBUG_LEVEL_INFORMATION;
#endif
HRESULT hr = ::D2D1CreateFactory(
D2D1_FACTORY_TYPE_SINGLE_THREADED,
IID_ID2D1Factory1,
&options,
reinterpret_cast<void**>(&m_pd2dFactory)
);
// 创建 WIC 工厂.
if (SUCCEEDED(hr)) {
hr = ::CoCreateInstance(
CLSID_WICImagingFactory2,
nullptr,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&m_pWICFactory)
);
}
// 创建 DirectWrite 工厂.
if (SUCCEEDED(hr)) {
hr = ::DWriteCreateFactory(
DWRITE_FACTORY_TYPE_SHARED,
__uuidof(m_pDWriteFactory),
reinterpret_cast<IUnknown **>(&m_pDWriteFactory)
);
}
// 创建正文文本格式.
if (SUCCEEDED(hr)) {
hr = m_pDWriteFactory->CreateTextFormat(
L"Arial",
nullptr,
DWRITE_FONT_WEIGHT_NORMAL,
DWRITE_FONT_STYLE_NORMAL,
DWRITE_FONT_STRETCH_NORMAL,
22.f,
L"", //locale
&m_pTextFormatMain
);
if (m_pTextFormatMain) {
m_pTextFormatMain->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER);
m_pTextFormatMain->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER);
}
}
return hr;
}
// 创建设备资源
HRESULT ImageRenderer::CreateDeviceResources() {
HRESULT hr = S_OK;
// DXGI Surface 后台缓冲
IDXGISurface* pDxgiBackBuffer = nullptr;
// 创建 D3D11设备与设备上下文
if (SUCCEEDED(hr)) {
// D3D11 创建flag
// 一定要有D3D11_CREATE_DEVICE_BGRA_SUPPORT
// 否则创建D2D设备上下文会失败
UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
#ifdef _DEBUG
// Debug状态 有D3D DebugLayer就可以取消注释
creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
D3D_FEATURE_LEVEL featureLevels[] = {
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
D3D_FEATURE_LEVEL_9_3,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_1
};
// 创建设备
hr = ::D3D11CreateDevice(
// 设为空指针选择默认设备
nullptr,
// 强行指定硬件渲染
//D3D_DRIVER_TYPE_HARDWARE,
// 强行指定WARP渲染
D3D_DRIVER_TYPE_WARP,
// 没有软件接口
nullptr,
// 创建flag
creationFlags,
// 欲使用的特性等级列表
featureLevels,
// 特性等级列表长度
lengthof(featureLevels),
// SDK 版本
D3D11_SDK_VERSION,
// 返回的D3D11设备指针
&m_pd3dDevice,
// 返回的特性等级
&m_featureLevel,
// 返回的D3D11设备上下文指针
&m_pd3dDeviceContext
);
}
#ifdef _DEBUG
// 创建 ID3D11Debug
if (SUCCEEDED(hr)) {
//hr = m_pd3dDevice->QueryInterface(IID_PPV_ARGS(&m_pd3dDebug));
}
#endif
// 创建 IDXGIDevice
if (SUCCEEDED(hr)) {
hr = m_pd3dDevice->QueryInterface(IID_PPV_ARGS(&m_pDxgiDevice));
}
// 创建D2D设备
if (SUCCEEDED(hr)) {
hr = m_pd2dFactory->CreateDevice(m_pDxgiDevice, &m_pd2dDevice);
}
// 创建D2D设备上下文
if (SUCCEEDED(hr)) {
hr = m_pd2dDevice->CreateDeviceContext(
D2D1_DEVICE_CONTEXT_OPTIONS_NONE,
&m_pd2dDeviceContext
);
}
// 获取Dxgi适配器 可以获取该适配器信息
if (SUCCEEDED(hr)) {
// 顺带使用像素作为单位
m_pd2dDeviceContext->SetUnitMode(D2D1_UNIT_MODE_PIXELS);
hr = m_pDxgiDevice->GetAdapter(&m_pDxgiAdapter);
}
// 获取Dxgi工厂
if (SUCCEEDED(hr)) {
hr = m_pDxgiAdapter->GetParent(IID_PPV_ARGS(&m_pDxgiFactory));
}
// 创建交换链
if (SUCCEEDED(hr)) {
RECT rect = { 0 }; ::GetClientRect(m_hwnd, &rect);
// 交换链信息
DXGI_SWAP_CHAIN_DESC1 swapChainDesc = { 0 };
swapChainDesc.Width = rect.right - rect.left;
swapChainDesc.Height = rect.bottom - rect.top;
swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
swapChainDesc.Stereo = FALSE;
swapChainDesc.SampleDesc.Count = 1;
swapChainDesc.SampleDesc.Quality = 0;
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.BufferCount = 2;
swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
swapChainDesc.Flags = 0;
#ifdef USING_DirectComposition
// DirectComposition桌面应用程序
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_PREMULTIPLIED;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
// 创建DirectComposition交换链
hr = m_pDxgiFactory->CreateSwapChainForComposition(
m_pDxgiDevice,
&swapChainDesc,
nullptr,
&m_pSwapChain
);
#else
// 一般桌面应用程序
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
// 利用窗口句柄创建交换链
hr = m_pDxgiFactory->CreateSwapChainForHwnd(
m_pd3dDevice,
m_hwnd,
&swapChainDesc,
nullptr,
nullptr,
&m_pSwapChain
);
#endif
}
// 确保DXGI队列里边不会超过一帧
if (SUCCEEDED(hr)) {
hr = m_pDxgiDevice->SetMaximumFrameLatency(1);
}
// 利用交换链获取Dxgi表面
if (SUCCEEDED(hr)) {
hr = m_pSwapChain->GetBuffer(0, IID_PPV_ARGS(&pDxgiBackBuffer));
}
// 创建笔刷
if (SUCCEEDED(hr)) {
hr = m_pd2dDeviceContext->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Black), &m_pBlackBrush);
}
// 利用Dxgi表面创建位图
if (SUCCEEDED(hr)) {
D2D1_BITMAP_PROPERTIES1 bitmapProperties = D2D1::BitmapProperties1(
D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW,
D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED),
96.0f,
96.0f
);
hr = m_pd2dDeviceContext->CreateBitmapFromDxgiSurface(
pDxgiBackBuffer,
&bitmapProperties,
&m_pd2dTargetBimtap
);
}
// 设置
if (SUCCEEDED(hr)) {
// 设置 Direct2D 渲染目标
m_pd2dDeviceContext->SetTarget(m_pd2dTargetBimtap);
// 使用像素作为单位
m_pd2dDeviceContext->SetUnitMode(D2D1_UNIT_MODE_PIXELS);
}
#ifdef USING_DirectComposition
// 创建直接组合(Direct Composition)设备
if (SUCCEEDED(hr)) {
hr = DCompositionCreateDevice(
/*static_cast<ID2D1Device*>(UIRenderer)*/nullptr,
IID_PPV_ARGS(&m_pDcompDevice)
);
}
// 创建直接组合(Direct Composition)目标
if (SUCCEEDED(hr)) {
hr = m_pDcompDevice->CreateTargetForHwnd(
m_hwnd, true, &m_pDcompTarget
);
}
// 创建直接组合(Direct Composition)视觉
if (SUCCEEDED(hr)) {
hr = m_pDcompDevice->CreateVisual(&m_pDcompVisual);
}
// 设置当前交换链为视觉内容
if (SUCCEEDED(hr)) {
hr = m_pDcompVisual->SetContent(m_pSwapChain);
}
// 设置当前视觉为窗口目标
if (SUCCEEDED(hr)) {
hr = m_pDcompTarget->SetRoot(m_pDcompVisual);
}
// 向系统提交
if (SUCCEEDED(hr)) {
hr = m_pDcompDevice->Commit();
}
#endif
::SafeRelease(pDxgiBackBuffer);
return hr;
}
// ImageRenderer析构函数
ImageRenderer::~ImageRenderer(){
this->DiscardDeviceResources();
::SafeRelease(m_pd2dFactory);
::SafeRelease(m_pWICFactory);
::SafeRelease(m_pDWriteFactory);
::SafeRelease(m_pTextFormatMain);
// 调试
#ifdef _DEBUG
if (m_pd3dDebug) {
m_pd3dDebug->ReportLiveDeviceObjects(D3D11_RLDO_DETAIL);
}
::SafeRelease(m_pd3dDebug);
#endif
::DeleteCriticalSection(&m_cs);
}
// 丢弃设备相关资源
void ImageRenderer::DiscardDeviceResources(){
::SafeRelease(m_pd3dDevice);
::SafeRelease(m_pd3dDeviceContext);
::SafeRelease(m_pd2dDevice);
::SafeRelease(m_pd2dDeviceContext);
::SafeRelease(m_pDxgiFactory);
::SafeRelease(m_pDxgiDevice);
::SafeRelease(m_pDxgiAdapter);
::SafeRelease(m_pSwapChain);
::SafeRelease(m_pd2dTargetBimtap);
::SafeRelease(m_pBlackBrush);
// DirectComposition
#ifdef USING_DirectComposition
::SafeRelease(m_pDcompDevice);
::SafeRelease(m_pDcompTarget);
::SafeRelease(m_pDcompVisual);
#endif
}
// 渲染图形图像
HRESULT ImageRenderer::OnRender(UINT syn){
HRESULT hr = S_OK;
// 没有就创建
if (!m_pd2dDeviceContext) {
hr = this->CreateDeviceResources();
}
this->Lock();
auto tpushed = this->pushed;
D2D1_POINT_2F tpoints[] = {
this->points[0], this->points[1]
};
this->Unlock();
// 成功就渲染
if (SUCCEEDED(hr)) {
// 开始渲染
m_pd2dDeviceContext->BeginDraw();
// 重置转换
m_pd2dDeviceContext->SetTransform(D2D1::Matrix3x2F::Identity());
// 清屏
m_pd2dDeviceContext->Clear(D2D1::ColorF(D2D1::ColorF::White));
// 正式刻画.........
if (tpushed) {
auto xxxx = tpoints[0].x - tpoints[1].x;
auto yyyy = tpoints[0].y - tpoints[1].y;
float rrrr = std::sqrt(xxxx*xxxx + yyyy*yyyy);
D2D1_ELLIPSE ellipse = { tpoints[0], rrrr + 10.f, rrrr + 10.f };
// Direct 2D
m_pd2dDeviceContext->DrawEllipse(ellipse, m_pBlackBrush);
// Mid Bresenham
MidpointBresenhamDrawCircle(
static_cast<int>(tpoints[0].x),
static_cast<int>(tpoints[0].y),
rrrr
);
}
// 结束渲染
m_pd2dDeviceContext->EndDraw();
// 呈现目标
hr = m_pSwapChain->Present(syn, 0);
}
// 设备丢失?
if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET) {
this->DiscardDeviceResources();
hr = S_FALSE;
}
return hr;
}
// 从文件读取位图
HRESULT ImageRenderer::LoadBitmapFromFile(
ID2D1DeviceContext *pRenderTarget,
IWICImagingFactory2 *pIWICFactory,
PCWSTR uri,
UINT width,
UINT height,
ID2D1Bitmap1 **ppBitmap
){
IWICBitmapDecoder *pDecoder = nullptr;
IWICBitmapFrameDecode *pSource = nullptr;
IWICStream *pStream = nullptr;
IWICFormatConverter *pConverter = nullptr;
IWICBitmapScaler *pScaler = nullptr;
HRESULT hr = pIWICFactory->CreateDecoderFromFilename(
uri,
nullptr,
GENERIC_READ,
WICDecodeMetadataCacheOnLoad,
&pDecoder
);
if (SUCCEEDED(hr)) {
hr = pDecoder->GetFrame(0, &pSource);
}
if (SUCCEEDED(hr)) {
hr = pIWICFactory->CreateFormatConverter(&pConverter);
}
if (SUCCEEDED(hr)) {
if (width != 0 || height != 0) {
UINT originalWidth, originalHeight;
hr = pSource->GetSize(&originalWidth, &originalHeight);
if (SUCCEEDED(hr)) {
if (width == 0) {
FLOAT scalar = static_cast<FLOAT>(height) / static_cast<FLOAT>(originalHeight);
width = static_cast<UINT>(scalar * static_cast<FLOAT>(originalWidth));
}
else if (height == 0) {
FLOAT scalar = static_cast<FLOAT>(width) / static_cast<FLOAT>(originalWidth);
height = static_cast<UINT>(scalar * static_cast<FLOAT>(originalHeight));
}
hr = pIWICFactory->CreateBitmapScaler(&pScaler);
if (SUCCEEDED(hr)) {
hr = pScaler->Initialize(
pSource,
width,
height,
WICBitmapInterpolationModeCubic
);
}
if (SUCCEEDED(hr)) {
hr = pConverter->Initialize(
pScaler,
GUID_WICPixelFormat32bppPBGRA,
WICBitmapDitherTypeNone,
nullptr,
0.f,
WICBitmapPaletteTypeMedianCut
);
}
}
}
else {
hr = pConverter->Initialize(
pSource,
GUID_WICPixelFormat32bppPBGRA,
WICBitmapDitherTypeNone,
nullptr,
0.f,
WICBitmapPaletteTypeMedianCut
);
}
}
if (SUCCEEDED(hr)) {
hr = pRenderTarget->CreateBitmapFromWicBitmap(
pConverter,
nullptr,
ppBitmap
);
}
::SafeRelease(pDecoder);
::SafeRelease(pSource);
::SafeRelease(pStream);
::SafeRelease(pConverter);
::SafeRelease(pScaler);
return hr;
}
// 中点 Bresenham
void ImageRenderer::MidpointBresenhamDrawCircle(int ox, int oy, float r) {
m_pd2dDeviceContext->SetAntialiasMode(D2D1_ANTIALIAS_MODE_ALIASED);
//
float d = 1.25f - r;
int x = 0, y = static_cast<int>(r), fx = static_cast<int>(r / 1.4f);
while (x != fx)
{
if (d < 0)
d += 2 * x + 3;
else
{
d += 2 * (x - y) + 5;
--y;
}
this->putpixel(ox + x, oy + y);
this->putpixel(ox + x, oy - y);
this->putpixel(ox - x, oy + y);
this->putpixel(ox - x, oy - y);
this->putpixel(ox + y, oy - x);
this->putpixel(ox + y, oy + x);
this->putpixel(ox - y, oy + x);
this->putpixel(ox - y, oy - x);
++x;
}
//
m_pd2dDeviceContext->SetAntialiasMode(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
}
// 中点 Bresenham
void ImageRenderer::MidpointBresenhamDrawEllipse(int xc, int yc, int a, int b) {
float sqa = float(a * a);
float sqb = float(b * b);
float d = sqb + sqa * (-(float)b + 0.25f);
int x = 0;
int y = b;
putpixel(xc + x, yc + y);
putpixel(xc + x, yc + y);
putpixel(xc + x, yc + y);
putpixel(xc + x, yc + y);
while (sqb * float(x + 1) < sqa * (float(y) - 0.5f)) {
if (d < 0) {
d += sqb * float(2 * x + 3);
}
else {
d += (sqb * float(2 * x + 3) + sqa * float(-2 * y + 2));
y--;
}
x++;
putpixel(xc + x, yc + y);
putpixel(xc + x, yc + y);
putpixel(xc + x, yc + y);
putpixel(xc + x, yc + y);
}
d = (float(b) * (float(x) + 0.5f)) * 2.f + float((a * (y - 1)) * 2) - float((a * b) * 2);
while (y > 0) {
if (d < 0) {
d += sqb * float(2 * x + 2) + sqa * float(-2 * y + 3);
x++;
}
else {
d += sqa * float(-2 * y + 3);
}
y--;
putpixel(xc + x, yc + y);
putpixel(xc + x, yc + y);
putpixel(xc + x, yc + y);
putpixel(xc + x, yc + y);
}
}
// 设置像素点
void ImageRenderer::putpixel(int x, int y) {
D2D1_RECT_F rect;
rect.left = static_cast<float>(x);
rect.top = static_cast<float>(y);
rect.right = rect.left + 1.f;
rect.bottom = rect.top + 1.f;
m_pd2dDeviceContext->DrawRectangle(&rect, m_pBlackBrush);
}
|
[
"[email protected]"
] | |
18bd0889541d2167a533d39a5c04e45681b42cc8
|
9f9bc55039022735acde82997c1f1a0bd7bd37cf
|
/Student_Cuda_Tools_Reduction/src/01_cudatools/generic/Reduction.h
|
fdd1a4a02e3c118e35aae964555786fe80537c64
|
[] |
no_license
|
khansabassem/GPGPU
|
1bc503252d81739c9c318ac49fc6134a5eb2327d
|
66bebe5c298afced9ddcd3f36f6998595c490091
|
refs/heads/main
| 2023-08-13T07:19:58.048558 | 2021-10-18T10:59:46 | 2021-10-18T10:59:46 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,445 |
h
|
#pragma once
#include "Lock.h"
#include "Thread1D.h"
/*----------------------------------------------------------------------*\
|* prt fonction / reduction *|
\*---------------------------------------------------------------------*/
#define BinaryOperator(name) T (*name)(T, T)
#define AtomicOp(name) void (*name)(T*, T)
/*----------------------------------------------------------------------*\
|* Implementation *|
\*---------------------------------------------------------------------*/
class Reduction
{
public:
/**
* Hypothese:
*
* (H1) BinaryOperator un operateur binaire sur des element de Type T
* (H2) AtomicOp permet de realiser des operations atomics
*
* Usage example :
*
* Version1:
*
* __device__ int add(int x, int y){return x+y;}
* __device__ void addAtomic(int* ptrX, int y){atomicAdd(ptrX,y);}
*
* ReductionGeneric::reduce(add,addAtomic,tabSm,ptrResultGM);
*
* Version2:
*
* __device__ int add(int x, int y){return x+y;}
*
* #include "Lock.h"
* __device__ int volatile mutex = 0; //variable global
* __device__ void addAtomic(int* ptrX, int y) // 10x plus lent que version1, mais plus flexible
* {
* Lock locker(&mutex);
* locker.lock();
* (*ptrX)+=y;
* locker.unlock();
* }
*
* ReductionGeneric::reduce(add,addAtomic,tabSm,ptrResultGM);
*/
template <typename T>
static __device__ void reduce(BinaryOperator(OP) , AtomicOp(ATOMIC_OP), T* tabSM, T* ptrResultGM)
//static __device__ void reduce(T (*OP)(T, T) ,void (*ATOMIC_OP)(T*, T), T* tabSM, T* ptrResultGM) // idem ci-dessus mais sans define
{
reductionIntraBlock(OP, tabSM);
reductionInterBlock(ATOMIC_OP,tabSM, ptrResultGM);
}
private:
/*--------------------------------------*\
|* reductionIntraBlock *|
\*-------------------------------------*/
/**
* used dans une boucle in reductionIntraBlock
*/
template <typename T>
static __device__ void ecrasement(BinaryOperator(OP),T* tabSM, int middle)
{
const int TID_LOCAL = threadIdx.x;
if(TID_LOCAL < middle)
{
tabSM[TID_LOCAL] = OP(tabSM[TID_LOCAL], tabSM[TID_LOCAL+middle]);
}
// Meme principe que ReductionAdd
// OP est la variable representant l'operateur binaire
}
/**
* Sur place, le resultat est dans tabSM[0]
*/
template <typename T>
static __device__ void reductionIntraBlock(BinaryOperator(OP),T* tabSM)
{
// Ecrasement sucessifs dans une boucle (utiliser la methode ecrasement ci-dessus)
int middle = Thread1D::nbThreadBlock() >> 1;
while(middle > 0)
{
ecrasement(OP, tabSM, middle);
middle = middle>>1;
// ne jamais mettre de syncthreads dans un if
__syncthreads();// pour touts les threads d'un meme block
}
}
/*--------------------------------------*\
|* reductionInterblock *|
\*-------------------------------------*/
template <typename T>
static __device__ void reductionInterBlock(AtomicOp(ATOMIC_OP), T* tabSM, T* ptrResultGM)
{
const int TID_LOCAL = threadIdx.x;
if(TID_LOCAL == 0)
{
ATOMIC_OP(ptrResultGM, tabSM[0]);
}
// pas de syncthreads
// ATOMIC_OP est la variable representant l'operateur binaire atomic
}
};
/*----------------------------------------------------------------------*\
|* End *|
\*---------------------------------------------------------------------*/
|
[
"[email protected]"
] | |
4b7ffe18083b380fc5070eb83c9e47296cdc181d
|
3d17cf7c4bd09cd7dbdec027da21d8cfc6e8bd54
|
/event.cpp
|
e25bade8d50cf98eb7c837c1c9ed642296c34c31
|
[] |
no_license
|
lookm8000/HuntTheWumpus
|
42a2d44f102f7cf3ee1533484055b08c3d6c4508
|
cb43ad44ed589793a79a47ea192b9886944ce2e3
|
refs/heads/master
| 2023-03-22T03:30:29.010277 | 2017-03-08T07:34:03 | 2017-03-08T07:34:03 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 552 |
cpp
|
/**********************************
* Program: event.hpp
* Author: Sam Young
* Date: 3/5/2017
* Description: runs functions for event class
* Input: None
* Output: None
****************************************/
#include"event.hpp"
/**************************************
* Function: get_name_event()
* Description: returns the name of the event, (not really used in my program
* Parameters: none
* Pre-Conditions: none
* Post-Conditions: none
* *****************************/
string Event::get_name_event(){
return name_event;
}
|
[
"[email protected]"
] | |
d493631dab147480615c7b5c864083aec7366056
|
4dc9caed5cb3f4639587d3d596a82cd748254045
|
/lib/Backend/IRBuilder.h
|
3959a3865c432812abb364fcaebb7b9d1c791c8c
|
[
"MIT"
] |
permissive
|
jkrems/ChakraCore
|
2e68c27a8a278c36bfa144f77dbd79398279c52b
|
59b31e5821b7b8df3ed1f5021ed971da82cde9e1
|
refs/heads/master
| 2021-01-18T04:42:10.298111 | 2016-01-22T23:45:30 | 2016-01-22T23:45:30 | 50,215,307 | 2 | 0 | null | 2016-01-23T00:06:01 | 2016-01-23T00:06:00 | null |
UTF-8
|
C++
| false | false | 19,596 |
h
|
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#pragma once
///---------------------------------------------------------------------------
///
/// class IRBuilder
///
/// To generate IR from the Jn bytecodes.
///
///---------------------------------------------------------------------------
class BranchReloc
{
public:
BranchReloc(IR::BranchInstr * instr, uint32 branchOffset, uint32 offs)
: branchInstr(instr), branchOffset(branchOffset), offset(offs), isNotBackEdge(false)
{ }
private:
IR::BranchInstr * branchInstr;
uint32 offset;
bool isNotBackEdge;
uint32 branchOffset;
public:
IR::BranchInstr * GetBranchInstr()
{
return this->branchInstr;
}
uint32 GetOffset() const
{
return this->offset;
}
uint32 GetBranchOffset() const
{
return this->branchOffset;
}
bool IsNotBackEdge() const
{
return this->isNotBackEdge;
}
void SetNotBackEdge()
{
this->isNotBackEdge = true;
}
};
class IRBuilder
{
friend struct IRBuilderSwitchAdapter;
public:
IRBuilder(Func * func)
: m_func(func)
, m_argsOnStack(0)
, m_loopBodyRetIPSym(nullptr)
, m_ldSlots(nullptr)
, m_loopCounterSym(nullptr)
, callTreeHasSomeProfileInfo(false)
, m_saveLoopImplicitCallFlags(nullptr)
, catchOffsetStack(nullptr)
, m_switchAdapter(this)
, m_switchBuilder(&m_switchAdapter)
#if DBG
, m_callsOnStack(0)
, m_usedAsTemp(nullptr)
#endif
#ifdef BAILOUT_INJECTION
, seenLdStackArgPtr(false)
, expectApplyArg(false)
, seenProfiledBeginSwitch(false)
#endif
#ifdef BYTECODE_BRANCH_ISLAND
, longBranchMap(nullptr)
#endif
{
auto loopCount = func->GetJnFunction()->GetLoopCount();
if (loopCount > 0) {
m_saveLoopImplicitCallFlags = (IR::Opnd**)func->m_alloc->Alloc(sizeof(IR::Opnd*) * loopCount);
#if DBG
memset(m_saveLoopImplicitCallFlags, 0, sizeof(IR::Opnd*) * loopCount);
#endif
}
// Note: use original byte code without debugging probes, so that we don't jit BPs inserted by the user.
m_functionBody = func->m_workItem->GetFunctionBody();
func->m_workItem->InitializeReader(m_jnReader, m_statementReader);
};
~IRBuilder() {
Assert(m_func->GetJnFunction()->GetLoopCount() == 0 || m_saveLoopImplicitCallFlags);
if (m_saveLoopImplicitCallFlags) {
m_func->m_alloc->Free(m_saveLoopImplicitCallFlags, sizeof(IR::Opnd*) * m_func->GetJnFunction()->GetLoopCount());
}
}
void Build();
void InsertLabels();
IR::LabelInstr * CreateLabel(IR::BranchInstr * branchInstr, uint& offset);
private:
void AddInstr(IR::Instr *instr, uint32 offset);
BranchReloc * AddBranchInstr(IR::BranchInstr *instr, uint32 offset, uint32 targetOffset);
#ifdef BYTECODE_BRANCH_ISLAND
void ConsumeBranchIsland();
void EnsureConsumeBranchIsland();
uint ResolveVirtualLongBranch(IR::BranchInstr * branchInstr, uint offset);
#endif
BranchReloc * CreateRelocRecord(IR::BranchInstr * branchInstr, uint32 offset, uint32 targetOffset);
void BuildGeneratorPreamble();
void BuildConstantLoads();
void BuildImplicitArgIns();
#define LAYOUT_TYPE(layout) \
void Build##layout(Js::OpCode newOpcode, uint32 offset);
#define LAYOUT_TYPE_WMS(layout) \
template <typename SizePolicy> void Build##layout(Js::OpCode newOpcode, uint32 offset);
#include "ByteCode\LayoutTypes.h"
void BuildReg1(Js::OpCode newOpcode, uint32 offset, Js::RegSlot R0);
void BuildReg2(Js::OpCode newOpcode, uint32 offset, Js::RegSlot R0, Js::RegSlot R1, uint32 nextOffset);
void BuildProfiledReg2(Js::OpCode newOpcode, uint32 offset, Js::RegSlot dstRegSlot, Js::RegSlot srcRegSlot, Js::ProfileId profileId, Js::InlineCacheIndex inlineCacheIndex = Js::Constants::NoInlineCacheIndex);
void BuildProfiledReg2WithICIndex(Js::OpCode newOpcode, uint32 offset, Js::RegSlot dstRegSlot, Js::RegSlot srcRegSlot, Js::ProfileId profileId, Js::InlineCacheIndex inlineCacheIndex);
void BuildReg3(Js::OpCode newOpcode, uint32 offset, Js::RegSlot dstRegSlot, Js::RegSlot src1RegSlot,
Js::RegSlot src2RegSlot, Js::ProfileId profileId);
void BuildReg3C(Js::OpCode newOpCode, uint32 offset, Js::RegSlot dstRegSlot, Js::RegSlot src1RegSlot,
Js::RegSlot src2RegSlot, Js::CacheId inlineCacheIndex);
void BuildReg4(Js::OpCode newOpcode, uint32 offset, Js::RegSlot dstRegSlot, Js::RegSlot src1RegSlot,
Js::RegSlot src2RegSlot, Js::RegSlot src3RegSlot);
void BuildReg2B1(Js::OpCode newOpcode, uint32 offset, Js::RegSlot dstRegSlot, Js::RegSlot srcRegSlot, byte index);
void BuildReg3B1(Js::OpCode newOpcode, uint32 offset, Js::RegSlot dstRegSlot, Js::RegSlot src1RegSlot,
Js::RegSlot src2RegSlot, uint8 index);
void BuildReg5(Js::OpCode newOpcode, uint32 offset, Js::RegSlot dstRegSlot, Js::RegSlot src1RegSlot,
Js::RegSlot src2RegSlot, Js::RegSlot src3RegSlot, Js::RegSlot src4RegSlot);
void BuildUnsigned1(Js::OpCode newOpcode, uint32 offset, uint32 C1);
void BuildReg1Unsigned1(Js::OpCode newOpcode, uint32 offset, Js::RegSlot R0, int32 C1);
void BuildProfiledReg1Unsigned1(Js::OpCode newOpcode, uint32 offset, Js::RegSlot R0, int32 C1, Js::ProfileId profileId);
void BuildReg2Int1(Js::OpCode newOpcode, uint32 offset, Js::RegSlot dstRegSlot, Js::RegSlot srcRegSlot, int32 value);
void BuildElementC(Js::OpCode newOpcode, uint32 offset, Js::RegSlot fieldRegSlot, Js::RegSlot regSlot,
Js::PropertyIdIndexType propertyIdIndex);
void BuildElementScopedC(Js::OpCode newOpcode, uint32 offset, Js::RegSlot regSlot,
Js::PropertyIdIndexType propertyIdIndex);
void BuildElementSlot(Js::OpCode newOpcode, uint32 offset, Js::RegSlot fieldRegSlot, Js::RegSlot regSlot,
int32 slotId, Js::ProfileId profileId);
void BuildElementSlotI1(Js::OpCode newOpcode, uint32 offset, Js::RegSlot regSlot,
int32 slotId, Js::ProfileId profileId);
void BuildElementSlotI2(Js::OpCode newOpcode, uint32 offset, Js::RegSlot regSlot,
int32 slotId1, int32 slotId2, Js::ProfileId profileId);
void BuildArgIn0(uint32 offset, Js::RegSlot R0);
void BuildArg(Js::OpCode newOpcode, uint32 offset, Js::ArgSlot argument, Js::RegSlot srcRegSlot);
void BuildArgIn(uint32 offset, Js::RegSlot dstRegSlot, uint16 argument);
void BuildArgInRest();
void BuildElementP(Js::OpCode newOpcode, uint32 offset, Js::RegSlot regSlot, Js::CacheId inlineCacheIndex);
void BuildElementCP(Js::OpCode newOpcode, uint32 offset, Js::RegSlot instance, Js::RegSlot regSlot, Js::CacheId inlineCacheIndex);
void BuildElementC2(Js::OpCode newOpcode, uint32 offset, Js::RegSlot instanceSlot, Js::RegSlot instance2Slot,
Js::RegSlot regSlot, Js::PropertyIdIndexType propertyIdIndex);
void BuildElementScopedC2(Js::OpCode newOpcode, uint32 offset, Js::RegSlot instance2Slot,
Js::RegSlot regSlot, Js::PropertyIdIndexType propertyIdIndex);
void BuildElementU(Js::OpCode newOpcode, uint32 offset, Js::RegSlot instance, Js::PropertyIdIndexType propertyIdIndex);
void BuildElementI(Js::OpCode newOpcode, uint32 offset, Js::RegSlot baseRegSlot, Js::RegSlot indexRegSlot,
Js::RegSlot regSlot, Js::ProfileId profileId);
void BuildElementUnsigned1(Js::OpCode newOpcode, uint32 offset, Js::RegSlot baseRegSlot, uint32 index, Js::RegSlot regSlot);
IR::Instr * BuildCallI_Helper(Js::OpCode newOpcode, uint32 offset, Js::RegSlot Return, Js::RegSlot Function, Js::ArgSlot ArgCount,
Js::ProfileId profileId, Js::InlineCacheIndex inlineCacheIndex = Js::Constants::NoInlineCacheIndex);
IR::Instr * BuildProfiledCallI(Js::OpCode opcode, uint32 offset, Js::RegSlot returnValue, Js::RegSlot function,
Js::ArgSlot argCount, Js::ProfileId profileId, Js::InlineCacheIndex inlineCacheIndex = Js::Constants::NoInlineCacheIndex);
IR::Instr * BuildProfiledCallIExtended(Js::OpCode opcode, uint32 offset, Js::RegSlot returnValue, Js::RegSlot function,
Js::ArgSlot argCount, Js::ProfileId profileId, Js::CallIExtendedOptions options, uint32 spreadAuxOffset);
IR::Instr * BuildProfiledCallIWithICIndex(Js::OpCode opcode, uint32 offset, Js::RegSlot returnValue, Js::RegSlot function,
Js::ArgSlot argCount, Js::ProfileId profileId, Js::InlineCacheIndex inlineCacheIndex);
void BuildProfiledCallIExtendedFlags(Js::OpCode opcode, uint32 offset, Js::RegSlot returnValue, Js::RegSlot function,
Js::ArgSlot argCount, Js::ProfileId profileId, Js::CallIExtendedOptions options, uint32 spreadAuxOffset);
void BuildProfiledCallIExtendedWithICIndex(Js::OpCode opcode, uint32 offset, Js::RegSlot returnValue, Js::RegSlot function,
Js::ArgSlot argCount, Js::ProfileId profileId, Js::CallIExtendedOptions options, uint32 spreadAuxOffset);
void BuildProfiledCallIExtendedFlagsWithICIndex(Js::OpCode opcode, uint32 offset, Js::RegSlot returnValue, Js::RegSlot function,
Js::ArgSlot argCount, Js::ProfileId profileId, Js::CallIExtendedOptions options, uint32 spreadAuxOffset);
void BuildProfiled2CallI(Js::OpCode opcode, uint32 offset, Js::RegSlot returnValue, Js::RegSlot function,
Js::ArgSlot argCount, Js::ProfileId profileId, Js::ProfileId profileId2);
void BuildProfiled2CallIExtended(Js::OpCode opcode, uint32 offset, Js::RegSlot returnValue, Js::RegSlot function,
Js::ArgSlot argCount, Js::ProfileId profileId, Js::ProfileId profileId2, Js::CallIExtendedOptions options, uint32 spreadAuxOffset);
void BuildLdSpreadIndices(uint32 offset, uint32 spreadAuxOffset);
void BuildCallIExtended(Js::OpCode newOpcode, uint32 offset, Js::RegSlot returnValue, Js::RegSlot function,
Js::ArgSlot argCount, Js::CallIExtendedOptions options, uint32 spreadAuxOffset);
void BuildCallCommon(IR::Instr *instr, StackSym *symDst, Js::ArgSlot argCount);
void BuildRegexFromPattern(Js::RegSlot dstRegSlot, uint32 patternIndex, uint32 offset);
void BuildClass(Js::OpCode newOpcode, uint32 offset, Js::RegSlot constructor, Js::RegSlot extends);
void BuildBrReg1(Js::OpCode newOpcode, uint32 offset, uint targetOffset, Js::RegSlot srcRegSlot);
void BuildBrReg2(Js::OpCode newOpcode, uint32 offset, uint targetOffset, Js::RegSlot src1RegSlot, Js::RegSlot src2RegSlot);
void BuildBrBReturn(Js::OpCode newOpcode, uint32 offset, Js::RegSlot DestRegSlot, Js::RegSlot SrcRegSlot, uint32 targetOffset);
IR::IndirOpnd * BuildIndirOpnd(IR::RegOpnd *baseReg, IR::RegOpnd *indexReg);
IR::IndirOpnd * BuildIndirOpnd(IR::RegOpnd *baseReg, uint32 offset);
#if DBG_DUMP || defined(ENABLE_IR_VIEWER)
IR::IndirOpnd * BuildIndirOpnd(IR::RegOpnd *baseReg, uint32 offset, const wchar_t *desc);
#endif
IR::SymOpnd * BuildFieldOpnd(Js::OpCode newOpCode, Js::RegSlot reg, Js::PropertyId propertyId, Js::PropertyIdIndexType propertyIdIndex, PropertyKind propertyKind, uint inlineCacheIndex = -1);
PropertySym * BuildFieldSym(Js::RegSlot reg, Js::PropertyId propertyId, Js::PropertyIdIndexType propertyIdIndex, uint inlineCacheIndex, PropertyKind propertyKind);
SymID BuildSrcStackSymID(Js::RegSlot regSlot);
IR::RegOpnd * BuildDstOpnd(Js::RegSlot dstRegSlot, IRType type = TyVar, bool isCatchObjectSym = false);
IR::RegOpnd * BuildSrcOpnd(Js::RegSlot srcRegSlot, IRType type = TyVar);
IR::AddrOpnd * BuildAuxArrayOpnd(AuxArrayValue auxArrayType, uint32 offset, uint32 auxArrayOffset, uint extraSlots = 0);
IR::Opnd * BuildAuxObjectLiteralTypeRefOpnd(int objectId, uint32 offset);
private:
uint AddStatementBoundary(uint statementIndex, uint offset);
void CheckBuiltIn(PropertySym * propertySym, Js::BuiltinFunction *puBuiltInIndex);
bool IsFloatFunctionCallsite(Js::BuiltinFunction index, size_t argc);
IR::Instr * BuildProfiledFieldLoad(Js::OpCode loadOp, IR::RegOpnd *dstOpnd, IR::SymOpnd *srcOpnd, Js::CacheId inlineCacheIndex, bool *pUnprofiled);
IR::Instr * BuildProfiledSlotLoad(Js::OpCode loadOp, IR::RegOpnd *dstOpnd, IR::SymOpnd *srcOpnd, Js::ProfileId profileId, bool *pUnprofiled);
SymID GetMappedTemp(Js::RegSlot reg)
{
AssertMsg(this->RegIsTemp(reg), "Processing non-temp reg as a temp?");
AssertMsg(this->tempMap, "Processing non-temp reg without a temp map?");
return this->tempMap[reg - this->firstTemp];
}
void SetMappedTemp(Js::RegSlot reg, SymID tempId)
{
AssertMsg(this->RegIsTemp(reg), "Processing non-temp reg as a temp?");
AssertMsg(this->tempMap, "Processing non-temp reg without a temp map?");
this->tempMap[reg - this->firstTemp] = tempId;
}
BOOL GetTempUsed(Js::RegSlot reg)
{
AssertMsg(this->RegIsTemp(reg), "Processing non-temp reg as a temp?");
AssertMsg(this->fbvTempUsed, "Processing non-temp reg without a used BV?");
return this->fbvTempUsed->Test(reg - this->firstTemp);
}
void SetTempUsed(Js::RegSlot reg, BOOL used)
{
AssertMsg(this->RegIsTemp(reg), "Processing non-temp reg as a temp?");
AssertMsg(this->fbvTempUsed, "Processing non-temp reg without a used BV?");
if (used)
{
this->fbvTempUsed->Set(reg - this->firstTemp);
}
else
{
this->fbvTempUsed->Clear(reg - this->firstTemp);
}
}
BOOL RegIsTemp(Js::RegSlot reg)
{
return reg >= this->firstTemp;
}
BOOL RegIsConstant(Js::RegSlot reg)
{
return reg > 0 && reg < this->m_func->GetJnFunction()->GetConstantCount();
}
Js::RegSlot InnerScopeIndexToRegSlot(uint32) const;
Js::RegSlot GetEnvReg() const;
Js::RegSlot GetEnvRegForEvalCode() const;
Js::RegSlot GetEnvRegForInnerFrameDisplay() const;
void AddEnvOpndForInnerFrameDisplay(IR::Instr *instr, uint offset);
bool DoSlotArrayCheck(IR::SymOpnd *fieldOpnd, bool doDynamicCheck);
void EmitClosureRangeChecks();
void DoClosureRegCheck(Js::RegSlot reg);
void BuildInitCachedScope(int auxOffset, int offset);
void GenerateLoopBodySlotAccesses(uint offset);
void GenerateLoopBodyStSlots(SymID loopParamSymId, uint offset);
IR::Instr * GenerateLoopBodyStSlot(Js::RegSlot regSlot, uint offset = Js::Constants::NoByteCodeOffset);
bool IsLoopBody() const;
bool IsLoopBodyInTry() const;
uint GetLoopBodyExitInstrOffset() const;
IR::SymOpnd * BuildLoopBodySlotOpnd(SymID symId);
void EnsureLoopBodyLoadSlot(SymID symId, bool isCatchObjectSym = false);
void SetLoopBodyStSlot(SymID symID, bool isCatchObjectSym);
bool IsLoopBodyOuterOffset(uint offset) const;
bool IsLoopBodyReturnIPInstr(IR::Instr * instr) const;
IR::Opnd * InsertLoopBodyReturnIPInstr(uint targetOffset, uint offset);
IR::Instr * CreateLoopBodyReturnIPInstr(uint targetOffset, uint offset);
void InsertBailOutForDebugger(uint offset, IR::BailOutKind kind, IR::Instr* insertBeforeInstr = nullptr);
void InsertBailOnNoProfile(uint offset);
void InsertBailOnNoProfile(IR::Instr *const insertBeforeInstr);
bool DoBailOnNoProfile();
void InsertIncrLoopBodyLoopCounter(IR::LabelInstr *loopTopLabelInstr);
void InsertInitLoopBodyLoopCounter(uint loopNum);
void InsertDoneLoopBodyLoopCounter(uint32 lastOffset);
IR::RegOpnd * InsertConvPrimStr(IR::RegOpnd * srcOpnd, uint offset, bool forcePreOpBailOutIfNeeded);
#ifdef BAILOUT_INJECTION
void InjectBailOut(uint offset);
void CheckBailOutInjection(Js::OpCode opcode);
bool seenLdStackArgPtr;
bool expectApplyArg;
bool seenProfiledBeginSwitch;
#endif
JitArenaAllocator * m_tempAlloc;
JitArenaAllocator * m_funcAlloc;
Func * m_func;
IR::Instr * m_lastInstr;
IR::Instr ** m_offsetToInstruction;
uint32 m_functionStartOffset;
Js::ByteCodeReader m_jnReader;
Js::StatementReader m_statementReader;
Js::FunctionBody * m_functionBody;
SList<IR::Instr *> *m_argStack;
SList<BranchReloc*> *branchRelocList;
SList<uint> *catchOffsetStack;
SymID * tempMap;
BVFixed * fbvTempUsed;
Js::RegSlot firstTemp;
IRBuilderSwitchAdapter m_switchAdapter;
SwitchIRBuilder m_switchBuilder;
BVFixed * m_ldSlots;
BVFixed * m_stSlots;
#if DBG
BVFixed * m_usedAsTemp;
#endif
StackSym * m_loopBodyRetIPSym;
StackSym* m_loopCounterSym;
bool callTreeHasSomeProfileInfo;
// Keep track of how many args we have on the stack whenever
// we make a call so that the max stack used over all calls can be
// used to estimate how much stack we should probe for at the
// beginning of a JITted function.
#if DBG
uint32 m_offsetToInstructionCount;
uint32 m_callsOnStack;
#endif
uint32 m_argsOnStack;
Js::PropertyId m_loopBodyLocalsStartSlot;
IR::Opnd** m_saveLoopImplicitCallFlags;
#ifdef BYTECODE_BRANCH_ISLAND
typedef JsUtil::BaseDictionary<uint32, uint32, JitArenaAllocator> LongBranchMap;
LongBranchMap * longBranchMap;
static IR::Instr * const VirtualLongBranchInstr;
#endif
};
|
[
"[email protected]"
] | |
af71777e8ee789f90002dae05139a56efbbd465c
|
ad126ce2c0eaffa54f9696992cb824fcb4a14722
|
/Final/Drive/Movement.ino
|
a71b52eec3f5e8f8f9d3b3ca7cfcceea61bec578
|
[] |
no_license
|
KevinYoung23/Group19_MarsRover
|
3a1b8140aa42ec9fb7a822de3c319aa814fc61a4
|
8bb62c876214fb27b037266625a8b375fa2ee14e
|
refs/heads/main
| 2023-08-28T04:57:33.528057 | 2021-11-10T11:33:27 | 2021-11-10T11:33:27 | 378,125,448 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 8,822 |
ino
|
ISR(TCA0_CMP1_vect){
TCA0.SINGLE.INTFLAGS |= TCA_SINGLE_CMP1_bm; //clear interrupt flag
loopTrigger = 1;
}
// This subroutine processes all of the analogue samples, creating the required values for the main loop
void sampling(){
// Make the initial sampling operations for the circuit measurements
sensorValue0 = analogRead(A0); //sample Vb
sensorValue2 = analogRead(A2); //sample Vref
sensorValue3 = analogRead(A3); //sample Vpd
current_mA = ina219.getCurrent_mA(); // sample the inductor current (via the sensor chip)
// Process the values so they are a bit more usable/readable
// The analogRead process gives a value between 0 and 1023
// representing a voltage between 0 and the analogue reference which is 4.096V
vb = sensorValue0 * (4.096 / 1023.0); // Convert the Vb sensor reading to volts
vref = sensorValue2 * (4.096 / 1023.0) / speed_factor; // Convert the Vref sensor reading to volts
vpd = sensorValue3 * (4.096 / 1023.0); // Convert the Vpd sensor reading to volts
// The inductor current is in mA from the sensor so we need to convert to amps.
// We want to treat it as an input current in the Boost, so its also inverted
// For open loop control the duty cycle reference is calculated from the sensor
// differently from the Vref, this time scaled between zero and 1.
// The boost duty cycle needs to be saturated with a 0.33 minimum to prevent high output voltages
if (Boost_mode == 1){
iL = -current_mA/1000.0;
dutyref = saturation(sensorValue2 * (1.0 / 1023.0),0.99,0.33);
}else{
iL = current_mA/1000.0;
dutyref = sensorValue2 * (1.0 / 1023.0);
}
}
float saturation( float sat_input, float uplim, float lowlim){ // Saturatio function
if (sat_input > uplim) sat_input=uplim;
else if (sat_input < lowlim ) sat_input=lowlim;
else;
return sat_input;
}
void pwm_modulate(float pwm_input){ // PWM function
analogWrite(6,(int)(255-pwm_input*255));
}
// This is a PID controller for the voltage
float pidv( float pid_input){
float e_integration;
e0v = pid_input;
e_integration = e0v;
//anti-windup, if last-time pid output reaches the limitation, this time there won't be any intergrations.
if(u1v >= uv_max) {
e_integration = 0;
} else if (u1v <= uv_min) {
e_integration = 0;
}
delta_uv = kpv*(e0v-e1v) + kiv*Ts*e_integration + kdv/Ts*(e0v-2*e1v+e2v); //incremental PID programming avoids integrations.there is another PID program called positional PID.
u0v = u1v + delta_uv; //this time's control output
//output limitation
saturation(u0v,uv_max,uv_min);
u1v = u0v; //update last time's control output
e2v = e1v; //update last last time's error
e1v = e0v; // update last time's error
return u0v;
}
// This is a PID controller for the current
float pidi(float pid_input){
float e_integration;
e0i = pid_input;
e_integration=e0i;
//anti-windup
if(u1i >= ui_max){
e_integration = 0;
} else if (u1i <= ui_min) {
e_integration = 0;
}
delta_ui = kpi*(e0i-e1i) + kii*Ts*e_integration + kdi/Ts*(e0i-2*e1i+e2i); //incremental PID programming avoids integrations.
u0i = u1i + delta_ui; //this time's control output
//output limitation
saturation(u0i,ui_max,ui_min);
u1i = u0i; //update last time's control output
e2i = e1i; //update last last time's error
e1i = e0i; // update last time's error
return u0i;
}
// This is a PI controller for position control
float pi_p(float pi_p_input){
float e_integration;
e0p=pi_p_input;
e_integration=e0p;
delta_up=kpp*(e0p-e1p)+kip*Ts*e_integration;
u0p=u1p+delta_up;
u1p = u0p; //update last time's control output
e2p = e1p; //update last last time's error
e1p = e0p; // update last time's error
return u0p;
}
// Speed control
void Speed_Control(float cp){
analogWrite(6,(int)(255-cp*255));
}
void move_forward(){
digitalWrite(pwmr, HIGH);
digitalWrite(pwml, HIGH);
DIRRstate = HIGH;
DIRLstate = LOW;
digitalWrite(DIRR, DIRRstate);
digitalWrite(DIRL, DIRLstate);
}
void move_backward(){
digitalWrite(pwmr, HIGH);
digitalWrite(pwml, HIGH);
DIRRstate = LOW;
DIRLstate = HIGH;
digitalWrite(DIRR, DIRRstate);
digitalWrite(DIRL, DIRLstate);
}
void rover_stop(){
digitalWrite(pwmr, LOW);
digitalWrite(pwml, LOW);
}
void left_correction(){
digitalWrite(pwmr, HIGH);
digitalWrite(pwml, HIGH);
DIRRstate =LOW ;
DIRLstate =LOW;
digitalWrite(DIRR, DIRRstate);
digitalWrite(DIRL, DIRLstate);
}
void right_correction(){
digitalWrite(pwmr, HIGH);
digitalWrite(pwml, HIGH);
DIRRstate = HIGH;
DIRLstate = HIGH;
digitalWrite(DIRR, DIRRstate);
digitalWrite(DIRL, DIRLstate);
}
void left_turn(){
digitalWrite(pwmr, HIGH);
digitalWrite(pwml, HIGH);
DIRRstate =LOW ;
DIRLstate =LOW;
digitalWrite(DIRR, DIRRstate);
digitalWrite(DIRL, DIRLstate);
}
void right_turn(){
digitalWrite(pwmr, HIGH);
digitalWrite(pwml, HIGH);
DIRRstate = HIGH;
DIRLstate = HIGH;
digitalWrite(DIRR, DIRRstate);
digitalWrite(DIRL, DIRLstate);
}
bool turning_left(float degree, long current_x, int speed_factor)
{
float final_dis=2.6*acos(-1)*14.4*degree/360; //2
float err_l=current_x-final_dis;
float cp=pi_p(err_l);
Serial.println("err_l="+String(err_l));
Speed_Control(abs(cp)*0.0025 * speed_factor + 0.4);
if(err_l>0.5){
right_turn();
return false;
}
else if(err_l<-0.5){
left_turn();
return false;
}
else{
if(firstTime==true){
instructionCompleteTime=millis();
firstTime=false;
return false;
}
if(firstTime==false && millis()- instructionCompleteTime>5000)
{
rover_stop();
return true;
}
}
}
bool turning_right(float degree, long current_x, int speed_factor)
{
float final_dis=2.8*acos(-1)*14.4*degree/360; //2
float err_r=-current_x-final_dis;
float cp=pi_p(err_r);
Speed_Control(abs(cp)*0.0025 * speed_factor+0.4);
Serial.println("err_r="+String(err_r));
if(err_r>0.5){
left_turn();
return false;
}
else if(err_r<-0.5){
right_turn();
return false;
}
else{
if(firstTime==true){
instructionCompleteTime=millis();
firstTime=false;
return false;
}
if(firstTime==false && millis()- instructionCompleteTime>5000)
{
rover_stop();
return true;
}
}
}
bool moving_forward(float distance, long current_y, int speed_factor){
float err_f=current_y-distance;
float cp=pi_p(err_f);
Speed_Control(abs(cp)*0.0025 * speed_factor+0.4);
if(err_f>0.5){
move_backward();
return false;
}
else if(err_f<-0.5){
move_forward();
return false;
}
else{
if(firstTime == true){
instructionCompleteTime=millis();
firstTime=false;
return false;
}
if(firstTime==false && millis()- instructionCompleteTime>5000)
{
rover_stop();
return true;
}
}
}
bool moving_backward(float distance, long current_y, int speed_factor){
float err_f=-current_y-distance;
float cp=pi_p(err_f);
Speed_Control(abs(cp)*0.0025 * speed_factor+0.4);
if(err_f>0.5){
move_forward();
return false;
}
else if(err_f<-0.5){
move_backward();
return false;
}
else{
if(firstTime == true){
instructionCompleteTime=millis();
firstTime=false;
return false;
}
if(firstTime==false && millis()- instructionCompleteTime>5000)
{
rover_stop();
return true;
}
}
}
void rover_cruising(boolean lcorrection, boolean rcorrection){
if(total_y < max_y)
{
if(total_x < - 3)
{
left_correction();
lcorrection = true;
rcorrection = false;
}
else if(total_x > 3)
{
right_correction();
rcorrection = true;
lcorrection = false;
}
else
{
if(lcorrection == false and rcorrection == false)
{
//moving_forward();
}
else if(lcorrection == true)
{
left_correction();
lcorrection = total_x > -1.5 ? false : true;
}
else if(rcorrection == true)
{
right_correction();
rcorrection = total_x < 1.5 ? false : true;
}
}
}else
{
if (rcorrection == true and lcorrection == true){
rover_stop();
}else{
right_turn();
rcorrection = true;
lcorrection = true;
}
}
}
|
[
"[email protected]"
] | |
f1031bae687da00d13fb8b953548081fb17fd3ad
|
18eac502997ee1b6ce51fe595e539ff0d1399e49
|
/software/src/master/src/kernel/Vxa_ICaller2.h
|
8ddce5671a3876a4833c4c92264d04c980c2cdc2
|
[
"BSD-3-Clause"
] |
permissive
|
MichaelJCaruso/vision
|
75c8fed0cacde005800b99314bcba7cc7d85329b
|
1a3dda9697a9954bb310aee149e4aa0e8493906f
|
refs/heads/master
| 2021-01-12T17:05:56.256462 | 2020-01-12T20:32:49 | 2020-01-12T20:32:49 | 71,495,285 | 1 | 0 |
BSD-3-Clause
| 2019-04-03T18:23:13 | 2016-10-20T19:08:13 |
C++
|
UTF-8
|
C++
| false | false | 808 |
h
|
#ifndef Vxa_ICaller2_Interface
#define Vxa_ICaller2_Interface
#ifndef Vxa_ICaller2
#define Vxa_ICaller2 extern
#endif
/************************
***** Components *****
************************/
#include "Vxa_ICaller.h"
/**************************
***** Declarations *****
**************************/
/*************************
***** Definitions *****
*************************/
namespace Vxa {
VINTERFACE_ROLE (ICaller2, ICaller)
VINTERFACE_ROLE_1 (Suspensions, IVReceiver<Vxa::cardinality_t>*);
VINTERFACE_ROLE_0 (Suspend);
VINTERFACE_ROLE_0 (Resume);
VINTERFACE_ROLE_END
VxaINTERFACE (ICaller2, ICaller);
VINTERFACE_METHOD_1 (Suspensions, IVReceiver<Vxa::cardinality_t>*);
VINTERFACE_METHOD_0 (Suspend);
VINTERFACE_METHOD_0 (Resume);
VINTERFACE_END
}
#endif
|
[
"[email protected]"
] | |
08990755f2bdb3b0bba57d470c9d96bda839ed40
|
ece78696bd093e8c8a1864781e6436c7d3d2fa15
|
/Decorator/Navigation.h
|
d55154a257d4e3dae36b09b9a78ff563a48df912
|
[] |
no_license
|
igortereshchenko/CppPatterns
|
9f94c4258f000b78c260730deeb58a2685306105
|
e3c69c0d63218caceb9b96c2d32bd2f74dcddca4
|
refs/heads/master
| 2021-01-19T23:52:48.585690 | 2017-04-29T20:38:33 | 2017-04-29T20:38:33 | 89,045,954 | 0 | 2 | null | null | null | null |
UTF-8
|
C++
| false | false | 781 |
h
|
#pragma once
#include <string>
#include "CommonCar.h"
#include "OptionsDecorator.h"
#include <iostream>
using namespace std;
class Navigation: public OptionsDecorator
{
CommonCar *_b;
public:
Navigation(CommonCar *b)
{
_b = b;
}
string getDescription()
{
return _b->getDescription() + ", Navigation";
}
double getCost()
{
return 300.56 + _b->getCost();
}
~Navigation()
{
cout << "~Navigation()\n";
delete _b;
}
};
|
[
"[email protected]"
] | |
d5b2cee8a3d308b1ba7a3de544d5b950319f717d
|
04a695e6362bfc81db6010cf1b781b815665e32e
|
/AllTest/libmssqllog/mssqlcapture.h
|
f7569816829d8b49c94a4f993b8ee3d2b4ebc52f
|
[] |
no_license
|
yq1991/origin
|
b850c488c9d38c49efbfc81ea1b98d3a8395a331
|
74e61f743a6676199fed6cea0fd9b4d385d4214c
|
refs/heads/master
| 2020-06-07T16:14:11.582600 | 2019-06-18T01:35:43 | 2019-06-18T01:35:43 | 193,055,192 | 1 | 2 | null | null | null | null |
UTF-8
|
C++
| false | false | 4,130 |
h
|
//////////////////////////////////////////////////////////////////////////////
// Copyright 2006 WaveTop Information Corp.
//
// Capture socket i/o(Winsock) APIs of mssql process
//
//
#ifndef __WAVETOP_SQLSERV_CAPTURE_H_
#define __WAVETOP_SQLSERV_CAPTURE_H_ 1
#include "capture.h"
#include <windows.h>
#include <stdio.h>
#include "libmssqllog.h"
class CCaptureSession {
public:
CCaptureSession();
~CCaptureSession();
public:
MiLogHandle m_LogHandle;
UINT64 m_nCurNum;
HANDLE m_hWriteHandle;
HANDLE m_hClientHandle;
//
// Init wavetop log library.
//
int LogInit(void);
//
// Close wavetop log library.
//
int LogClose(void);
//
// Create a connection.
// @[out]
// Return 0, if successful. Otherwise, nonzero.
//
int CreateConnection(SOCKET sSock, int nType);
//
// Test a connection status.
//
int CCaptureSession::TestConnectionStatus(SOCKET sSock, LPWSABUF lpBuffers,
DWORD dwBufferCount, LPVOID *lpWTOA, DWORD *pnStatus);
//
// Add a connection event, but no data.
// @[out]
// Return 0, if successful. Otherwise, nonzero.
// lpWTOA - return the WaveTop overlapped.
//
int AddConnectionEvent(SOCKET sSock,
int nType,
unsigned char *pszBuf,
DWORD dwBufSize,
LPWSAOVERLAPPED lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
LPVOID *lpWTOA,
DWORD dwID);
// Get a overlapped result.
// @[out]
// Return 0, if successful. Otherwise, nonzero.
// ppNode - return IO buffer slot.
//
int PostResultByOverlapped(LPVOID lpWTOA,
DWORD dwCompletionKey,
DWORD dwStatus,
DWORD *pnTransfer,
DWORD dwID,
IONodeSt **ppNode);
//
// Close a connection when closesocket.
//
int CloseConnetion(SOCKET sSock, int nType);
//
// Save a trampoline PROC.
// @[in]
// pProc -- the trampoline PROC.
// @[out]
// Return 0, if successful. Otherwise, nonzero.
//
int AddTrampolineProc(char *pszModuleName, char *pszImpModuleName, char *pszFuncName,
PROC *pTrampAddr, PROC *pFakeAddr);
//
// Travels all PROCs.
// @[out]
// pProc -- the trampoline PROC.
// Return 0, if successful. Otherwise, nonzero.
//
int TravelFirst(TrampolineProcSt *pProc);
int TravelNext(TrampolineProcSt *pProc);
private:
int RecvOtherData(SOCKET sSock, char *pszBuf, int nSize);
int CaptureSendData(HANDLE hIO, SOCKET sSock, char *pszIP, DWORD dwStatus,
DWORD dwSequ, unsigned char *pszBuf, int nType, DWORD dwNumberOfBytesRecvd);
PSECURITY_ATTRIBUTES GetNullACL(void);
void CleanNullACL(void *sa);
private:
bool m_bIsClose;
PSECURITY_ATTRIBUTES m_sa;
ConnSessionSt m_arSesions[WAVETOP_CAPTURE_MAX_SESSION];
TrampolineProcSt m_arProcs[32];
int m_nProcCnt;
int m_nProcPos;
int m_nProcCursor;
};
extern CCaptureSession g_CaptureSession;
/////////////////////////////////////////////////////////////////////////////
//
// The export interfaces
//
/////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
extern "C" {
#endif
/////////////////////////////////////////////////////////////////////////////
// Capture SQLServer process entry.
// @[in]
//
// @[out]
// Return 0, if successful. Otherwise, return error code(windows).
//
__declspec(dllexport) DWORD WaveTopSQLServEntry(void);
/////////////////////////////////////////////////////////////////////////////
// Capture SQLServer process detach.
// @[in]
//
// @[out]
// Return 0, if successful. Otherwise, return error code(windows).
//
__declspec(dllexport) DWORD WaveTopSQLServDetach(void);
#ifdef __cplusplus
}
#endif
#endif // __WAVETOP_SQLSERV_CAPTURE_H_ 1
|
[
"[email protected]"
] | |
f5f1e320b5071dcd65de2c001de9f4b7babafb50
|
4ac0df23964f36d4188aac40fe3e7701193c0fba
|
/DetectorDescription/Detectors/src/EndCap_geo.cxx
|
b569f91cb33ca6f7c8fbcf15e132835287ad770c
|
[] |
no_license
|
jhrdinka/FCCSW_feb15
|
1772b2f18fbd8def367159c30a2e0c46dcc09425
|
482f3c1bd8453fd566efb92f8405ffe0dcc5faaf
|
refs/heads/master
| 2021-01-10T18:25:49.907510 | 2015-02-27T10:56:33 | 2015-02-27T10:56:33 | 30,644,615 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 6,641 |
cxx
|
//
// EndCap_geo.cxx
//
//
// Created by Julia Hrdinka on 07/01/15.
//
//
#include "DD4hep/DetFactoryHelper.h"
#include "DD4hep/TGeoUnits.h"
#include "DetExtensions/DetDiscLayer.h"
#include "DetExtensions/DetModule.h"
#include "DetExtensions/Extension.h"
#include "DetExtensions/DetDiscVolume.h"
using namespace std;
using namespace DD4hep;
using namespace DD4hep::Geometry;
static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens)
{
xml_det_t x_det = e;
string det_name = x_det.nameStr();
Material air = lcdd.air();
//Detector envelope of subdetector
DetElement endcap(det_name, x_det.id());
//get status for the RecoGeometry
xml_comp_t x_status = x_det.child(_U(status));
int status = x_status.id();
//add Extension to Detlement for the RecoGeometry
Det::DetDiscVolume* detvolume = new Det::DetDiscVolume(status);
endcap.addExtension<Det::IExtension>(detvolume);
//Volume for the envelope
DD4hep::XML::Dimension x_det_dim(x_det.dimensions());
Tube endcap_shape(x_det_dim.rmin(),x_det_dim.rmax(),x_det_dim.dz());
Volume endcap_vol(det_name+"_envelope",endcap_shape,air);
double endcap_pos = x_det_dim.z();
double sign = 1.;
if (endcap_pos<0.) sign = -1.;
//Visualization
endcap_vol.setVisAttributes(lcdd.invisible());
//Set sensitive Type
sens.setType("Geant4Tracker");
int layer_num = 0;
for (xml_coll_t j(e,_U(layer)); j; j++) {
xml_comp_t x_layer = j;
double rmin = x_layer.inner_r();
double rmax = x_layer.outer_r();
double layer_z = x_layer.dz();
int repeat = x_layer.repeat();
//Layer
string layer_name = det_name + _toString(layer_num,"layer%d");
//Create Volume and DetELement for Layer
Volume layer_vol(layer_name, Tube(rmin,rmax,layer_z), air);
DetElement detlayer(endcap,layer_name, layer_num);
//add Extension to Detlement for the RecoGeometry
Det::DetDiscLayer* detdisclayer = new Det::DetDiscLayer(2,repeat);
detlayer.addExtension<Det::IExtension>(detdisclayer);
//Visualization
layer_vol.setVisAttributes(lcdd.invisible());
int module_num_num = 0;
for (xml_coll_t i(x_layer,_U(module)); i; i++) {
xml_comp_t x_module = i;
double radius = x_module.radius();
double slicedz = x_module.dz();
double deltaphi = 2.*M_PI/repeat;
int module_num = 0;
//Place the modules
for (int j = 0; j < repeat; j++)
{
//Create Module Volume
Volume mod_vol("module", Box(x_module.length(),x_module.width(),x_module.thickness()), air);
//Visualization
mod_vol.setVisAttributes(lcdd.invisible());
double phi = deltaphi/dd4hep::rad * j;
string module_name = _toString(repeat*module_num_num+module_num,"module%d");
Position trans(radius*cos(phi),
radius*sin(phi),
slicedz);
//Create Module Detelement
DetElement mod_det(detlayer,module_name,repeat*module_num_num+module_num);
//add Extension to Detelement for the RecoGeometry
Det::DetModule* detmod = new Det::DetModule();
mod_det.addExtension<Det::IExtension> (detmod);
int comp_num = 0;
for (xml_coll_t n(x_module,_U(module_component)); n; n++) {
xml_comp_t x_comp = n;
Volume comp_vol(_toString(comp_num, "component% ") + x_comp.materialStr(), Box(x_comp.length(),x_comp.width(),x_comp.thickness()),lcdd.material(x_comp.materialStr()));
//Visualization
comp_vol.setVisAttributes(lcdd, x_comp.visStr());
if(x_comp.isSensitive()) comp_vol.setSensitiveDetector(sens);
//Create DetElement
DetElement comp_det(mod_det, "component, " + x_comp.materialStr(),comp_num);
//add Extension
Det::Extension* ex = new Det::Extension();
comp_det.addExtension<Det::IExtension>(ex);
//place component in module
Position trans (0.,0., x_comp.z());
PlacedVolume placedcomp = mod_vol.placeVolume(comp_vol,trans);
//assign the placed Volume to the DetElement
comp_det.setPlacement(placedcomp);
placedcomp.addPhysVolID("component",comp_num);
++comp_num;
}
//Place Module Box Volumes in layer
PlacedVolume placedmodule = layer_vol.placeVolume(mod_vol, Transform3D(RotationX(M_PI)*RotationZ(M_PI-phi)*RotationX(M_PI),trans));
placedmodule.addPhysVolID("module", repeat*module_num_num+module_num);
// assign module DetElement to the placed Module volume
mod_det.setPlacement(placedmodule);
++module_num;
}
module_num_num++;
}
//Placed Layer Volume
Position layer_pos(0.,0.,x_layer.z());
PlacedVolume placedLayer = endcap_vol.placeVolume(layer_vol, layer_pos);
placedLayer.addPhysVolID("layer",layer_num);
detlayer.setPlacement(placedLayer);
++layer_num;
}
//Place envelope Volume
Volume mother_vol = lcdd.pickMotherVolume(endcap);
Position endcap_trans(0.,0.,endcap_pos);
if (sign ==-1) {
Transform3D endcap_transform(RotationX(M_PI), endcap_trans);
PlacedVolume placedEndCap = mother_vol.placeVolume(endcap_vol, endcap_transform);
placedEndCap.addPhysVolID("system",x_det.id());
//assign tracker DetElement to tracker volume
endcap.setPlacement(placedEndCap);
}
else {
Transform3D endcap_transform(endcap_trans);
PlacedVolume placedEndCap = mother_vol.placeVolume(endcap_vol, endcap_transform);
placedEndCap.addPhysVolID("system",x_det.id());
//assign tracker DetElement to tracker volume
endcap.setPlacement(placedEndCap);
}
//Place LayerVolume in motherVolume
return endcap;
}
DECLARE_DETELEMENT(EndCap, create_element)
|
[
"[email protected]"
] | |
8d471f4d54c7a5e6df50006e5e6e17bd591a0190
|
91a882547e393d4c4946a6c2c99186b5f72122dd
|
/Source/XPSP1/NT/admin/wmi/wbem/winmgmt/mofcomp_dll/moflex.h
|
de4a3a53b2c7fd7a132388c7057ad8a9abb3f2b6
|
[] |
no_license
|
IAmAnubhavSaini/cryptoAlgorithm-nt5src
|
94f9b46f101b983954ac6e453d0cf8d02aa76fc7
|
d9e1cdeec650b9d6d3ce63f9f0abe50dabfaf9e2
|
refs/heads/master
| 2023-09-02T10:14:14.795579 | 2021-11-20T13:47:06 | 2021-11-20T13:47:06 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 7,459 |
h
|
/*++
Copyright (C) 1996-2001 Microsoft Corporation
Module Name:
MOFLEX.H
Abstract:
Declarations for class CMofLexer, which tokenizes MOF files.
ANSI, DBCS and UNICODE are supported.
History:
a-raymcc 11-Oct-95 Created.
a-raymcc 27-Jan-96 Update for aliasing.
a-davj 6-June-96 Added support for octal, hex and binary constants
and line stitching, comment concatenation, escape
characters and old style comments.
--*/
#ifndef _MOFLEX_H_
#define _MOFLEX_H_
#include <windows.h>
#include <stdio.h>
#include "trace.h"
// Terminal tokens required by the parser.
// =======================================
#define TOK_NULL 0
#define TOK_ERROR -1
#define TOK_CLASS 256
#define TOK_SIMPLE_IDENT 257
#define TOK_OPEN_BRACE 258
#define TOK_CLOSE_BRACE 259
#define TOK_SEMI 260
#define TOK_COLON 261
#define TOK_INTERFACE 262
#define TOK_REF 263
#define TOK_OPEN_BRACKET 264
#define TOK_CLOSE_BRACKET 265
#define TOK_EQUALS 266
#define TOK_INSTANCE 267
#define TOK_AS 268
#define TOK_COMMA 269
#define TOK_EXTERNAL 270
#define TOK_OPEN_PAREN 271
#define TOK_CLOSE_PAREN 272
#define TOK_LPWSTR 274
#define TOK_UUID 277
#define TOK_KEYWORD_NULL 278
#define TOK_FLOAT_VALUE 279
#define TOK_AMPERSAND 280
#define TOK_DOT 281
#define TOK_DOLLAR_SIGN 282
#define TOK_HEX_CONST 283
#define TOK_OCTAL_CONST 284
#define TOK_LINE 285
#define TOK_OF 286
#define TOK_OBJECT 287
#define TOK_TYPEDEF 288
#define TOK_SUBRANGE 289
#define TOK_PRAGMA 290
#define TOK_DEFINE 291
#define TOK_IFDEF 292
#define TOK_INCLUDE 293
#define TOK_ENDIF 294
#define TOK_IFNDEF 295
#define TOK_WCHAR 296
#define TOK_ENUM 300
#define TOK_AUTORECOVER 301
#define TOK_NAMESPACE 302
#define TOK_POUND 303
#define TOK_TRUE 304
#define TOK_FALSE 305
#define TOK_TOINSTANCE 306
#define TOK_TOSUBCLASS 307
#define TOK_ENABLEOVERRIDE 308
#define TOK_DISABLEOVERRIDE 309
#define TOK_NOTTOINSTANCE 310
#define TOK_NOTTOSUBCLASS 311
#define TOK_QUALIFIER 312
#define TOK_INSTANCEFLAGS 313
#define TOK_CLASSFLAGS 314
#define TOK_SIGNED64_NUMERIC_CONST 315
#define TOK_UNSIGNED64_NUMERIC_CONST 316
#define TOK_VOID 317
#define TOK_AMENDMENT 318
#define TOK_RESTRICTED 319
#define TOK_SYSTEM_IDENT 320
#define TOK_AMENDED 321
#define TOK_DELETECLASS 322
#define TOK_FAIL 323
#define TOK_NOFAIL 324
#define TOK_DELETEINSTANCE 326
#define TOK_LOCALE 327
#define TOK_PLUS 328
#define TOK_INSTANCELOCALE 329
#define TOK_NONLOCAL 330
#define TOK_NONLOCALTYPE 331
#define TOK_SOURCE 332
#define TOK_SOURCETYPE 333
class DataSrc;
// This type is used to describe the state of the lexer state machine.
// ====================================================================
typedef enum { start,
new_style_comment, // ie, "//" comments
old_style_comment, // ie, "/* ... */" comments
wstring,
wcharacter,
uuid,
ident,
numeric,
lexerror,
stop
} LexState;
class CMofLexer
{
PDBG m_pDbg;
int m_nLine;
int m_nTokCol;
int m_nStartOfLinePos;
int m_nTokLine;
int m_nErrorCode;
BOOL m_bUnicode;
wchar_t *m_pBuff; // holds the data to be parsed
BYTE *m_pToFar;
//todo wchar_t *m_pCurrWChar; // points to the current character
//todo wchar_t *m_pLastWChar; // points to the last valid character
DataSrc * m_pDataSrc;
wchar_t *m_pWorkBuf; // Holds the current token string
int m_nWorkBufSize; // number of WCHARs working buff holds
wchar_t *m_pEndOfText; // points to null terminator of working buff
BOOL m_bInString;
BOOL m_bBadString;
bool m_bBMOF;
WCHAR m_wFile[MAX_PATH];
__int64 m_i8;
void Init();
BOOL SpaceAvailable();
void BuildBuffer(long lSize, TCHAR * pFileName,char * pMemSrc, char * pMemToFar);
void MovePtr(int iNum);
wchar_t GetChar(int iNum = 0);
int iGetColumn();
int iGetNumericType(void);
LexState ProcessStr(wchar_t * pNewChar, LexState lsCurr, int *piRet);
int ConvertEsc(wchar_t * pResult, LexState lsCurr);
int OctalConvert(wchar_t *pResult, LexState lsCurr);
int HexConvert(wchar_t *pResult, LexState lsCurr);
BOOL bOKNumericAddition(wchar_t cTest);
BOOL ValidGuid();
bool ProcessBMOFFile(FILE *fp);
bool CreateBufferFromBMOF(byte * pIn, DWORD dwCompressedSize, DWORD dwExpandedSize);
public:
enum {
no_error,
file_not_found,
memory_failure,
access_denied,
file_io_error,
unrecognized_token,
token_too_long,
invalid_source_file,
invalid_source_buffer,
problem_creating_temp_file,
preprocessor_error,
invalid_include_file
};
CMofLexer(PDBG pDbg);
CMofLexer(const TCHAR *pFilePath, PDBG pDbg);
~CMofLexer();
HRESULT SetBuffer(char *pSrcMemory, DWORD dwMemSize);
BOOL IsUnicode(){return m_bUnicode;};
int NextToken(bool bDontAllowWhitespace = false); // Returns 0 on end of file
__int64 GetLastInt(){return m_i8;};
const OLECHAR *GetText(int *pLineDeclared = 0);
int GetLineNumber() { return m_nLine; }
void SetLineNumber(int iNew) {m_nLine = iNew-1;}; // the -1 accounts for the cr/lf at eol
WCHAR * GetErrorFile(){return m_wFile;};
void SetErrorFile(const WCHAR * pNew){wcsncpy(m_wFile, pNew, MAX_PATH-1);};
int GetColumn() { return m_nTokCol; }
int GetError() { return m_nErrorCode; }
void SetError(int iError) { m_nErrorCode = iError; }
bool IsBMOF(){return m_bBMOF;};
BYTE * GetBuff(){return (BYTE *)m_pBuff;};
BYTE * GetToFar(){return (BYTE *)m_pToFar;};
void SetLexPosition(ParseState * pPos);
void GetLexPosition(ParseState * pPos);
};
#endif
|
[
"[email protected]"
] | |
69d01fae03768d1f5fdd5e84fe669610997494fa
|
41f5ce839be6d4c247bce5d5b5d687ad3bf60c45
|
/test.cpp
|
6c74946dc7ba60e974bb65372409e0db7a14ead3
|
[] |
no_license
|
himanshusanecha/One-day-Before-Interview
|
269bd617fdc71419460f7f487d66d7bb19f40ec6
|
bf1dc77c009ae9ddf1920dde4f684248c54559ac
|
refs/heads/master
| 2023-08-24T08:58:01.572847 | 2021-10-24T20:45:42 | 2021-10-24T20:45:42 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 78 |
cpp
|
// Find the shortest path in a matrix from the top left to the bottom right.
|
[
"[email protected]"
] | |
7fbd95515329109949585acc8c1db5631a303e12
|
00dbe4fd5f00fab51f959fdf32ddb185daa8de30
|
/P10176.cpp
|
3a99c5808629d6cdbe15c1adf049249b519a2cb4
|
[] |
no_license
|
LasseD/uva
|
c02b21c37700bd6f43ec91e788b2787152bfb09b
|
14b62742d3dfd8fb55948b2682458aae676e7c14
|
refs/heads/master
| 2023-01-29T14:51:42.426459 | 2023-01-15T09:29:47 | 2023-01-15T09:29:47 | 17,707,082 | 3 | 4 | null | null | null | null |
UTF-8
|
C++
| false | false | 434 |
cpp
|
// 131071 = 17 ones
int main() {
char c;
int X = 131071;
while(true) {
LL remainder = 0;
while(true) {
c = getchar();
if(c == '0' || c == '1') {
remainder = (remainder << 1) + (c == '1');
if(remainder >= X)
remainder = remainder % X;
}
if(c == EOF)
return 0;
if(c == '#')
break;
}
if(remainder == 0)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
}
|
[
"[email protected]"
] | |
bfa8651345ae6eede6734a1f90233909b35046d6
|
0744dcc5394cebf57ebcba343747af6871b67017
|
/external/include/grpc++/impl/codegen/channel_interface.h
|
769f853974786ba4f8f4463398f6ae4f0053dc39
|
[
"MIT",
"Apache-2.0"
] |
permissive
|
Samsung/TizenRT
|
96abf62f1853f61fcf91ff14671a5e0c6ca48fdb
|
1a5c2e00a4b1bbf4c505bbf5cc6a8259e926f686
|
refs/heads/master
| 2023-08-31T08:59:33.327998 | 2023-08-08T06:09:20 | 2023-08-31T04:38:20 | 82,517,252 | 590 | 719 |
Apache-2.0
| 2023-09-14T06:54:49 | 2017-02-20T04:38:30 |
C
|
UTF-8
|
C++
| false | false | 4,349 |
h
|
/*
*
* Copyright 2016 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.
*
*/
#ifndef GRPCXX_IMPL_CODEGEN_CHANNEL_INTERFACE_H
#define GRPCXX_IMPL_CODEGEN_CHANNEL_INTERFACE_H
#include <grpc++/impl/codegen/status.h>
#include <grpc++/impl/codegen/time.h>
#include <grpc/impl/codegen/connectivity_state.h>
namespace grpc {
class ChannelInterface;
class ClientContext;
class CompletionQueue;
template <class R>
class ClientReader;
template <class W>
class ClientWriter;
template <class W, class R>
class ClientReaderWriter;
namespace internal {
class Call;
class CallOpSetInterface;
class RpcMethod;
template <class InputMessage, class OutputMessage>
class BlockingUnaryCallImpl;
template <class R>
class ClientAsyncReaderFactory;
template <class W>
class ClientAsyncWriterFactory;
template <class W, class R>
class ClientAsyncReaderWriterFactory;
template <class R>
class ClientAsyncResponseReaderFactory;
} // namespace internal
/// Codegen interface for \a grpc::Channel.
class ChannelInterface {
public:
virtual ~ChannelInterface() {}
/// Get the current channel state. If the channel is in IDLE and
/// \a try_to_connect is set to true, try to connect.
virtual grpc_connectivity_state GetState(bool try_to_connect) = 0;
/// Return the \a tag on \a cq when the channel state is changed or \a
/// deadline expires. \a GetState needs to called to get the current state.
template <typename T>
void NotifyOnStateChange(grpc_connectivity_state last_observed, T deadline,
CompletionQueue* cq, void* tag) {
TimePoint<T> deadline_tp(deadline);
NotifyOnStateChangeImpl(last_observed, deadline_tp.raw_time(), cq, tag);
}
/// Blocking wait for channel state change or \a deadline expiration.
/// \a GetState needs to called to get the current state.
template <typename T>
bool WaitForStateChange(grpc_connectivity_state last_observed, T deadline) {
TimePoint<T> deadline_tp(deadline);
return WaitForStateChangeImpl(last_observed, deadline_tp.raw_time());
}
/// Wait for this channel to be connected
template <typename T>
bool WaitForConnected(T deadline) {
grpc_connectivity_state state;
while ((state = GetState(true)) != GRPC_CHANNEL_READY) {
if (!WaitForStateChange(state, deadline)) return false;
}
return true;
}
private:
template <class R>
friend class ::grpc::ClientReader;
template <class W>
friend class ::grpc::ClientWriter;
template <class W, class R>
friend class ::grpc::ClientReaderWriter;
template <class R>
friend class ::grpc::internal::ClientAsyncReaderFactory;
template <class W>
friend class ::grpc::internal::ClientAsyncWriterFactory;
template <class W, class R>
friend class ::grpc::internal::ClientAsyncReaderWriterFactory;
template <class R>
friend class ::grpc::internal::ClientAsyncResponseReaderFactory;
template <class InputMessage, class OutputMessage>
friend class ::grpc::internal::BlockingUnaryCallImpl;
friend class ::grpc::internal::RpcMethod;
virtual internal::Call CreateCall(const internal::RpcMethod& method,
ClientContext* context,
CompletionQueue* cq) = 0;
virtual void PerformOpsOnCall(internal::CallOpSetInterface* ops,
internal::Call* call) = 0;
virtual void* RegisterMethod(const char* method) = 0;
virtual void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline,
CompletionQueue* cq, void* tag) = 0;
virtual bool WaitForStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline) = 0;
};
} // namespace grpc
#endif // GRPCXX_IMPL_CODEGEN_CHANNEL_INTERFACE_H
|
[
"[email protected]"
] | |
17c39b11aa56ee96d867398713c8c1bf4002338b
|
62895d5feb418f45f496e080018787e1e4b29bdc
|
/pvAccessCPP/src/remote/simpleChannelSearchManagerImpl.cpp
|
4a560ad93bc1fbbd5f10a5870736d7f740fe4f63
|
[] |
no_license
|
ncanestrari/EPICS-EPICS_V4
|
79248442adaba01243042a3513a30193769663d8
|
856274668c5e5366adfd9fc753dfa68eb188ad1b
|
refs/heads/master
| 2021-01-17T21:48:39.128382 | 2015-08-27T14:26:47 | 2015-08-27T14:26:47 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 10,309 |
cpp
|
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <stdlib.h>
#include <time.h>
#include <vector>
#include <pv/timeStamp.h>
#define epicsExportSharedSymbols
#include <pv/simpleChannelSearchManagerImpl.h>
#include <pv/pvaConstants.h>
#include <pv/blockingUDP.h>
#include <pv/serializeHelper.h>
using namespace std;
using namespace epics::pvData;
namespace epics {
namespace pvAccess {
const int SimpleChannelSearchManagerImpl::DATA_COUNT_POSITION = PVA_MESSAGE_HEADER_SIZE + 4+1+3+16+2+1+4;
const int SimpleChannelSearchManagerImpl::CAST_POSITION = PVA_MESSAGE_HEADER_SIZE + 4;
const int SimpleChannelSearchManagerImpl::PAYLOAD_POSITION = 4;
// 225ms +/- 25ms random
const double SimpleChannelSearchManagerImpl::ATOMIC_PERIOD = 0.225;
const int SimpleChannelSearchManagerImpl::PERIOD_JITTER_MS = 25;
const int SimpleChannelSearchManagerImpl::BOOST_VALUE = 1;
// must be power of two (so that search is done)
const int SimpleChannelSearchManagerImpl::MAX_COUNT_VALUE = 1 << 7;
const int SimpleChannelSearchManagerImpl::MAX_FALLBACK_COUNT_VALUE = (1 << 6) + 1;
const int SimpleChannelSearchManagerImpl::MAX_FRAMES_AT_ONCE = 10;
const int SimpleChannelSearchManagerImpl::DELAY_BETWEEN_FRAMES_MS = 50;
SimpleChannelSearchManagerImpl::shared_pointer
SimpleChannelSearchManagerImpl::create(Context::shared_pointer const & context)
{
SimpleChannelSearchManagerImpl::shared_pointer thisPtr(new SimpleChannelSearchManagerImpl(context));
thisPtr->activate();
return thisPtr;
}
SimpleChannelSearchManagerImpl::SimpleChannelSearchManagerImpl(Context::shared_pointer const & context) :
m_context(context),
m_responseAddress(*context->getSearchTransport()->getRemoteAddress()),
m_canceled(),
m_sequenceNumber(0),
m_sendBuffer(MAX_UDP_UNFRAGMENTED_SEND),
m_channels(),
m_lastTimeSent(),
m_mockTransportSendControl(),
m_channelMutex(),
m_userValueMutex(),
m_mutex()
{
// initialize send buffer
initializeSendBuffer();
// initialize random seed with some random value
srand ( time(NULL) );
}
void SimpleChannelSearchManagerImpl::activate()
{
// add some jitter so that all the clients do not send at the same time
double period = ATOMIC_PERIOD + (rand() % (2*PERIOD_JITTER_MS+1) - PERIOD_JITTER_MS)/(double)1000;
Context::shared_pointer context = m_context.lock();
if (context.get())
context->getTimer()->schedulePeriodic(shared_from_this(), period, period);
//new Thread(this, "pvAccess immediate-search").start();
}
SimpleChannelSearchManagerImpl::~SimpleChannelSearchManagerImpl()
{
// shared_from_this() is not allowed from destructor
// be sure to call cancel() first
// cancel();
}
void SimpleChannelSearchManagerImpl::cancel()
{
Lock guard(m_mutex);
if (m_canceled.get())
return;
m_canceled.set();
Context::shared_pointer context = m_context.lock();
if (context.get())
context->getTimer()->cancel(shared_from_this());
}
int32_t SimpleChannelSearchManagerImpl::registeredCount()
{
Lock guard(m_channelMutex);
return static_cast<int32_t>(m_channels.size());
}
void SimpleChannelSearchManagerImpl::registerSearchInstance(SearchInstance::shared_pointer const & channel)
{
if (m_canceled.get())
return;
bool immediateTrigger;
{
Lock guard(m_channelMutex);
//overrides if already registered
m_channels[channel->getSearchInstanceID()] = channel;
immediateTrigger = m_channels.size() == 1;
Lock guard2(m_userValueMutex);
int32_t& userValue = channel->getUserValue();
userValue = 1;
}
if (immediateTrigger)
callback();
}
void SimpleChannelSearchManagerImpl::unregisterSearchInstance(SearchInstance::shared_pointer const & channel)
{
Lock guard(m_channelMutex);
pvAccessID id = channel->getSearchInstanceID();
std::map<pvAccessID,SearchInstance::shared_pointer>::iterator channelsIter = m_channels.find(id);
if(channelsIter != m_channels.end())
m_channels.erase(id);
}
void SimpleChannelSearchManagerImpl::searchResponse(pvAccessID cid, int32_t /*seqNo*/, int8_t minorRevision, osiSockAddr* serverAddress)
{
Lock guard(m_channelMutex);
std::map<pvAccessID,SearchInstance::shared_pointer>::iterator channelsIter = m_channels.find(cid);
if(channelsIter == m_channels.end())
{
guard.unlock();
// minor hack to enable duplicate reports
SearchInstance::shared_pointer si = std::tr1::dynamic_pointer_cast<SearchInstance>(m_context.lock()->getChannel(cid));
if (si)
si->searchResponse(minorRevision, serverAddress);
}
else
{
SearchInstance::shared_pointer si = channelsIter->second;
// remove from search list
m_channels.erase(cid);
guard.unlock();
// then notify SearchInstance
si->searchResponse(minorRevision, serverAddress);
}
}
void SimpleChannelSearchManagerImpl::newServerDetected()
{
boost();
callback();
}
void SimpleChannelSearchManagerImpl::initializeSendBuffer()
{
// for now OK, since it is only set here
m_sequenceNumber++;
// new buffer
m_sendBuffer.clear();
m_sendBuffer.putByte(PVA_MAGIC);
m_sendBuffer.putByte(PVA_VERSION);
m_sendBuffer.putByte((EPICS_BYTE_ORDER == EPICS_ENDIAN_BIG) ? 0x80 : 0x00); // data + 7-bit endianess
m_sendBuffer.putByte((int8_t)3); // search
m_sendBuffer.putInt(4+1+3+16+2+1); // "zero" payload
m_sendBuffer.putInt(m_sequenceNumber);
// multicast vs unicast mask
m_sendBuffer.putByte((int8_t)0);
// reserved part
m_sendBuffer.putByte((int8_t)0);
m_sendBuffer.putShort((int16_t)0);
// NOTE: is it possible (very likely) that address is any local address ::ffff:0.0.0.0
encodeAsIPv6Address(&m_sendBuffer, &m_responseAddress);
m_sendBuffer.putShort((int16_t)ntohs(m_responseAddress.ia.sin_port));
// TODO now only TCP is supported
// note: this affects DATA_COUNT_POSITION
m_sendBuffer.putByte((int8_t)1);
// TODO "tcp" constant
SerializeHelper::serializeString("tcp", &m_sendBuffer, &m_mockTransportSendControl);
m_sendBuffer.putShort((int16_t)0); // count
}
void SimpleChannelSearchManagerImpl::flushSendBuffer()
{
Lock guard(m_mutex);
Transport::shared_pointer tt = m_context.lock()->getSearchTransport();
BlockingUDPTransport::shared_pointer ut = std::tr1::static_pointer_cast<BlockingUDPTransport>(tt);
m_sendBuffer.putByte(CAST_POSITION, (int8_t)0x80); // unicast, no reply required
ut->send(&m_sendBuffer, inetAddressType_unicast);
m_sendBuffer.putByte(CAST_POSITION, (int8_t)0x00); // b/m-cast, no reply required
ut->send(&m_sendBuffer, inetAddressType_broadcast_multicast);
initializeSendBuffer();
}
bool SimpleChannelSearchManagerImpl::generateSearchRequestMessage(SearchInstance::shared_pointer const & channel,
ByteBuffer* requestMessage, TransportSendControl* control)
{
epics::pvData::int16 dataCount = requestMessage->getShort(DATA_COUNT_POSITION);
dataCount++;
/*
if(dataCount >= MAX_SEARCH_BATCH_COUNT)
return false;
*/
const std::string name = channel->getSearchInstanceName();
// not nice...
const int addedPayloadSize = sizeof(int32)/sizeof(int8) + (1 + sizeof(int32)/sizeof(int8) + name.length());
if(((int)requestMessage->getRemaining()) < addedPayloadSize)
return false;
requestMessage->putInt(channel->getSearchInstanceID());
SerializeHelper::serializeString(name, requestMessage, control);
requestMessage->putInt(PAYLOAD_POSITION, requestMessage->getPosition() - PVA_MESSAGE_HEADER_SIZE);
requestMessage->putShort(DATA_COUNT_POSITION, dataCount);
return true;
}
bool SimpleChannelSearchManagerImpl::generateSearchRequestMessage(SearchInstance::shared_pointer const & channel,
bool allowNewFrame, bool flush)
{
Lock guard(m_mutex);
bool success = generateSearchRequestMessage(channel, &m_sendBuffer, &m_mockTransportSendControl);
// buffer full, flush
if(!success)
{
flushSendBuffer();
if(allowNewFrame)
generateSearchRequestMessage(channel, &m_sendBuffer, &m_mockTransportSendControl);
if (flush)
flushSendBuffer();
return true;
}
if (flush)
flushSendBuffer();
return flush;
}
void SimpleChannelSearchManagerImpl::boost()
{
Lock guard(m_channelMutex);
Lock guard2(m_userValueMutex);
std::map<pvAccessID,SearchInstance::shared_pointer>::iterator channelsIter = m_channels.begin();
for(; channelsIter != m_channels.end(); channelsIter++)
{
int32_t& userValue = channelsIter->second->getUserValue();
userValue = BOOST_VALUE;
}
}
void SimpleChannelSearchManagerImpl::callback()
{
// high-frequency beacon anomaly trigger guard
{
Lock guard(m_mutex);
epics::pvData::TimeStamp now;
now.getCurrent();
int64_t nowMS = now.getMilliseconds();
if (nowMS - m_lastTimeSent < 100)
return;
m_lastTimeSent = nowMS;
}
int count = 0;
int frameSent = 0;
vector<SearchInstance::shared_pointer> toSend;
{
Lock guard(m_channelMutex);
toSend.reserve(m_channels.size());
std::map<pvAccessID,SearchInstance::shared_pointer>::iterator channelsIter = m_channels.begin();
for(; channelsIter != m_channels.end(); channelsIter++)
toSend.push_back(channelsIter->second);
}
vector<SearchInstance::shared_pointer>::iterator siter = toSend.begin();
for (; siter != toSend.end(); siter++)
{
m_userValueMutex.lock();
int32_t& countValue = (*siter)->getUserValue();
bool skip = !isPowerOfTwo(countValue);
if (countValue == MAX_COUNT_VALUE)
countValue = MAX_FALLBACK_COUNT_VALUE;
else
countValue++;
m_userValueMutex.unlock();
// back-off
if (skip)
continue;
count++;
if (generateSearchRequestMessage(*siter, true, false))
frameSent++;
if (frameSent == MAX_FRAMES_AT_ONCE)
{
epicsThreadSleep(DELAY_BETWEEN_FRAMES_MS/(double)1000.0);
frameSent = 0;
}
}
if (count > 0)
flushSendBuffer();
}
bool SimpleChannelSearchManagerImpl::isPowerOfTwo(int32_t x)
{
return ((x > 0) && (x & (x - 1)) == 0);
}
void SimpleChannelSearchManagerImpl::timerStopped()
{
}
}}
|
[
"[email protected]"
] | |
804e7006c86b5323ba9571501ad03c03cf1bcd27
|
013c62be443c9773cbeb3ec8cda2c20d0aade004
|
/C.cpp
|
20ccc7fb55324b61eafe3c4ba7ba955286adaac5
|
[] |
no_license
|
Josemanuelhr/Olimpiada-Murciana-Programacion-2018
|
563196a4420c3811b4b7ac8e02e74871d7a817ca
|
e8f050704bb38192da358d8f8570c39635c99a58
|
refs/heads/master
| 2020-04-28T11:24:09.515297 | 2019-03-13T20:35:56 | 2019-03-13T20:35:56 | 175,237,235 | 2 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 7,464 |
cpp
|
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
vector< vector< char > > pared;
struct post_it { // Datos necesarios para tener un registro de un post-it
char e;
int inicio;
int fila_inicial;
};
vector< post_it > info; // array que almacena la informacion de todos los post-its que quedan por procesar
set< char > registrados; // conjunto que nos indica los post-its que ya han sido registrados en el array 'info'
struct borrar { // Datos necesarios para borrar un post-it
int inicio, final;
int fila_inicial, profundidad;
int pos;
};
vector< borrar > post_it_borrar; // array en el que almacenamos la informacion necesaria para borrar un post-it que ya ha sido
// procesado e identificado para un cierto nivel
vector< string > solucion; // array en el que iremos almacenando la solucion de los diferentes niveles
int H,W; // altura y anchura del caso actual
char elem_actual;
int inicio, final = 0; // Posiciones en las que se inicia y acaba una linea correspondiente a un post-it
int fila_inicial, profundidad = 0; // Numero de fila inicial donde comienza el post-it
/**
* Automata para buscar el final de la cadena:
* - Estado0: (char == char_actual) ? estado0 : estado1;
* - Estado1: (char != char_actual) ? estado1 : estado2;
* - Estado2: return -1;
*
**/
int estado = 0;
// Funcion que calcula la anchura maxima que tiene cierto post-it, esto se refiere a: hasta que columna aparece el post-it
// En el caso de que haya objetos que lo tapen de por medio devuelve -1
int buscar_final(post_it p, int pos) {
bool correcto = true;
estado = 0;
int j = p.inicio;
int cont = p.inicio;
while ((j<W) && (correcto)) {
switch (estado) {
case 0:
if (pared[pos][j] == p.e)
cont++;
else
estado = 1;
break;
case 1:
if (pared[pos][j] == p.e)
estado = 2;
break;
case 2:
correcto = false;
break;
}
j++;
}
if (correcto)
return cont-1; // ya que se empieza por la posicion inicial entonces hay que restarle 1
else
return -1;
}
// Funcion que calcula la profundidad maxima que tiene cierto post-it, esto se refiere a: hasta que fila aparece el post-it
// En el caso de que haya objetos que lo tapen de por medio devuelve -1
int buscar_profundidad(post_it p, int pos) {
bool correcto = true;
estado = 0;
int i = p.fila_inicial;
int cont = p.fila_inicial;
while ((i<H) && (correcto)) {
switch (estado) {
case 0:
if (pared[i][pos] == p.e)
cont++;
else
estado = 1;
break;
case 1:
if (pared[i][pos] == p.e)
estado = 2;
break;
case 2:
correcto = false;
break;
}
i++;
}
if (correcto)
return cont-1; // ya que se empieza por la posicion inicial entonces hay que restarle 1
else
return -1;
}
/**
* Funcion que recalcula la posicion de inicio para un cierto post-it
* Por ejemplo:
* .....
* ..XXX
* .XXXX
* Tendriamos que inicio = 2 antes de usar la funcion, pero tras usarla obtendriamos que el inicio esta en la posicion 1
**/
int recalcular_inicio(post_it p) {
int limi = p.inicio;
int min = p.inicio;
for (int i = p.fila_inicial; i < H ; ++i) {
while ((limi > 0) && (pared[i][limi-1] == p.e))
limi--;
if (limi < min)
min = limi;
}
return limi;
}
// Funcio que comprueba si un post-it se encuentra en el nivel actual y por lo tanto se ve 'entero'
bool comprobar_entero() {
bool entero = true; // suponemos que esta entero
int i = fila_inicial; // si estamos comprobando que esta entero es porque hemos encontrado que en la primera linea que aparece no hay problemas
int j;
if (i == H)
return true;
else {
do {
if(((inicio == 0) || (pared[i][inicio-1] != elem_actual)) && ((final == W-1) || (pared[i][final+1] != elem_actual))) {
j = inicio;
do {
if (!((pared[i][j] == elem_actual) || (pared[i][j] == '.')))
entero = false;
j++;
} while (entero && (j<=final));
} else {
entero = false;
}
i++;
} while(entero && (i<=profundidad));
return entero;
}
}
int main() {
int num_casos;
cin >> num_casos;
char elem;
for (int k = 0; k < num_casos; ++k) {
cin >> H >> W;
pared.clear();
pared.resize(H);
info.clear();
registrados.clear();
solucion.clear();
// Lectura de los datos
for (int i = 0; i < H; ++i)
for (int j = 0; j < W; ++j){
cin >> elem;
pared[i].push_back(elem);
if ((elem != '.') && (registrados.find(elem) == registrados.end())) { // Si no ha sido registrado aun se anade a 'info'
post_it a;
a.fila_inicial = i;
a.inicio = j;
a.e = elem;
info.push_back(a);
registrados.insert(elem);
}
}
// Busqueda de los post_its de diferentes niveles
bool sin_solucion = false;
bool fin = false;
do {
// Buscamos de entre todos los post_its los que pertenezcan al nivel X
post_it_borrar.clear();
int i;
string sol = "";
for (i = 0; i < info.size(); ++i) {
// Buscamos el final del post-it
int max = -1;
for (int val = 0; val < (H-info[i].fila_inicial) ; ++val){
final = buscar_final(info[i], info[i].fila_inicial+val);
if (final > max)
max = final;
}
final = max;
// Buscamos la profundidad hasta la que llega el post-it
max = -1;
for (int val = 0; val <= (final-info[i].inicio) ; ++val){
profundidad = buscar_profundidad(info[i], info[i].inicio+val);
if (profundidad > max)
max = profundidad;
}
profundidad = max;
// Si es un post-it candidato a ser de el nivel de actual, se analiza
if ((final != -1) && (profundidad != -1)) {
inicio = info[i].inicio;
fila_inicial = info[i].fila_inicial;
elem_actual = info[i].e;
if (comprobar_entero()){
sol += elem_actual;
borrar nuevo;
nuevo.inicio = inicio;
nuevo.final = final;
nuevo.fila_inicial = fila_inicial;
nuevo.profundidad = profundidad;
nuevo.pos = i;
post_it_borrar.push_back(nuevo);
}
}
}
sort(sol.begin(), sol.end());
solucion.push_back(sol);
// Si para un nivel X no hay elementos que borrar (no hay post-its en este nivel) y aun hay post-its por analizar
// es que el problema no tiene solucion
if ((post_it_borrar.size() == 0) && (info.size() != 0))
sin_solucion = true;
// Rellenamos con '.' los post_its que ya hemos analizado y los borramos de 'info'
for (int val = 0; val < post_it_borrar.size(); ++val) {
for (int posi = post_it_borrar[val].fila_inicial; posi <= post_it_borrar[val].profundidad; ++posi)
for (int posj = post_it_borrar[val].inicio; posj <= post_it_borrar[val].final; ++posj){
pared[posi][posj] = '.';
}
info.erase(info.begin() + post_it_borrar[val].pos - val); // -val porque son los elementos que ya han sido eliminados
}
// Cuando no quedan elementos en 'info' hemos acabado
if (info.size() == 0)
fin = true;
// Una vez que detectamos los post-its de un nivel comprobamos y actualizamos las posiciones de inicio de los restantes
for (int val = 0; val < info.size(); ++val){
info[val].inicio = recalcular_inicio(info[val]);
}
} while (!(fin) && !(sin_solucion));
cout << "Case " << k+1 << endl;
if (sin_solucion)
cout << "No solution" << endl;
else
for (int i = 0; i < solucion.size(); ++i) {
cout << solucion[i][0];
for(int pos = 1; pos < solucion[i].length(); ++pos)
cout << " " << solucion[i][pos];
cout << endl;
}
}
return 0;
}
|
[
"[email protected]"
] | |
05c0cbe08bea5327677350b1bb21fa8aafe9bb80
|
f7691162fa7bb5057ea5ff9a63dcde1cebad5e26
|
/groups/bdl/bdlc/bdlc_flathashtable_groupcontrol.h
|
dc59d1d9b5a636561926c705f508798ad1458e59
|
[
"Apache-2.0"
] |
permissive
|
martin-fleener/bde
|
b2c211d7e4520552ba53ed63458047b021f206b6
|
1c9e443c75ff6aaa70b3f12bf1b2045e17032995
|
refs/heads/master
| 2023-03-14T00:53:18.055462 | 2021-03-05T17:21:51 | 2021-03-05T17:21:51 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 7,001 |
h
|
// bdlc_flathashtable_groupcontrol.h -*-C++-*-
#ifndef INCLUDED_BDLC_FLATHASHTABLE_GROUPCONTROL
#define INCLUDED_BDLC_FLATHASHTABLE_GROUPCONTROL
#include <bsls_ident.h>
BSLS_IDENT("$Id: $")
//@PURPOSE: Provide inquiries to a flat hash table group of control values.
//
//@CLASSES:
// bdlc::FlatHashTable_GroupControl: flat hash table group control inquiries
//
//@DESCRIPTION: This component implements the class,
// 'bdlc::FlatHashTable_GroupControl', that provides query methods to a group
// of flat hash table control values. Note that the number of entries in a
// group control and the inquiry performance is platform dependant.
//
// The flat hash map/set/table data structures are inspired by Google's
// flat_hash_map CppCon presentations (available on youtube). The
// implementations draw from Google's open source 'raw_hash_set.h' file at:
// https://github.com/abseil/abseil-cpp/blob/master/absl/container/internal.
//
///Usage
///-----
// There is no usage example for this component since it is not meant for
// direct client use.
#include <bdlscm_version.h>
#include <bsls_assert.h>
#include <bsls_byteorder.h>
#include <bsls_platform.h>
#include <bsl_cstddef.h>
#include <bsl_cstdint.h>
#include <bsl_cstring.h>
#if defined(BSLS_PLATFORM_CPU_SSE2)
#include <immintrin.h>
#include <emmintrin.h>
#endif
namespace BloombergLP {
namespace bdlc {
// ================================
// class FlatHashTable_GroupControl
// ================================
class FlatHashTable_GroupControl
// This class provides methods for making inquires to the data of a group
// control loading during construction.
{
public:
// TYPES
#if defined(BSLS_PLATFORM_CPU_SSE2)
typedef __m128i Storage;
#else
typedef bsl::uint64_t Storage;
#endif
private:
// CLASS DATA
static const bsl::uint64_t k_MULT = 0x0101010101010101ull;
static const bsl::uint64_t k_DEFLATE = 0x0002040810204081ull;
static const int k_DEFLATE_SHIFT = 56;
static const bsl::uint64_t k_MSB_MASK = 0x8080808080808080ull;
// DATA
Storage d_value; // efficiently cached value for inquiries
// PRIVATE ACCESSORS
bsl::uint32_t matchRaw(bsl::uint8_t value) const;
// Return a bit mask of the 'k_SIZE' entries that have the specified
// 'value'. The bit at index 'i' corresponds to the result for
// 'data[i]'.
// NOT IMPLEMENTED
FlatHashTable_GroupControl();
FlatHashTable_GroupControl(const FlatHashTable_GroupControl&);
FlatHashTable_GroupControl& operator=(const FlatHashTable_GroupControl&);
public:
// PUBLIC CLASS DATA
static const bsl::uint8_t k_EMPTY = 0x80;
static const bsl::uint8_t k_ERASED = 0xC0;
static const bsl::size_t k_SIZE = sizeof(Storage);
// CREATORS
explicit FlatHashTable_GroupControl(const bsl::uint8_t *data);
// Create a group control query object using the specified 'data'. The
// bytes of 'data' have no alignment requirement. The behavior is
// undefined unless 'data' has at least 'k_SIZE' bytes available.
//! ~FlatHashTable_GroupControl() = default;
// Destroy this object.
// ACCESSORS
bsl::uint32_t available() const;
// Return a bit mask of the 'k_SIZE' entries that are empty or erased.
// The bit at index 'i' corresponds to the result for 'data[i]'.
bsl::uint32_t inUse() const;
// Return a bit mask of the 'k_SIZE' entries that are in use (i.e., not
// empty or erased). The bit at index 'i' corresponds to the result
// for 'data[i]'.
bsl::uint32_t match(bsl::uint8_t value) const;
// Return a bit mask of the 'k_SIZE' entries that have the specified
// 'value'. The bit at index 'i' corresponds to the result for
// 'data[i]'. The behavior is undefined unless '0 == (0x80 & value)'.
bool neverFull() const;
// Return 'true' if this group control was never full (i.e., has a
// value that is empty, but not erased).
};
// ============================================================================
// INLINE DEFINITIONS
// ============================================================================
// --------------------------------
// class FlatHashTable_GroupControl
// --------------------------------
// PRIVATE ACCESSORS
inline
bsl::uint32_t FlatHashTable_GroupControl::matchRaw(bsl::uint8_t value) const
{
#if defined(BSLS_PLATFORM_CPU_SSE2)
return _mm_movemask_epi8(_mm_cmpeq_epi8(
_mm_set1_epi8(static_cast<char>(value)),
d_value));
#else
Storage t = d_value ^ (k_MULT * value);
t = t | (t << 4);
t = t | (t << 2);
t = t | (t << 1);
return (((~t) & k_MSB_MASK) * k_DEFLATE) >> k_DEFLATE_SHIFT;
#endif
}
// CREATORS
inline
FlatHashTable_GroupControl::FlatHashTable_GroupControl(
const bsl::uint8_t *data)
{
#if defined(BSLS_PLATFORM_CPU_SSE2)
d_value = _mm_loadu_si128(static_cast<const Storage *>(
static_cast<const void *>(data)));
#else
bsl::memcpy(&d_value, data, k_SIZE);
d_value = BSLS_BYTEORDER_HOST_U64_TO_LE(d_value);
#endif
}
// ACCESSORS
inline
bsl::uint32_t FlatHashTable_GroupControl::available() const
{
#if defined(BSLS_PLATFORM_CPU_SSE2)
return _mm_movemask_epi8(d_value);
#else
return ((d_value & k_MSB_MASK) * k_DEFLATE) >> k_DEFLATE_SHIFT;
#endif
}
inline
bsl::uint32_t FlatHashTable_GroupControl::inUse() const
{
#if defined(BSLS_PLATFORM_CPU_SSE2)
return (~available()) & 0xFFFF;
#else
return (~available()) & 0xFF;
#endif
}
inline
bsl::uint32_t FlatHashTable_GroupControl::match(bsl::uint8_t value) const
{
BSLS_ASSERT_SAFE(0 == (value & 0x80));
return matchRaw(value);
}
inline
bool FlatHashTable_GroupControl::neverFull() const
{
return 0 != matchRaw(k_EMPTY);
}
} // close package namespace
} // close enterprise namespace
#endif
// ----------------------------------------------------------------------------
// Copyright 2020 Bloomberg Finance L.P.
//
// 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.
// ----------------------------- END-OF-FILE ----------------------------------
|
[
"[email protected]"
] | |
6fb89f214af30f3e8cd9ece1ec2def2fa4cde30a
|
3907f2c4a894604c1f99188f79d05ace27021fb7
|
/src/Viewer.cc
|
743a64ca5b0dfa9d0c67bc970d9fa4a15a284178
|
[] |
no_license
|
shuchun1997/orbextrator
|
ef0af7bb54f526e0712b719b40491d30713835d5
|
f36c41b24f3f5bd2d8e29aa744f19f81d08b7fbc
|
refs/heads/master
| 2023-05-01T04:07:59.075298 | 2021-05-19T13:23:24 | 2021-05-19T13:23:24 | 368,850,627 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 5,399 |
cc
|
#include "Viewer.h"
#include <pangolin/pangolin.h>
#include <mutex>
#include <unistd.h>
namespace ORB_SLAM2
{
Viewer::Viewer(System* pSystem, FrameDrawer *pFrameDrawer, MapDrawer *pMapDrawer, Tracking *pTracking,
const string &strSettingPath):mpSystem(pSystem),mpFrameDrawer(pFrameDrawer),mpMapDrawer(pMapDrawer),mpTracker(pTracking),
mbFinishRequested(false),mbFinished(true),mbStopped(true),mbStopRequested(false)
{
cv::FileStorage fSetting(strSettingPath,cv::FileStorage::READ);
float fps = fSetting["Camera.fps"];
if(fps<1)
fps = 30;
mT = 1e3 /fps;
mImageWidth = fSetting["Camera.width"];
mImageHeight = fSetting["Camera.Height"];
if(mImageWidth<1 || mImageHeight<1)
{
mImageWidth = 640;
mImageHeight = 480;
}
mViewpointX = fSetting["Viewer.ViewpointX"];
mViewpointY = fSetting["Viewer.ViewpointY"];
mViewpointZ = fSetting["Viewer.ViewpointZ"];
mViewpointF = fSetting["Viewer.ViewpointF"];
}
void Viewer::Run()
{
mbFinished = false;
mbStopped = false;
pangolin::CreateWindowAndBind("ORB-SLAM2: Map Viewer",1024,768);
//
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
pangolin::CreatePanel("menu").SetBounds(0.0,1.0,0.0,pangolin::Attach::Pix(175));
pangolin::Var<bool> menuFollowCamera("menu.Follow Camera",true,true);
pangolin::Var<bool> menuShowPoints("menu.Show Points",true,true);
pangolin::Var<bool> menuShowKeyFrames("menu.Show KeyFrames",true,true);
pangolin::Var<bool> menuShowGraph("menu.Show Graph",true,true);
pangolin::Var<bool> menuLocalizationMode("menu.Localization Mode",true,true);//todo
pangolin::Var<bool> menuReset("menu.Reset",false,false);
// Define Camera Render Object (for view / scene browsing)定义投影和初始模型视图矩阵
pangolin::OpenGlRenderState s_cam(
pangolin::ProjectionMatrix(1024,768,mViewpointF,mViewpointF,512,389,0.1,1000),
pangolin::ModelViewLookAt(mViewpointX,mViewpointY,mViewpointZ, 0,0,0,0.0,-1.0, 0.0)
);
// Add named OpenGL viewport to window and provide 3D Handler
// 定义地图面板
// 前两个参数(0.0, 1.0)表明宽度和面板纵向宽度和窗口大小相同
// 中间两个参数(pangolin::Attach::Pix(175), 1.0)表明右边所有部分用于显示图形
// 最后一个参数(-1024.0f/768.0f)为显示长宽比
pangolin::View& d_cam = pangolin::CreateDisplay()
.SetBounds(0.0, 1.0, pangolin::Attach::Pix(175), 1.0, -1024.0f/768.0f)
.SetHandler(new pangolin::Handler3D(s_cam));
pangolin::OpenGlMatrix Twc;
Twc.SetIdentity();
cv::namedWindow("ORB-SLAM2: Current Frame");
bool bFollow = true;
bool bLocalizationMode = false;
while(1)
{
// 清除缓冲区中的当前可写的颜色缓冲和深度缓冲
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
mpMapDrawer -> GetCurrentOpenGLCameraMatrix(Twc);
if(menuFollowCamera && bFollow)
{
s_cam.Follow(Twc);
}
else if(menuFollowCamera && !bFollow)
{
bFollow = false;
}
if(menuLocalizationMode && !bLocalizationMode)
{
mpSystem->ActivateLocalizationMode();
bLocalizationMode = true;
}
else if(!menuLocalizationMode && bLocalizationMode)
{
mpSystem->DeactivateLocalizationMode();
bLocalizationMode = false;
}
d_cam.Activate(s_cam);
glClearColor(1.0f,1.0f,1.0f,1.0f);
mpMapDrawer->DrawCurrentCamera(Twc);
if(menuShowKeyFrames || menuShowGraph)
mpMapDrawer->DrawKeyFrames(menuShowKeyFrames,menuShowGraph);
if(menuShowPoints)
mpMapDrawer->DrawMapPoints();
pangolin::FinishFrame();
cv::Mat im = mpFrameDrawer->DrawFrame();
cv::imshow("ORB-SLAM2: Current Frame",im);
cv::waitKey(mT);
if(menuReset)
{
menuShowGraph = true;
menuShowKeyFrames = true;
menuShowPoints = true;
menuLocalizationMode = false;
if(bLocalizationMode)
mpSystem->DeactivateLocalizationMode();
bLocalizationMode = false;
bFollow = true;
menuFollowCamera = true;
mpSystem->Reset();
menuReset = false;
}
if(Stop())
{
while(isStopped())
{
usleep(3000);
}
}
if(CheckFinish())
break;
}
SetFinish();
}
void Viewer::SetFinish()
{
unique_lock<mutex> lock(mMutexFinish);
mbFinished = true;
}
bool Viewer::CheckFinish()
{
unique_lock<mutex> lock(mMutexFinish);
return mbFinishRequested;
}
bool Viewer::isStopped()
{
unique_lock<mutex> lock(mMutexStop);
return mbStopped;
}
bool Viewer::Stop()
{
unique_lock<mutex> lock(mMutexStop);
unique_lock<mutex> lock2(mMutexFinish);
if(mbFinishRequested)
return false;
else if(mbStopRequested)
{
mbStopped = true;
mbStopRequested = false;
return true;
}
return false;
}
} //namespace
|
[
"[email protected]"
] | |
d72f2b32bb260022732fee7390bed4dac84d3059
|
4395183ad41d812ce462bfa6858ca346d34ece33
|
/Utils/Int.h
|
ee2607e18074f5fe78e0861ea0d19edef4e1cc0c
|
[
"MIT"
] |
permissive
|
pmcs/DataStructuresAlgorithms
|
0001c24db706b3c55b18d0edab3849930dbf7b55
|
b7da037448ae5444e4f3f843de8ee91af0e2c5c0
|
refs/heads/master
| 2020-07-05T20:35:42.092914 | 2019-05-20T09:05:26 | 2019-05-20T09:05:26 | 73,981,146 | 0 | 0 | null | 2016-11-17T02:16:31 | 2016-11-17T02:16:31 | null |
UTF-8
|
C++
| false | false | 1,033 |
h
|
#ifndef INT_H
#define INT_H
#include <iostream>
class Int {
int _value;
static unsigned _count;
public:
static unsigned Count() { return _count; }
Int() : _value(0) { ++_count; }
Int(const int& value) : _value(value) { ++_count; }
Int(const Int& value) : _value(value._value) { ++_count; }
~Int() { --_count; }
bool operator< (const Int& value) const { return _value < value._value; }
operator int() { return _value; }
operator const int() const { return _value; }
friend std::istream& operator>>(std::istream&, Int&);
friend std::ostream& operator<<(std::ostream&, Int&);
};
std::istream& operator>>(std::istream& input_stream, Int& int_object)
{
input_stream >> int_object._value;
return input_stream;
}
std::ostream& operator<<(std::ostream& output_stream, Int& int_object)
{
output_stream << int_object._value;
return output_stream;
}
unsigned int_hash_func(const Int& value)
{
return value;
}
/*static*/
unsigned Int::_count = 0;
#endif
|
[
"[email protected]"
] | |
1ce960861b5fe7d2b3926c41a808dbd6af4e8762
|
2cb681e118e3f1e4b2b141372ae1c6914599b835
|
/codeforces/630_J.cpp
|
89a5245d915be84f1c459b6983960436bb399b67
|
[] |
no_license
|
jatinarora2702/Competitive-Coding
|
1ad978a91122c920c839483e46812b5fb70a246e
|
a77f5d4f1737ca4e408ccf706128ba90ed664286
|
refs/heads/master
| 2021-01-11T20:11:34.791960 | 2020-12-31T00:21:06 | 2020-12-31T00:21:06 | 79,060,813 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 331 |
cpp
|
#include <bits/stdc++.h>
#define PB push_back
#define FF first
#define SS second
#define MP make_pair
#define VAL 1.000000011
using namespace std;
typedef long long int lli;
typedef long double ld;
const int INF = 1e9+7;
const int MOD = 1e9+7;
int main(){
lli n;
cin >> n;
lli ans;
ans = n / (lli)2520;
cout << ans << endl;
}
|
[
"[email protected]"
] | |
3b349ee8dd0b342ec4e707fd07d3893e289a0793
|
edcdb197d03b39fb75a9376c2a8e87768419f12f
|
/laboratorio2/parte2/mola.cpp
|
3cac2f967df601c33e6ac28df92e0a7db4d63aba
|
[] |
no_license
|
JeanCarlosChavarriaHughes/Estructuras-Abstractas-de-Computadores-ie0217-b11814
|
f5ff1a3c3d4702515a30ae0a4b88aebdb57a63d3
|
17028f558834023a4959267965c293dbb8c32a1a
|
refs/heads/master
| 2021-01-15T22:20:16.890521 | 2017-08-10T08:25:51 | 2017-08-10T08:25:51 | 99,898,427 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 107 |
cpp
|
#include <iostream>
using namespace std;
bool mola(void){
cout<<"Mola Hundo!" <<endl;
return true;
//h
}
|
[
"[email protected]"
] | |
aaa60a84b8c80ba097bb3efdabf96b8a429aa853
|
a37fc94db6b5cd3303db41b310bf282cc1f5db11
|
/MonkeyTemplateParser/template_parser.build/stdcpp/main.h
|
cfb2591619c670b2ea9e25c0f99bf8b905f8e993
|
[] |
no_license
|
ziggybcn/harpl-project
|
3ff0a96ddaf7c32bc160e4fd4d86f1cbb8b2f05e
|
059fe0cdf1728432c381c8ff7b4284dfd9fe8b26
|
refs/heads/master
| 2016-09-15T22:25:58.880106 | 2012-09-03T23:54:53 | 2012-09-03T23:54:53 | 32,208,973 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 474 |
h
|
//Lang/OS...
#include <cmath>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <typeinfo>
#include <signal.h>
#if _WIN32
#include <windows.h>
#include <direct.h>
#include <sys/stat.h>
#undef LoadString
#elif __APPLE__
#include <mach-o/dyld.h>
#include <sys/stat.h>
#include <dirent.h>
#include <copyfile.h>
#elif __linux
#include <unistd.h>
#include <sys/stat.h>
#include <dirent.h>
#endif
|
[
"[email protected]"
] | |
c7395c89742a4b9b85948ac38ed20daeae800368
|
347d24555940a6fbbf81706473de5ed1bfdf4bbc
|
/cppSecondCourse/references/main.cpp
|
99abf307523d283369849c8e0efd768bfe232547
|
[] |
no_license
|
LeeHudsonDLS/ProgrammingCourses
|
ee195cf2c7a6440e879a3822733bc080a81deac1
|
128812b26238149d2e1c61dd3a59f0cd9e90bcd7
|
refs/heads/master
| 2020-09-09T10:54:37.610720 | 2019-11-13T07:27:01 | 2019-11-13T07:27:01 | 221,426,352 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 526 |
cpp
|
#include <iostream>
using namespace std;
// const causes reference to only have read access to the variable
void swap(int &a, const int &b){
int temp;
temp = a;
a = b;
//Won't work due to being const
//b = temp;
}
int main() {
int x = 100;
int y = 200;
int z = 300;
int *test = &x;
int* px = &x;
int*& ppx = px;
// Creates alias for x
int& xx =x;
int& xxx = xx;
x++;
xx++;
xxx++;
cout << *ppx << endl;
cout << y << endl;
cout << z << endl;
}
|
[
"[email protected]"
] | |
313097cff8aca3a50e4ef9daf673cca14d634b8f
|
1372f080d52e8d9a853533f1fd102be7975e6670
|
/2016/HW4/Memory.cpp
|
d4eb3d4af9969f4288fbb891d18f0191f367e381
|
[] |
no_license
|
drykptn/Object-Oriented-Programming
|
623ab1942d561cfb41e3ca112d36410597ae6593
|
8a588046aa2992b7eb36e828df25232a8a7a88bb
|
refs/heads/master
| 2021-01-24T00:32:24.829442 | 2018-02-24T18:37:54 | 2018-02-24T18:37:54 | 122,744,371 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,002 |
cpp
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Memory.cpp
* Author: derya
*
* Created on 31 Ekim 2016 Pazartesi, 14:35
*/
#include "Memory.h"
Memory::Memory ( ){/*Empty constructor*/ }
// take an option constructor
Memory::Memory( const int option ):incomingOption(option){}
//set the memory for null value
void Memory::setMemory ( const int index , const int value ) {
address[index] = 0;
}
//set the memory for incoming value
void Memory::setMem ( const int index , const int value ) {
address[index] += value;
}
//print memory on the screen
void Memory::printAll ( )
{
cout << "Memory Values" << endl;
for (int i = 0; i < SIZE_OF_ADDRESS ; ++i)
{
cout << "#" << i << " : " << address[i] << " | ";
if( i == 9 || i == 19 || i == 29 || i == 39 )
cout << endl;
}
cout << endl;
}
|
[
"[email protected]"
] | |
28da191c608e90072389ee90eb5bed8ec523ca69
|
2b7dd0f63f8f1b2e8133a89392ec64d7d8c6aeeb
|
/src/qt/clientmodel.cpp
|
8ae4ef2044b6c8a7822f18d42c6586dd900d193a
|
[
"MIT"
] |
permissive
|
heindeep/bluecoin
|
621c2e3936096db736a8748449d66e6a5dee681a
|
4fbd81ba94cab8f9d6fa42671bad83017ca9e728
|
refs/heads/master
| 2020-04-27T09:39:30.441084 | 2019-03-28T18:36:44 | 2019-03-28T18:36:44 | 174,223,856 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 9,846 |
cpp
|
// Copyright (c) 2011-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2017 The PIVX developers
// Copyright (c) 2019 The Bluecoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "clientmodel.h"
#include "bantablemodel.h"
#include "guiconstants.h"
#include "peertablemodel.h"
#include "alert.h"
#include "chainparams.h"
#include "checkpoints.h"
#include "clientversion.h"
#include "main.h"
#include "masternode-sync.h"
#include "masternodeman.h"
#include "net.h"
#include "ui_interface.h"
#include "util.h"
#include <stdint.h>
#include <QDateTime>
#include <QDebug>
#include <QTimer>
static const int64_t nClientStartupTime = GetTime();
ClientModel::ClientModel(OptionsModel* optionsModel, QObject* parent) : QObject(parent),
optionsModel(optionsModel),
peerTableModel(0),
banTableModel(0),
cachedNumBlocks(0),
cachedMasternodeCountString(""),
cachedReindexing(0), cachedImporting(0),
numBlocksAtStartup(-1), pollTimer(0)
{
peerTableModel = new PeerTableModel(this);
banTableModel = new BanTableModel(this);
pollTimer = new QTimer(this);
connect(pollTimer, SIGNAL(timeout()), this, SLOT(updateTimer()));
pollTimer->start(MODEL_UPDATE_DELAY);
pollMnTimer = new QTimer(this);
connect(pollMnTimer, SIGNAL(timeout()), this, SLOT(updateMnTimer()));
// no need to update as frequent as data for balances/txes/blocks
pollMnTimer->start(MODEL_UPDATE_DELAY * 4);
subscribeToCoreSignals();
}
ClientModel::~ClientModel()
{
unsubscribeFromCoreSignals();
}
int ClientModel::getNumConnections(unsigned int flags) const
{
LOCK(cs_vNodes);
if (flags == CONNECTIONS_ALL) // Shortcut if we want total
return vNodes.size();
int nNum = 0;
BOOST_FOREACH (CNode* pnode, vNodes)
if (flags & (pnode->fInbound ? CONNECTIONS_IN : CONNECTIONS_OUT))
nNum++;
return nNum;
}
QString ClientModel::getMasternodeCountString() const
{
int ipv4 = 0, ipv6 = 0, onion = 0;
mnodeman.CountNetworks(ActiveProtocol(), ipv4, ipv6, onion);
int nUnknown = mnodeman.size() - ipv4 - ipv6 - onion;
if(nUnknown < 0) nUnknown = 0;
return tr("Total: %1 (IPv4: %2 / IPv6: %3 / Tor: %4 / Unknown: %5)").arg(QString::number((int)mnodeman.size())).arg(QString::number((int)ipv4)).arg(QString::number((int)ipv6)).arg(QString::number((int)onion)).arg(QString::number((int)nUnknown));
}
int ClientModel::getNumBlocks() const
{
LOCK(cs_main);
return chainActive.Height();
}
int ClientModel::getNumBlocksAtStartup()
{
if (numBlocksAtStartup == -1) numBlocksAtStartup = getNumBlocks();
return numBlocksAtStartup;
}
quint64 ClientModel::getTotalBytesRecv() const
{
return CNode::GetTotalBytesRecv();
}
quint64 ClientModel::getTotalBytesSent() const
{
return CNode::GetTotalBytesSent();
}
QDateTime ClientModel::getLastBlockDate() const
{
LOCK(cs_main);
if (chainActive.Tip())
return QDateTime::fromTime_t(chainActive.Tip()->GetBlockTime());
else
return QDateTime::fromTime_t(Params().GenesisBlock().GetBlockTime()); // Genesis block's time of current network
}
double ClientModel::getVerificationProgress() const
{
LOCK(cs_main);
return Checkpoints::GuessVerificationProgress(chainActive.Tip());
}
void ClientModel::updateTimer()
{
// Get required lock upfront. This avoids the GUI from getting stuck on
// periodical polls if the core is holding the locks for a longer time -
// for example, during a wallet rescan.
TRY_LOCK(cs_main, lockMain);
if (!lockMain)
return;
// Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change.
// Periodically check and update with a timer.
int newNumBlocks = getNumBlocks();
static int prevAttempt = -1;
static int prevAssets = -1;
// check for changed number of blocks we have, number of blocks peers claim to have, reindexing state and importing state
if (cachedNumBlocks != newNumBlocks ||
cachedReindexing != fReindex || cachedImporting != fImporting ||
masternodeSync.RequestedMasternodeAttempt != prevAttempt || masternodeSync.RequestedMasternodeAssets != prevAssets) {
cachedNumBlocks = newNumBlocks;
cachedReindexing = fReindex;
cachedImporting = fImporting;
prevAttempt = masternodeSync.RequestedMasternodeAttempt;
prevAssets = masternodeSync.RequestedMasternodeAssets;
emit numBlocksChanged(newNumBlocks);
}
emit bytesChanged(getTotalBytesRecv(), getTotalBytesSent());
}
void ClientModel::updateMnTimer()
{
// Get required lock upfront. This avoids the GUI from getting stuck on
// periodical polls if the core is holding the locks for a longer time -
// for example, during a wallet rescan.
TRY_LOCK(cs_main, lockMain);
if (!lockMain)
return;
QString newMasternodeCountString = getMasternodeCountString();
if (cachedMasternodeCountString != newMasternodeCountString) {
cachedMasternodeCountString = newMasternodeCountString;
emit strMasternodesChanged(cachedMasternodeCountString);
}
}
void ClientModel::updateNumConnections(int numConnections)
{
emit numConnectionsChanged(numConnections);
}
void ClientModel::updateAlert(const QString& hash, int status)
{
// Show error message notification for new alert
if (status == CT_NEW) {
uint256 hash_256;
hash_256.SetHex(hash.toStdString());
CAlert alert = CAlert::getAlertByHash(hash_256);
if (!alert.IsNull()) {
emit message(tr("Network Alert"), QString::fromStdString(alert.strStatusBar), CClientUIInterface::ICON_ERROR);
}
}
emit alertsChanged(getStatusBarWarnings());
}
bool ClientModel::inInitialBlockDownload() const
{
return IsInitialBlockDownload();
}
enum BlockSource ClientModel::getBlockSource() const
{
if (fReindex)
return BLOCK_SOURCE_REINDEX;
else if (fImporting)
return BLOCK_SOURCE_DISK;
else if (getNumConnections() > 0)
return BLOCK_SOURCE_NETWORK;
return BLOCK_SOURCE_NONE;
}
QString ClientModel::getStatusBarWarnings() const
{
return QString::fromStdString(GetWarnings("statusbar"));
}
OptionsModel* ClientModel::getOptionsModel()
{
return optionsModel;
}
PeerTableModel* ClientModel::getPeerTableModel()
{
return peerTableModel;
}
BanTableModel *ClientModel::getBanTableModel()
{
return banTableModel;
}
QString ClientModel::formatFullVersion() const
{
return QString::fromStdString(FormatFullVersion());
}
QString ClientModel::formatBuildDate() const
{
return QString::fromStdString(CLIENT_DATE);
}
bool ClientModel::isReleaseVersion() const
{
return CLIENT_VERSION_IS_RELEASE;
}
QString ClientModel::clientName() const
{
return QString::fromStdString(CLIENT_NAME);
}
QString ClientModel::formatClientStartupTime() const
{
return QDateTime::fromTime_t(nClientStartupTime).toString();
}
void ClientModel::updateBanlist()
{
banTableModel->refresh();
}
// Handlers for core signals
static void ShowProgress(ClientModel* clientmodel, const std::string& title, int nProgress)
{
// emits signal "showProgress"
QMetaObject::invokeMethod(clientmodel, "showProgress", Qt::QueuedConnection,
Q_ARG(QString, QString::fromStdString(title)),
Q_ARG(int, nProgress));
}
static void NotifyNumConnectionsChanged(ClientModel* clientmodel, int newNumConnections)
{
// Too noisy: qDebug() << "NotifyNumConnectionsChanged : " + QString::number(newNumConnections);
QMetaObject::invokeMethod(clientmodel, "updateNumConnections", Qt::QueuedConnection,
Q_ARG(int, newNumConnections));
}
static void NotifyAlertChanged(ClientModel* clientmodel, const uint256& hash, ChangeType status)
{
qDebug() << "NotifyAlertChanged : " + QString::fromStdString(hash.GetHex()) + " status=" + QString::number(status);
QMetaObject::invokeMethod(clientmodel, "updateAlert", Qt::QueuedConnection,
Q_ARG(QString, QString::fromStdString(hash.GetHex())),
Q_ARG(int, status));
}
static void BannedListChanged(ClientModel *clientmodel)
{
qDebug() << QString("%1: Requesting update for peer banlist").arg(__func__);
QMetaObject::invokeMethod(clientmodel, "updateBanlist", Qt::QueuedConnection);
}
void ClientModel::subscribeToCoreSignals()
{
// Connect signals to client
uiInterface.ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2));
uiInterface.NotifyNumConnectionsChanged.connect(boost::bind(NotifyNumConnectionsChanged, this, _1));
uiInterface.NotifyAlertChanged.connect(boost::bind(NotifyAlertChanged, this, _1, _2));
uiInterface.BannedListChanged.connect(boost::bind(BannedListChanged, this));
}
void ClientModel::unsubscribeFromCoreSignals()
{
// Disconnect signals from client
uiInterface.ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
uiInterface.NotifyNumConnectionsChanged.disconnect(boost::bind(NotifyNumConnectionsChanged, this, _1));
uiInterface.NotifyAlertChanged.disconnect(boost::bind(NotifyAlertChanged, this, _1, _2));
uiInterface.BannedListChanged.disconnect(boost::bind(BannedListChanged, this));
}
|
[
"[email protected]"
] | |
76085310f177066e2a88d012a25ea9946ed80690
|
88eda50580b3f808159cfb5a03e8a4159eb26483
|
/src/model/Adjacency.h
|
b764cfa19401ee6c582338d94ee1e78c6f574313
|
[
"Apache-2.0"
] |
permissive
|
carloseduardosx/Graphs
|
ad621bf4cab2f44877690b506531e138c18a3e3c
|
4d8d0c37e26550bae5adfe60c8f1786eb33f4684
|
refs/heads/master
| 2021-01-01T03:49:29.466615 | 2016-04-26T07:44:25 | 2016-04-26T07:44:25 | 56,958,479 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 217 |
h
|
#ifndef GRAPHS_ADJACENCY_H
#define GRAPHS_ADJACENCY_H
class Vertex;
class Corner;
class Adjacency {
private:
Corner *corner;
public:
Corner *getCorner();
void setCorner(Corner *corner);
};
#endif
|
[
"[email protected]"
] | |
fddb7854e078ea3d60e4d18aaf3898a9cc806452
|
9a62169ace507c0be95adf3f86c849b0dc144c3e
|
/dts_testcases/new/mlf_cl.1.cpp
|
f113d515b7424785c22070dfdc552de3a73d9e36
|
[] |
no_license
|
13001090108/DTSEmbed_LSC
|
84b2e7edbf1c7f5162b19f06c892a5b42d3ad88e
|
38cc44c10304458e923a1a834faa6b0ca216c0e2
|
refs/heads/master
| 2020-04-02T05:27:57.577850 | 2018-10-22T06:28:28 | 2018-10-22T06:28:28 | 154,078,761 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 83 |
cpp
|
class A
{
int *f;
void test()
{
f = new int(1);
}
~A()
{
delete f;
}
};
|
[
"[email protected]"
] | |
028735344d1921ecc61572997ba90035f7255fb3
|
c9f47801cbfd4e8057dbe43a7c3036ea260636bc
|
/NodeMCU-sketch_DC-post/a_Wifi_Setup.ino
|
1cfc3162aaa4f6b1106a4cf16d19560a923df426
|
[] |
no_license
|
newkfooz/abencoctrl
|
83b340ef03f456030500665f16e4f8a491981891
|
5952a98cfd42de5502acf37bb42e3837db1a488f
|
refs/heads/master
| 2022-11-28T11:39:07.579549 | 2020-08-08T15:28:35 | 2020-08-08T15:28:35 | 286,039,006 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,393 |
ino
|
////_____ WIFI setup _____////
void setup_wifi(){
delay(10);
Serial.println(); // Connect to WiFi network
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password); // Attempting to connect to the AP
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected"); // Connected
server.on("/", runServer); // Handle GET or POST method
server.begin(); // Start the server
Serial.println("Server started");
Serial.print("Use this URL to connect: "); // Print the IP address on serial monitor
Serial.print("http://"); // URL IP to be typed in mobile/desktop browser
Serial.print(WiFi.localIP());
Serial.println("/");
digitalWrite(0, LOW); // red Led if connected and server working
}
void callback(char* topic, byte* payload, unsigned int length) {
msgIn = "";
digitalWrite(2, LOW);
Serial.print("Message arrived [");
Serial.print(topic);
Serial.print("] ");
for (int i = 0; i < length; i++) {
msgIn = msgIn + ((char)payload[i]);
}
Serial.println(msgIn);
delay(100);
ControlsByMessage((String)topic, msgIn);
}
|
[
"[email protected]"
] | |
7fd27b34366d31e8cbb242c43851073bee3eaa50
|
8b84b0de830dbfd0061f5872e7eda67bb06aa81d
|
/inst/include/hestModel.h
|
066fba36dfc8aa9d57bc7c3814ef1e0b61fc54f3
|
[] |
no_license
|
mlysy/msde
|
465c7470cce644748984be399ca41307b82bb21d
|
2774ebd9f2dcd5087d5f6cbffabcd86c0d28ce69
|
refs/heads/main
| 2022-05-28T23:35:16.502340 | 2022-05-24T15:39:05 | 2022-05-24T15:39:05 | 66,009,155 | 1 | 1 | null | 2016-08-25T03:57:08 | 2016-08-18T15:34:11 |
R
|
UTF-8
|
C++
| false | false | 2,523 |
h
|
/// @file hestModel.h
#ifndef hestModel_h
#define hestModel_h 1
/// SDE model class for Heston's stochastic volatility model.
///
/// The model is given by
/// ```
/// dXt = (alpha - .125 * Zt^2)dt + .5 * Zt dB_Xt
/// dZt = (beta/Zt - .5*gamma * Zt)dt + sigma * dB_Zt
/// cor(B_Xt, B_Zt) = rho
/// ```
///
/// The data vector is `x = (X, Z)` and the parameter vector is `theta = (alpha, gamma, beta, sigma, rho)`.
class sdeModel {
public:
static const int nParams = 5; ///< Number of model parameters.
static const int nDims = 2; ///< Number of SDE dimensions.
static const bool sdDiff = true; ///< Diffusion is on the standard deviation scale.
static const bool diagDiff = false; ///< Diffusion is not diagonal.
/// SDE drift function.
void sdeDr(double *dr, double *x, double *theta);
/// SDE diffusion function.
void sdeDf(double *df, double *x, double *theta);
/// SDE data validator.
bool isValidData(double *x, double *theta);
/// SDE parameter validator.
bool isValidParams(double *theta);
};
/// @param[out] dr Array into which to store the calculated drift.
/// @param[in] x Array of SDE components at a given time point.
/// @param[in] theta Array of SDE parameters.
inline void sdeModel::sdeDr(double *dr, double *x, double *theta) {
dr[0] = (theta[0] - .125 * x[1]*x[1]); // x
dr[1] = (theta[2]/x[1] - .5 * theta[1]*x[1]); // z
return;
}
/// @param[out] df Array into which to store the calculated diffusion matrix.
/// @param[in] x Array of SDE components at a given time point.
/// @param[in] theta Array of SDE parameters.
inline void sdeModel::sdeDf(double *df, double *x, double *theta) {
df[0] = .5 * x[1];
df[2] = theta[3];
df[3] = sqrt(1.0-theta[4]*theta[4]) * df[2];
df[2] *= theta[4];
return;
}
/// @param[in] x Array of SDE components at a given time point.
/// @param[in] theta Array of SDE parameters.
///
/// @return Whether or not the SDE data `x` is valid. In this case we must have `Zt > 0`.
inline bool sdeModel::isValidData(double *x, double *theta) {
return(x[1] > 0.0);
}
/// @param[in] theta Array of SDE parameters.
///
/// @return Whether or not the SDE parameters `theta` are valid. In this case we must have `gamma, sigma > 0`, `beta > sigma^2/2`, and `|rho| < 1`.
inline bool sdeModel::isValidParams(double *theta) {
bool isValid;
isValid = (theta[1] > 0) && (theta[3] > 0);
isValid = isValid && (-1.0 < theta[4]) && (1.0 > theta[4]);
isValid = isValid && (theta[2] > 0.5 * theta[3] * theta[3]);
return(isValid);
}
#endif
|
[
"[email protected]"
] | |
91d06e442f9e350f517406410e48939c4afbd985
|
0065f06de6ff69420ed5eadb0e7f03ceba13bf44
|
/CPP_Course-master/University/C++_Part_2/Homework_2/Program_1/Main.cpp
|
bbd237ea7e3f16e7697d38bb324d3ee0b2ae0dd8
|
[] |
no_license
|
cc3387/CPP_Course
|
d5ac23b3a0d63ad7825572f394f5d0192e7bb70e
|
35a0c6aa80aa76526dae95aeaa9a7851a9f620cd
|
refs/heads/master
| 2021-01-18T23:20:45.089792 | 2016-07-04T15:12:41 | 2016-07-04T15:12:41 | 40,858,734 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 404 |
cpp
|
#include <iostream>
#include "figure.h"
#include "Rectangle.h"
#include "Triangle.h"
int main(){
triangle tri;
figure *fig = &tri;
fig->draw();
std::cout <<
"\nDerived class Triangle object calling center()\n";
fig->center();
rectangle rect;
figure *fig1 = ▭
fig1->draw();
std::cout <<
"\nDerived class Triangle object calling center()\n";
fig1->center();
}
|
[
"[email protected]"
] | |
8449792e31a62c39c44538c9b36bf6e5df993454
|
a1058bb42a52cf44f72825e9cb6e5778c352463c
|
/lessons/28_antialiasing_and_multisampling/LUtil.cpp
|
19f0a005164690a6c0ed771c061fe1517c0ef5e9
|
[] |
no_license
|
crossbridge-community/crossbridge-example-glsl
|
98e78c79413d7253e038beb469c4c3397636fde9
|
6f40d077aeba35b7147af8d22328585a9c1cc7f6
|
refs/heads/master
| 2016-09-07T11:49:17.356689 | 2014-09-15T14:02:25 | 2014-09-15T14:02:25 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,606 |
cpp
|
/*This source code copyrighted by Lazy Foo' Productions (2004-2013)
and may not be redistributed without written permission.*/
//Version: 028
#include "LUtil.h"
#include <IL/il.h>
#include <IL/ilu.h>
//Aliasing
AliasMode gMode = ALIAS_MODE_ALIASED;
bool initGL()
{
//Initialize GLEW
GLenum glewError = glewInit();
if( glewError != GLEW_OK )
{
printf( "Error initializing GLEW! %s\n", glewGetErrorString( glewError ) );
return false;
}
//Make sure OpenGL 2.1 is supported
if( !GLEW_VERSION_2_1 )
{
printf( "OpenGL 2.1 not supported!\n" );
return false;
}
//Set the viewport
glViewport( 0.f, 0.f, SCREEN_WIDTH, SCREEN_HEIGHT );
//Initialize Projection Matrix
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( 0.0, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0, 1.0, -1.0 );
//Initialize Modelview Matrix
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
//Initialize clear color
glClearColor( 0.f, 0.f, 0.f, 1.f );
//Enable texturing
glEnable( GL_TEXTURE_2D );
//Set blending
glEnable( GL_BLEND );
glDisable( GL_DEPTH_TEST );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
//Set antialiasing/multisampling
glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );
glDisable( GL_LINE_SMOOTH );
glDisable( GL_POLYGON_SMOOTH );
glDisable( GL_MULTISAMPLE );
//Check for error
GLenum error = glGetError();
if( error != GL_NO_ERROR )
{
//printf( "Error initializing OpenGL! %s\n", gluErrorString( error ) );
printf( "Error initializing OpenGL!\n");
return false;
}
//Initialize DevIL and DevILU
ilInit();
iluInit();
ilClearColour( 255, 255, 255, 000 );
//Check for error
ILenum ilError = ilGetError();
if( ilError != IL_NO_ERROR )
{
printf( "Error initializing DevIL! %s\n", iluErrorString( ilError ) );
return false;
}
return true;
}
bool loadMedia()
{
return true;
}
void update()
{
}
void render()
{
//Clear color
glClear( GL_COLOR_BUFFER_BIT );
//Start alias mode
switch( gMode )
{
case ALIAS_MODE_ALIASED:
glDisable( GL_LINE_SMOOTH );
glDisable( GL_POLYGON_SMOOTH );
glDisable( GL_MULTISAMPLE );
break;
case ALIAS_MODE_ANTIALIASED:
glEnable( GL_LINE_SMOOTH );
glEnable( GL_POLYGON_SMOOTH );
glDisable( GL_MULTISAMPLE );
break;
case ALIAS_MODE_MULTISAMPLE:
glDisable( GL_LINE_SMOOTH );
glDisable( GL_POLYGON_SMOOTH );
glEnable( GL_MULTISAMPLE );
break;
}
//Render Triangle
glColor3f( 1.f, 1.f, 1.f );
glBegin( GL_TRIANGLES );
glVertex2f( SCREEN_WIDTH, 0.f );
glVertex2f( SCREEN_WIDTH, SCREEN_HEIGHT );
glVertex2f( 0.f, SCREEN_HEIGHT );
glEnd();
//End alias mode
switch( gMode )
{
case ALIAS_MODE_ANTIALIASED:
glDisable( GL_LINE_SMOOTH );
glDisable( GL_POLYGON_SMOOTH );
break;
case ALIAS_MODE_MULTISAMPLE:
glDisable( GL_MULTISAMPLE );
break;
}
//Update screen
glutSwapBuffers();
}
void handleKeys( unsigned char key, int x, int y )
{
//If the user presses q
if( key == 'q' )
{
//Cycle alias mode
switch( gMode )
{
case ALIAS_MODE_ALIASED:
printf( "Antialiased\n" );
gMode = ALIAS_MODE_ANTIALIASED;
break;
case ALIAS_MODE_ANTIALIASED:
printf( "Multisampled\n" );
gMode = ALIAS_MODE_MULTISAMPLE;
break;
case ALIAS_MODE_MULTISAMPLE:
printf( "Aliased\n" );
gMode = ALIAS_MODE_ALIASED;
break;
}
}
}
|
[
"[email protected]"
] | |
18d961f8bd5cae2f17b8be0467dffb5cb4231ae7
|
43707cf850fe9fdd52c66446ad489a11a6e75503
|
/game-709/server/servers/common/src/dbmysql_mgr.h
|
a42c97b53fa211fbe44b065715e1171c138bf8af
|
[] |
no_license
|
luoweiqiao/game-709
|
d6b2ca8b9d473bd87e0adc25c5f0845318081bc2
|
c1a144199c36a5322261fae84aaed83acd7d2106
|
refs/heads/master
| 2023-03-25T22:01:31.551606 | 2021-03-22T05:04:01 | 2021-03-22T05:04:01 | 308,546,921 | 1 | 4 | null | null | null | null |
UTF-8
|
C++
| false | false | 7,963 |
h
|
#ifndef __DBMYSQL_MGR_H__
#define __DBMYSQL_MGR_H__
#include <string>
#include "fundamental/noncopyable.h"
#include "svrlib.h"
#include "dbmysql/dbmysql.h"
#include <vector>
#include "db_operator.h"
#include "db_struct_define.h"
#include <queue>
#include "dbmysql/db_task.h"
#include "game_define.h"
#include "config/config.h"
using namespace std;
using namespace svrlib;
class AsyncDBCallBack
{
public:
virtual bool OnProcessDBEvent(CDBEventRep* pRep) = 0;
};
class CDBTaskImple : public CDBTask
{
public:
virtual void writeLog(string logStr);
};
class CDBMysqlMgr : public ITimerSink,public AutoDeleteSingleton<CDBMysqlMgr>
{
public:
CDBMysqlMgr();
~CDBMysqlMgr();
virtual void OnTimer(uint8 eventID);
bool Init(stDBConf szDBConf[]);
void ShutDown();
void SetAsyncDBCallBack(AsyncDBCallBack* pCallBack);
void ProcessDBEvent();
// 加载玩家数据
void AsyncLoadPlayerData(uint32 uid);
void AsyncLoadAccountData(uint32 uid);
void AsyncLoadMissionData(uint32 uid);
// 加载游戏数据
void AsyncLoadGameData(uint32 uid,uint16 gameType);
//void AsyncLoadPayData(uint32 uid);
// 加载登陆机器人
bool AsyncLoadRobotLogin(uint16 gameType,uint8 level, uint8 day,uint32 robotNum,uint32 batchID, uint32 loginType, uint32 leveltype);
void AsyncLoadTimeIntervalRobotLogin(uint16 gameType, uint32 roomid, uint8 level, uint8 day, uint32 robotNum, uint32 batchID, uint32 loginType);
// 添加异步SQL语句
void AddAsyncSql(uint8 dbType,string strSql);
// 数据库操作接口
public:
// 更新服务器配置信息
void UpdateServerInfo();
// 上报服务器在线人数
void ReportOnlines();
// 更新玩家在线服务器房间
void UpdatePlayerOnlineInfo(uint32 uid,uint32 svrid,uint32 roomid,uint8 playerType,int64 coin = 0,int64 safecoin = 0,int64 score = 0,string strCity="");
void UpdatePlayerOnlineInfoEx(uint32 uid, uint32 svrid, uint32 roomid, uint8 playerType, int64 coin = 0, int64 safecoin = 0, int64 score = 0, string strCity = "");
void ClearPlayerOnlineInfo(uint32 svrid);
// 更新连续登陆奖励
void UpdatePlayerLoginInfo(uint32 uid,uint32 offlinetime, uint32 clogin,uint32 weeklogin,uint32 reward,uint32 bankrupt,uint32 dgameCount, uint32 signTime);
void UpdatePlayerLoginTime(uint32 uid,uint32 logintime,string loginip);
void AddPlayerLoginTimeInfo(uint32 uid,uint32 days,uint32 playTime);
void UpdatePlayerClogin();
// 设置玩家保险箱密码
void UpdatePlayerSafePasswd(uint32 uid,string passwd);
// 修改玩家账号数值(增量修改)
bool ChangeAccountValue(uint32 uid,int64 diamond,int64 coin,int64 ingot,int64 score,int32 cvalue,int64 safecoin);
bool AtomChangeAccountValue(uint32 uid,int64 diamond,int64 coin,int64 ingot,int64 score,int32 cvalue,int64 safecoin);
void ChangeFeeValue(uint32 uid,int64 feewin,int64 feelose);
// 增加玩家破产次数
void AddBankruptValue(uint32 uid);
// 增加机器人登陆次数
void AddRobotLoginCount(uint32 uid);
void SetRobotLoginState(uint32 uid,uint8 state);
// 清空机器人登陆状态
void ClearRobotLoginState();
// 保险箱赠送操作
void GiveSafeBox(uint32 suid,uint32 ruid,int64 coin,int64 tax,string strIp);
// 插入游戏数据记录
void InsertGameValue(uint16 gameType,uint32 uid);
// 修改游戏数据记录
void ChangeGameValue(uint16 gameType,uint32 uid, bool bIsRobot, bool isCoin,int32 win,int32 lose,int64 winscore, int64 lExWinScore,int64 maxscore,int rwelfare,int welcount);
// 更新最大牌型
void UpdateGameMaxCard(uint16 gameType,uint32 uid,bool isCoin,uint8 cardData[],uint8 cardCount);
// 重置每日盈利
void ResetGameDaywin(uint16 gameType,uint32 uid);
void ResetGameWeekWin(uint16 gameType);
void ResetGameWeekWin(uint16 gameType, uint32 uid);
// 修改斗地主数值(增量修改)
void ChangeLandValue(uint32 uid,bool isCoin,int32 win,int32 lose,int32 land,int32 spring,int64 maxScore);
// 保存用户任务信息
void SaveUserMission(uint32 uid,map<uint32,stUserMission>& missions);
// 更新私人房收益
void ChangePrivateTableIncome(uint32 tableID,int64 hostIncome,int64 sysIncome);
// 更新私人房过期时间
void UpdatePrivateTableDuetime(uint32 tableID,uint32 duetime);
// 插入充值订单记录
void InsertPayLog(uint32 uid,int64 rmb,int64 diamond);
// 发送邮件给玩家
void SendMail(uint32 sendID,uint32 recvID,string title,string content,string nickname);
//异步保存夺宝数据
void AsyncSaveSnatchCoinGameData(uint32 uid, uint32 type, string card);
void AsyncSaveUserSnatchGameData(uint32 uid, uint32 snatch_type, uint32 player_type, string periods, string card);
//清除夺宝数据
void ClearSnatchCoinGameData();
void ClearUserSnatchGameData(uint32 snatch_type);
void AsyncSaveUserBankruptScore(uint32 uid, uint16 gameType, uint16 roomID, int64 oldValue, int64 newValue, int64 enter_min, uint64 utime);
// 修改用户库存数值(增量修改)
void ChangeStockScore(uint16 gametype, uint32 uid, int64 score);
void UpdateGameRoomParam(string param, uint16 gametype, uint16 roomid);
void AsyncInsertBairenCount(struct tagBairenCount & BairenCount);
void AsyncRemoveBairenCount(struct tagBairenCount & BairenCount);
void ClearBairenCount();
void SaveControlPlayerData(struct tagControlPalyer & ControlPalyer);
void SaveControlPlayerData(struct tagControlMultiPalyer & ControlPalyer);
// 添加自动杀分数据记录
//void AddAutoKillData(uint32 uid,uint32 gid,uint32 rid,int64 newSrcoe,int64 oldSrcoe);
// 更新自动杀分玩家数据
//void SaveAutoKillPlayerData(uint32 uid,int64 coin);
// 插入活跃福利的玩家充值与提现数据
void InsertActiveWelfare(uint32 uid, int64 recharge_actwle, int64 converts_actwle);
// 记录玩家活跃福利的数据
void InsertActiveWelfareLog(uint32 uid, uint8 game_id, int64 base_loss, string loss_range, uint64 welfare, uint8 status, int64 current_loss, int64 win_coin, uint64 sys_time);
// 记录新注册玩家福利的数据
void InsertNewRegisterWelfareLog(uint32 uid, uint8 game_id, uint32 curr_must_win, uint32 curr_total_win, uint64 curr_win_coin, uint64 total_win_coin, uint32 status, uint64 sys_time);
// 更新库存信息 add by har
// addStockScore : 实时库存增加值
// addJackpot : 实时奖池增加值
void UpdateStock(uint16 gameType, uint16 roomId, int64 addStockScore, int64 addJackpot);
// 修改捕鱼游戏数据记录
void ChangeGameValueForFish(uint32 uid, bool isCoin, int64 winscore, int welcount);
// 同步数据库操作
public:
CDBOperator& GetSyncDBOper(uint8 dbIndex){ return m_syncDBOper[dbIndex]; }
protected:
void ZeroSqlBuff(){memset(m_szSql,0,sizeof(m_szSql));}
// 调用通用sql
void SendCommonLog(uint8 dbType);
private:
// 启动日志异步线程
bool StartAsyncDB();
// 连接配置数据库
bool ConnectSyncDB();
private:
bool OnProcessDBEvent(CDBEventRep* pRep);
private:
// 同步数据库操作
CDBOperator m_syncDBOper[DB_INDEX_TYPE_MAX]; // 同步数据库
// 异步数据库操作
CDBTaskImple* m_pAsyncTask[DB_INDEX_TYPE_MAX]; // 异步数据库线程
stDBConf m_DBConf[DB_INDEX_TYPE_MAX];
AsyncDBCallBack* m_pAsyncDBCallBack;
uint16 m_svrID;
char m_szSql[4096];
CTimer* m_pReportTimer;
};
#endif // __DBMYSQL_MGR_H__
|
[
"[email protected]"
] | |
d4523648a126600d77e64a67673db45548b2a30c
|
b70c43d17abe9337847575bc36023afcbd0e6cad
|
/test/MqttSnMessageTester/NetworkContextTestContainer.h
|
2d847d41a08277d1c56b208467e5dd52160ba53a
|
[] |
no_license
|
S3ler/CMqttSnForwarder
|
ca4600b7d6c85b940f7a06e42155e19c90bb56c7
|
072ddf0fe40be35cf780cb501a79550bc7b32a25
|
refs/heads/master
| 2020-04-25T12:03:30.930538 | 2020-01-14T12:29:19 | 2020-01-14T12:29:19 | 172,766,029 | 1 | 1 | null | 2020-01-15T16:33:57 | 2019-02-26T18:24:31 |
C
|
UTF-8
|
C++
| false | false | 3,525 |
h
|
//
// Created by SomeDude on 18.07.2019.
//
#ifndef CMQTTSNFORWARDER_TEST_MQTTSNMESSAGETESTER_NETWORKCONTEXTTESTCONTAINER_H_
#define CMQTTSNFORWARDER_TEST_MQTTSNMESSAGETESTER_NETWORKCONTEXTTESTCONTAINER_H_
#include <config/client/client_find_mqtt_sn_gateway_config.h>
#include <config/network/client/client_network_config.h>
#include <forwarder/MqttSnForwarder.h>
#include <forwarder/config/forwarder_config.h>
#include <network/linux/client/ip/tcp/MqttSnClientTcpNetwork.h>
#include <network/linux/client/ip/udp/MqttSnClientUdpNetwork.h>
#include <network/linux/client/plugin/MqttSnClientPluginNetwork.h>
#include <network/linux/gateway/ip/tcp/MqttSnGatewayTcpNetwork.h>
#include <network/linux/gateway/plugin/MqttSnGatewayPluginNetwork.h>
#include <network/linux/gateway/plugin/gateway_network_plugin_interface.h>
#include <stdint.h>
#include <memory>
#include <vector>
using std::shared_ptr;
class NetworkContextTestContainer {
private:
MqttSnForwarder forwarder;
void *gatewayNetworkContext = NULL;
void *clientNetworkContext = NULL;
private:
device_address mqttSnGatewayNetworkAddress;
device_address clientNetworkAddress;
device_address clientNetworkBroadcastAddress;
device_address gatewayNetworkAddress;
device_address gatewayNetworkBroadcastAddress;
#ifdef WITH_LINUX_PLUGIN_NETWORK_TODO
shared_ptr<gateway_plugin_device_address> pluginMqttSnGatewayNetworkAddress = nullptr;
shared_ptr<gateway_plugin_device_address> pluginForwarderGatewayNetworkAddress = nullptr;
shared_ptr<gateway_plugin_device_address> pluginForwarderGatewayNetworkBroadcastAddress = nullptr;
shared_ptr<gateway_plugin_config> plugin_cfg = nullptr;
shared_ptr<MqttSnGatewayPluginContext> gatewayPluginContext = nullptr;
shared_ptr<MqttSnClientPluginContext> clientPluginContext = nullptr;
#endif
#ifdef WITH_LINUX_TCP_CLIENT_NETWORK_TODO
shared_ptr<MqttSnGatewayTcpNetwork> tcpGatewayNetworkContext = nullptr;
shared_ptr<MqttSnClientTcpNetwork> tcpClientNetworkContext = nullptr;
#endif
#ifdef WITH_LINUX_UDP_CLIENT_NETWORK
shared_ptr<MqttSnGatewayUdpNetwork> udpGatewayNetworkContext;
shared_ptr<MqttSnClientUdpNetwork> udpClientNetworkContext;
#endif
public:
void *InitializeClientNetwork(MqttSnClientNetworkInterface *clientNetworkInterface,
const client_network_config *cncfg,
const client_mqtt_sn_gateway_config *optional_msgcfg);
void *InitializeGatewayNetwork(MqttSnGatewayNetworkInterface *gatewayNetworkInterface,
const gateway_network_config *gncfg,
const client_mqtt_sn_gateway_config *msgcfg,
const client_find_mqtt_sn_gateway_config *cfmsgcfg);
private:
#ifdef WITH_LINUX_UDP_CLIENT_NETWORK
int32_t init_client_udp(const client_network_config *cncfg,
const client_mqtt_sn_gateway_config *optional_msgcfg,
MqttSnClientNetworkInterface *clientNetworkInterface,
const MqttSnLogger *logger);
int32_t init_gateway_udp(const gateway_network_config *gncfg,
const client_mqtt_sn_gateway_config *msgcfg,
const client_find_mqtt_sn_gateway_config *cfmsgcfg,
MqttSnGatewayNetworkInterface *gatewayNetworkInterface,
const MqttSnLogger *logger);
#endif
};
#endif //CMQTTSNFORWARDER_TEST_MQTTSNMESSAGETESTER_NETWORKCONTEXTTESTCONTAINER_H_
|
[
"[email protected]"
] | |
24ec48acfba57384b3f8e3725d005b18cc3f344a
|
a44fa3e9c84cddde45efdf57ec83dc74ec7c9769
|
/source/complex.cpp
|
238c6897a98a567df0e5ca711c4e1356c6b90a74
|
[] |
no_license
|
Kladium/complex_travis
|
c69067b2f0d7c25247e8a16450c9059dafc97ec9
|
8f1e2fa8e9b23f170628febb9979443eec1d16e2
|
refs/heads/master
| 2020-03-20T18:31:43.178703 | 2018-06-16T16:12:56 | 2018-06-16T16:12:56 | 137,592,265 | 0 | 0 | null | 2018-06-16T15:54:21 | 2018-06-16T15:54:21 | null |
UTF-8
|
C++
| false | false | 2,200 |
cpp
|
#include "complex.hpp"
Complex::Complex():Re(0.0),Im(0.0){};
Complex::Complex(double re, double im): Re(re), Im(im){}
Complex::Complex(const Complex& other): Re(other.Re), Im(other.Im){}
void Complex::print(ostream& os){
if(Im < 0){
os << Re << Im << "i" << endl;
}else{
os << Re <<"+"<< Im << "i" << endl;
}
}
double Complex::real(){
return Re;
}
double Complex::imaginary(){
return Im;
}
Complex Complex::add(const Complex& other){
return Complex(Re+other.Re, Im+other.Im);
}
Complex Complex::sub(const Complex& other){
return Complex(Re-other.Re, Im-other.Im);
}
Complex Complex::mul(int number){
return Complex(Re*number, Im*number);
}
Complex Complex::div(int number){
try{
if(number == 0){
throw 1;
}
Re = Re/number;
Im = Im/number;
}catch (int number){
cout << "Division by zero" << endl;
}
return Complex(Re, Im);
}
Complex Complex::operator*(const Complex& other){
return Complex(Re*other.Re - Im*other.Im, Im*other.Re + Re*other.Im);
}
Complex Complex::operator/(const Complex& other){
return Complex((Re*other.Re + Im*other.Im)/(other.Re*other.Re + other.Im*other.Im),(-Re*other.Im + Im*other.Re)/(other.Re*other.Re + other.Im*other.Im));
}
Complex Complex::operator+=(const Complex& other){
Re += other.Re;
Im += other.Im;
return Complex(Re, Im);
}
Complex Complex::operator-=(const Complex& other){
Re -= other.Re;
Im -= other.Im;
return Complex(Re, Im);
}
Complex Complex::operator*=(const Complex& other){
double tmp;
tmp = Re*other.Re - Im*other.Im;
Im = Im*other.Re + Re*other.Im;
Re = tmp;
return Complex(Re,Im);
}
Complex Complex::operator/=(const Complex& other){
double tmp;
tmp = (Re*other.Re + Im*other.Im)/(other.Re*other.Re + other.Im*other.Im);
Im = (-Re*other.Im + Im*other.Re)/(other.Re*other.Re + other.Im*other.Im);
Re = tmp;
return Complex(Re,Im);
}
Complex Complex::operator=(const Complex& other){
Re = other.Re;
Im = other.Im;
return Complex(Re,Im);
}
bool Complex::operator==(const Complex& other){
return (Re == other.Re && Im == other.Im);
}
|
[
"[email protected]"
] | |
2da8d81fe445489dacba194193f8789859dcab5b
|
c1252dd51bd95d3c0a5f72e852b228b2ca9f7e59
|
/Proj/Project 2/CPU.h
|
5ea41c39a4a910308b4d9d2a348f18536b1d4daf
|
[] |
no_license
|
ZarusInfinite/PenaLorenzo_CSC17A_48983
|
8fa56823952d1f834452714910f756de0553d8c1
|
6e314ccf95c435ba515b75998d544f58b7085005
|
refs/heads/master
| 2016-08-12T08:57:44.052522 | 2015-12-19T02:43:56 | 2015-12-19T02:43:56 | 43,413,812 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,331 |
h
|
/*
* File: CPU.h
* Author: Louli
*
* Created on December 14, 2015, 11:11 PM
*/
#ifndef CPU_H
#define CPU_H
#include <string>
using namespace std;
//CPU class
class CPU
{
private:
string brand;
string series;
string model;
string socket;//Socket type, i.e. LGA 1150 or AM3+
string coreName;
bool hyperThread;//Whether cpu support hyperthreading (intel only)
bool intGraphics;//Integrated graphics yes or no
int numCores;
int numThreads;
float clock;
int TDP;
float price;
public:
CPU();//Constructors
//Mutators
void setBrand(string);
void setSeries(string);
void setModel(string);
void setSock(string);
void setName(string);
void setHype();//call if true
void setIG();//call if true
void setCores(int);
void setThreads(int);
void setClock(float);
void setTDP(int);
void setPrice(float);
//Accessors
string getBrand();
string getSeries();
string getModel();
string getSocket();
string getName();
int getCores();
int getThreads();
float getClock();
int getTDP();
float getPrice();
};
#endif /* CPU_H */
|
[
"[email protected]"
] | |
f918b6d2407838935d4409a28fdc937cce2a7c2c
|
10d98fecb882d4c84595364f715f4e8b8309a66f
|
/fast_k_means_2020/tree_embedding.cc
|
d61a82336e1a457b58fb64d62de38c9c65a0ed99
|
[
"CC-BY-4.0",
"Apache-2.0"
] |
permissive
|
afcarl/google-research
|
51c7b70d176c0d70a5ee31ea1d87590f3d6c6f42
|
320a49f768cea27200044c0d12f394aa6c795feb
|
refs/heads/master
| 2021-12-02T18:36:03.760434 | 2021-09-30T20:59:01 | 2021-09-30T21:07:02 | 156,725,548 | 1 | 0 |
Apache-2.0
| 2018-11-08T15:13:53 | 2018-11-08T15:13:52 | null |
UTF-8
|
C++
| false | false | 2,486 |
cc
|
// Copyright 2021 The Google Research 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 "tree_embedding.h"
#include <iostream>
namespace fast_k_means {
void TreeEmbedding::BuildTree(const vector<vector<int> >& input_points) {
id_space.push_back(map<int, vector<int> >());
space_id.push_back(map<vector<int>, int>());
// Constructing the first layer of the tree.
for (int i = 0; i < input_points.size(); i++) {
if (space_id[height].find(input_points[i]) == space_id[height].end()) {
id_space[height][first_unused_id] = input_points[i];
space_id[height][input_points[i]] = first_unused_id++;
number_points.push_back(0);
children.push_back(vector<int>(0));
points_in_node.push_back(vector<int>(0));
}
number_points[space_id[height][input_points[i]]]++;
points_in_node[space_id[height][input_points[i]]].push_back(i);
}
// If the size is one, then we have reached the root and construction is done.
while (space_id[height].size() > 1) {
id_space.push_back(map<int, vector<int> >());
space_id.push_back(map<vector<int>, int>());
for (const auto& e : space_id[height]) {
vector<int> e_space = e.first;
int e_int = e.second;
for (int i = 0; i < e_space.size(); i++) e_space[i] /= 2;
if (space_id[height + 1].find(e_space) == space_id[height + 1].end()) {
id_space[height + 1][first_unused_id] = e_space;
space_id[height + 1][e_space] = first_unused_id++;
number_points.push_back(0);
children.push_back(vector<int>(0));
points_in_node.push_back(vector<int>(0));
}
int current_id = space_id[height + 1][e_space];
number_points[current_id] += number_points[e_int];
children[current_id].push_back(e_int);
for (auto points : points_in_node[e_int])
points_in_node[current_id].push_back(points);
}
height++;
}
root = space_id[height++].begin()->second;
}
} // namespace fast_k_means
|
[
"[email protected]"
] | |
4b5563afce0eb83c38ff3f58f0975afda0ebf3a2
|
4b76397793fa742fe0f00b3a7a593d708e3106e3
|
/msgCode_10_7_18_withInterval/msgCode_10_7_18_withInterval.ino
|
e4c42c22907fbc7cfb33abaa3ebacb6cd513e128
|
[] |
no_license
|
jbillauer88/ecatSensingGarment
|
6b9ec0a8f9b33bbf6d56826cca82bed9e804196b
|
f4161c36f18c19e25cb43d181e08e18d6268054b
|
refs/heads/master
| 2020-03-26T12:15:20.818562 | 2019-02-16T20:47:54 | 2019-02-16T20:47:54 | 144,883,581 | 0 | 1 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,792 |
ino
|
// M.S.G. Logging Code
// Project ECAT
// By Jeremy Billauer
// October 2018
//////////////////////////////////////////////////////////////
// Including all sensor libraries along with libraries for I2C
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <Adafruit_MPL3115A2.h>
#include <Adafruit_AM2315.h>
#include "Adafruit_SGP30.h"
#include "Adafruit_VEML6070.h"
// Initializing SD Variables
File myFile;
const int chipSelect = 4;
// Initializing I2C Sensor Variables
Adafruit_MPL3115A2 baro = Adafruit_MPL3115A2(); // MPL3115A2 Sensor | Altitude + Barometric Pressure
Adafruit_AM2315 am2315; // AM2315 Sensor | Temperature + Humidity
Adafruit_SGP30 sgp; // SGP30 Sensor | Air Quality + Gas
Adafruit_VEML6070 uv = Adafruit_VEML6070(); // VEML6070 Sensor | Light Quality
uint32_t getAbsoluteHumidity(float temperature, float humidity) {
// approximation formula from Sensirion SGP30 Driver Integration chapter 3.15
const float absoluteHumidity = 216.7f * ((humidity / 100.0f) * 6.112f * exp((17.62f * temperature) / (243.12f + temperature)) / (273.15f + temperature)); // [g/m^3]
const uint32_t absoluteHumidityScaled = static_cast<uint32_t>(1000.0f * absoluteHumidity); // [mg/m^3]
return absoluteHumidityScaled;
}
// Initializing Interval Variables
uint32_t timer = millis();
int interval = 1000;
void setup() {
// Setup Code
// Starting I2C sensors
startSensors ();
// Starting SD card
SD.begin(chipSelect);
}
void loop() {
// Recurring Code
// Creating or Opening CSV txt file
myFile = SD.open("cold.txt", FILE_WRITE);
// Insert if(gpsFIX) else (myFile) when GPS logging is figured out
if(myFile) {
// Test if file exists so as only to print header info once per file
if(myFile.size() < 1){
writeHeader();
}
// Time to separate logging sessions | Creates break everytime program is reset
if(millis() < 1000){
myFile.println(" ");
}
if (timer > millis()) timer = millis();
// Using interval instead of delay to set resolution of samples
if (millis() - timer > interval) {
timer = millis(); // reset the timer
logI2Cdata();
}
}
}
void startSensors () {
baro.begin();
am2315.begin();
sgp.begin();
uv.begin(VEML6070_HALF_T);
}
void writeHeader() {
myFile.print("Baro (Hg)");
myFile.print(",");
myFile.print("Alt (Meters)");
myFile.print(",");
myFile.print("Temp (In C - Chest)");
myFile.print(",");
myFile.print("Temp (In C - Elbow)");
myFile.print(",");
myFile.print("Hum %");
myFile.print(",");
myFile.print("TVOC (ppb)");
myFile.print(",");
myFile.print("EC02 (ppm)");
myFile.print(",");
myFile.println("UV (Unitless)");
}
void logI2Cdata () {
// Code for MPL3115A2 Sensor ///////////////////////////////////////////////////
float pascals = baro.getPressure();
myFile.print(pascals/3377);
myFile.print(",");
float altm = baro.getAltitude();
myFile.print(altm);
myFile.print(",");
float tempC = baro.getTemperature();
myFile.print(tempC);
myFile.print(",");
// Code for AM2315 Sensor ///////////////////////////////////////////////////
myFile.print(am2315.readTemperature());
myFile.print(",");
myFile.print(am2315.readHumidity());
myFile.print(",");
// Code for SGP30 Sensor ///////////////////////////////////////////////////
if (! sgp.IAQmeasure()) {
//Serial.println("Measurement failed");
return;
}
myFile.print(sgp.TVOC);
myFile.print(",");
myFile.print(sgp.eCO2);
myFile.print(",");
// Code for VEML6070 Sensor ////////////////////////////////////////////////
myFile.println(uv.readUV());
myFile.close();
}
|
[
"[email protected]"
] | |
1358f33454f49b7b67c0ae8ae56746d91006f5db
|
e017afbf7f077682694b6926a333850b0eb3e4a4
|
/client/src/Defines/Vect2f.hpp
|
f4431cb0d00f67fe3cf889c4fcf8eed1f82bead1
|
[] |
no_license
|
zheck/rtype
|
a1540b8c4dc9e818fa499c1328042caf2075b728
|
c4b3fbb23c3d7556052aee182b2d531b515e5e98
|
refs/heads/master
| 2021-01-10T01:48:20.049694 | 2015-10-01T15:05:42 | 2015-10-01T15:05:42 | 43,503,054 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 473 |
hpp
|
#ifndef _VECT2F_HPP
#define _VECT2F_HPP
class Vect2f
{
public:
float x;
float y;
public:
Vect2f() {}
Vect2f(float fx, float fy) : x(fx), y(fy) {}
Vect2f(Vect2f const & rhs) : x(rhs.x), y(rhs.y) {}
~Vect2f() {}
Vect2f & operator=(Vect2f const & rhs) {
x = rhs.x;
y = rhs.y;
return *this;
}
Vect2f operator+(Vect2f const & rhs) {
return Vect2f(x + rhs.x, y + rhs.y);
}
};
#endif
|
[
"[email protected]"
] | |
2fce7ebfca3e896910a8206e823f8f06b5dd9d83
|
560090526e32e009e2e9331e8a2b4f1e7861a5e8
|
/Compiled/blaze-3.2/blazemark/blazemark/blitz/Complex1.h
|
6e9396b00cb0252c9acd007e486d1cacc0f33689
|
[
"BSD-3-Clause"
] |
permissive
|
jcd1994/MatlabTools
|
9a4c1f8190b5ceda102201799cc6c483c0a7b6f7
|
2cc7eac920b8c066338b1a0ac495f0dbdb4c75c1
|
refs/heads/master
| 2021-01-18T03:05:19.351404 | 2018-02-14T02:17:07 | 2018-02-14T02:17:07 | 84,264,330 | 2 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 3,023 |
h
|
//=================================================================================================
/*!
// \file blazemark/blitz/Complex1.h
// \brief Header file for the Blitz++ kernel for the complex expression c = A * ( a + b )
//
// Copyright (C) 2012-2017 Klaus Iglberger - All Rights Reserved
//
// This file is part of the Blaze library. You can redistribute it and/or modify it under
// the terms of the New (Revised) BSD License. Redistribution and use in source and binary
// forms, with or without modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
// 3. Neither the names of the Blaze development group nor the names of its contributors
// may be used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
*/
//=================================================================================================
#ifndef _BLAZEMARK_BLITZ_COMPLEX1_H_
#define _BLAZEMARK_BLITZ_COMPLEX1_H_
//*************************************************************************************************
// Includes
//*************************************************************************************************
#include <blazemark/system/Types.h>
namespace blazemark {
namespace blitz {
//=================================================================================================
//
// KERNEL FUNCTIONS
//
//=================================================================================================
//*************************************************************************************************
/*!\name Blitz++ kernel functions */
//@{
double complex1( size_t N, size_t steps );
//@}
//*************************************************************************************************
} // namespace blitz
} // namespace blazemark
#endif
|
[
"[email protected]"
] | |
d79ba2eda067569982b3685636e4c0c6db1b3c79
|
98ac44c819c545d91d885b6d74afbfbeffa736b6
|
/Limbaje formale si compilatoare(C++)/Tema1/Problema8/Main.cpp
|
ef87b847e0e2d5c5a07b637a2d3cbdc7370f1967
|
[] |
no_license
|
Iuly2000/Projects
|
9ac6ab766dfc8f18bbc72d97291404933bca2e49
|
393e1423841414aac2ae6773b949f56240f33278
|
refs/heads/master
| 2023-05-28T06:20:25.142820 | 2021-05-29T17:51:12 | 2021-05-29T17:51:12 | 372,019,485 | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,407 |
cpp
|
#include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>
#include <time.h>
void gallows(std::vector<std::string> vector)
{
srand(time(NULL));
int rword = rand() % vector.size();
int lives = 6;
char input;
std::string str,letters;
std::cout << "This is the word you have to guess:";
for (int index = 0; index < vector[rword].size(); index++)
str.append("_ ");
std::cout << str << "you have " << lives << " lives left\n";
while (lives > 0)
{
std::cout << "Insert a letter:";
std::cin >> input;
if (!(vector[rword].find(input) >= 0 && vector[rword].find(input) <= vector[rword].size())||(letters.find(input)>=0&&letters.find(input)<letters.size()))
{
--lives;
if (lives == 0)
std::cout << "Sorry,you've lost!";
else
std::cout << "ERROR,you have " << lives << " lives remaining.\n";
}
else
{
letters.append(&input);
for (int index = 0; index < vector[rword].size(); index++)
if (vector[rword][index] == input)
str[index * 2] = input;
if (str.find("_") < 0 || str.find("_") > str.size())
{
std::cout << str << "\n";
std::cout << "Congratulations,you've won!";
lives = 0;
}
else
std::cout << str << "\n";
}
}
}
int main()
{
std::vector<std::string> vector = { "ananas","crocodile","banana","pool","summer","compliment","cinema","machine","robot","mansion","stronghold" };
gallows(vector);
return 0;
}
|
[
"[email protected]"
] | |
30941836305a862457303edb34fca6d3f463cec9
|
15a651d7a54567a9135948e7f3449117528cf9e7
|
/src/hybrid/hybrid_time_discretization.cpp
|
89f0609644c994eb04bf6750c3484a88b1f7e440
|
[
"BSD-3-Clause"
] |
permissive
|
6293/idocp
|
5242ce7b2b1b3c85b3a1ffede3e25a300f4362eb
|
946524db7ae4591b578be2409ca619961572e7be
|
refs/heads/master
| 2023-08-21T01:31:28.233326 | 2021-09-14T03:38:59 | 2021-09-14T03:38:59 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,652 |
cpp
|
#include "idocp/hybrid/hybrid_time_discretization.hpp"
#include <iostream>
namespace idocp {
void HybridTimeDiscretization::showInfo() const {
std::cout << "----- The discretized optimal control problem (OCP) -----" << std::endl;
std::cout << "T = " << T_ << std::endl;
std::cout << "N_ideal = " << N_ideal() << std::endl;
std::cout << "N = " << N() << std::endl;
std::cout << "N_impulse = " << N_impulse() << std::endl;
std::cout << "N_lift = " << N_lift() << std::endl;
std::cout << "N_all = " << N_all() << std::endl;
std::cout << "isFormulationTractable: ";
if (isFormulationTractable()) std::cout << "true" << std::endl;
else std::cout << "false" << std::endl;
std::cout << "isSwitchingTimeConsistent: ";
if (isSwitchingTimeConsistent()) std::cout << "true" << std::endl;
else std::cout << "false" << std::endl;
for (int i=0; i<N(); ++i) {
std::cout << "i = " << i << ": t = " << t(i) << ": dt = " << dt(i) << std::endl;
if (isTimeStageBeforeImpulse(i)) {
const int index = impulseIndexAfterTimeStage(i);
std::cout << "impulse = " << index
<< ": t = " << t_impulse(index)
<< ": dt_aux = " << dt_aux(index) << std::endl;
}
else if (isTimeStageBeforeLift(i)) {
const int index = liftIndexAfterTimeStage(i);
std::cout << "lift = " << index
<< ": t = " << t_lift(index)
<< ": dt_lift = " << dt_lift(index) << std::endl;
}
}
std::cout << "i = " << N() << ": t = " << t(N()) << std::endl;
std::cout << "---------------------------------------------------------" << std::endl;
}
} // namespace idocp
|
[
"[email protected]"
] | |
2a7981c82f2a70de49bdb6bcf0018e939dcdbdfa
|
786274455f3aed8eec8c805b4a6be1a6e60f6341
|
/Experimentation/ExperimentSystem/plans/DistributedSolving.hpp
|
3c5f3e34974b4d8f2a81e8b976c2d22bd0f99f0a
|
[] |
no_license
|
RWang/oklibrary
|
6ab9b0eed3e192c3d5f2c8b9d536a72fa895814b
|
c83a54135e0dbce2523c9ac485fa8865c9f38633
|
refs/heads/master
| 2021-01-15T22:13:53.528446 | 2010-08-19T20:39:30 | 2010-08-19T20:39:30 | 131,209 | 1 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,869 |
hpp
|
// Oliver Kullmann, 19.4.2009 (Swansea)
/* Copyright 2009 Oliver Kullmann
This file is part of the OKlibrary. OKlibrary 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 and included in this library; either version 3 of the
License, or any later version. */
/*!
\file ExperimentSystem/plans/DistributedSolving.hpp
\brief Plans for distributed SAT solving via a splitting tree
\todo Distribution via splitting trees
<ul>
<li> The basic idea is to have a possibly amended r_k-splitting tree T (see
ComputerAlgebra/Satisfiability/Lisp/Backtracking/SplittingTrees.mac)
for the hard input clause-set F, such that T has no [true] or [false]
leaves. </li>
<li> The leaves of F are enumerated by indices 1, ..., L, and the
distributed solving of F just distributes problem instances F_i for i in
{1,...,L} to available machines (using appropriate solvers S_i). </li>
<li> The problem instance F_i is just the instance at the corresponding
node of T, which is created by adding the assignments on the path to leaf i
to F (as unit clauses; so the reduction of S_i must be strong enough
to recover all forced assignments (possibly helped by the amendments)).
</li>
<li> The main task is to find a suitable T; but even if we split the
instance into, say, 2^16 subinstances F_i, the tree T is still relatively
small. </li>
<li> And given F, T and i, computing F_i is a rather simple task (assuming
that F_i will take at least, say, hours). </li>
<li> T could be computed by the OKsolver_2002 (see "Simple parallelisation"
in Solvers/OKsolver/SAT2002/plans/general.hpp), but also stronger reduction
means could be used. </li>
<li> First we implement all this at the Maxima/Lisp level. </li>
</ul>
*/
|
[
"[email protected]"
] | |
b76188f606c8f20133d11c0817d7319d2e23df6f
|
82065840e3502df38706a4393be88f63e009f002
|
/Methods/MethodsDebugProject/MethodsDebugProject/Headers/TMethodOfGlobalSearch.h
|
c541f3f1e7cc7a7f26dd558d400ad97611aa2312
|
[] |
no_license
|
deathboydmi/ITLabSearchForAGlobalMinimum
|
a2849919c023945ec243066133dd1a90e0b3c8bf
|
486597e153178943704cf39452624a0cc71d4385
|
refs/heads/master
| 2021-06-17T18:01:08.930773 | 2017-05-12T11:33:07 | 2017-05-12T11:33:07 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 1,998 |
h
|
#include "IMethod.h"
class TMethodOfGlobalSearch : public IMethod
{
protected:
TFunction function;
public:
TMethodOfGlobalSearch(TTask *_pTask, TSearchData *_pData)
{
pTask = _pTask;
pData = _pData;
TFunction _func(pTask->str_function);
function = _func;
}
double f(double x)
{
/*return (x/4)*cos(x);*/
return function.Calculate(x);
}
~TMethodOfGlobalSearch() { }
virtual void RenewSearchData(double _x)
{
double _y = f(_x);
TPoint tmp;
tmp.x = _x; tmp.y = _y;
pData->insert(tmp, root);
}
virtual TPoint CalculateOptimum()
{
TPoint result;
double m = 1;
double maxM = 0;
double* M = new double[pTask->maxOfIterations];
double* x = new double[pTask->maxOfIterations];
double* R = new double[pTask->maxOfIterations];
double maxR = 0;
unsigned int maxIR = 0;
double minF;
double minX;
x[0] = pTask->xl; x[1] = pTask->xr;
if (f(x[0]) < f(x[1]))
{
minF = f(x[0]);
minX = x[0];
}
else
{
minF = f(x[1]);
minX = x[1];
}
for (size_t i = 1; i < pTask->maxOfIterations; i++)
{
for (size_t j = 0; j < i; j++)
for (size_t l = 0; l < i - j; l++)
if (x[l] > x[l + 1])
std::swap(x[l], x[l + 1]);
for (size_t j = 1; j <= i; j++)
{
M[j - 1] = (abs(f(x[j]) - f(x[j - 1]))) / (x[j] - x[j - 1]);
if (M[j - 1] > maxM)
{
maxM = M[j - 1];
}
}
if (maxM > 0)
{
m = pTask->r*maxM;
}
for (size_t j = 1; j <= i; j++)
{
R[j - 1] = m*(x[j] - x[j - 1]) + (pow((f(x[j]) - f(x[j - 1])), 2)) / (m*(x[j] - x[j - 1])) - 2 * (f(x[j]) + f(x[j - 1]));
if (R[j - 1] > maxR)
{
maxR = R[j];
maxIR = j;
}
}
if (abs(x[maxIR] - x[maxIR - 1]) < pTask->eps)
{
break;
}
x[i + 1] = 0.5*(x[maxIR] + x[maxIR - 1]) - 0.5*(f(x[maxIR]) - f(x[maxIR - 1])) / m;
RenewSearchData(x[i + 1]);
if (f(x[i + 1]) < minF)
{
minF = f(x[i + 1]);
minX = x[i + 1];
}
}
result.x = minX;
result.y = minF;
return result;
}
};
|
[
"[email protected]"
] | |
9b6113a5f756c6fd0ebaf072558cf4a69244203f
|
e78d2fc4bfe185f74ede33fd14eefa16e071a975
|
/src/base58.h
|
8af43d83f4d14143a6fc5a3a4f4925ee21b2763e
|
[
"MIT"
] |
permissive
|
danrachita/charm
|
bb09e369c5d14633ae6fa636bbc73cb309d91989
|
9c70f930033d7cbbcf0e2d00efc4d24b651c4761
|
refs/heads/master
| 2020-03-23T03:52:32.633831 | 2018-04-23T14:58:53 | 2018-04-23T14:58:53 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C++
| false | false | 5,769 |
h
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2015 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
/**
* Why base-58 instead of standard base-64 encoding?
* - Don't want 0OIl characters that look the same in some fonts and
* could be used to create visually identical looking data.
* - A string with non-alphanumeric characters is not as easily accepted as input.
* - E-mail usually won't line-break if there's no punctuation to break at.
* - Double-clicking selects the whole string as one word if it's all alphanumeric.
*/
#ifndef BITCOIN_BASE58_H
#define BITCOIN_BASE58_H
#include "chainparams.h"
#include "key.h"
#include "pubkey.h"
#include "script/script.h"
#include "script/standard.h"
#include "support/allocators/zeroafterfree.h"
#include <string>
#include <vector>
/**
* Encode a byte sequence as a base58-encoded string.
* pbegin and pend cannot be NULL, unless both are.
*/
std::string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend);
/**
* Encode a byte vector as a base58-encoded string
*/
std::string EncodeBase58(const std::vector<unsigned char>& vch);
/**
* Decode a base58-encoded string (psz) into a byte vector (vchRet).
* return true if decoding is successful.
* psz cannot be NULL.
*/
bool DecodeBase58(const char* psz, std::vector<unsigned char>& vchRet);
/**
* Decode a base58-encoded string (str) into a byte vector (vchRet).
* return true if decoding is successful.
*/
bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet);
/**
* Encode a byte vector into a base58-encoded string, including checksum
*/
std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn);
/**
* Decode a base58-encoded string (psz) that includes a checksum into a byte
* vector (vchRet), return true if decoding is successful
*/
inline bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet);
/**
* Decode a base58-encoded string (str) that includes a checksum into a byte
* vector (vchRet), return true if decoding is successful
*/
inline bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet);
/**
* Base class for all base58-encoded data
*/
class CBase58Data
{
protected:
//! the version byte(s)
std::vector<unsigned char> vchVersion;
//! the actually encoded data
typedef std::vector<unsigned char, zero_after_free_allocator<unsigned char> > vector_uchar;
vector_uchar vchData;
CBase58Data();
void SetData(const std::vector<unsigned char> &vchVersionIn, const void* pdata, size_t nSize);
void SetData(const std::vector<unsigned char> &vchVersionIn, const unsigned char *pbegin, const unsigned char *pend);
public:
bool SetString(const char* psz, unsigned int nVersionBytes = 1);
bool SetString(const std::string& str);
std::string ToString() const;
int CompareTo(const CBase58Data& b58) const;
bool operator==(const CBase58Data& b58) const { return CompareTo(b58) == 0; }
bool operator<=(const CBase58Data& b58) const { return CompareTo(b58) <= 0; }
bool operator>=(const CBase58Data& b58) const { return CompareTo(b58) >= 0; }
bool operator< (const CBase58Data& b58) const { return CompareTo(b58) < 0; }
bool operator> (const CBase58Data& b58) const { return CompareTo(b58) > 0; }
};
/** base58-encoded Charm addresses.
* Public-key-hash-addresses have version 76 (or 140 testnet).
* The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the serialized public key.
* Script-hash-addresses have version 16 (or 19 testnet).
* The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script.
*/
class CBitcoinAddress : public CBase58Data {
public:
bool Set(const CKeyID &id);
bool Set(const CScriptID &id);
bool Set(const CTxDestination &dest);
bool IsValid() const;
bool IsValid(const CChainParams ¶ms) const;
CBitcoinAddress() {}
CBitcoinAddress(const CTxDestination &dest) { Set(dest); }
CBitcoinAddress(const std::string& strAddress) { SetString(strAddress); }
CBitcoinAddress(const char* pszAddress) { SetString(pszAddress); }
CTxDestination Get() const;
bool GetKeyID(CKeyID &keyID) const;
bool GetIndexKey(uint160& hashBytes, int& type) const;
bool IsScript() const;
};
/**
* A base58-encoded secret key
*/
class CBitcoinSecret : public CBase58Data
{
public:
void SetKey(const CKey& vchSecret);
CKey GetKey();
bool IsValid() const;
bool SetString(const char* pszSecret);
bool SetString(const std::string& strSecret);
CBitcoinSecret(const CKey& vchSecret) { SetKey(vchSecret); }
CBitcoinSecret() {}
};
template<typename K, int Size, CChainParams::Base58Type Type> class CBitcoinExtKeyBase : public CBase58Data
{
public:
void SetKey(const K &key) {
unsigned char vch[Size];
key.Encode(vch);
SetData(Params().Base58Prefix(Type), vch, vch+Size);
}
K GetKey() {
K ret;
if (vchData.size() == Size) {
//if base58 encouded data not holds a ext key, return a !IsValid() key
ret.Decode(&vchData[0]);
}
return ret;
}
CBitcoinExtKeyBase(const K &key) {
SetKey(key);
}
CBitcoinExtKeyBase(const std::string& strBase58c) {
SetString(strBase58c.c_str(), Params().Base58Prefix(Type).size());
}
CBitcoinExtKeyBase() {}
};
typedef CBitcoinExtKeyBase<CExtKey, 74, CChainParams::EXT_SECRET_KEY> CBitcoinExtKey;
typedef CBitcoinExtKeyBase<CExtPubKey, 74, CChainParams::EXT_PUBLIC_KEY> CBitcoinExtPubKey;
#endif // BITCOIN_BASE58_H
|
[
"[email protected]"
] | |
caeae05df49d08b2ea32db9a3d02308f01810962
|
297497957c531d81ba286bc91253fbbb78b4d8be
|
/third_party/msgpack/include/msgpack/preprocessor/list/for_each.hpp
|
c2387b617a3db60bdbfe399ca47b4a791b410410
|
[
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
marco-c/gecko-dev-comments-removed
|
7a9dd34045b07e6b22f0c636c0a836b9e639f9d3
|
61942784fb157763e65608e5a29b3729b0aa66fa
|
refs/heads/master
| 2023-08-09T18:55:25.895853 | 2023-08-01T00:40:39 | 2023-08-01T00:40:39 | 211,297,481 | 0 | 0 |
NOASSERTION
| 2019-09-29T01:27:49 | 2019-09-27T10:44:24 |
C++
|
UTF-8
|
C++
| false | false | 1,774 |
hpp
|
#
#
#
#
#
#
# ifndef MSGPACK_PREPROCESSOR_LIST_FOR_EACH_HPP
# define MSGPACK_PREPROCESSOR_LIST_FOR_EACH_HPP
#
# include <msgpack/preprocessor/config/config.hpp>
# include <msgpack/preprocessor/list/for_each_i.hpp>
# include <msgpack/preprocessor/tuple/elem.hpp>
# include <msgpack/preprocessor/tuple/rem.hpp>
#
#
#
# if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG()
# define MSGPACK_PP_LIST_FOR_EACH(macro, data, list) MSGPACK_PP_LIST_FOR_EACH_I(MSGPACK_PP_LIST_FOR_EACH_O, (macro, data), list)
# else
# define MSGPACK_PP_LIST_FOR_EACH(macro, data, list) MSGPACK_PP_LIST_FOR_EACH_X(macro, data, list)
# define MSGPACK_PP_LIST_FOR_EACH_X(macro, data, list) MSGPACK_PP_LIST_FOR_EACH_I(MSGPACK_PP_LIST_FOR_EACH_O, (macro, data), list)
# endif
#
# if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG()
# define MSGPACK_PP_LIST_FOR_EACH_O(r, md, i, elem) MSGPACK_PP_LIST_FOR_EACH_O_D(r, MSGPACK_PP_TUPLE_ELEM(2, 0, md), MSGPACK_PP_TUPLE_ELEM(2, 1, md), elem)
# else
# define MSGPACK_PP_LIST_FOR_EACH_O(r, md, i, elem) MSGPACK_PP_LIST_FOR_EACH_O_I(r, MSGPACK_PP_TUPLE_REM_2 md, elem)
# define MSGPACK_PP_LIST_FOR_EACH_O_I(r, im, elem) MSGPACK_PP_LIST_FOR_EACH_O_D(r, im, elem)
# endif
#
# define MSGPACK_PP_LIST_FOR_EACH_O_D(r, m, d, elem) m(r, d, elem)
#
#
#
# if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG()
# define MSGPACK_PP_LIST_FOR_EACH_R(r, macro, data, list) MSGPACK_PP_LIST_FOR_EACH_I_R(r, MSGPACK_PP_LIST_FOR_EACH_O, (macro, data), list)
# else
# define MSGPACK_PP_LIST_FOR_EACH_R(r, macro, data, list) MSGPACK_PP_LIST_FOR_EACH_R_X(r, macro, data, list)
# define MSGPACK_PP_LIST_FOR_EACH_R_X(r, macro, data, list) MSGPACK_PP_LIST_FOR_EACH_I_R(r, MSGPACK_PP_LIST_FOR_EACH_O, (macro, data), list)
# endif
#
# endif
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.