blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
905 values
visit_date
timestamp[us]date
2015-08-09 11:21:18
2023-09-06 10:45:07
revision_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-17 19:19:19
committer_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-06 06:22:19
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-07 00:51:45
2023-09-14 21:58:39
gha_created_at
timestamp[us]date
2008-03-27 23:40:48
2023-08-21 23:17:38
gha_language
stringclasses
141 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
115 values
content
stringlengths
3
10.4M
authors
listlengths
1
1
author_id
stringlengths
0
158
0c5a538ecb5647b38eefbb32d68163eca955c85d
d0889089b86bc407b154879cb294e703f9303989
/Lumos/External/Tracy/server/TracyEvent.hpp
56c7df0712181361dbb8dd34c30b3670aab77683
[ "BSD-3-Clause", "MIT", "LicenseRef-scancode-public-domain" ]
permissive
jmorton06/Lumos
9ab96420c619d9baac07e4561d0a7e83645d54c8
e5f0ebfa9049d3515caaad056fda082a1e9d74ae
refs/heads/main
2023-09-01T02:48:00.496623
2023-07-06T07:31:44
2023-07-06T07:31:44
164,933,352
1,052
126
MIT
2023-09-06T08:08:18
2019-01-09T20:32:10
C++
UTF-8
C++
false
false
24,966
hpp
#ifndef __TRACYEVENT_HPP__ #define __TRACYEVENT_HPP__ #include <assert.h> #include <limits> #include <stdint.h> #include <string> #include <string.h> #include "TracyCharUtil.hpp" #include "TracyShortPtr.hpp" #include "TracySortedVector.hpp" #include "TracyVector.hpp" #include "tracy_robin_hood.h" #include "../common/TracyForceInline.hpp" #include "../common/TracyQueue.hpp" namespace tracy { #pragma pack( 1 ) struct StringRef { enum Type { Ptr, Idx }; tracy_force_inline StringRef() : str( 0 ), __data( 0 ) {} tracy_force_inline StringRef( Type t, uint64_t data ) : str( data ) , __data( 0 ) { isidx = t == Idx; active = 1; } uint64_t str; union { struct { uint8_t isidx : 1; uint8_t active : 1; }; uint8_t __data; }; }; struct StringRefHasher { size_t operator()( const StringRef& key ) const { return charutil::hash( (const char*)&key, sizeof( StringRef ) ); } }; struct StringRefComparator { bool operator()( const StringRef& lhs, const StringRef& rhs ) const { return memcmp( &lhs, &rhs, sizeof( StringRef ) ) == 0; } }; class StringIdx { public: tracy_force_inline StringIdx() { memset( m_idx, 0, sizeof( m_idx ) ); } tracy_force_inline StringIdx( uint32_t idx ) { SetIdx( idx ); } tracy_force_inline void SetIdx( uint32_t idx ) { idx++; memcpy( m_idx, &idx, 3 ); } tracy_force_inline uint32_t Idx() const { uint32_t idx = 0; memcpy( &idx, m_idx, 3 ); assert( idx != 0 ); return idx - 1; } tracy_force_inline bool Active() const { uint32_t zero = 0; return memcmp( m_idx, &zero, 3 ) != 0; } private: uint8_t m_idx[3]; }; struct StringIdxHasher { size_t operator()( const StringIdx& key ) const { return charutil::hash( (const char*)&key, sizeof( StringIdx ) ); } }; struct StringIdxComparator { bool operator()( const StringIdx& lhs, const StringIdx& rhs ) const { return memcmp( &lhs, &rhs, sizeof( StringIdx ) ) == 0; } }; class Int24 { public: tracy_force_inline Int24() { memset( m_val, 0, sizeof( m_val ) ); } tracy_force_inline Int24( uint32_t val ) { SetVal( val ); } tracy_force_inline void SetVal( uint32_t val ) { memcpy( m_val, &val, 2 ); val >>= 16; memcpy( m_val+2, &val, 1 ); } tracy_force_inline uint32_t Val() const { uint8_t hi; memcpy( &hi, m_val+2, 1 ); uint16_t lo; memcpy( &lo, m_val, 2 ); return ( uint32_t( hi ) << 16 ) | lo; } private: uint8_t m_val[3]; }; class Int48 { public: tracy_force_inline Int48() {} tracy_force_inline Int48( int64_t val ) { SetVal( val ); } tracy_force_inline void Clear() { memset( m_val, 0, 6 ); } tracy_force_inline void SetVal( int64_t val ) { memcpy( m_val, &val, 4 ); val >>= 32; memcpy( m_val+4, &val, 2 ); } tracy_force_inline int64_t Val() const { int16_t hi; memcpy( &hi, m_val+4, 2 ); uint32_t lo; memcpy( &lo, m_val, 4 ); return ( int64_t( uint64_t( hi ) << 32 ) ) | lo; } tracy_force_inline bool IsNonNegative() const { return ( m_val[5] >> 7 ) == 0; } private: uint8_t m_val[6]; }; struct Int48Sort { bool operator()( const Int48& lhs, const Int48& rhs ) { return lhs.Val() < rhs.Val(); }; }; struct SourceLocationBase { StringRef name; StringRef function; StringRef file; uint32_t line; uint32_t color; }; struct SourceLocation : public SourceLocationBase { mutable uint32_t namehash; }; enum { SourceLocationSize = sizeof( SourceLocation ) }; struct ZoneEvent { tracy_force_inline ZoneEvent() {}; tracy_force_inline int64_t Start() const { return int64_t( _start_srcloc ) >> 16; } tracy_force_inline void SetStart( int64_t start ) { assert( start < (int64_t)( 1ull << 47 ) ); memcpy( ((char*)&_start_srcloc)+2, &start, 4 ); memcpy( ((char*)&_start_srcloc)+6, ((char*)&start)+4, 2 ); } tracy_force_inline int64_t End() const { return int64_t( _end_child1 ) >> 16; } tracy_force_inline void SetEnd( int64_t end ) { assert( end < (int64_t)( 1ull << 47 ) ); memcpy( ((char*)&_end_child1)+2, &end, 4 ); memcpy( ((char*)&_end_child1)+6, ((char*)&end)+4, 2 ); } tracy_force_inline bool IsEndValid() const { return ( _end_child1 >> 63 ) == 0; } tracy_force_inline int16_t SrcLoc() const { return int16_t( _start_srcloc & 0xFFFF ); } tracy_force_inline void SetSrcLoc( int16_t srcloc ) { memcpy( &_start_srcloc, &srcloc, 2 ); } tracy_force_inline int32_t Child() const { int32_t child; memcpy( &child, &_child2, 4 ); return child; } tracy_force_inline void SetChild( int32_t child ) { memcpy( &_child2, &child, 4 ); } tracy_force_inline bool HasChildren() const { uint8_t tmp; memcpy( &tmp, ((char*)&_end_child1)+1, 1 ); return ( tmp >> 7 ) == 0; } tracy_force_inline void SetStartSrcLoc( int64_t start, int16_t srcloc ) { assert( start < (int64_t)( 1ull << 47 ) ); start <<= 16; start |= uint16_t( srcloc ); memcpy( &_start_srcloc, &start, 8 ); } uint64_t _start_srcloc; uint16_t _child2; uint64_t _end_child1; uint32_t extra; }; enum { ZoneEventSize = sizeof( ZoneEvent ) }; static_assert( std::is_standard_layout<ZoneEvent>::value, "ZoneEvent is not standard layout" ); struct ZoneExtra { Int24 callstack; StringIdx text; StringIdx name; Int24 color; }; enum { ZoneExtraSize = sizeof( ZoneExtra ) }; // This union exploits the fact that the current implementations of x64 and arm64 do not provide // full 64 bit address space. The high bits must be bit-extended, so 0x80... is an invalid pointer. // This allows using the highest bit as a selector between a native pointer and a table index here. union CallstackFrameId { struct { uint64_t idx : 62; uint64_t sel : 1; uint64_t custom : 1; }; uint64_t data; }; enum { CallstackFrameIdSize = sizeof( CallstackFrameId ) }; static tracy_force_inline bool operator==( const CallstackFrameId& lhs, const CallstackFrameId& rhs ) { return lhs.data == rhs.data; } struct SampleData { Int48 time; Int24 callstack; }; enum { SampleDataSize = sizeof( SampleData ) }; struct SampleDataSort { bool operator()( const SampleData& lhs, const SampleData& rhs ) { return lhs.time.Val() < rhs.time.Val(); }; }; struct SampleDataRange { Int48 time; uint16_t thread; CallstackFrameId ip; }; enum { SampleDataRangeSize = sizeof( SampleDataRange ) }; struct HwSampleData { SortedVector<Int48, Int48Sort> cycles; SortedVector<Int48, Int48Sort> retired; SortedVector<Int48, Int48Sort> cacheRef; SortedVector<Int48, Int48Sort> cacheMiss; SortedVector<Int48, Int48Sort> branchRetired; SortedVector<Int48, Int48Sort> branchMiss; bool is_sorted() const { return cycles.is_sorted() && retired.is_sorted() && cacheRef.is_sorted() && cacheMiss.is_sorted() && branchRetired.is_sorted() && branchMiss.is_sorted(); } void sort() { if( !cycles.is_sorted() ) cycles.sort(); if( !retired.is_sorted() ) retired.sort(); if( !cacheRef.is_sorted() ) cacheRef.sort(); if( !cacheMiss.is_sorted() ) cacheMiss.sort(); if( !branchRetired.is_sorted() ) branchRetired.sort(); if( !branchMiss.is_sorted() ) branchMiss.sort(); } }; enum { HwSampleDataSize = sizeof( HwSampleData ) }; struct LockEvent { enum class Type : uint8_t { Wait, Obtain, Release, WaitShared, ObtainShared, ReleaseShared }; tracy_force_inline int64_t Time() const { return int64_t( _time_srcloc ) >> 16; } tracy_force_inline void SetTime( int64_t time ) { assert( time < (int64_t)( 1ull << 47 ) ); memcpy( ((char*)&_time_srcloc)+2, &time, 4 ); memcpy( ((char*)&_time_srcloc)+6, ((char*)&time)+4, 2 ); } tracy_force_inline int16_t SrcLoc() const { return int16_t( _time_srcloc & 0xFFFF ); } tracy_force_inline void SetSrcLoc( int16_t srcloc ) { memcpy( &_time_srcloc, &srcloc, 2 ); } uint64_t _time_srcloc; uint8_t thread; Type type; }; struct LockEventShared : public LockEvent { uint64_t waitShared; uint64_t sharedList; }; struct LockEventPtr { short_ptr<LockEvent> ptr; uint8_t lockingThread; uint8_t lockCount; uint64_t waitList; }; enum { LockEventSize = sizeof( LockEvent ) }; enum { LockEventSharedSize = sizeof( LockEventShared ) }; enum { LockEventPtrSize = sizeof( LockEventPtr ) }; enum { MaxLockThreads = sizeof( LockEventPtr::waitList ) * 8 }; static_assert( std::numeric_limits<decltype(LockEventPtr::lockCount)>::max() >= MaxLockThreads, "Not enough space for lock count." ); struct GpuEvent { tracy_force_inline int64_t CpuStart() const { return int64_t( _cpuStart_srcloc ) >> 16; } tracy_force_inline void SetCpuStart( int64_t cpuStart ) { assert( cpuStart < (int64_t)( 1ull << 47 ) ); memcpy( ((char*)&_cpuStart_srcloc)+2, &cpuStart, 4 ); memcpy( ((char*)&_cpuStart_srcloc)+6, ((char*)&cpuStart)+4, 2 ); } tracy_force_inline int64_t CpuEnd() const { return int64_t( _cpuEnd_thread ) >> 16; } tracy_force_inline void SetCpuEnd( int64_t cpuEnd ) { assert( cpuEnd < (int64_t)( 1ull << 47 ) ); memcpy( ((char*)&_cpuEnd_thread)+2, &cpuEnd, 4 ); memcpy( ((char*)&_cpuEnd_thread)+6, ((char*)&cpuEnd)+4, 2 ); } tracy_force_inline int64_t GpuStart() const { return int64_t( _gpuStart_child1 ) >> 16; } tracy_force_inline void SetGpuStart( int64_t gpuStart ) { /*assert( gpuStart < (int64_t)( 1ull << 47 ) );*/ memcpy( ((char*)&_gpuStart_child1)+2, &gpuStart, 4 ); memcpy( ((char*)&_gpuStart_child1)+6, ((char*)&gpuStart)+4, 2 ); } tracy_force_inline int64_t GpuEnd() const { return int64_t( _gpuEnd_child2 ) >> 16; } tracy_force_inline void SetGpuEnd( int64_t gpuEnd ) { assert( gpuEnd < (int64_t)( 1ull << 47 ) ); memcpy( ((char*)&_gpuEnd_child2)+2, &gpuEnd, 4 ); memcpy( ((char*)&_gpuEnd_child2)+6, ((char*)&gpuEnd)+4, 2 ); } tracy_force_inline int16_t SrcLoc() const { return int16_t( _cpuStart_srcloc & 0xFFFF ); } tracy_force_inline void SetSrcLoc( int16_t srcloc ) { memcpy( &_cpuStart_srcloc, &srcloc, 2 ); } tracy_force_inline uint16_t Thread() const { return uint16_t( _cpuEnd_thread & 0xFFFF ); } tracy_force_inline void SetThread( uint16_t thread ) { memcpy( &_cpuEnd_thread, &thread, 2 ); } tracy_force_inline int32_t Child() const { return int32_t( uint32_t( _gpuStart_child1 & 0xFFFF ) | ( uint32_t( _gpuEnd_child2 & 0xFFFF ) << 16 ) ); } tracy_force_inline void SetChild( int32_t child ) { memcpy( &_gpuStart_child1, &child, 2 ); memcpy( &_gpuEnd_child2, ((char*)&child)+2, 2 ); } uint64_t _cpuStart_srcloc; uint64_t _cpuEnd_thread; uint64_t _gpuStart_child1; uint64_t _gpuEnd_child2; Int24 callstack; }; enum { GpuEventSize = sizeof( GpuEvent ) }; static_assert( std::is_standard_layout<GpuEvent>::value, "GpuEvent is not standard layout" ); struct MemEvent { tracy_force_inline uint64_t Ptr() const { return uint64_t( int64_t( _ptr_csalloc1 ) >> 8 ); } tracy_force_inline void SetPtr( uint64_t ptr ) { memcpy( ((char*)&_ptr_csalloc1)+1, &ptr, 4 ); memcpy( ((char*)&_ptr_csalloc1)+5, ((char*)&ptr)+4, 2 ); memcpy( ((char*)&_ptr_csalloc1)+7, ((char*)&ptr)+6, 1 ); } tracy_force_inline uint64_t Size() const { return _size_csalloc2 >> 16; } tracy_force_inline void SetSize( uint64_t size ) { assert( size < ( 1ull << 47 ) ); memcpy( ((char*)&_size_csalloc2)+2, &size, 4 ); memcpy( ((char*)&_size_csalloc2)+6, ((char*)&size)+4, 2 ); } tracy_force_inline uint32_t CsAlloc() const { return uint8_t( _ptr_csalloc1 ) | ( uint16_t( _size_csalloc2 ) << 8 ); } tracy_force_inline void SetCsAlloc( uint32_t csAlloc ) { memcpy( &_ptr_csalloc1, &csAlloc, 1 ); memcpy( &_size_csalloc2, ((char*)&csAlloc)+1, 2 ); } tracy_force_inline int64_t TimeAlloc() const { return int64_t( _time_thread_alloc ) >> 16; } tracy_force_inline void SetTimeAlloc( int64_t time ) { assert( time < (int64_t)( 1ull << 47 ) ); memcpy( ((char*)&_time_thread_alloc)+2, &time, 4 ); memcpy( ((char*)&_time_thread_alloc)+6, ((char*)&time)+4, 2 ); } tracy_force_inline int64_t TimeFree() const { return int64_t( _time_thread_free ) >> 16; } tracy_force_inline void SetTimeFree( int64_t time ) { assert( time < (int64_t)( 1ull << 47 ) ); memcpy( ((char*)&_time_thread_free)+2, &time, 4 ); memcpy( ((char*)&_time_thread_free)+6, ((char*)&time)+4, 2 ); } tracy_force_inline uint16_t ThreadAlloc() const { return uint16_t( _time_thread_alloc ); } tracy_force_inline void SetThreadAlloc( uint16_t thread ) { memcpy( &_time_thread_alloc, &thread, 2 ); } tracy_force_inline uint16_t ThreadFree() const { return uint16_t( _time_thread_free ); } tracy_force_inline void SetThreadFree( uint16_t thread ) { memcpy( &_time_thread_free, &thread, 2 ); } tracy_force_inline void SetTimeThreadAlloc( int64_t time, uint16_t thread ) { time <<= 16; time |= thread; memcpy( &_time_thread_alloc, &time, 8 ); } tracy_force_inline void SetTimeThreadFree( int64_t time, uint16_t thread ) { uint64_t t; memcpy( &t, &time, 8 ); t <<= 16; t |= thread; memcpy( &_time_thread_free, &t, 8 ); } uint64_t _ptr_csalloc1; uint64_t _size_csalloc2; Int24 csFree; uint64_t _time_thread_alloc; uint64_t _time_thread_free; }; enum { MemEventSize = sizeof( MemEvent ) }; static_assert( std::is_standard_layout<MemEvent>::value, "MemEvent is not standard layout" ); struct CallstackFrameBasic { StringIdx name; StringIdx file; uint32_t line; }; struct CallstackFrame : public CallstackFrameBasic { uint64_t symAddr; }; struct SymbolData : public CallstackFrameBasic { StringIdx imageName; StringIdx callFile; uint32_t callLine; uint8_t isInline; Int24 size; }; enum { CallstackFrameBasicSize = sizeof( CallstackFrameBasic ) }; enum { CallstackFrameSize = sizeof( CallstackFrame ) }; enum { SymbolDataSize = sizeof( SymbolData ) }; struct SymbolLocation { uint64_t addr; uint32_t len; }; enum { SymbolLocationSize = sizeof( SymbolLocation ) }; struct CallstackFrameData { short_ptr<CallstackFrame> data; uint8_t size; StringIdx imageName; }; enum { CallstackFrameDataSize = sizeof( CallstackFrameData ) }; struct MemCallstackFrameTree { MemCallstackFrameTree( CallstackFrameId id ) : frame( id ), alloc( 0 ), count( 0 ) {} CallstackFrameId frame; uint64_t alloc; uint32_t count; unordered_flat_map<uint64_t, MemCallstackFrameTree> children; unordered_flat_set<uint32_t> callstacks; }; enum { MemCallstackFrameTreeSize = sizeof( MemCallstackFrameTree ) }; struct CallstackFrameTree { CallstackFrameTree( CallstackFrameId id ) : frame( id ), count( 0 ) {} CallstackFrameId frame; uint32_t count; unordered_flat_map<uint64_t, CallstackFrameTree> children; }; enum { CallstackFrameTreeSize = sizeof( CallstackFrameTree ) }; struct CrashEvent { uint64_t thread = 0; int64_t time = 0; uint64_t message = 0; uint32_t callstack = 0; }; enum { CrashEventSize = sizeof( CrashEvent ) }; struct ContextSwitchData { enum : int8_t { Fiber = 99 }; enum : int8_t { NoState = 100 }; enum : int8_t { Wakeup = -2 }; tracy_force_inline int64_t Start() const { return int64_t( _start_cpu ) >> 16; } tracy_force_inline void SetStart( int64_t start ) { assert( start < (int64_t)( 1ull << 47 ) ); memcpy( ((char*)&_start_cpu)+2, &start, 4 ); memcpy( ((char*)&_start_cpu)+6, ((char*)&start)+4, 2 ); } tracy_force_inline int64_t End() const { return int64_t( _end_reason_state ) >> 16; } tracy_force_inline void SetEnd( int64_t end ) { assert( end < (int64_t)( 1ull << 47 ) ); memcpy( ((char*)&_end_reason_state)+2, &end, 4 ); memcpy( ((char*)&_end_reason_state)+6, ((char*)&end)+4, 2 ); } tracy_force_inline bool IsEndValid() const { return ( _end_reason_state >> 63 ) == 0; } tracy_force_inline uint8_t Cpu() const { return uint8_t( _start_cpu & 0xFF ); } tracy_force_inline void SetCpu( uint8_t cpu ) { memcpy( &_start_cpu, &cpu, 1 ); } tracy_force_inline int8_t Reason() const { return int8_t( (_end_reason_state >> 8) & 0xFF ); } tracy_force_inline void SetReason( int8_t reason ) { memcpy( ((char*)&_end_reason_state)+1, &reason, 1 ); } tracy_force_inline int8_t State() const { return int8_t( _end_reason_state & 0xFF ); } tracy_force_inline void SetState( int8_t state ) { memcpy( &_end_reason_state, &state, 1 ); } tracy_force_inline int64_t WakeupVal() const { return _wakeup.Val(); } tracy_force_inline void SetWakeup( int64_t wakeup ) { assert( wakeup < (int64_t)( 1ull << 47 ) ); _wakeup.SetVal( wakeup ); } tracy_force_inline uint16_t Thread() const { return _thread; } tracy_force_inline void SetThread( uint16_t thread ) { _thread = thread; } tracy_force_inline void SetStartCpu( int64_t start, uint8_t cpu ) { assert( start < (int64_t)( 1ull << 47 ) ); _start_cpu = ( uint64_t( start ) << 16 ) | cpu; } tracy_force_inline void SetEndReasonState( int64_t end, int8_t reason, int8_t state ) { assert( end < (int64_t)( 1ull << 47 ) ); _end_reason_state = ( uint64_t( end ) << 16 ) | ( uint64_t( reason ) << 8 ) | uint8_t( state ); } uint64_t _start_cpu; uint64_t _end_reason_state; Int48 _wakeup; uint16_t _thread; }; enum { ContextSwitchDataSize = sizeof( ContextSwitchData ) }; struct ContextSwitchCpu { tracy_force_inline int64_t Start() const { return int64_t( _start_thread ) >> 16; } tracy_force_inline void SetStart( int64_t start ) { assert( start < (int64_t)( 1ull << 47 ) ); memcpy( ((char*)&_start_thread)+2, &start, 4 ); memcpy( ((char*)&_start_thread)+6, ((char*)&start)+4, 2 ); } tracy_force_inline int64_t End() const { int64_t v; memcpy( &v, ((char*)&_end)-2, 8 ); return v >> 16; } tracy_force_inline void SetEnd( int64_t end ) { assert( end < (int64_t)( 1ull << 47 ) ); _end.SetVal( end ); } tracy_force_inline bool IsEndValid() const { return _end.IsNonNegative(); } tracy_force_inline uint16_t Thread() const { return uint16_t( _start_thread ); } tracy_force_inline void SetThread( uint16_t thread ) { memcpy( &_start_thread, &thread, 2 ); } tracy_force_inline void SetStartThread( int64_t start, uint16_t thread ) { assert( start < (int64_t)( 1ull << 47 ) ); _start_thread = ( uint64_t( start ) << 16 ) | thread; } uint64_t _start_thread; Int48 _end; }; enum { ContextSwitchCpuSize = sizeof( ContextSwitchCpu ) }; struct ContextSwitchUsage { ContextSwitchUsage() {} ContextSwitchUsage( int64_t time, uint8_t other, uint8_t own ) { SetTime( time ); SetOther( other ); SetOwn( own ); } tracy_force_inline int64_t Time() const { return int64_t( _time_other_own ) >> 16; } tracy_force_inline void SetTime( int64_t time ) { assert( time < (int64_t)( 1ull << 47 ) ); memcpy( ((char*)&_time_other_own)+2, &time, 4 ); memcpy( ((char*)&_time_other_own)+6, ((char*)&time)+4, 2 ); } tracy_force_inline uint8_t Other() const { return uint8_t( _time_other_own ); } tracy_force_inline void SetOther( uint8_t other ) { memcpy( &_time_other_own, &other, 1 ); } tracy_force_inline uint8_t Own() const { uint8_t v; memcpy( &v, ((char*)&_time_other_own)+1, 1 );return v; } tracy_force_inline void SetOwn( uint8_t own ) { memcpy( ((char*)&_time_other_own)+1, &own, 1 ); } uint64_t _time_other_own; }; enum { ContextSwitchUsageSize = sizeof( ContextSwitchUsage ) }; struct MessageData { int64_t time; StringRef ref; uint16_t thread; uint32_t color; Int24 callstack; }; enum { MessageDataSize = sizeof( MessageData ) }; struct PlotItem { Int48 time; double val; }; enum { PlotItemSize = sizeof( PlotItem ) }; struct FrameEvent { int64_t start; int64_t end; int32_t frameImage; }; enum { FrameEventSize = sizeof( FrameEvent ) }; struct FrameImage { short_ptr<const char> ptr; uint32_t csz; uint16_t w, h; uint32_t frameRef; uint8_t flip; }; enum { FrameImageSize = sizeof( FrameImage ) }; struct GhostZone { Int48 start, end; Int24 frame; int32_t child; }; enum { GhostZoneSize = sizeof( GhostZone ) }; struct ChildSample { Int48 time; uint64_t addr; }; enum { ChildSampleSize = sizeof( ChildSample ) }; #pragma pack() struct ThreadData { uint64_t id; uint64_t count; Vector<short_ptr<ZoneEvent>> timeline; Vector<short_ptr<ZoneEvent>> stack; Vector<short_ptr<MessageData>> messages; uint32_t nextZoneId; Vector<uint32_t> zoneIdStack; #ifndef TRACY_NO_STATISTICS Vector<int64_t> childTimeStack; Vector<GhostZone> ghostZones; uint64_t ghostIdx; SortedVector<SampleData, SampleDataSort> postponedSamples; #endif Vector<SampleData> samples; SampleData pendingSample; Vector<SampleData> ctxSwitchSamples; uint64_t kernelSampleCnt; uint8_t isFiber; ThreadData* fiber; uint8_t* stackCount; tracy_force_inline void IncStackCount( int16_t srcloc ) { stackCount[uint16_t(srcloc)]++; } tracy_force_inline bool DecStackCount( int16_t srcloc ) { return --stackCount[uint16_t(srcloc)] != 0; } }; struct GpuCtxThreadData { Vector<short_ptr<GpuEvent>> timeline; Vector<short_ptr<GpuEvent>> stack; }; struct GpuCtxData { int64_t timeDiff; uint64_t thread; uint64_t count; float period; GpuContextType type; bool hasPeriod; bool hasCalibration; int64_t calibratedGpuTime; int64_t calibratedCpuTime; double calibrationMod; int64_t lastGpuTime; uint64_t overflow; uint32_t overflowMul; StringIdx name; unordered_flat_map<uint64_t, GpuCtxThreadData> threadData; short_ptr<GpuEvent> query[64*1024]; }; enum { GpuCtxDataSize = sizeof( GpuCtxData ) }; enum class LockType : uint8_t; struct LockMap { struct TimeRange { int64_t start = std::numeric_limits<int64_t>::max(); int64_t end = std::numeric_limits<int64_t>::min(); }; StringIdx customName; int16_t srcloc; Vector<LockEventPtr> timeline; unordered_flat_map<uint64_t, uint8_t> threadMap; std::vector<uint64_t> threadList; LockType type; int64_t timeAnnounce; int64_t timeTerminate; bool valid; bool isContended; TimeRange range[64]; }; struct LockHighlight { int64_t id; int64_t begin; int64_t end; uint8_t thread; bool blocked; }; enum class PlotType : uint8_t { User, Memory, SysTime }; enum class PlotValueFormatting : uint8_t { Number, Memory, Percentage }; struct PlotData { struct PlotItemSort { bool operator()( const PlotItem& lhs, const PlotItem& rhs ) { return lhs.time.Val() < rhs.time.Val(); }; }; uint64_t name; double min; double max; double sum; SortedVector<PlotItem, PlotItemSort> data; PlotType type; PlotValueFormatting format; }; struct MemData { Vector<MemEvent> data; Vector<uint32_t> frees; unordered_flat_map<uint64_t, size_t> active; uint64_t high = std::numeric_limits<uint64_t>::min(); uint64_t low = std::numeric_limits<uint64_t>::max(); uint64_t usage = 0; PlotData* plot = nullptr; bool reconstruct = false; uint64_t name = 0; }; struct FrameData { uint64_t name; Vector<FrameEvent> frames; uint8_t continuous; int64_t min = std::numeric_limits<int64_t>::max(); int64_t max = std::numeric_limits<int64_t>::min(); int64_t total = 0; double sumSq = 0; }; struct StringLocation { const char* ptr; uint32_t idx; }; struct SourceLocationHasher { size_t operator()( const SourceLocation* ptr ) const { return charutil::hash( (const char*)ptr, sizeof( SourceLocationBase ) ); } }; struct SourceLocationComparator { bool operator()( const SourceLocation* lhs, const SourceLocation* rhs ) const { return memcmp( lhs, rhs, sizeof( SourceLocationBase ) ) == 0; } }; struct ContextSwitch { Vector<ContextSwitchData> v; int64_t runningTime = 0; }; struct CpuData { Vector<ContextSwitchCpu> cs; }; struct CpuThreadData { int64_t runningTime = 0; uint32_t runningRegions = 0; uint32_t migrations = 0; }; enum { CpuThreadDataSize = sizeof( CpuThreadData ) }; struct Parameter { uint32_t idx; StringRef name; bool isBool; int32_t val; }; struct SymbolStats { uint32_t incl, excl; unordered_flat_map<uint32_t, uint32_t> parents; unordered_flat_map<uint32_t, uint32_t> baseParents; }; enum { SymbolStatsSize = sizeof( SymbolStats ) }; } #endif
[ "jmorton06@live.co.uk" ]
jmorton06@live.co.uk
3e988675f13039cd9e67204c30bc83942f471d0d
843910b963dca4555308d2736c26fa0234d631a6
/IoLib/src/CFileStream.cpp
48ef6b94240eace444d7af2ee1c9c9479a6054ad
[]
no_license
kobake/KppLibs
1bbb11bbea8765738e975ddde81d8536c6a129f1
60d9343a41260f3d90be61b1e6fd4ee31b05d05b
refs/heads/master
2021-01-17T19:26:04.315121
2020-03-28T00:37:43
2020-03-28T00:37:43
58,841,018
1
0
null
null
null
null
SHIFT_JIS
C++
false
false
2,710
cpp
#include "_required.h" #include <DebugLib.h> #include "CFileStream.h" #include <string> // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // // CFileInputStream // // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // // -- -- コンストラクタ・デストラクタ -- -- // CFileInputStream::CFileInputStream(const wchar_t* path,const wchar_t* mode) { fp=_wfopen(path,mode); fp_hold=true; if(!fp)throw Io::OpenException(L"OpenException(%s)",path); } CFileInputStream::CFileInputStream(FILE* _fp,bool _hold) { fp=_fp; fp_hold=_hold; } CFileInputStream::~CFileInputStream() { if(fp_hold){ Close(); } } // -- -- インターフェース -- -- // bool CFileInputStream::good() const { return fp!=NULL; } bool CFileInputStream::Eof() const { return feof(fp)!=0; } int CFileInputStream::Read(void* p,int size) { return (int)fread(p,1,size,fp); } void CFileInputStream::peek(void* p,int size) { size_t r=fread(p,1,size,fp); fseek(fp,(long)r*-1,SEEK_CUR); } void CFileInputStream::skip(uint n) { fseek(fp,n,SEEK_CUR); } void CFileInputStream::seek(int n,SeekMode mode) { if(mode==ESEEK_CUR){ fseek(fp,n,SEEK_CUR); }else if(mode==ESEEK_BEGIN){ fseek(fp,n,SEEK_SET); }else if(mode==ESEEK_END){ fseek(fp,n,SEEK_END); } } uint CFileInputStream::tell() const { return (uint)ftell(fp); } uint CFileInputStream::Available() const { long cur=ftell(fp); fseek(fp,0,SEEK_END); long end=ftell(fp); fseek(fp,cur,SEEK_SET); return end-cur; } void CFileInputStream::Close() { if(fp){ fclose(fp); fp=NULL; } } int CFileInputStream::get() { return getc(fp); } // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // // CFileOutputStream // // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // CFileOutputStream::CFileOutputStream(const wchar_t* path,const wchar_t* mode) { fp=_wfopen(path,mode); if(!fp)throw Io::OpenException(L"OpenException(%s)",path); } CFileOutputStream::~CFileOutputStream() { Close(); } bool CFileOutputStream::good() const { return fp!=NULL; } int CFileOutputStream::Write(const void* p,int size) { return (uint)fwrite(p,1,size,fp); } void CFileOutputStream::skip(uint n) { fseek(fp,n,SEEK_CUR); } void CFileOutputStream::seek(int n,SeekMode mode) { if(mode==ESEEK_CUR){ fseek(fp,n,SEEK_CUR); }else if(mode==ESEEK_BEGIN){ fseek(fp,n,SEEK_SET); }else if(mode==ESEEK_END){ fseek(fp,n,SEEK_END); } } uint CFileOutputStream::tell() const { return (uint)ftell(fp); } void CFileOutputStream::Close() { if(fp){ fclose(fp); fp=NULL; } } void CFileOutputStream::put(int n) { putc(n,fp); }
[ "kobake@users.sourceforge.net" ]
kobake@users.sourceforge.net
a9de371b82d70ea5eb5e11c1728d8cc066767485
6d3d9d7b02e513108a22c71b620dfe1658f6bf9e
/Project1/ObservableExp.cpp
efeb89399dc02423404f071dde5e91ac313936a3
[]
no_license
SilensAngelusNex/FireEmblem
35a8ef47d6d37ea4e8a37d69e8591a658e6a6913
4bb2505f399ae5c5a2af86e0fb7fa8934d20dc1f
refs/heads/master
2020-03-18T13:16:44.295638
2018-07-07T15:34:00
2018-07-07T15:34:00
134,773,134
3
2
null
2018-07-11T21:29:49
2018-05-24T22:00:42
C++
UTF-8
C++
false
false
502
cpp
#include "ObservableExp.h" #include "AttributeList.h" void ObservableExp::notifyAllExp(int before, int after) { for (ObserverExp* observer : _observers) { observer->notifyExpUp(before, after); } } void ObservableExp::notifyAllLevel(int after, const AttributeList& growths) { for (ObserverExp* observer : _observers) { observer->notifyLevelUp(after, growths); } } void ObservableExp::notifyAllTier(int after) { for (ObserverExp* observer : _observers) { observer->notifyTierUp(after); } }
[ "carvalhoweston@gmail.com" ]
carvalhoweston@gmail.com
cd7b18b4b1fa6dc22279c15680ccbc6c9950b196
f99af904abb8b2dc39ad53b429f1e2b0f1ce58a8
/SideBar/sidebar.h
47691e4c4393ac452be1e46f5d081b5c26195353
[]
no_license
alisantouri1993/Shared_Libs
fa9b5e3a59706e1ccb8c4964ce60eb6baa392ae3
1637c3f6f68efa00a278210b58bd8d695ab9c4e1
refs/heads/master
2023-03-03T06:46:51.035542
2021-02-16T12:01:28
2021-02-16T12:01:28
338,504,161
0
0
null
null
null
null
UTF-8
C++
false
false
2,251
h
#ifndef SIDEBAR_H #define SIDEBAR_H #include <QWidget> #include <QPropertyAnimation> #include <QGraphicsEffect> #include <QGridLayout> #include <QPainter> #include <QPaintEvent> #include "sidebarcontainer.h" namespace Ui { class Sidebar; } class SidebarLabel; class Sidebar : public QWidget { Q_OBJECT public: explicit Sidebar(QWidget *parent = nullptr ,const QString &title = ""); ~Sidebar(); enum Direction { RightToLeft , LeftToRight , UpToDown , DownToUp }; private: //void initAnimation(); void initObjects(); void connectObjects(); void configLayout(); public : void setSideBarDirection(Sidebar::Direction dir); void setSideBarSelection(SideBarContainer::Selection select); void repaintNeeded(); QAction * addAction(const QString &text, const QIcon &icon = QIcon() , bool popupMenuEnabled = false); QAction * addMenuAction(QAction *action ,const QString &text , const QIcon &icon = QIcon()); protected: void resizeEvent(QResizeEvent *event); private slots: void on_rightExpandBut_clicked(bool checked); void on_leftExpandBut_clicked(bool checked); void on_upExpandBut_clicked(bool checked); void on_downExpandBut_clicked(bool checked); private: Ui::Sidebar *ui; SideBarContainer * sidebarContainer; QPropertyAnimation *animation; Sidebar::Direction m_dir; SidebarLabel * sidebarLabel; QString m_title = ""; }; class SidebarLabel : public QWidget { Q_OBJECT public: explicit SidebarLabel(QWidget *parent = nullptr , SideBarContainer::ContainerOrientaion orientation = SideBarContainer::Vertical); ~SidebarLabel() = default; public: void setSidebarLabelOrientation(SideBarContainer::ContainerOrientaion orientation); void setSidebarLabelTitle(const QString &title); QSize minimumSizeHint() const; signals: void sidebarPositionChanged(const QPoint &newPos); protected: void paintEvent(QPaintEvent *event); void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); private: QString m_title = ""; QGridLayout * layout; SideBarContainer::ContainerOrientaion m_orientation; QPoint sidebarCurrentPos; }; #endif // SIDEBAR_H
[ "a.ghaffari@email.com" ]
a.ghaffari@email.com
2cf74150a6c6346b4a0f6fe3f61d880c89d31e7b
453de3a9f957befde8f1d9e27c861945715d1d24
/test_app/main.cpp
24f2583e07e4ae2e7cd54b05cbfb2fcab0152c36
[]
no_license
koplyarov/jmr
1ecfbee47cca29e3fe6395ed1ffe64d2392ad72d
182a5707a3bfa957562906f04bbedc86c9412446
refs/heads/master
2021-01-24T09:25:42.261204
2018-10-03T14:58:11
2018-10-03T14:58:11
123,013,194
0
0
null
null
null
null
UTF-8
C++
false
false
3,050
cpp
#include "util.hpp" #include <adapters.hpp> #include <iostream> #include <unordered_set> using namespace jmr; using namespace jmr::io; using namespace jmr::operations; using namespace joint; class SplitToWordsMapper { private: IClient_Ptr _client; public: using JointInterfaces = TypeList<IMapper>; SplitToWordsMapper(IClient_Ref client) : _client(client) { } void Process(IRowReader_Ref input, IRowWriter_Ref output) { while (auto row = input->ReadRow()) { auto path = row->GetStringField("path"); auto content = row->GetStringField("content"); for (const auto& word : SplitString(content, ' ')) { auto outRow = _client->CreateRow(); outRow->SetStringField("path", path); outRow->SetStringField("word", word); output->WriteRow(outRow); } } } }; class BuildPathsListReducer { private: IClient_Ptr _client; public: using JointInterfaces = TypeList<IReducer>; BuildPathsListReducer(IClient_Ref client) : _client(client) { } void Process(StringRef key, IRowReader_Ref input, IRowWriter_Ref output) { std::unordered_set<std::string> paths; while (auto row = input->ReadRow()) { auto path = row->GetStringField("path"); paths.insert(path.Storage()); } std::string pathsStr; for (const auto& path : paths) pathsStr += path + " "; auto outRow = _client->CreateRow(); outRow->SetStringField("_word", key); outRow->SetStringField("paths", String(pathsStr)); output->WriteRow(outRow); } }; int main(int argc, const char** argv) { std::vector<std::pair<String, String>> documents = { {"/doc1", "this is the first document"}, {"/doc2", "this is the second document"}, {"/doc3", "what is this"}, }; std::string executablePath(argv[0]); std::string executableDir(executablePath.substr(0, executablePath.find_last_of("/\\"))); joint::Context ctx; joint::Module m(executableDir + "/core/Core.jm"); auto client = m.GetRootObject<IClient>("MakeClient"); std::cout << client->GetVersionString() << std::endl; auto writer = client->CreateTable("/input_documents"); for (const auto& doc_pair : documents) { auto row = client->CreateRow(); row->SetStringField("path", doc_pair.first); row->SetStringField("content", doc_pair.second); writer->WriteRow(row); } auto operation = client->RunMapReduce( MapReduceOpConfig{"word", "/input_documents", "/output_index"}, ctx.MakeComponent<IMapper, SplitToWordsMapper>(client), ctx.MakeComponent<IReducer, BuildPathsListReducer>(client) ); operation->Join(); auto reader = client->ReadTable("/output_index"); while (auto row = reader->ReadRow()) std::cout << row->SerializeToJson() << std::endl; return 0; }
[ "koplyarov.da@gmail.com" ]
koplyarov.da@gmail.com
5b510fb6866854a50df68601350e70c9bc54c76e
dbba0baad4eb12302298a5ed789b3684987b4e43
/data_structure-master/1线性表/递归遍历单链表.cpp
1d9267a5abd13ff60aa43761bdbf2d2d93a9b0a2
[]
no_license
changqing1234/learning
d9eb4ded14218825c38cb3ec269bbb8f864b473b
9a7fc8847fcc0f1be05edfb150ea3e94a179fcb3
refs/heads/master
2022-12-08T11:50:12.155546
2020-08-28T19:46:47
2020-08-28T19:46:47
243,701,369
0
0
null
null
null
null
GB18030
C++
false
false
3,071
cpp
#include<iostream> #include<stdio.h> #include<malloc.h> using namespace std; int s[100], k = 0; typedef int ElemType; typedef struct DLNode{ ElemType data; struct DLNode *next; }LNode, *LinkList; void print(LinkList L); void createListR(LinkList &L, int n); void createListF(LinkList &L, int n); void merge1(LinkList &A, LinkList &B, LinkList &C); void merge2(LinkList &A, LinkList &B, LinkList &C); void traverse(LinkList A, int a); int getdepth(LinkList A); int main(void){ int n; LinkList L1, L2, L3; cout<<"请输入你要输入的数据个数"<<endl; cin>>n; cout<<endl; //尾插法 createListR(L2, n); print(L2); int a = getdepth(L2->next); traverse(L2->next, a); int i = 0; cout<<"数组中的数据为:"<<endl; for(int i=0; i<a; i++){ cout<<s[i]<<" "; } } int getdepth(LinkList A){ if(A != NULL){ k++; getdepth(A->next); }else{ return k; } } //递归逆序保存数据到全局数组中 void traverse(LinkList A, int a){ if(A != NULL){ s[--a] = A->data; traverse(A->next, a); }else{ return ; } } //打印单链表 void print(LinkList L){ LinkList p = L->next; cout<<"链表的数据如下:"<<endl; while(p){ cout<<p->data<<" "; p = p->next; } cout<<endl; } //尾插法建立单链表(顺序建立链表) void createListR(LinkList &L, int n){ LinkList r, s; //建立头结点 L = (LinkList)malloc(sizeof(LNode)); L->next = NULL; r = L; cout<<"这是尾插法,请输入你要输入的数据 "; for(int i=0; i<n; i++){ s = (LinkList)malloc(sizeof(LNode)); cin>>s->data; r->next = s; r = s; } r->next = NULL; } //头插法建立链表 void createListF(LinkList &L, int n){ LinkList s; cout<<"这是头插法,请输入你要输入的数据: "; //建立头结点 L = (LNode*)malloc(sizeof(LNode)); L->next = NULL; for(int i=0; i<n; i++){ s = (LinkList)malloc(sizeof(LNode)); cin>>s->data; //将头结点的指针域赋值给新建的结点,即新节点插入到头结点跟下一个结点之间 s->next = L->next; //头结点指向新建立的结点 L->next = s; } } //将两个有序单链表进行归并 ,递增排序插入 void merge1(LinkList &A, LinkList &B, LinkList &C){ LinkList p, q, r; p = A->next; q = B->next; C = A; C->next = NULL; r = C; //释放B的头结点 free(B); while( p && q){ if(p->data <= q->data){ r->next = p; r = p; p = p->next; }else{ r->next = q; r = q; q = q->next; } } r->next = p ? p: q; } //逆序归并 void merge2(LinkList &A, LinkList &B, LinkList &C){ LinkList p, q, s; p = A->next; q = B->next; C = A; C->next = NULL; free(B); while(p && q){ if(p->data <= q->data){ s = p; p = p->next; s->next = C->next; C->next = s; }else{ s = q; q = q->next; s->next = C->next; C->next = s; } } while(p){ s = p; p = p->next; s->next = C->next; C->next = s; } while(q){ s = q; q = q->next; s->next = C->next; C->next = s; } }
[ "53471569+changqing1234@users.noreply.github.com" ]
53471569+changqing1234@users.noreply.github.com
dc2ba4d8fc2660b7beaee53410baee570ab44a3c
9de5e5ae976fafac5a6e191974578b8b311729cb
/nucl/math/Vector.h
3ec39290b76c7e71fa3e99e54588d9363e3dae99
[]
no_license
PPNav/prototype
ddc92a6f9cf19171d1a18b05436c02fec6c07abb
0815da607e10e1da579290f063f8e147106077c3
refs/heads/master
2021-01-19T20:33:20.892113
2012-01-14T05:54:01
2012-01-14T05:54:01
null
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
7,157
h
#ifndef __NC_VECTOR_h__ #define __NC_VECTOR_h__ #include "nucl/Types.h" #include "nucl/math/Math.h" #include "nucl/math/Coordinate.h" #include "nucl/TypeTraits.h" #include "nucl/Assert.h" namespace nc{ namespace generic{ namespace math{ //同次座標系にしたときにz = 0 struct Vector2 : public nc::math::Coordinate2{ Vector2() {}; Vector2( const Vector2& rhs ) : Coordinate2(rhs) {} Vector2( const Coordinate2& rhs ) : Coordinate2(rhs) {} Vector2( const nc::math::Coordinate2Data& rhs ) : Coordinate2(rhs) {} Vector2( real_t x, real_t y ) : Coordinate2(x, y) {} Vector2( const real_t arr[] ) : Coordinate2(arr) {} const Vector2& operator= ( const Vector2& rhs ){ return static_cast< const Vector2 & >( assign(rhs) ); } const Vector2& operator= ( const Coordinate2& rhs ){ return static_cast< const Vector2 & >( assign(rhs) ); } const Vector2& operator= ( const Coordinate2Data& rhs ){ return static_cast< const Vector2 & >( assign(rhs) ); } //の関数は、次の公式に基づく外積から z 要素を決定する。((this->x, this->y, 0) cross (rhs.x, rhs.y, 0)) //z 要素の値が正の場合、ベクトル rhs はベクトル this から反時計回りである。この情報は、背面のカリングに役立つ。 real_t ccw( const Vector2& rhs ) const; //Vectorの長さ real_t length() const; //Vectorの長さ(平方)fastest. real_t lengthSquared() const; //正規化します。 Vector2 normalize(); //正規化された方向を返します。 //内部でnormalizeしてます。 Vector2 direction() const; }; //同次座標系にしたときにw = 0 struct Vector3 : public nc::math::Coordinate3{ Vector3() {}; Vector3( const Vector3& rhs ) : Coordinate3(rhs) {} Vector3( const Coordinate3& rhs ) : Coordinate3(rhs) {} Vector3( const nc::math::Coordinate3Data& rhs ) : Coordinate3(rhs) {} Vector3( const Vector2& rhs, real_t z ) : Coordinate3(rhs, z) {} Vector3( real_t x, real_t y, real_t z ) : Coordinate3(x, y, z) {} Vector3( const real_t arr[] ) : Coordinate3(arr) {} const Vector3& operator= ( const Vector3& rhs ){ return static_cast< const Vector3 & >( assign(rhs) ); } const Vector3& operator= ( const Coordinate3& rhs ){ return static_cast< const Vector3 & >( assign(rhs) ); } const Vector3& operator= ( const Coordinate3Data& rhs ){ return static_cast< const Vector3 & >( assign(rhs) ); } //Vectorの長さ slow. real_t length() const; //Vectorの長さ(平方)fastest. real_t lengthSquared() const; //Vectorのおおよその長さ(not strictly. but faster than length?) real_t approximateLength() const; //正規化します Vector3 normalize(); //正規化された方向を返します。 //内部でnormalizeしてます。 Vector3 direction() const; }; //同次座標系にしたときにz = 0 struct Vector4 : public nc::math::Coordinate4{ Vector4() {}; Vector4( const Vector4& rhs ) : Coordinate4(rhs) {} Vector4( const Coordinate4& rhs ) : Coordinate4(rhs) {} Vector4( const nc::math::Coordinate4Data& rhs ) : Coordinate4(rhs) {} Vector4( const nc::math::Coordinate3Data& rhs, real_t w ) : Coordinate4(rhs, w) {} Vector4( const Vector2& rhs, real_t z, real_t w ) : Coordinate4(rhs, z, w) {} Vector4( real_t x, real_t y, real_t z, real_t w ) : Coordinate4(x, y, z, w) {} Vector4( const real_t arr[] ) : Coordinate4(arr) {} const Vector4& operator= ( const Vector4& rhs ){ return static_cast< const Vector4 & >( assign(rhs) ); } const Vector4& operator= ( const Coordinate4& rhs ){ return static_cast< const Vector4 & >( assign(rhs) ); } const Vector4& operator= ( const Coordinate4Data& rhs ){ return static_cast< const Vector4 & >( assign(rhs) ); } //Vectorの長さ real_t length() const; //Vectorの長さ(平方) real_t lengthSquared() const; //正規化します Vector4 normalize(); }; //--------------------inline impliment-------------------------- inline real_t Vector2::ccw( const Vector2& rhs ) const { return (x * rhs.y) - (y * rhs.x); } inline real_t Vector2::length() const { return nc::math::sqrt( lengthSquared() ); } inline real_t Vector2::lengthSquared() const { return x * x + y * y; } inline Vector2 Vector2::normalize() { *this /= length(); return *this; } inline Vector2 Vector2::direction() const { return Vector2( *this ).normalize(); } //------------------------------- inline real_t Vector3::length() const { return nc::math::sqrt( lengthSquared() ); } inline real_t Vector3::lengthSquared() const { return x * x + y * y + z * z; } inline real_t Vector3::approximateLength() const { real_t a, b, c; if (x < 0.0f) a = -x; else a = x; if (y < 0.0f) b = -y; else b = y; if (z < 0.0f) c = -z; else c = z; if (a < b) { real_t t = a; a = b; b = t; } if (a < c) { real_t t = a; a = c; c = t; } return a * 0.9375f + (b + c) * 0.375f; } inline Vector3 Vector3::normalize() { *this /= length(); return *this; } inline Vector3 Vector3::direction() const { return Vector3( *this ).normalize(); } //------------------------------- inline real_t Vector4::length() const { return nc::math::sqrt( lengthSquared() ); } inline real_t Vector4::lengthSquared() const { return x * x + y * y + z * z + w * w; } inline Vector4 Vector4::normalize() { *this /= length(); return *this; } }//namespace math }//namespace generic }//namespace nc #include "PlatformInclude.h" #ifdef NC_PLATFORM_USE_INTRINSIC_VECTOR #include "PLT_Vector.h" #else namespace nc{ //namespace setup namespace math{ using nc::generic::math::Vector2; using nc::generic::math::Vector3; using nc::generic::math::Vector4; }//namespace math }//namespace nc #endif namespace nc{ namespace math{ //固定値ベクトル static const Vector2 Vector2Zero( 0,0 ); static const Vector3 Vector3Zero( 0,0,0 ); static const Vector4 Vector4Zero( 0,0,0,0 ); static const Vector2 Vector2AxisX( 1, 0 ); static const Vector2 Vector2AxisY( 0, 1 ); static const Vector3 Vector3AxisX( 1, 0, 0 ); static const Vector3 Vector3AxisY( 0, 1, 0 ); static const Vector3 Vector3AxisZ( 0, 0, 1 ); static const Vector4 Vector4AxisX( 1, 0, 0, 0 ); static const Vector4 Vector4AxisY( 0, 1, 0, 0 ); static const Vector4 Vector4AxisZ( 0, 0, 1, 0 ); static const Vector4 Vector4AxisW( 0, 0, 0, 1 ); }//nsmespace math }//namespace nc //#include "VectorUtil.h" #endif // __NC_VECTOR_h__
[ "code4th@gmail.com" ]
code4th@gmail.com
a1eddeb420e87d94bf8b4b9ce16a7dead6f32a3e
f3e9d343fb9eabeae78bb7ca469eaef40c5632ee
/ABC099/c_true.cpp
95a0daea8148c5fef4e6a0f4f859b3e85112578d
[]
no_license
KitauraHiromi/atcoder
810af2625fb3877c154b3dd924ca391bd8be06fe
588fdde313837731c4fa3ef392664b667aed6da8
refs/heads/master
2021-06-04T11:54:03.784275
2020-05-12T23:24:17
2020-05-12T23:24:17
109,550,902
0
0
null
null
null
null
UTF-8
C++
false
false
737
cpp
#include <bits/stdc++.h> #include <iostream> #include <utility> // pair #include <string> #include <vector> #define MAX_N 100001 #define INF 1000000001 #define FOR(i, a, b) for(int i=a; i<b; i++) #define REP(i, n) for(int i=0; i<n; i++) #define RER(i, n) for(int i=n-1; i>=0; i--) #define ALL(v) v.begin() v.end() #define pb push_back using namespace std; typedef long long ll; typedef pair<int, int> P; int n, dp[MAX_N]; signed main(){ cin >> n; dp[0] = 0; for(int i=1; i<=n; i++){ dp[i] = INF; int j = 1; while(i >= j){ dp[i] = min(dp[i-j] + 1, dp[i]); j *= 6; } j = 1; while(i >= j){ dp[i] = min(dp[i-j] + 1, dp[i]); j *= 9; } } cout << dp[n] << endl; return 0; }
[ "kasumiga_eria394@yahoo.co.jp" ]
kasumiga_eria394@yahoo.co.jp
b6849a846bfc4bfae56368f56628e978f0a4b168
526f28aca4a6de125bbce1c7d597a744b95b3603
/Header/Joueur.h
0089cf14867e623dbea4dd4ef586496b6d575cfb
[]
no_license
smailine/Quarto
1d1c71f88dcc91d3a9e982dd2b9fa1f5063ec05c
ff4461fca6e17ff1e71739d2679f18d9abce0ddd
refs/heads/master
2020-05-07T17:50:08.180571
2019-04-10T20:10:49
2019-04-10T20:10:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
511
h
#ifndef JUEUR_H #define JUEUR_H #include "Grille.h" class Joueur{ private: Grille grilleJeu; int adversaire; // impaire joueur, paire un IA int niveau; public: // contructeur Joueur(); Joueur(int niveau); //getteurs et setteurs void setGrille(Grille grille); Grille getGrille(); int getAdversaire(); //autres methodes void choixCase(); void choixAdversaire(); void choixPoin(); void choisirNiveau(); }; #endif // JUEUR_H
[ "48807622+Ineida@users.noreply.github.com" ]
48807622+Ineida@users.noreply.github.com
676c376b7027ea1f8c251901436dc12a228dd64d
e5b13b23221f1be64ca575562a9fba4a3f558aa1
/src/sdl2/SDLJeu.cpp
4d0a582995e79af25f8a4086b4acea1a8bd8e7af
[]
no_license
JulineG/Labyrinthe
986df94bbe398bc7040f342f2586b9ffc54f12d2
18bed74188d3169d1caf5d6c46423b876a8cf40b
refs/heads/master
2020-05-02T16:44:33.895672
2019-03-27T21:36:37
2019-03-27T21:36:37
171,681,210
0
0
null
null
null
null
UTF-8
C++
false
false
11,828
cpp
#include <iostream> #include <cassert> #include <string> #include <fstream> #include <stdlib.h> #include "SDLJeu.h" using namespace std; const int TAILLE_SPRITE = 32; Image::Image () { surface = NULL; texture = NULL; a_change = false; } void Image::chargerImageDepuisFichier(const char* filename, SDL_Renderer * renderer) { surface = IMG_Load(filename); if (surface == NULL) { string nfn = string("../") + filename; cout << "Error: cannot load "<< filename <<". Trying "<<nfn<<endl; surface = IMG_Load(nfn.c_str()); if (surface == NULL) { nfn = string("../") + nfn; surface = IMG_Load(nfn.c_str()); } } if (surface == NULL) { cout<<"Error: cannot load "<< filename <<endl; exit(1); } SDL_Surface * surfaceCorrectPixelFormat = SDL_ConvertSurfaceFormat(surface,SDL_PIXELFORMAT_ARGB8888,0); SDL_FreeSurface(surface); surface = surfaceCorrectPixelFormat; texture = SDL_CreateTextureFromSurface(renderer,surface); if (texture == NULL) { cout << "Error: problem to create the texture of "<< filename<< endl; exit(1); } } void Image::creerTextureAPartirDeSurface (SDL_Renderer * renderer) { texture = SDL_CreateTextureFromSurface(renderer,surface); if (texture == NULL) { cout << "Error: problem to create the texture from surface " << endl; exit(1); } } void Image::dessiner (SDL_Renderer * renderer, int x, int y, int w, int h) { int ok; SDL_Rect r; r.x = x; r.y = y; r.w = (w<0)?surface->w:w; r.h = (h<0)?surface->h:h; if (a_change) { ok = SDL_UpdateTexture(texture,NULL,surface->pixels,surface->pitch); assert(ok == 0); a_change = false; } ok = SDL_RenderCopy(renderer,texture,NULL,&r); assert(ok == 0); if (texture != NULL){ ok = SDL_RenderCopy(renderer,texture,NULL,&r); assert (ok==0); } } SDL_Texture * Image::getTexture() const {return texture;} void Image::setSurface(SDL_Surface * surf) {surface = surf;} sdlJeu::sdlJeu () : jeu() { // Initialisation de la console if (SDL_Init(SDL_INIT_VIDEO) < 0) { cout << "Erreur lors de l'initialisation de la SDL : " << SDL_GetError() << endl;SDL_Quit();exit(1); } if (TTF_Init() != 0) { cout << "Erreur lors de l'initialisation de la SDL_ttf : " << TTF_GetError() << endl;SDL_Quit();exit(1); } int imgFlags = IMG_INIT_PNG | IMG_INIT_JPG; if( !(IMG_Init(imgFlags) & imgFlags)) { cout << "SDL_image ne peut pas être initialiser! SDL_image Erreur: " << IMG_GetError() << endl;SDL_Quit();exit(1); } if( Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 1, 2048 ) < 0 ) { cout << "SDL_mixer ne peut pas être initialiser! SDL_mixer Erreur: " << Mix_GetError() << endl; cout << "Pas de son !!!" << endl; withSound = false; } else withSound = true; int dimx, dimy; dimx = jeu.getConstTerrain().getDimx(); dimy = jeu.getConstTerrain().getDimy(); dimx = dimx * TAILLE_SPRITE; dimy = (dimy+3) * TAILLE_SPRITE; // Creation de la fenetre window = SDL_CreateWindow("Labyrinthe", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, dimx, dimy, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE); if (window == NULL) { cout << "Erreur lors de la creation de la fenetre : " << SDL_GetError() << endl; SDL_Quit(); exit(1); } renderer = SDL_CreateRenderer(window,-1,SDL_RENDERER_ACCELERATED); // IMAGES im_arbre.chargerImageDepuisFichier("./data/arbre.png",renderer); im_personnage_gauche_droite.chargerImageDepuisFichier("./data/personnage_gauche_droite.png",renderer); im_personnage_droite_gauche.chargerImageDepuisFichier("./data/personnage_droite_gauche.png",renderer); im_personnage_epee_gauche_droite.chargerImageDepuisFichier("./data/personnage_epee_gauche_droite.png",renderer); im_personnage_epee_droite_gauche.chargerImageDepuisFichier("./data/personnage_epee_droite_gauche.png",renderer); im_monstre.chargerImageDepuisFichier("./data/monstre.png",renderer); im_etoile.chargerImageDepuisFichier("./data/etoile.png",renderer); im_loupe.chargerImageDepuisFichier("./data/loupe.png",renderer); im_porte.chargerImageDepuisFichier("./data/porte.png",renderer); im_epee.chargerImageDepuisFichier("./data/epee.png",renderer); im_coeur.chargerImageDepuisFichier("./data/coeur.png",renderer); im_chemin.chargerImageDepuisFichier("./data/chemin.png",renderer); // FONTS font = TTF_OpenFont("data/ObelixPro.ttf",70); if (font == NULL) { cout << "Failed to load ObelixPro.ttf! SDL_TTF Error: " << TTF_GetError() << endl; SDL_Quit(); exit(1); } // SONS if (withSound) { music = Mix_LoadWAV("data/jeu_son.wav"); if (music == NULL) { cout << "Failed to load jeu_son.wav! SDL_mixer Error: " << Mix_GetError() << endl; SDL_Quit(); exit(1); } } //TEMPS setTemps(0); } sdlJeu::~sdlJeu () { if (withSound) Mix_Quit(); TTF_CloseFont(font); TTF_Quit(); SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); SDL_Quit(); } int sdlJeu::getTemps()const{ return temps; } void sdlJeu::setTemps(const int t){ temps=t; } void sdlJeu::sdlAff (const char action_clavier) { //Remplir l'cran de blanc SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); SDL_RenderClear(renderer); int x,y; const Terrain& ter = jeu.getConstTerrain(); const Personnage& per = jeu.getConstPersonnage(); const Monstre& mon1=jeu.getConstMonstre1(); const Monstre& mon2=jeu.getConstMonstre2(); const Monstre& mon3=jeu.getConstMonstre3(); // Afficher les sprites for (int i=0;i<jeu.getVie();i++) { im_coeur.dessiner(renderer,i*TAILLE_SPRITE,27*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); } for (int j=18;j>18-jeu.getEtoile();j--){ im_etoile.dessiner(renderer,j*TAILLE_SPRITE,27*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); } if(jeu.getEtoile()==0){ im_porte.dessiner(renderer,18*TAILLE_SPRITE,27*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); } if (jeu.getAvoir_epee()){ im_epee.dessiner(renderer,9*TAILLE_SPRITE,27*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); } for (x=-jeu.getJumelle();x<=jeu.getJumelle();x++){ for (y=-jeu.getJumelle();y<=jeu.getJumelle();y++){ im_chemin.dessiner(renderer,(per.getX()+x)*TAILLE_SPRITE,(per.getY()+y)*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); if(!jeu.getTuer() && (mon1.getX()<=per.getX()+x)&&(mon1.getY()<=per.getY()+y)&&(mon1.getY()>=per.getY()-y)&&(mon1.getX()>=per.getX()-x)){ im_monstre.dessiner(renderer,mon1.getX()*TAILLE_SPRITE,mon1.getY()*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); } if((mon2.getX()<=per.getX()+x)&&(mon2.getY()<=per.getY()+y)&&(mon2.getY()>=per.getY()-y)&&(mon2.getX()>=per.getX()-x)){ im_monstre.dessiner(renderer,mon2.getX()*TAILLE_SPRITE,mon2.getY()*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); } if((mon3.getX()<=per.getX()+x)&&(mon3.getY()<=per.getY()+y)&&(mon3.getY()>=per.getY()-y)&&(mon3.getX()>=per.getX()-x)){ im_monstre.dessiner(renderer,mon3.getX()*TAILLE_SPRITE,mon3.getY()*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); } switch(ter.getXY(per.getX()+x,per.getY()+y)){ case 'P' : im_porte.dessiner(renderer,(per.getX()+x)*TAILLE_SPRITE,(per.getY()+y)*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); break; case '#' : // Afficher le sprite arbre im_arbre.dessiner(renderer,(per.getX()+x)*TAILLE_SPRITE,(per.getY()+y)*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); break; case 'E' : // Afficher le sprite de l'etoile im_etoile.dessiner(renderer,(per.getX()+x)*TAILLE_SPRITE,(per.getY()+y)*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); break; case 'e' : // Afficher le sprite du epee im_epee.dessiner(renderer,(per.getX()+x)*TAILLE_SPRITE,(per.getY()+y)*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); break; case 'L' : // Afficher le sprite des loupes im_loupe.dessiner(renderer,(per.getX()+x)*TAILLE_SPRITE,(per.getY()+y)*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); break; } } } char format [50]; int t = getTemps(); if (jeu.getAvoir_perdu()) { sprintf(format, "Vous avez perdu en %d secondes", t); font_color.r = 195;font_color.g = 0;font_color.b = 0; font_im.setSurface(TTF_RenderText_Solid(font,format,font_color)); font_im.creerTextureAPartirDeSurface(renderer); SDL_Rect positionTitre; positionTitre.x = 4*TAILLE_SPRITE;positionTitre.y = 13*TAILLE_SPRITE;positionTitre.w = 12*TAILLE_SPRITE;positionTitre.h = 2*TAILLE_SPRITE; SDL_RenderCopy(renderer,font_im.getTexture(),NULL,&positionTitre); } if (jeu.getJeu_termine()){ sprintf(format, "Vous avez gagne en %d secondes", t); font_color.r = 195;font_color.g = 0;font_color.b = 0; font_im.setSurface(TTF_RenderText_Solid(font,format,font_color)); font_im.creerTextureAPartirDeSurface(renderer); SDL_Rect positionTitre; positionTitre.x = 4*TAILLE_SPRITE;positionTitre.y = 13*TAILLE_SPRITE;positionTitre.w = 12*TAILLE_SPRITE;positionTitre.h = 2*TAILLE_SPRITE; SDL_RenderCopy(renderer,font_im.getTexture(),NULL,&positionTitre); } if (jeu.getAvoir_epee()) { switch (action_clavier){ case 'd' : im_personnage_epee_gauche_droite.dessiner(renderer,per.getX()*TAILLE_SPRITE,per.getY()*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); break; case 'q' : im_personnage_epee_droite_gauche.dessiner(renderer,per.getX()*TAILLE_SPRITE,per.getY()*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); break; } } else { switch (action_clavier){ case 'd' : im_personnage_gauche_droite.dessiner(renderer,per.getX()*TAILLE_SPRITE,per.getY()*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); break; case 'q' : im_personnage_droite_gauche.dessiner(renderer,per.getX()*TAILLE_SPRITE,per.getY()*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); break; case NULL : im_personnage_droite_gauche.dessiner(renderer,per.getX()*TAILLE_SPRITE,per.getY()*TAILLE_SPRITE,TAILLE_SPRITE,TAILLE_SPRITE); break; } } } void sdlJeu::sdlBoucle() { SDL_Event events; bool quit = false; bool termine = false; char action; Uint32 t = SDL_GetTicks(), nt; // tant que ce n'est pas la fin ... while (!quit) { nt = SDL_GetTicks(); if (nt-t>300) { jeu.actionsAutomatiques(); jeu.gererPosition(); t = nt; } // tant qu'il y a des evenements traiter (cette boucle n'est pas bloquante) while (SDL_PollEvent(&events)) { if (events.type == SDL_QUIT) quit = true; // Si l'utilisateur a clique sur la croix de fermeture else if (events.type == SDL_KEYDOWN) { // Si une touche est enfoncee switch (events.key.keysym.scancode) { case SDL_SCANCODE_UP: jeu.actionClavier('z'); // car Y inverse jeu.gererPosition(); break; case SDL_SCANCODE_DOWN: jeu.actionClavier('s'); // car Y inverse jeu.gererPosition(); break; case SDL_SCANCODE_LEFT: jeu.actionClavier('q'); jeu.gererPosition(); action = 'q'; break; case SDL_SCANCODE_RIGHT: jeu.actionClavier('d'); jeu.gererPosition(); action = 'd'; break; case SDL_SCANCODE_KP_1: quit = true; break; case SDL_SCANCODE_1: quit = true; break; default: break; } } Mix_PlayChannel(-1,music,-1); } if (((jeu.getAvoir_perdu()) || (jeu.getJeu_termine())) && !termine) { termine = true; nt=SDL_GetTicks(); setTemps(nt*0.001); } // on affiche le jeu sur le buffer cach sdlAff(action); // on permute les deux buffers (cette fonction ne doit se faire qu'une seule fois dans la boucle) SDL_RenderPresent(renderer); } }
[ "juline.gabrovec@etu.univ-lyon1.fr" ]
juline.gabrovec@etu.univ-lyon1.fr
9a8ddcc56761c62ca9e89a6f681488ae2430f5e9
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5688567749672960_1/C++/duykhanhuet/A.cpp
436ccbad202b9dd388c68aa054c1c0cd45353dac
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
C++
false
false
1,589
cpp
// Author: Nguyen Duy Khanh #include<bits/stdc++.h> #define FOR(i,a,b) for( int i=(a),_b=(b);i<=_b;i++) #define DOW(i,b,a) for( int i=(b),_a=(a);i>=_a;i--) #define DEBUG(x) { printf << #x << " = " << x << endl; } #define DEBUGARR(a,n) {cout << #a << " = " ; FOR(_,1,n) cout << a[_] << ' '; cout <<endl;} #define CHECK printf("OK\n"); #define FILL(a, b) memset((a), (b), sizeof((a))) #define pb push_back #define mp make_pair #define st first #define nd second #define Nmax 35000 using namespace std; int test; long long res, n, mu[20]; long long rev(long long n){ long long res = 0; while (n){ res = res * 10 + n % 10; n = n / 10; } return res; } int scs(long long n){ int res = 0; while (n){ res++; n = n / 10; } return res; } long long cal(long long n){ if (n < 10) return n; int k = scs(n); long long a, b; if (k % 2 == 0) { a = n % mu[k/2]; b = rev(n) % mu[k/2]; } else { a = n % mu[k/2]; b = rev(n) % mu[k/2 + 1]; } if (a == 0) return cal(n-9) + 9; if (b == 1) return cal(mu[k-1] - 1) + n - mu[k-1] + 1; return a + b + cal(mu[k-1] - 1) + 1; } int main() { ios::sync_with_stdio(false); freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); mu[0] = 1; FOR(i,1,15) mu[i] = mu[i-1] * 10; cin >> test; FOR(t,1,test){ cout << "Case #" << t << ": "; cin >> n; cout << cal(n) << endl; } return 0; }
[ "eewestman@gmail.com" ]
eewestman@gmail.com
ed8a2463d6d03f924f4a18f961ab75afa0762e2f
360167801aeddd0d85cad1a8d308f5d6500d67e6
/DP/knapsackTopDown.cpp
7f4b8d9a283ba1ba596117843a9c399b0c4bb2a8
[]
no_license
rajat-dwivedi/CodeQuestions
781ea3fdb4a556e82c31feef0bc1abbb108bad0e
eb2dbc352c492c04b1e64bb8c66196f897e0c586
refs/heads/master
2023-04-17T07:55:40.727120
2021-05-02T09:04:46
2021-05-02T09:04:46
null
0
0
null
null
null
null
UTF-8
C++
false
false
890
cpp
#include<bits/stdc++.h> using namespace std; //top down version of knapsack problem aka Memoization //the maximimum size can be taken according to the given constraints if n<=100 and W<=100 is given then int t[102][102]; int solve(int W,int n,int wt[],int val[]){ if(t[n][W]!=-1) return t[n][W]; if(W==0 || n==0) return t[n][W]=0; if(wt[n-1]>W) return t[n][W]=solve(W,n-1,wt,val); else { return t[n][W]=max(val[n-1]+solve(W-wt[n-1],n-1,wt,val), solve(W,n-1,wt,val)); } } int main(){ memset(t,-1,sizeof(t)); int W = 50; int val[] = {60,100,120}; int wt[] = {10,20,30}; int n = sizeof(wt)/sizeof(wt[0]); cout<<solve(W,n,wt,val)<<endl; // for(int i=0;i<=3;i++){ // for(int j=0;j<=50;j++){ // cout<<t[i][j]<<" "; // } // cout<<endl; // } return 0; }
[ "raj@Rajats-MacBook-Air.local" ]
raj@Rajats-MacBook-Air.local
325232a11cdfabe4da32a673ab7a00c7a104fb7a
577ee60fc6263d418696a9c2ee92c5d27d0a0ec0
/Source/democpp/TestCaseObject.h
131b41ffe724f913896aca2f03bf95814ca8e7ac
[ "BSD-3-Clause", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Tencent/sluaunreal
d4a67c2e3e1f51ca38fe1ae22e32522b59acc114
cbe70b28a6cd6f659fe02d9ec2d8f867dff86453
refs/heads/master
2023-08-31T03:23:48.974944
2023-08-23T01:16:30
2023-08-23T01:16:30
142,866,337
1,717
446
NOASSERTION
2023-09-05T13:58:42
2018-07-30T11:27:14
C++
UTF-8
C++
false
false
1,040
h
// Tencent is pleased to support the open source community by making sluaunreal available. // Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved. // Licensed under the BSD 3-Clause License (the "License"); // you may not use this file except in compliance with the License. You may obtain a copy of the License at // https://opensource.org/licenses/BSD-3-Clause // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and limitations under the License. #pragma once #include "CoreMinimal.h" #include "InterfaceTestCase.h" #include "TestCaseObject.generated.h" UCLASS() class UTestCaseObject : public UObject, public ITestCaseInterface { GENERATED_BODY() public: void Init() override; UPROPERTY() TScriptInterface<class ITestCaseInterface> TestCaseInterface; };
[ "zjhongxian@gmail.com" ]
zjhongxian@gmail.com
2ed83892a57866014dd80fb78cfb16b90eb86b20
7b7d03b1e3b3c9b5e695e94049a25303029cf480
/ch14/ex14_35.cpp
f015bdf9630e2a5eb7164df1b8d3062e3f385c34
[]
no_license
liuhuoer/CppPrimer
533b7281f2ef8e70e7b7c29335b738ba3bf45aed
d7ce4bb61704315cc2d588fe8a1392b28d53068f
refs/heads/master
2020-03-18T03:18:11.697289
2019-01-29T08:22:33
2019-01-29T08:22:33
134,233,628
1
0
null
null
null
null
UTF-8
C++
false
false
390
cpp
#ifndef ex14_35 #define ex14_35 #include <iostream> class OutputString { public: OutputString(std::istream& t = std::cin) : is(t) { } std::string operator() () const { std::string str; std::getline(is, str); return is ? str : std::string(); } private: std::istream& is; }; int main() { OutputString myos(std::cin); std::cout << myos() << std::endl; return 0; } #endif
[ "951340249@qq.com" ]
951340249@qq.com
a8c9a005a5450010b08542ddd6890e466f222068
1afe3e8f76b4809cff3d9a70b5b04607b0005340
/example.cpp
aa716975c26f59b44f987e672489f0ea47df776a
[]
no_license
chrisking94/STM32-CPP-Library
5d55abb36cdea89cc84d3745ceccfe6763f41e5a
36025bf1122e6c93e2cbd8b4419e8987587500af
refs/heads/master
2020-06-25T02:40:20.692428
2018-01-23T07:51:03
2018-01-23T07:51:03
96,953,405
1
0
null
null
null
null
UTF-8
C++
false
false
194
cpp
#include "BaseLib.h" #include "GPIO.h" #include "GPIOPin.h" #define led PC13 int main() { BaseLib_init();//RCC,AFIO,SCB,NVIC, led.pinMod(_OGPP); for(;;) { led=!led; } }
[ "1050243371@qq.com" ]
1050243371@qq.com
c90dbb4b3594df3e97de3f9fca78107c2d583caf
634f95f90230b0f7e11158dc271cba5a3bc703c7
/UnityChanDemo/SkinAnimationDemo/Enemy/Enemy_00.cpp
f0179cbb7d0b07a331c30807a77cf3f458351c8c
[]
no_license
TakayukiKiyohara/Sandbox
55c7e2051bcb55b7765a9f367c3ee47d33f473de
99c354eb91c501d8a10d09806aa4acdcf5d26dcb
refs/heads/master
2021-01-18T01:06:30.462238
2016-11-11T13:43:58
2016-11-11T13:43:58
68,387,195
4
0
null
null
null
null
SHIFT_JIS
C++
false
false
4,846
cpp
/*! * @brief タイプ0の敵。 */ #include "stdafx.h" #include "Enemy/Enemy_00.h" #include "Player/Player.h" #include "Enemy/HFSM/EnemyStateSearch.h" #include "Enemy/HFSM/EnemyStateFind.h" #include "Enemy/HFSM/EnemyStateDamage.h" #include "Enemy/HFSM/EnemyStateDeath.h" #include "DamageCollisionWorld.h" #include "tkEngine/Sound/tkSoundSource.h" Enemy_00::Enemy_00() { state = enLocalState_Search; initPosition = CVector3::Zero; moveSpeed = 0.0f; direction = CVector3::AxisZ; moveDirection = CVector3::AxisZ; radius = 0.0f; height = 0.0f; hp = 70; } Enemy_00::~Enemy_00() { for (auto& state : states) { delete state; } } void Enemy_00::Init(const char* modelPath, CVector3 pos, CQuaternion rotation) { Enemy::Init(modelPath, pos, rotation); PlayAnimation(enAnimWalk); animation.SetAnimationLoopFlag(enAnimAttack, false); animation.SetAnimationLoopFlag(enAnimDamage, false); animation.SetAnimationLoopFlag(enAnimDeath, false); sphereShape.reset(new CSphereCollider); sphereShape->Create(radius); collisionObject.reset(new btCollisionObject()); collisionObject->setCollisionShape(sphereShape->GetBody()); InitHFSM(); } /*! * @brief HFSMを初期化。 */ void Enemy_00::InitHFSM() { //探索状態を追加。 states.push_back( new EnemyStateSearch(this) ); //発見状態を追加。 states.push_back( new EnemyStateFind(this) ); //ダメージ状態を追加。 states.push_back( new EnemyStateDamage(this)); //死亡状態を追加。 states.push_back( new EnemyStateDeath(this)); state = enLocalState_Search; states[state]->Enter(IEnemyState::SEnterArg()); } void Enemy_00::Start() { } void Enemy_00::Update() { Enemy::Update(); states[state]->Update(); switch (state) { case enLocalState_Search: { CVector3 unityPos = g_player->GetPosition(); CVector3 diff; diff.Subtract(unityPos, position); if (diff.LengthSq() < 5.0f * 5.0f) { //見つけた。 states[state]->Leave(); state = enLocalState_Find; states[state]->Enter(IEnemyState::SEnterArg()); } }break; case enLocalState_Find: { }break; case enLocalState_Damage: if (!animation.IsPlay()) { states[state]->Leave(); state = enLocalState_Find; states[state]->Enter(IEnemyState::SEnterArg()); } break; } //ダメージ処理 Damage(); if (state != enLocalState_Death) { CVector3 speed = characterController.GetMoveSpeed(); speed.x = moveDirection.x * moveSpeed; speed.z = moveDirection.z * moveSpeed; characterController.SetMoveSpeed(speed); characterController.Execute(); position = characterController.GetPosition(); //回転は適当に。 float angle = atan2f(direction.x, direction.z); rotation.SetRotation(CVector3::AxisY, angle); } animation.Update(GameTime().GetFrameDeltaTime()); light.SetPointLightPosition(g_player->GetPointLightPosition()); light.SetPointLightColor(g_player->GetPointLightColor()); skinModel.Update(position, rotation, CVector3::One); if (state != enLocalState_Death) { timer += GameTime().GetFrameDeltaTime(); if (timer > 2.0f) { if (g_random.GetRandDouble() < 0.2f) { CSoundSource* se = NewGO<CSoundSource>(0); se->Init("Assets/Sound/enemy_umeki.wav", true); se->Play(false); se->SetPosition(position); } timer = 0.0f; } } } void Enemy_00::Damage() { if (state == enLocalState_Death) { //死んでる。 return; } float offset = radius + height * 0.5f; CVector3 centerPos; centerPos = position; centerPos.y += offset; btTransform trans; trans.setOrigin(btVector3(centerPos.x, centerPos.y, centerPos.z)); collisionObject->setWorldTransform(trans); const DamageCollisionWorld::Collision* dmgColli = g_damageCollisionWorld->FindOverlappedDamageCollision( DamageCollisionWorld::enDamageToEnemy, collisionObject.get() ); if (!dmgColli) { centerPos.y += offset; trans.setOrigin(btVector3(centerPos.x, centerPos.y, centerPos.z)); collisionObject->setWorldTransform(trans); const DamageCollisionWorld::Collision* dmgColli = g_damageCollisionWorld->FindOverlappedDamageCollision( DamageCollisionWorld::enDamageToEnemy, collisionObject.get() ); } if (dmgColli != NULL && states[state]->IsPossibleApplyDamage(dmgColli) ) { //ダメージを食らっている。 hp -= dmgColli->damage; if (hp <= 0) { //死亡。 states[state]->Leave(); state = enLocalState_Death; states[state]->Enter(IEnemyState::SEnterArg()); } else { states[state]->Leave(); state = enLocalState_Damage; IEnemyState::SEnterArg enterArg; enterArg.arg[0] = dmgColli->groupID; //ダメージを受けたコリジョンのグループIDを渡す。 states[state]->Enter(enterArg); } } } void Enemy_00::Render(CRenderContext& renderContext) { skinModel.Draw(renderContext, g_camera->GetCamera().GetViewMatrix(), g_camera->GetCamera().GetProjectionMatrix()); }
[ "nezumimusume30@gmail.com" ]
nezumimusume30@gmail.com
7ba400d387f22ca462bbaac532c2083df7b3a847
8d539ced39960119c418907075b631cec18ca399
/Trees/079-LongestRootedPath.cpp
0f860ddf80ff491d4a8577b2d18f3d77697281b9
[ "MIT" ]
permissive
lucastarche/aotd
d27eed7414c11ce1a0a18c2459b800e9cdf91eef
e501a1f27fc48508d24eac461308aaa2e56a23cf
refs/heads/master
2023-07-19T03:56:06.845259
2021-09-12T12:14:56
2021-09-12T12:14:56
294,989,043
3
1
null
2020-12-16T13:58:42
2020-09-12T17:06:06
C++
UTF-8
C++
false
false
1,249
cpp
//Longest Rooted Path //This determines the longest path we can get in the rooted subtree with root n. This will be useful later on when we want to get the tree's diameter. //We can use recursion again, thanks to the fact that the longest path of node n will be the max of each child, plus one. //Runtime: O(n) #include <bits/stdc++.h> using namespace std; class Tree { private: int n; vector<int> parents; vector<vector<int>> children; public: Tree() { parents.resize(1, 0); children.resize(1); n = 1; } void insert(int parent) { parents.push_back(parent); children.push_back({}); children[parent].push_back(n); n++; } int RootedLongestPath(int start) { int ans = 0; for (auto child : children[start]) { ans = max(ans, RootedLongestPath(child) + 1); } return ans; } }; int main() { int amount; cin >> amount; Tree tree; for (int i = 0; i < amount; i++) { int temp; cin >> temp; tree.insert(temp); } int q; cin >> q; for (int i = 0; i < q; i++) { int query; cin >> query; cout << tree.RootedLongestPath(query) << '\n'; } }
[ "lucastarche@gmail.com" ]
lucastarche@gmail.com
bc4ee47aff3bb5b1c48a4a5dad3aa3470ac4a9eb
defb48199497b09321158b1069b795509ce749e8
/Homework/hw5/hw5/src/util/bst.h
197a5188ac2149c3c0fe1bb927a07aadc65f8f38
[]
no_license
asfhiolNick/NTU_DSnP_201901
5ecb7bfe61f936fcb19a9722faf89b18cbebff17
6238a687343bf3d6aedd43337c9bdbc033fadfcc
refs/heads/master
2023-05-19T09:41:53.309504
2021-06-13T02:57:52
2021-06-13T02:57:52
241,570,638
2
0
null
null
null
null
UTF-8
C++
false
false
869
h
/**************************************************************************** FileName [ bst.h ] PackageName [ util ] Synopsis [ Define binary search tree package ] Author [ Chung-Yang (Ric) Huang ] Copyright [ Copyleft(c) 2005-present LaDs(III), GIEE, NTU, Taiwan ] ****************************************************************************/ #ifndef BST_H #define BST_H #include <cassert> using namespace std; template <class T> class BSTree; // BSTreeNode is supposed to be a private class. User don't need to see it. // Only BSTree and BSTree::iterator can access it. // // DO NOT add any public data member or function to this class!! // template <class T> class BSTreeNode { // TODO: design your own class!! }; template <class T> class BSTree { // TODO: design your own class!! class iterator { }; }; #endif // BST_H
[ "cyhuang@ntu.edu.tw" ]
cyhuang@ntu.edu.tw
35a35c6b2c97719b211dcd553984aebc0649cb05
807a77f6dd41f4a692a4a047c668a94255d0b7ba
/LearnOpenGL/Shader.h
5cff8440207f9a5d2530aaa12aa40dadfc95f3cc
[ "MIT" ]
permissive
felipunky/LearnOpenGL
b9c5b4b30993a66fac66614368b1ca222b48ee18
c39a46d4da1a52ce5a492e8c8db407910b55dc5f
refs/heads/master
2020-03-28T07:39:26.067277
2018-09-10T02:12:32
2018-09-10T02:12:32
147,915,673
0
0
null
null
null
null
UTF-8
C++
false
false
5,487
h
#ifndef SHADER_H #define SHADER_H #include <glad/glad.h> #include <glm.hpp> #include <string> #include <fstream> #include <sstream> #include <iostream> class Shader { public: unsigned int ID; Shader( const char* vertexPath, const char* fragmentPath ) { // Retrieve the vertex/fragment source from filePath. std::string vertexCode; std::string fragmentCode; std::ifstream vShaderFile; std::ifstream fShaderFile; // Ensure ifstream objects can throw exceptions. vShaderFile.exceptions( std::ifstream::failbit | std::ifstream::badbit ); fShaderFile.exceptions(std::ifstream::failbit | std::ifstream::badbit); try { // Open files. vShaderFile.open( vertexPath ); fShaderFile.open( fragmentPath ); std::stringstream vShaderStream, fShaderStream; // Read file's buffer contents into streams. vShaderStream << vShaderFile.rdbuf(); fShaderStream << fShaderFile.rdbuf(); // Close file handlers vShaderFile.close(); fShaderFile.close(); // Convert stream into string. vertexCode = vShaderStream.str(); fragmentCode = fShaderStream.str(); } catch( std::ifstream::failure e ) { std::cout << "ERROR::SHADER::FILE_NOT_SUCCESFULLY_READ" << std::endl; } const char* vShaderCode = vertexCode.c_str(); const char* fShaderCode = fragmentCode.c_str(); // Compile shaders. unsigned int vertex, fragment; int success; char infoLog[512]; // Vertex shader. vertex = glCreateShader( GL_VERTEX_SHADER ); glShaderSource( vertex, 1, &vShaderCode, NULL ); glCompileShader( vertex ); checkCompileErrors( vertex, "VERTEX" ); // Fragment shader. fragment = glCreateShader( GL_FRAGMENT_SHADER ); glShaderSource( fragment, 1, &fShaderCode, NULL ); glCompileShader( fragment ); checkCompileErrors(vertex, "FRAGMENT"); // Shader program. ID = glCreateProgram(); glAttachShader( ID, vertex ); glAttachShader( ID, fragment ); glLinkProgram( ID ); checkCompileErrors( ID, "PROGRAM" ); // Delete the shaders we don't need them anymore they are linked into our // program. glDeleteShader( vertex ); glDeleteShader( fragment ); } void use() { glUseProgram( ID ); } // utility uniform functions // ------------------------------------------------------------------------ void setBool(const std::string &name, bool value) const { glUniform1i(glGetUniformLocation(ID, name.c_str()), (int)value); } // ------------------------------------------------------------------------ void setInt(const std::string &name, int value) const { glUniform1i(glGetUniformLocation(ID, name.c_str()), value); } // ------------------------------------------------------------------------ void setFloat(const std::string &name, float value) const { glUniform1f(glGetUniformLocation(ID, name.c_str()), value); } // ------------------------------------------------------------------------ void setVec2(const std::string &name, const glm::vec2 &value) const { glUniform2fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); } void setVec2(const std::string &name, float x, float y) const { glUniform2f(glGetUniformLocation(ID, name.c_str()), x, y); } // ------------------------------------------------------------------------ void setVec3(const std::string &name, const glm::vec3 &value) const { glUniform3fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); } void setVec3(const std::string &name, float x, float y, float z) const { glUniform3f(glGetUniformLocation(ID, name.c_str()), x, y, z); } // ------------------------------------------------------------------------ void setVec4(const std::string &name, const glm::vec4 &value) const { glUniform4fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); } void setVec4(const std::string &name, float x, float y, float z, float w) { glUniform4f(glGetUniformLocation(ID, name.c_str()), x, y, z, w); } // ------------------------------------------------------------------------ void setMat2(const std::string &name, const glm::mat2 &mat) const { glUniformMatrix2fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]); } // ------------------------------------------------------------------------ void setMat3(const std::string &name, const glm::mat3 &mat) const { glUniformMatrix3fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]); } // ------------------------------------------------------------------------ void setMat4(const std::string &name, const glm::mat4 &mat) const { glUniformMatrix4fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]); } private: // We define our compile error function void checkCompileErrors( unsigned int shader, std::string type ) { int success; char infoLog[1024]; if( type != "PROGRAM" ) { glGetShaderiv( shader, GL_COMPILE_STATUS, &success ); if ( !success ) { glGetShaderInfoLog( shader, 1024, NULL, infoLog ); std::cout << "ERROR::SHADER_COMPILATION_ERROR of type: " << type << "\n" << infoLog << "\n -- --------------------------------------------------- -- " << std::endl; } } else { glGetProgramiv( shader, GL_LINK_STATUS, &success ); if( !success ) { glGetProgramInfoLog( shader, 1024, NULL, infoLog ); std::cout << "ERROR::SHADER_COMPILATION_ERROR of type: " << type << "\n" << infoLog << "\n -- --------------------------------------------------- -- " << std::endl; } } } }; #endif
[ "feli20gutierrez@hotmail.com" ]
feli20gutierrez@hotmail.com
d9dc59d4de23544692c2f83f19711bf445e03169
59cd90ad9834dde3d84a8ea7bc635008e0c128d5
/ch11/ex11-31.cc
60287b95da6d78d789da9db4fcd4781601c328d9
[ "MIT" ]
permissive
ts25504/Cpp-Primer
c636e13dcb17a1a482aea476646b4b0603929e2a
d1c5960f5f0ba969b766224f177f6c29c13d0d22
refs/heads/master
2021-01-01T06:12:10.914417
2015-02-20T14:15:19
2015-02-20T14:15:19
30,415,240
0
0
null
null
null
null
UTF-8
C++
false
false
893
cc
/* * Exercise 11.31: Write a program that defines a multimap of authors and their works. Use find to find an element in the multimap and erase that element. Be sure your program works correctly if the element you look for is not in the map. */ #include <map> #include <iostream> #include <string> int main() { std::multimap<std::string, std::string> authors{ {"kr", "C"}, {"mayer", "effectiveCPP"}, {"lcx", "SanTi"} }; std::string author = "lcx"; std::string work = "SanTi"; auto found = authors.find(author); auto cnt = authors.count(author); while (cnt) { if (found->second == work) { authors.erase(found); break; } ++found; --cnt; } for (const auto& author : authors) std::cout << author.first << " " << author.second << std::endl; return 0; }
[ "ts25504@163.com" ]
ts25504@163.com
4e025ee0f4d00d65e4462e6dd7260dee92faa9d5
d5ed28ca88ca026e9384fb1057570b63de3a0613
/convmatrix.h
7eebc4b7f000e98e87ca87ff52a8c9938b03689b
[]
no_license
ShevelevaA/ITOI
79e34aff7f358cb79a5ee03aefe8f4b6b8d013aa
07caf8a6ea6d490cb43b82c34313c35e5bb15fe8
refs/heads/master
2021-01-23T00:29:21.999856
2017-04-11T16:02:05
2017-04-11T16:02:05
85,738,455
0
0
null
null
null
null
UTF-8
C++
false
false
530
h
#ifndef EDITMATRIX_H #define EDITMATRIX_H #include "imageMatrix.h" #include <memory> class Convolution { public: Convolution(); ImageMatrix * sobel(ImageMatrix * imageMatrix); ImageMatrix * gaus(ImageMatrix * imageMatrix, double sigma); private: unique_ptr<double []> sobelOperator(const double * matrixX, const double * matrixY, int width, int height); unique_ptr<double []> getBlurRadius(double sigma, int dimention); int getDimentionRadius(double sigma); }; #endif // EDITMATRIX_H
[ "lenych_94@mai.ru" ]
lenych_94@mai.ru
df864705cfc141bc377bc86850238f20e139c134
af7b57e2c1da688289902b91c0c931a380efccf0
/Zanshin/Arrow/ZanshinTrackerArrow.h
6675b122bf889a7f69beaf74876b97d5ec826d6c
[]
no_license
JuanCCS/Zanshin
c4f00c1b7d059b6eb1005e8d8df04bdbc800f03a
0bf35b98f0e412d3abba5c25dd6ac997ddb3c743
refs/heads/master
2021-01-01T03:49:42.560714
2016-05-19T16:05:49
2016-05-19T16:05:49
56,642,412
1
2
null
null
null
null
UTF-8
C++
false
false
1,446
h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "Arrow/ZanshinBasicArrow.h" #include "ZanshinTrackerArrow.generated.h" /** * */ UCLASS() class ZANSHIN_API AZanshinTrackerArrow : public AZanshinBasicArrow { GENERATED_BODY() public: ////////////////////////////////////////////////////////////////////////// // Constructor AZanshinTrackerArrow(); UPROPERTY(EditAnywhere, Category = Tracker) float DeactivationDelayTracker; AZanshinCharacter* TrackedEnemy; ////////////////////////////////////////////////////////////////////////// // Components UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Particle) UParticleSystemComponent* TrackingParticleArrow; ////////////////////////////////////////////////////////////////////////// // Particle on Enemy UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Particle) UParticleSystemComponent* TrackingParticleOnEnemy; protected: void SpecialPower(AZanshinCharacter* Enemy, const FHitResult& Hit) override; void SpecialPowerHitEnvironment(const FHitResult& Hit) override; void ActivatePassivePower(AZanshinCharacter* Enemy) override; void ResetTrackerEffect(); ////////////////////////////////////////////////////////////////////////// // Timer Handles UPROPERTY(EditAnywhere, Category = Trail) FTimerHandle DeactivateTrackerTimerHandle; };
[ "juanccs@juans-mbp.vfs.local" ]
juanccs@juans-mbp.vfs.local
93054aa60324cd326bc4a7c2b66aba53bce09bac
b73383cddac335112cc1a7b13fe395fff78a38d7
/src/rpcprotocol.cpp
bf42bc84d91b9d3d5e077e7fb60ddf848d20dd29
[ "MIT" ]
permissive
CommuterCoin/CommuterCoin
b8927e83e6a68cb6ae09ea628b5929435398c53c
e568251662772f6f6f8c50ba28379be5b5a69204
refs/heads/master
2021-06-24T10:14:06.626080
2020-06-26T23:21:57
2020-06-26T23:21:57
208,345,250
2
1
MIT
2021-03-13T04:25:23
2019-09-13T20:55:45
C++
UTF-8
C++
false
false
7,750
cpp
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2013 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "rpcprotocol.h" #include "util.h" #include <stdint.h> #include <boost/algorithm/string.hpp> #include <boost/asio.hpp> #include <boost/asio/ssl.hpp> #include <boost/bind.hpp> #include <boost/filesystem.hpp> #include <boost/foreach.hpp> #include <boost/iostreams/concepts.hpp> #include <boost/iostreams/stream.hpp> #include <boost/lexical_cast.hpp> #include <boost/shared_ptr.hpp> #include "json/json_spirit_writer_template.h" using namespace std; using namespace boost; using namespace boost::asio; using namespace json_spirit; // // HTTP protocol // // This ain't Apache. We're just using HTTP header for the length field // and to be compatible with other JSON-RPC implementations. // string HTTPPost(const string& strMsg, const map<string,string>& mapRequestHeaders) { ostringstream s; s << "POST / HTTP/1.1\r\n" << "User-Agent: commutercoin-json-rpc/" << FormatFullVersion() << "\r\n" << "Host: 127.0.0.1\r\n" << "Content-Type: application/json\r\n" << "Content-Length: " << strMsg.size() << "\r\n" << "Connection: close\r\n" << "Accept: application/json\r\n"; BOOST_FOREACH(const PAIRTYPE(string, string)& item, mapRequestHeaders) s << item.first << ": " << item.second << "\r\n"; s << "\r\n" << strMsg; return s.str(); } static string rfc1123Time() { return DateTimeStrFormat("%a, %d %b %Y %H:%M:%S +0000", GetTime()); } string HTTPReply(int nStatus, const string& strMsg, bool keepalive) { if (nStatus == HTTP_UNAUTHORIZED) return strprintf("HTTP/1.0 401 Authorization Required\r\n" "Date: %s\r\n" "Server: commutercoin-json-rpc/%s\r\n" "WWW-Authenticate: Basic realm=\"jsonrpc\"\r\n" "Content-Type: text/html\r\n" "Content-Length: 296\r\n" "\r\n" "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n" "\"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd\">\r\n" "<HTML>\r\n" "<HEAD>\r\n" "<TITLE>Error</TITLE>\r\n" "<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>\r\n" "</HEAD>\r\n" "<BODY><H1>401 Unauthorized.</H1></BODY>\r\n" "</HTML>\r\n", rfc1123Time(), FormatFullVersion()); const char *cStatus; if (nStatus == HTTP_OK) cStatus = "OK"; else if (nStatus == HTTP_BAD_REQUEST) cStatus = "Bad Request"; else if (nStatus == HTTP_FORBIDDEN) cStatus = "Forbidden"; else if (nStatus == HTTP_NOT_FOUND) cStatus = "Not Found"; else if (nStatus == HTTP_INTERNAL_SERVER_ERROR) cStatus = "Internal Server Error"; else cStatus = ""; return strprintf( "HTTP/1.1 %d %s\r\n" "Date: %s\r\n" "Connection: %s\r\n" "Content-Length: %u\r\n" "Content-Type: application/json\r\n" "Server: commutercoin-json-rpc/%s\r\n" "\r\n" "%s", nStatus, cStatus, rfc1123Time(), keepalive ? "keep-alive" : "close", strMsg.size(), FormatFullVersion(), strMsg); } bool ReadHTTPRequestLine(std::basic_istream<char>& stream, int &proto, string& http_method, string& http_uri) { string str; getline(stream, str); // HTTP request line is space-delimited vector<string> vWords; boost::split(vWords, str, boost::is_any_of(" ")); if (vWords.size() < 2) return false; // HTTP methods permitted: GET, POST http_method = vWords[0]; if (http_method != "GET" && http_method != "POST") return false; // HTTP URI must be an absolute path, relative to current host http_uri = vWords[1]; if (http_uri.size() == 0 || http_uri[0] != '/') return false; // parse proto, if present string strProto = ""; if (vWords.size() > 2) strProto = vWords[2]; proto = 0; const char *ver = strstr(strProto.c_str(), "HTTP/1."); if (ver != NULL) proto = atoi(ver+7); return true; } int ReadHTTPStatus(std::basic_istream<char>& stream, int &proto) { string str; getline(stream, str); vector<string> vWords; boost::split(vWords, str, boost::is_any_of(" ")); if (vWords.size() < 2) return HTTP_INTERNAL_SERVER_ERROR; proto = 0; const char *ver = strstr(str.c_str(), "HTTP/1."); if (ver != NULL) proto = atoi(ver+7); return atoi(vWords[1].c_str()); } int ReadHTTPHeaders(std::basic_istream<char>& stream, map<string, string>& mapHeadersRet) { int nLen = 0; while (true) { string str; std::getline(stream, str); if (str.empty() || str == "\r") break; string::size_type nColon = str.find(":"); if (nColon != string::npos) { string strHeader = str.substr(0, nColon); boost::trim(strHeader); boost::to_lower(strHeader); string strValue = str.substr(nColon+1); boost::trim(strValue); mapHeadersRet[strHeader] = strValue; if (strHeader == "content-length") nLen = atoi(strValue.c_str()); } } return nLen; } int ReadHTTPMessage(std::basic_istream<char>& stream, map<string, string>& mapHeadersRet, string& strMessageRet, int nProto) { mapHeadersRet.clear(); strMessageRet = ""; // Read header int nLen = ReadHTTPHeaders(stream, mapHeadersRet); if (nLen < 0 || nLen > (int)MAX_SIZE) return HTTP_INTERNAL_SERVER_ERROR; // Read message if (nLen > 0) { vector<char> vch(nLen); stream.read(&vch[0], nLen); strMessageRet = string(vch.begin(), vch.end()); } string sConHdr = mapHeadersRet["connection"]; if ((sConHdr != "close") && (sConHdr != "keep-alive")) { if (nProto >= 1) mapHeadersRet["connection"] = "keep-alive"; else mapHeadersRet["connection"] = "close"; } return HTTP_OK; } // // JSON-RPC protocol. Bitcoin speaks version 1.0 for maximum compatibility, // but uses JSON-RPC 1.1/2.0 standards for parts of the 1.0 standard that were // unspecified (HTTP errors and contents of 'error'). // // 1.0 spec: http://json-rpc.org/wiki/specification // 1.2 spec: http://groups.google.com/group/json-rpc/web/json-rpc-over-http // http://www.codeproject.com/KB/recipes/JSON_Spirit.aspx // string JSONRPCRequest(const string& strMethod, const Array& params, const Value& id) { Object request; request.push_back(Pair("method", strMethod)); request.push_back(Pair("params", params)); request.push_back(Pair("id", id)); return write_string(Value(request), false) + "\n"; } Object JSONRPCReplyObj(const Value& result, const Value& error, const Value& id) { Object reply; if (error.type() != null_type) reply.push_back(Pair("result", Value::null)); else reply.push_back(Pair("result", result)); reply.push_back(Pair("error", error)); reply.push_back(Pair("id", id)); return reply; } string JSONRPCReply(const Value& result, const Value& error, const Value& id) { Object reply = JSONRPCReplyObj(result, error, id); return write_string(Value(reply), false) + "\n"; } Object JSONRPCError(int code, const string& message) { Object error; error.push_back(Pair("code", code)); error.push_back(Pair("message", message)); return error; }
[ "commutercoin@gmail.com" ]
commutercoin@gmail.com
1d80d6e21ad56d540d36eb8d07521e1342921d63
c90c97d71877c0a91f1593e63bf0f7ac3b11f94b
/Grid.cpp
0eb9dceee74cf71d1010d651331e77c93912a5b2
[]
no_license
poojarao8/oop_latticehydro_code
2489dedd95a2b5bb674f502d6f1f026cbd4c2f88
cc2fbec782f4cab7e05233486ff31fa9e26090b2
refs/heads/master
2020-08-05T06:29:42.466518
2020-03-06T20:43:16
2020-03-06T20:43:16
212,430,634
1
1
null
null
null
null
UTF-8
C++
false
false
344
cpp
#include "main.h" Grid::Grid(int l, int w, int h) { L = l; W = w; H = h; grid_pts = L*W*H; dx = 2*3.14/L; GL = L + 2*NGUARD; // grid containing the guard cells GW = W + 2*NGUARD; GH = H + 2*NGUARD; cout << "Grid object is being created" << endl; } Grid::~Grid(void) { cout << "Grid object is being deleted" << endl; }
[ "poojarao12@gmail.com" ]
poojarao12@gmail.com
7fec39b90712d7bc05c9b0593a7c86b8a08dacf6
45c629e4b96ca14968fb640b7eb42765a141580d
/server/ser_tcp.cpp
d49382a726203b8e70ac948afe36937d94107b21
[]
no_license
jlidder/FTPWinSock_Client_Server_App
e5d76073f56bed6eeb4094205d0741c5df1ce3de
7c1d46f86d5840570732d88c7818994dcc31def9
refs/heads/master
2021-01-16T18:06:33.853107
2013-03-25T15:36:55
2013-03-25T15:36:55
7,742,930
0
1
null
2013-02-11T16:09:41
2013-01-22T00:05:48
C++
UTF-8
C++
false
false
15,867
cpp
// SERVER TCP PROGRAM // revised and tidied up by // J.W. Atwood // 1999 June 30 // There is still some leftover trash in this code. /* send and receive codes between client and server */ /* This is your basic WINSOCK shell */ #pragma once #pragma comment( linker, "/defaultlib:ws2_32.lib" ) #include <winsock2.h> #include <ws2tcpip.h> #include <process.h> #include <winsock.h> #include <iostream> #include <stdio.h> #include <windows.h> #include <fstream> #include "aux_ser.h" #include <sstream> using namespace std; int main(void){ WSADATA wsadata; try{ if (WSAStartup(0x0202,&wsadata)!=0){ cout<<"Error in starting WSAStartup()\n"; }else{ buffer="WSAStartup was suuccessful\n"; WriteFile(test,buffer,sizeof(buffer),&dwtest,NULL); /* display the wsadata structure */ cout<< endl << "wsadata.wVersion " << wsadata.wVersion << endl << "wsadata.wHighVersion " << wsadata.wHighVersion << endl << "wsadata.szDescription " << wsadata.szDescription << endl << "wsadata.szSystemStatus " << wsadata.szSystemStatus << endl << "wsadata.iMaxSockets " << wsadata.iMaxSockets << endl << "wsadata.iMaxUdpDg " << wsadata.iMaxUdpDg << endl; } //Display info of local host gethostname(localhost,10); cout<<"hostname: "<<localhost<< endl; if((hp=gethostbyname(localhost)) == NULL) { cout << "gethostbyname() cannot get local host info?" << WSAGetLastError() << endl; exit(1); } //Create the server socket if((s = socket(AF_INET,SOCK_DGRAM,0))==INVALID_SOCKET) throw "can't initialize socket"; // For UDP protocol replace SOCK_STREAM with SOCK_DGRAM //Fill-in Server Port and Address info. sa.sin_family = AF_INET; sa.sin_port = htons(port); sa.sin_addr.s_addr = htonl(INADDR_ANY); //Bind the server port if (bind(s,(LPSOCKADDR)&sa,sizeof(sa)) == SOCKET_ERROR) throw "can't bind the socket"; cout << "Bind was successful" << endl; int sa_len = sizeof(sa); //while(1) // { //waiting to receiving handshake hndShake(); if (msgFrame.command[0] == 'l' || msgFrame.command[0]== 'L') { //STEP 1 : SEND NO. OF FILES TO CLIENT. HANDLE hFind; WIN32_FIND_DATA data; int no_of_files=0; hFind = FindFirstFile("g:\\My Documents\\Visual Studio 2012\\Projects\\Server\\Server\\*.*", &data); if (hFind != INVALID_HANDLE_VALUE) { do { printf("%s\n", data.cFileName); no_of_files++; }while (FindNextFile(hFind, &data)); FindClose(hFind); } char* no_of_files_char; std::string tempstring; std::stringstream out; out << no_of_files; sprintf(msgFrame.data,out.str().c_str()); sendNwait(); //send no of files. //STEP 3 : SEND FILE NAMES string file_start_response( reinterpret_cast< char const* >(szbuffer) ); for(int counter=0; counter<no_of_files; counter++) { hFind = FindFirstFile("g:\\My Documents\\Visual Studio 2012\\Projects\\Server\\Server\\*.*", &data); if (hFind != INVALID_HANDLE_VALUE) { do { sprintf(msgFrame.data,data.cFileName); sendNwait(); string rcvd_msg( reinterpret_cast< char const* >(msgFrame.data) ); char donelistchar[128] = "donelist"; if(strcmp(rcvd_msg.c_str(),donelistchar)) { //break; } }while (FindNextFile(hFind, &data)); FindClose(hFind); } } } else if (msgFrame.command[0] == 'g' || msgFrame.command[0] == 'G') { ifstream inFile(msgFrame.file_name, ios::in|ios::binary|ios::ate); if(inFile.is_open()) { FILE * logFile2; char name [100]; logFile2 = fopen ("log.txt","a"); ostringstream convert5; convert5 << msgFrame.file_size;// insert the textual representation of 'Number' in the characters in the stream string file_size_string = convert5.str(); // set 'Result' to the contents of the stream char file_transfer_msg[200]="File transfer initiated(GET)\n"; fprintf(logFile2,file_transfer_msg); fclose(logFile2); msgFrame.file_size = inFile.tellg(); inFile.seekg(0, ios::beg); //sending file size sendNwait(); //sending file int packet_amount = (int)ceil(((double)msgFrame.file_size/(double)PACKET_SIZE)); for(int i=1;i<=packet_amount;i++) { inFile.read(msgFrame.data,PACKET_SIZE);//read from file //send what is read sendNwait(); } FILE * logFile1; logFile1 = fopen ("log.txt","a"); ostringstream convert55; convert55 << msgFrame.file_size;// insert the textual representation of 'Number' in the characters in the stream string file_size_string1212 = convert55.str(); // set 'Result' to the contents of the stream char file_size_msg[200]="Number of Bytes Sent to Client: "; strcat(file_size_msg,file_size_string1212.c_str()); strcat(file_size_msg,"\n"); fprintf(logFile1,file_size_msg); fclose(logFile1); } else { msgFrame.file_size = -1; //sending no file found -1 sendNwait(); cout << "file doesn't exist"; } inFile.close(); }//end of Get else if (msgFrame.command[0] == 'p' || msgFrame.command[0] == 'P') { sprintf(msgFrame.data,"starttransfer"); sendNwait(); if(msgFrame.file_size <0 ) throw "file does not exist on server!"; else//receive file {//calulate packet number FILE * logFile2; char name [100]; logFile2 = fopen ("log.txt","a"); ostringstream convert5; convert5 << msgFrame.file_size;// insert the textual representation of 'Number' in the characters in the stream string file_size_string = convert5.str(); // set 'Result' to the contents of the stream char file_transfer_msg[200]="File transfer initiated(PUT)\n"; fprintf(logFile2,file_transfer_msg); fclose(logFile2); int packet_amount = (int)ceil(((double)msgFrame.file_size/PACKET_SIZE)); ofstream outFile( msgFrame.file_name, ios::binary | ios::out); for(int i=1;i<=packet_amount;i++)//needs to use select for final implementation { sendNwait(); if(i < packet_amount) { outFile.write(msgFrame.data,PACKET_SIZE); } else { int lastPacketSize = msgFrame.file_size - ((packet_amount - 1) * PACKET_SIZE); outFile.write(msgFrame.data,lastPacketSize); outFile.close(); cout<<"File is completely received"<<endl; sendNwait(); } } FILE * logFile1; logFile1 = fopen ("log.txt","a"); ostringstream convert55; convert55 << msgFrame.file_size;// insert the textual representation of 'Number' in the characters in the stream string file_size_string1212 = convert55.str(); // set 'Result' to the contents of the stream char file_size_msg[200]="Number of Bytes Downloaded to Server HDD: "; strcat(file_size_msg,file_size_string1212.c_str()); strcat(file_size_msg,"\n"); fprintf(logFile1,file_size_msg); fclose(logFile1); } } else if (msgFrame.command[0] == 'd' || msgFrame.command[0] == 'D') { string tempmsg = "send me file name!"; sprintf(msgFrame.data, tempmsg.c_str()); sendNwait(); //send no of files. //received file name boolean fSuccess = DeleteFile(TEXT(msgFrame.data)); if (!fSuccess) { // Handle the error. printf ("Delete File failed, error %d\n", GetLastError()); return (6); } else { sendNwait(); printf ("Delete File is OK!\n"); } } // }//wait loop } //try loop //Display needed error message. catch(char* str) { cerr<<str<<WSAGetLastError()<<endl;} //close server socket closesocket(s); /* When done uninstall winsock.dll (WSACleanup()) and exit */ WSACleanup(); return 0; } void hndShake() {//waits for initiation //preparing log stuff. FILE * logFile; char name [100]; logFile = fopen ("log.txt","a"); char log_msg_sending[128] = "Client: sent packet: "; char log_msg_receiving[128] = "Client: received ACK for packet: "; char log_msg_3wayhandshake[128] = "Client: 3 way handshaking beginning\n"; char log_msg_3wayhandshake_finished[128] = "Client: 3 way handshaking completed! \n"; msgFrame.client_seqNo = -1; msgFrame.server_seqNo = -1; msgFrame.client_number = -1; msgFrame.server_number = -1; if((ibytesrecv = recvfrom(s,(char*)&msgFrame,sizeof(msgFrame),0,(SOCKADDR *)&SenderAddr,&SenderAddrSize)) == SOCKET_ERROR) throw "Receive error in server program\n"; ostringstream convert5; convert5 << msgFrame.server_number;// insert the textual representation of 'Number' in the characters in the stream string pack_num_string16 = convert5.str(); // set 'Result' to the contents of the stream fprintf(logFile,strcat(log_msg_receiving,pack_num_string16.c_str())); fprintf(logFile,"\n"); fprintf(logFile,log_msg_3wayhandshake); int serverNo = rand() % 256; msgFrame.server_number =serverNo; cout<<"received "<<msgFrame.client_number<< " and sending " <<msgFrame.server_number<<endl; //making a deep copy of original values in case of resending hldFrame.client_number = msgFrame.client_number; hldFrame.server_number = msgFrame.server_number; hldFrame.client_seqNo = msgFrame.client_seqNo;hldFrame.server_seqNo=msgFrame.server_seqNo; sprintf(hldFrame.command,msgFrame.command);sprintf(hldFrame.file_name,msgFrame.file_name);hldFrame.file_size=msgFrame.file_size; memcpy(hldFrame.data,msgFrame.data,PACKET_SIZE); bool wrongPacket = false; do { char log_msg_sending[128] = "Client: sent packet: "; char log_msg_receiving[128] = "Client: received ACK for packet: "; char log_msg_3wayhandshake[128] = "Client: 3 way handshaking beginning\n"; char log_msg_3wayhandshake_finished[128] = "Client: 3 way handshaking completed! \n"; if((ibytessent = sendto(s,(char*)&msgFrame,sizeof(msgFrame),0,(SOCKADDR *)&SenderAddr, sizeof (SenderAddr)))==SOCKET_ERROR) {throw "error in send in server program\n";} //log the packet sent in log file. string pack_num_string; ostringstream convert4; convert4 << msgFrame.client_number; string pack_num_string14 = convert4.str(); fprintf(logFile,strcat(log_msg_sending,pack_num_string14.c_str())); fprintf(logFile,"\n"); struct timeval tp; tp.tv_usec =300000; tp.tv_sec=0; FD_ZERO(&readfds); //initialize FD_SET(s, &readfds); //put the socket in the set if((RetVal = select (1 , &readfds, NULL, NULL, &tp))==SOCKET_ERROR) {exit(EXIT_FAILURE);} else if(RetVal > 0) {//it now will wait for the msgFrame to begin data tranfer if((ibytesrecv = recvfrom(s,(char*) &msgFrame,sizeof(msgFrame),0, (SOCKADDR *) & SenderAddr, &SenderAddrSize)) == SOCKET_ERROR) throw "Receive failed\n"; ostringstream convert3; convert3 << msgFrame.server_number;// insert the textual representation of 'Number' in the characters in the stream string pack_num_string9 = convert3.str(); // set 'Result' to the contents of the stream fprintf(logFile,strcat(log_msg_receiving,pack_num_string9.c_str())); fprintf(logFile,"\n"); if((msgFrame.client_seqNo<0)) { //reverse msgFrame by deep copy msgFrame.client_number=hldFrame.client_number;msgFrame.server_number=hldFrame.server_number;msgFrame.client_seqNo=hldFrame.client_seqNo;msgFrame.server_seqNo=hldFrame.server_seqNo; sprintf(msgFrame.command,hldFrame.command);sprintf(msgFrame.file_name,hldFrame.file_name);msgFrame.file_size=hldFrame.file_size; memcpy(msgFrame.data,hldFrame.data,PACKET_SIZE); wrongPacket = true; // set the wrongPacket as true } else wrongPacket = false; } }while (RetVal ==0 ||wrongPacket ); msgFrame.server_seqNo = (msgFrame.server_number %2);//create server sequence number fprintf(logFile,log_msg_3wayhandshake_finished); fclose(logFile); } //Stop and Wait functions void sendNwait() {//sends and waits for reply. If time out resends FILE * logFile; char name [100]; logFile = fopen ("log.txt","a"); msgFrame.client_seqNo =(msgFrame.client_seqNo+1) %2;//increase the cleint seqNo //making a deep copy of original values in case of resending hldFrame.client_number = msgFrame.client_number; hldFrame.server_number = msgFrame.server_number; hldFrame.client_seqNo = msgFrame.client_seqNo;hldFrame.server_seqNo=msgFrame.server_seqNo; sprintf(hldFrame.command,msgFrame.command);sprintf(hldFrame.file_name,msgFrame.file_name);hldFrame.file_size=msgFrame.file_size; memcpy(hldFrame.data,msgFrame.data,PACKET_SIZE); bool wrongPacket = false;//control bool do { //waits and resends if it times out. Also resends if same packet is received if((ibytessent = sendto(s,(char*)&msgFrame,sizeof(msgFrame),0,(SOCKADDR *)&SenderAddr, sizeof (SenderAddr)))==SOCKET_ERROR) {throw "error in send in server program\n";} char log_msg_sending[128] = "Client: sent packet: "; char log_msg_receiving[128] = "Client: received ACK for packet: "; string pack_num_string; ostringstream convert2; convert2.clear(); convert2 << msgFrame.client_seqNo; string pack_num_string7 = convert2.str(); fprintf(logFile,strcat(log_msg_sending,pack_num_string7.c_str())); fprintf(logFile,"\n"); struct timeval tp; tp.tv_usec =300000;//time out tp.tv_sec=0; FD_ZERO(&readfds); //initialize FD_SET(s, &readfds); //put the socket in the set if((RetVal = select (1 , &readfds, NULL, NULL, &tp))==SOCKET_ERROR) {exit(EXIT_FAILURE);} else if(RetVal > 0) { if((ibytesrecv = recvfrom(s,(char*) &msgFrame,sizeof(msgFrame),0, (SOCKADDR *) & SenderAddr, &SenderAddrSize)) == SOCKET_ERROR) throw "Receive failed\n"; string pack_num_string; ostringstream convert1; convert1.clear(); convert1 << msgFrame.server_seqNo; string pack_num_string6 = convert1.str(); fprintf(logFile,strcat(log_msg_receiving,pack_num_string6.c_str())); fprintf(logFile,"\n"); if(hldFrame.server_seqNo == msgFrame.server_seqNo|| msgFrame.server_seqNo<0) { //reverse msgFrame by deep copy msgFrame.client_number=hldFrame.client_number;msgFrame.server_number=hldFrame.server_number;msgFrame.client_seqNo=hldFrame.client_seqNo;msgFrame.server_seqNo=hldFrame.server_seqNo; sprintf(msgFrame.command,hldFrame.command);sprintf(msgFrame.file_name,hldFrame.file_name);msgFrame.file_size=hldFrame.file_size; memcpy(msgFrame.data,hldFrame.data,PACKET_SIZE); wrongPacket = true; // set the wrongPacket as true } else wrongPacket = false; } }while (RetVal ==0 || wrongPacket); fclose(logFile); }
[ "jaspreetsinghlidder@gmail.com" ]
jaspreetsinghlidder@gmail.com
804730070fd837e03dc7066036b7f6488634c868
a3ea669e19359a3b27c1babe7ba2ed8018a19519
/libs/flake/commands/KoShapeReorderCommand.cpp
1c8ddc2d001fe663e9f238ed1e0b33ba4a27de69
[]
no_license
NavyZhao1978/QCalligra
67a5f64632528e4dcbca6b7b7d185f9984b5bb51
2eefdc843aca6ced31d4cab84742ea632d455f7f
refs/heads/master
2021-01-20T09:01:54.679815
2012-11-05T08:33:52
2012-11-05T08:33:52
4,645,434
1
0
null
null
null
null
UTF-8
C++
false
false
5,782
cpp
/* This file is part of the KDE project * Copyright (C) 2006 Thomas Zander <zander@kde.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "KoShapeReorderCommand.h" #include "KoShape.h" #include "KoShapeManager.h" #include "KoShapeContainer.h" #include "KoDebug.h" #include <limits.h> class KoShapeReorderCommandPrivate { public: KoShapeReorderCommandPrivate(const QList<KoShape*> &s, QList<int> &ni) : shapes(s), newIndexes(ni) { } QList<KoShape*> shapes; QList<int> previousIndexes; QList<int> newIndexes; }; KoShapeReorderCommand::KoShapeReorderCommand(const QList<KoShape*> &shapes, QList<int> &newIndexes, KUndo2Command *parent) : KUndo2Command(parent), d(new KoShapeReorderCommandPrivate(shapes, newIndexes)) { Q_ASSERT(shapes.count() == newIndexes.count()); foreach (KoShape *shape, shapes) d->previousIndexes.append(shape->zIndex()); setText(QObject::tr("Reorder shapes")); } KoShapeReorderCommand::~KoShapeReorderCommand() { delete d; } void KoShapeReorderCommand::redo() { KUndo2Command::redo(); for (int i = 0; i < d->shapes.count(); i++) { d->shapes.at(i)->update(); d->shapes.at(i)->setZIndex(d->newIndexes.at(i)); d->shapes.at(i)->update(); } } void KoShapeReorderCommand::undo() { KUndo2Command::undo(); for (int i = 0; i < d->shapes.count(); i++) { d->shapes.at(i)->update(); d->shapes.at(i)->setZIndex(d->previousIndexes.at(i)); d->shapes.at(i)->update(); } } static void prepare(KoShape *s, QMap<KoShape*, QList<KoShape*> > &newOrder, KoShapeManager *manager, KoShapeReorderCommand::MoveShapeType move) { KoShapeContainer *parent = s->parent(); QMap<KoShape*, QList<KoShape*> >::iterator it(newOrder.find(parent)); if (it == newOrder.end()) { QList<KoShape*> children; if (parent != 0) { children = parent->shapes(); } else { // get all toplevel shapes children = manager->topLevelShapes(); } qSort(children.begin(), children.end(), KoShape::compareShapeZIndex); // the append and prepend are needed so that the raise/lower of all shapes works as expected. children.append(0); children.prepend(0); it = newOrder.insert(parent, children); } QList<KoShape *> & shapes(newOrder[parent]); int index = shapes.indexOf(s); if (index != -1) { shapes.removeAt(index); switch (move) { case KoShapeReorderCommand::BringToFront: index = shapes.size(); break; case KoShapeReorderCommand::RaiseShape: if (index < shapes.size()) { ++index; } break; case KoShapeReorderCommand::LowerShape: if (index > 0) { --index; } break; case KoShapeReorderCommand::SendToBack: index = 0; break; } shapes.insert(index,s); } } // static KoShapeReorderCommand *KoShapeReorderCommand::createCommand(const QList<KoShape*> &shapes, KoShapeManager *manager, MoveShapeType move, KUndo2Command *parent) { QList<int> newIndexes; QList<KoShape*> changedShapes; QMap<KoShape*, QList<KoShape*> > newOrder; QList<KoShape*> sortedShapes(shapes); qSort(sortedShapes.begin(), sortedShapes.end(), KoShape::compareShapeZIndex); if (move == BringToFront || move == LowerShape) { for (int i = 0; i < sortedShapes.size(); ++i) { prepare(sortedShapes.at(i), newOrder, manager, move); } } else { for (int i = sortedShapes.size() - 1; i >= 0; --i) { prepare(sortedShapes.at(i), newOrder, manager, move); } } QMap<KoShape*, QList<KoShape*> >::iterator newIt(newOrder.begin()); for (; newIt!= newOrder.end(); ++newIt) { QList<KoShape*> order(newIt.value()); order.removeAll(0); int index = -2^13; int pos = 0; for (; pos < order.size(); ++pos) { if (order[pos]->zIndex() > index) { index = order[pos]->zIndex(); } else { break; } } if (pos == order.size()) { //nothing needs to be done continue; } else if (pos <= order.size() / 2) { // new index for the front int startIndex = order[pos]->zIndex() - pos; for (int i = 0; i < pos; ++i) { changedShapes.append(order[i]); newIndexes.append(startIndex++); } } else { //new index for the end for (int i = pos; i < order.size(); ++i) { changedShapes.append(order[i]); newIndexes.append(++index); } } } Q_ASSERT(changedShapes.count() == newIndexes.count()); return changedShapes.isEmpty() ? 0: new KoShapeReorderCommand(changedShapes, newIndexes, parent); }
[ "13851687818@163.com" ]
13851687818@163.com
2df99c4a0a946a87d14c926d7a6a238a5d14e516
6a6487cb64424d4ccdc05d3bb6607e8976517a80
/SimpleExamples/mb_fifo_example/models/Driver_pv.cpp
5b80c1fb08fd1b4318886c45d4ae6ae3593d7ca5
[]
no_license
trueman1990/VistaModels
79d933a150f80166c9062294f4725b812bb5d4fc
5766de72c844a9e14fa65cb752ea81dfd6e7c42a
refs/heads/master
2021-06-08T22:02:32.737552
2017-01-23T16:10:23
2017-01-23T16:10:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,523
cpp
/**************************************************************/ /* */ /* Copyright Mentor Graphics Corporation 2006 - 2015 */ /* All Rights Reserved */ /* */ /* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY */ /* INFORMATION WHICH IS THE PROPERTY OF MENTOR */ /* GRAPHICS CORPORATION OR ITS LICENSORS AND IS */ /* SUBJECT TO LICENSE TERMS. */ /* */ /**************************************************************/ //*< //* Generated By Model Builder, Mentor Graphics Computer Systems, Inc. //* //* This file contains the PV class for Driver. //* This is a template file: You may modify this file to implement the //* behavior of your component. //* //* Model Builder version: 4.2.1 //* Generated on: Nov. 01, 2016 10:07:36 AM, (user: markca) //*> #include "Driver_pv.h" using namespace sc_core; using namespace sc_dt; using namespace std; //constructor Driver_pv::Driver_pv(sc_module_name module_name) : Driver_pv_base(module_name) { SC_THREAD(thread); } Driver_pv::~Driver_pv() { } void Driver_pv::thread() { unsigned int value = 0x0; for(int i = 0; i < 10; i++) { cout << "DRV @ " << sc_time_stamp() << " WRITING: " << hex << value << endl; master_write(0x0, &value, 1); value++; } }
[ "mark_carey@mentor.com" ]
mark_carey@mentor.com
475ef94797b06d3f296b87cadf084926825ed4e5
e1d6417b995823e507a1e53ff81504e4bc795c8f
/gbk/server/Billing/Billing/Main/ServerManager.cpp
c89d639109d62b43954660fc7771b409d5ff5573
[]
no_license
cjmxp/pap_full
f05d9e3f9390c2820a1e51d9ad4b38fe044e05a6
1963a8a7bda5156a772ccb3c3e35219a644a1566
refs/heads/master
2020-12-02T22:50:41.786682
2013-11-15T08:02:30
2013-11-15T08:02:30
null
0
0
null
null
null
null
GB18030
C++
false
false
13,206
cpp
#include "stdafx.h" #include "ServerManager.h" #include "Config.h" #include "Log.h" #include "Config.h" #include "TimeManager.h" #include "PacketFactoryManager.h" #include "PlayerPool.h" #include "FoxWin32.h" #define ACCEPT_ONESTEP 50 ServerManager* g_pServerManager = NULL ; ServerManager::ServerManager( ) { __ENTER_FUNCTION FD_ZERO( &m_ReadFDs[SELECT_BAK] ) ; FD_ZERO( &m_WriteFDs[SELECT_BAK] ) ; FD_ZERO( &m_ExceptFDs[SELECT_BAK] ) ; m_Timeout[SELECT_BAK].tv_sec = 0; m_Timeout[SELECT_BAK].tv_usec = 0; m_MinFD = m_MaxFD = INVALID_SOCKET ; m_iFDSize = 0 ; SetActive(TRUE) ; __LEAVE_FUNCTION } ServerManager::~ServerManager( ) { __ENTER_FUNCTION SAFE_DELETE( m_pServerSocket ) ; __LEAVE_FUNCTION } BOOL ServerManager::Init( ) { __ENTER_FUNCTION //hxj m_pServerSocket = new ServerSocket( g_Config.m_BillingInfo.m_Port ) ; Assert( m_pServerSocket ) ; m_pServerSocket->setNonBlocking() ; m_SocketID = m_pServerSocket->getSOCKET() ; Assert( m_SocketID != INVALID_SOCKET ) ; FD_SET(m_SocketID , &m_ReadFDs[SELECT_BAK]); FD_SET(m_SocketID , &m_ExceptFDs[SELECT_BAK]); m_MinFD = m_MaxFD = m_SocketID; m_Timeout[SELECT_BAK].tv_sec = 0; m_Timeout[SELECT_BAK].tv_usec = 0; m_ThreadID = MyGetCurrentThreadID( ) ; for( int i=0; i<OVER_MAX_SERVER; i++ ) { m_aServerHash[i] = INVALID_ID ; } __LEAVE_FUNCTION return TRUE ; } BOOL ServerManager::Select( ) { __ENTER_FUNCTION m_Timeout[SELECT_USE].tv_sec = m_Timeout[SELECT_BAK].tv_sec; m_Timeout[SELECT_USE].tv_usec = m_Timeout[SELECT_BAK].tv_usec; m_ReadFDs[SELECT_USE] = m_ReadFDs[SELECT_BAK]; m_WriteFDs[SELECT_USE] = m_WriteFDs[SELECT_BAK]; m_ExceptFDs[SELECT_USE] = m_ExceptFDs[SELECT_BAK]; MySleep(100) ; _MY_TRY { int iRet = SocketAPI::select_ex( (int)m_MaxFD+1 , &m_ReadFDs[SELECT_USE] , &m_WriteFDs[SELECT_USE] , &m_ExceptFDs[SELECT_USE] , &m_Timeout[SELECT_USE] ) ; Assert( iRet!=SOCKET_ERROR ) ; } _MY_CATCH { g_pLog->SaveLog(BILLING_LOGFILE, "ERROR: ServerManager::Select( )..." ) ; } return TRUE ; __LEAVE_FUNCTION return FALSE ; } BOOL ServerManager::RemovePlayer( Player* pPlayer ) { __ENTER_FUNCTION BOOL ret = FALSE ; //ID_t ServerID = ((ServerPlayer*)pPlayer)->GetServerData()->m_ServerID ; //BOOL bUseShareMem = FALSE; //第一步:清除PlayerManager中的信息 ret = DelPlayer( pPlayer ) ; Assert( ret ) ; //第二步:清除PlayerPool中的信息,注意此步骤必须放在最后, //当调用此操作后,当前Player就有可能会被马上分配给新接入玩家 ((ServerPlayer*)pPlayer)->FreeOwn( ) ; //第三步:处理此服务器上玩家的状态 g_pLog->SaveLog(BILLING_LOGFILE, "ServerManager::RemovePlayer(PID:%d)...OK", pPlayer->PlayerID() ) ; return ret ; __LEAVE_FUNCTION return FALSE ; } BOOL ServerManager::ProcessInputs( ) { __ENTER_FUNCTION BOOL ret = FALSE ; if (m_MinFD == INVALID_SOCKET && m_MaxFD == INVALID_SOCKET) // no player exist { return TRUE ; } //新连接接入: if( FD_ISSET(m_SocketID,&m_ReadFDs[SELECT_USE]) ) { for( int i=0; i<ACCEPT_ONESTEP; i++ ) { if( !AcceptNewConnection() ) break; } } //数据读取 uint nPlayerCount = GetPlayerNumber() ; for( uint i=0; i<nPlayerCount; i++ ) { if( m_pPlayers[i]==INVALID_ID ) continue ; ServerPlayer* pPlayer = g_pPlayerPool->GetPlayer(m_pPlayers[i]) ; Assert( pPlayer ) ; SOCKET s = pPlayer->GetSocket()->getSOCKET() ; if( s == m_SocketID ) continue ; if( FD_ISSET( s, &m_ReadFDs[SELECT_USE] ) ) { if( pPlayer->GetSocket()->isSockError() ) {//连接出现错误 RemovePlayer( pPlayer ) ; } else {//连接正常 _MY_TRY { ret = pPlayer->ProcessInput( ) ; if( !ret ) { RemovePlayer( pPlayer ) ; } } _MY_CATCH { RemovePlayer( pPlayer ) ; } } } } return TRUE ; __LEAVE_FUNCTION return FALSE ; } BOOL ServerManager::ProcessOutputs( ) { __ENTER_FUNCTION BOOL ret = FALSE ; if (m_MinFD == INVALID_SOCKET && m_MaxFD == INVALID_SOCKET) // no player exist { return TRUE ; } //数据发送 uint nPlayerCount = GetPlayerNumber() ; for( uint i=0; i<nPlayerCount; i++ ) { if( m_pPlayers[i]==INVALID_ID ) continue ; ServerPlayer* pPlayer = g_pPlayerPool->GetPlayer(m_pPlayers[i]) ; Assert( pPlayer ) ; SOCKET s = pPlayer->GetSocket()->getSOCKET() ; if( s == m_SocketID ) continue ; if( FD_ISSET( s, &m_WriteFDs[SELECT_USE] ) ) { if( pPlayer->GetSocket()->isSockError() ) {//连接出现错误 RemovePlayer( pPlayer ) ; } else {//连接正常 _MY_TRY { ret = pPlayer->ProcessOutput( ) ; if( !ret ) { RemovePlayer( pPlayer ) ; } } _MY_CATCH { RemovePlayer( pPlayer ) ; } } } } return TRUE ; __LEAVE_FUNCTION return FALSE ; } BOOL ServerManager::ProcessExceptions( ) { __ENTER_FUNCTION if (m_MinFD == INVALID_SOCKET && m_MaxFD == INVALID_SOCKET) // no player exist { return TRUE ; } uint nPlayerCount = GetPlayerNumber() ; for( uint i=0; i<nPlayerCount; i++ ) { if( m_pPlayers[i]==INVALID_ID ) continue ; //某个玩家断开网络连接 ServerPlayer* pPlayer = g_pPlayerPool->GetPlayer(m_pPlayers[i]) ; Assert( pPlayer ) ; SOCKET s = pPlayer->GetSocket()->getSOCKET() ; if( s == m_SocketID ) {//侦听句柄出现问题,难。。。 Assert( FALSE ) ; continue ; } if( FD_ISSET( s, &m_ExceptFDs[SELECT_USE] ) ) { RemovePlayer( pPlayer ) ; } } return TRUE ; __LEAVE_FUNCTION return FALSE ; } BOOL ServerManager::ProcessCommands( ) { __ENTER_FUNCTION BOOL ret ; if (m_MinFD == INVALID_SOCKET && m_MaxFD == INVALID_SOCKET) // no player exist { return TRUE ; } uint nPlayerCount = GetPlayerNumber() ; for( uint i=0; i<nPlayerCount; i++ ) { if( m_pPlayers[i]==INVALID_ID ) continue ; ServerPlayer* pPlayer = g_pPlayerPool->GetPlayer(m_pPlayers[i]) ; Assert( pPlayer ) ; SOCKET s = pPlayer->GetSocket()->getSOCKET() ; if( s == m_SocketID ) continue ; if( pPlayer->GetSocket()->isSockError() ) {//连接出现错误 RemovePlayer( pPlayer ) ; } else {//连接正常 _MY_TRY { ret = pPlayer->ProcessCommand( FALSE ) ; if( !ret ) { RemovePlayer( pPlayer ) ; } } _MY_CATCH { RemovePlayer( pPlayer ) ; } } } return TRUE ; __LEAVE_FUNCTION return FALSE ; } BOOL ServerManager::AcceptNewConnection( ) { __ENTER_FUNCTION int iStep = 0 ; BOOL ret = FALSE ; //从玩家池中找出一个空闲的玩家数据集 ServerPlayer* client = g_pPlayerPool->NewPlayer() ; // Assert( client ) ; if( client==NULL ) return FALSE ; iStep = 5 ; client->CleanUp( ) ; int fd = INVALID_SOCKET ; iStep = 10 ; _MY_TRY { //接受客户端接入Socket句柄 ret = m_pServerSocket->accept( client->GetSocket() ) ; if( !ret ) { iStep = 15 ; goto EXCEPTION ; } } _MY_CATCH { iStep += 1000 ; goto EXCEPTION ; } _MY_TRY { iStep = 30 ; fd = (int)client->GetSocket()->getSOCKET(); if( fd == INVALID_SOCKET ) { Assert(FALSE) ; goto EXCEPTION ; } iStep = 40 ; ret = client->GetSocket()->setNonBlocking() ; if( !ret ) { Assert(FALSE) ; goto EXCEPTION ; } iStep = 50 ; if( client->GetSocket()->getSockError() ) { Assert(FALSE) ; goto EXCEPTION ; } iStep = 60 ; ret = client->GetSocket()->setLinger(0) ; if( !ret ) { Assert(FALSE) ; goto EXCEPTION ; } iStep = 70 ; //初始化基本玩家信息 client->Init( ) ; //设置当前客户端连接的状态 client->SetPlayerStatus( PS_WORLD_CONNECT ) ; iStep = 80 ; _MY_TRY { ret = AddPlayer( client ) ; if( !ret ) { Assert(FALSE) ; goto EXCEPTION ; } } _MY_CATCH { iStep += 10000 ; goto EXCEPTION ; } } _MY_CATCH { iStep += 100000 ; } g_pLog->SaveLog(BILLING_LOGFILE, "ServerManager::AcceptNewConnection(SOCKET:%d)...OK", client->GetSocket()->getSOCKET() ) ; return TRUE ; EXCEPTION: client->CleanUp() ; g_pPlayerPool->DelPlayer( client->PlayerID() ) ; return FALSE ; __LEAVE_FUNCTION return FALSE ; } BOOL ServerManager::AddPlayer( Player* pPlayer ) { __ENTER_FUNCTION if( m_iFDSize>=FD_SETSIZE ) {//已经超出能够检测的网络句柄最大数; Assert(FALSE) ; return FALSE ; } BOOL ret = PlayerManager::AddPlayer( pPlayer ) ; if( !ret ) { Assert(FALSE) ; return FALSE ; } SOCKET fd = pPlayer->GetSocket()->getSOCKET() ; Assert( fd != INVALID_SOCKET ) ; m_MinFD = min(fd , m_MinFD); m_MaxFD = max(fd , m_MaxFD); FD_SET(fd , &m_ReadFDs[SELECT_BAK]); FD_SET(fd , &m_WriteFDs[SELECT_BAK]); FD_SET(fd , &m_ExceptFDs[SELECT_BAK]); m_iFDSize++ ; return TRUE ; __LEAVE_FUNCTION return FALSE ; } BOOL ServerManager::DelPlayer( Player* pPlayer ) { __ENTER_FUNCTION ServerPlayer* pServerPlayer = (ServerPlayer*)pPlayer ; Assert( pServerPlayer ) ; SOCKET fd = pServerPlayer->GetSocket()->getSOCKET() ; Assert( m_MinFD!=INVALID_SOCKET ) ; Assert( m_MaxFD!=INVALID_SOCKET ) ; if( fd==INVALID_SOCKET ) { Assert(FALSE) ; } if( fd==m_MinFD ) { SOCKET s = m_MaxFD ; uint nPlayerCount = GetPlayerNumber() ; for( uint i=0; i<nPlayerCount; i++ ) { if( m_pPlayers[i]==INVALID_ID ) continue ; ServerPlayer* pPlayer = g_pPlayerPool->GetPlayer(m_pPlayers[i]) ; Assert( pPlayer ) ; if( pPlayer==NULL ) continue ; SOCKET temp = pPlayer->GetSocket()->getSOCKET() ; if( temp == fd ) continue ; if( temp==INVALID_SOCKET ) continue ; if( temp < s ) { s = temp ; } } if( m_MinFD == m_MaxFD ) { m_MinFD = m_MaxFD = INVALID_SOCKET ; } else { if( s > m_SocketID ) { m_MinFD = m_SocketID ; } else { m_MinFD = s ; } } } else if( fd==m_MaxFD ) { SOCKET s = m_MinFD ; uint nPlayerCount = GetPlayerNumber() ; for( uint i=0; i<nPlayerCount; i++ ) { if( m_pPlayers[i]==INVALID_ID ) continue ; ServerPlayer* pPlayer = g_pPlayerPool->GetPlayer(m_pPlayers[i]) ; Assert( pPlayer ) ; if( pPlayer==NULL ) continue ; SOCKET temp = pPlayer->GetSocket()->getSOCKET() ; if( temp == fd ) continue ; if( temp==INVALID_SOCKET ) continue ; if( temp > s ) { s = temp ; } } if( m_MaxFD == m_MinFD ) { m_MinFD = m_MaxFD = INVALID_SOCKET ; } else { if( s < m_SocketID ) { m_MaxFD = m_SocketID ; } else { m_MaxFD = s ; } } } FD_CLR(fd , &m_ReadFDs[SELECT_BAK]); FD_CLR(fd , &m_ReadFDs[SELECT_USE]); FD_CLR(fd , &m_WriteFDs[SELECT_BAK]); FD_CLR(fd , &m_WriteFDs[SELECT_USE]); FD_CLR(fd , &m_ExceptFDs[SELECT_BAK]); FD_CLR(fd , &m_ExceptFDs[SELECT_USE]); m_iFDSize-- ; Assert( m_iFDSize>=0 ) ; PlayerManager::RemovePlayer( pPlayer->PlayerID() ) ; return TRUE ; __LEAVE_FUNCTION return FALSE ; } BOOL ServerManager::HeartBeat( ) { __ENTER_FUNCTION BOOL ret ; DWORD dwTime = g_pTimeManager->CurrentTime() ; uint nPlayerCount = GetPlayerNumber() ; for( uint i=0; i<nPlayerCount; i++ ) { if( m_pPlayers[i] == INVALID_ID ) continue ; Player* pPlayer = g_pPlayerPool->GetPlayer(m_pPlayers[i]) ; if( pPlayer==NULL ) { Assert(FALSE) ; return FALSE ; } ret = pPlayer->HeartBeat( dwTime ) ; if( !ret ) {//如果逻辑操作返回失败,则需要断开当前连接 ret = RemovePlayer( pPlayer ) ; Assert( ret ) ; } } return TRUE ; __LEAVE_FUNCTION return FALSE ; } void ServerManager::RemoveAllPlayer( ) { __ENTER_FUNCTION uint nPlayerCount = GetPlayerNumber() ; for( uint i=0; i<nPlayerCount; i++ ) { if( m_pPlayers[0] == INVALID_ID ) break ; Player* pPlayer = g_pPlayerPool->GetPlayer(m_pPlayers[0]) ; if( pPlayer==NULL ) { Assert(FALSE) ; break ; } RemovePlayer( pPlayer ) ; } __LEAVE_FUNCTION } void ServerManager::Loop( ) { __ENTER_FUNCTION while( IsActive() ) { BOOL ret = FALSE ; UINT uTime = g_pTimeManager->CurrentTime() ; _MY_TRY { ret = Select( ) ; Assert( ret ) ; ret = ProcessExceptions( ) ; Assert( ret ) ; ret = ProcessInputs( ) ; Assert( ret ) ; ret = ProcessOutputs( ) ; Assert( ret ) ; } _MY_CATCH { } _MY_TRY { ret = ProcessCommands( ) ; Assert( ret ) ; } _MY_CATCH { } _MY_TRY { ret = HeartBeat( ) ; Assert( ret ) ; } _MY_CATCH { } }; __LEAVE_FUNCTION } ServerPlayer* ServerManager::GetServerPlayer( ID_t ServerID ) { __ENTER_FUNCTION Assert( ServerID>=0 && ServerID<OVER_MAX_SERVER ) ; PlayerID_t pid = m_aServerHash[ServerID] ; ServerPlayer* pServerPlayer = g_pPlayerPool->GetPlayer( pid ) ; Assert( pServerPlayer ) ; return pServerPlayer ; __LEAVE_FUNCTION return NULL ; } VOID ServerManager::BroadCast( Packet* pPacket ) { __ENTER_FUNCTION uint nPlayerCount = GetPlayerNumber() ; for( uint i=0; i<nPlayerCount; i++ ) { if( m_pPlayers[i] == INVALID_ID ) continue ; Player* pPlayer = g_pPlayerPool->GetPlayer(m_pPlayers[i]) ; if( pPlayer==NULL ) { Assert(FALSE) ; continue ; } pPlayer->SendPacket( pPacket ) ; } __LEAVE_FUNCTION }
[ "viticm@126.com" ]
viticm@126.com
87fbcda46ffdd3bb6cda2cd0304ac86816d24afc
d0c44dd3da2ef8c0ff835982a437946cbf4d2940
/cmake-build-debug/programs_tiling/function14790/function14790_schedule_6/function14790_schedule_6.cpp
6d6274c31e0f42e7f02309eedc617518af3f4a73
[]
no_license
IsraMekki/tiramisu_code_generator
8b3f1d63cff62ba9f5242c019058d5a3119184a3
5a259d8e244af452e5301126683fa4320c2047a3
refs/heads/master
2020-04-29T17:27:57.987172
2019-04-23T16:50:32
2019-04-23T16:50:32
176,297,755
1
2
null
null
null
null
UTF-8
C++
false
false
1,288
cpp
#include <tiramisu/tiramisu.h> using namespace tiramisu; int main(int argc, char **argv){ tiramisu::init("function14790_schedule_6"); constant c0("c0", 128), c1("c1", 2048), c2("c2", 256); var i0("i0", 0, c0), i1("i1", 0, c1), i2("i2", 0, c2), i01("i01"), i02("i02"), i03("i03"), i04("i04"); input input00("input00", {i2}, p_int32); input input01("input01", {i0}, p_int32); input input02("input02", {i0, i1}, p_int32); input input03("input03", {i1}, p_int32); computation comp0("comp0", {i0, i1, i2}, input00(i2) - input01(i0) * input02(i0, i1) * input03(i1)); comp0.tile(i0, i1, 64, 32, i01, i02, i03, i04); comp0.parallelize(i01); buffer buf00("buf00", {256}, p_int32, a_input); buffer buf01("buf01", {128}, p_int32, a_input); buffer buf02("buf02", {128, 2048}, p_int32, a_input); buffer buf03("buf03", {2048}, p_int32, a_input); buffer buf0("buf0", {128, 2048, 256}, p_int32, a_output); input00.store_in(&buf00); input01.store_in(&buf01); input02.store_in(&buf02); input03.store_in(&buf03); comp0.store_in(&buf0); tiramisu::codegen({&buf00, &buf01, &buf02, &buf03, &buf0}, "../data/programs/function14790/function14790_schedule_6/function14790_schedule_6.o"); return 0; }
[ "ei_mekki@esi.dz" ]
ei_mekki@esi.dz
3933fd91f3a86d36087cac4ede8c3553efa5b2f6
b2093b379cb5bbc09f44dddc84b20fceb1911b61
/src/Engine/OpenGLRHI/Desktop/OpenGLDesktop.cpp
b1bc162c31f38c9dfd7c7801ec07a171bcb2b322
[ "Apache-2.0" ]
permissive
slavidodo/game-engine
6a1afdbb30938cfcbc7b66cbc8d377eacd349e57
0be66b100648d28557b7755b4ab190e48cffce59
refs/heads/master
2020-11-29T00:48:55.893673
2020-06-24T13:45:04
2020-06-24T13:45:04
229,965,954
3
5
Apache-2.0
2020-06-24T13:45:30
2019-12-24T15:41:08
C++
UTF-8
C++
false
false
3,025
cpp
#include "pch.h" #include "OpenGLDesktop.h" #include "../OpenGLDefinitions.h" #include <GLFW/glfw3.h> struct PlatformOpenGLContext; struct PlatformOpenGLDevice; void PlatformCreateDummyWindow(PlatformOpenGLContext& Context); void PlatformReleaseOpenGLContext(PlatformOpenGLDevice* Device, PlatformOpenGLContext* Context); struct PlatformOpenGLContext { GLFWwindow* Window; GLuint VertexArrayObject; GLuint ViewportFramebuffer; }; class ContextScopedLock { public: ContextScopedLock(PlatformOpenGLContext Context) { mPreviousContext = glfwGetCurrentContext(); mSameContext = (mPreviousContext == Context.Window); glfwMakeContextCurrent(Context.Window); } ~ContextScopedLock() { if (!mSameContext) { glfwMakeContextCurrent(mPreviousContext); } } private: GLFWwindow* mPreviousContext; bool mSameContext; }; struct PlatformOpenGLDevice { PlatformOpenGLContext RenderingContext; PlatformOpenGLContext SharedContext; PlatformOpenGLDevice() { // Shared Context PlatformCreateDummyWindow(SharedContext); { ContextScopedLock ScopeLock(SharedContext); glGenVertexArrays(1, &SharedContext.VertexArrayObject); glBindVertexArray(SharedContext.VertexArrayObject); glGenFramebuffers(1, &SharedContext.ViewportFramebuffer); } // Rendering Context PlatformCreateDummyWindow(RenderingContext); { ContextScopedLock ScopeLock(RenderingContext); glGenVertexArrays(1, &RenderingContext.VertexArrayObject); glBindVertexArray(RenderingContext.VertexArrayObject); glGenFramebuffers(1, &RenderingContext.ViewportFramebuffer); } } ~PlatformOpenGLDevice() { glfwMakeContextCurrent(nullptr); PlatformReleaseOpenGLContext(this, &RenderingContext); PlatformReleaseOpenGLContext(this, &SharedContext); } }; // Public functions void PlatformCreateDummyWindow(PlatformOpenGLContext& Context) { glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); #ifdef __APPLE__ glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); #endif glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); Context.Window = glfwCreateWindow(800, 600, "", NULL, NULL); if (Context.Window == NULL) { throw std::runtime_error("(context) window creation failed"); } } void PlatformReleaseOpenGLContext(PlatformOpenGLDevice* Device, PlatformOpenGLContext* Context) { glDeleteVertexArrays(1, &Context->VertexArrayObject); glDeleteFramebuffers(1, &Context->ViewportFramebuffer); } PlatformOpenGLDevice* PlatformCreateOpenGLDevice() { return new PlatformOpenGLDevice; } OpenGLContextType PlatformOpenGLCurrentContext(PlatformOpenGLDevice* Device) { GLFWwindow* Context = glfwGetCurrentContext(); if (Context == Device->SharedContext.Window) { return OpenGLContextType::Shared; } else if (Context == Device->RenderingContext.Window) { return OpenGLContextType::Rendering; } else if (Context != NULL) { return OpenGLContextType::Other; } else { return OpenGLContextType::Invalid; } }
[ "slavidodo@gmail.com" ]
slavidodo@gmail.com
8cb46a6e9bb8eb3143e2b4616801e0cc606b03fa
018eac278e23bf4611b1b5d4aa0ac106dff8238b
/problem/SGU/152 Making round(乱搞).cpp
35a3db76fdafa04ae14fa3b7165c23f769e9bd9f
[]
no_license
qian99/acm
250294b153455913442d13bb5caed1a82cd0b9e3
4f88f34cbd6ee33476eceeeec47974c1fe2748d8
refs/heads/master
2021-01-11T17:38:56.835301
2017-01-23T15:00:46
2017-01-23T15:00:47
79,812,471
3
2
null
null
null
null
UTF-8
C++
false
false
1,534
cpp
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<algorithm> #include<map> #include<queue> #include<set> #include<stack> #include<cmath> #include<vector> #define inf 0x3f3f3f3f #define Inf 0x3FFFFFFFFFFFFFFFLL #define eps 1e-9 #define pi acos(-1.0) using namespace std; typedef long long ll; const int maxn=10000+10; struct Node { double val; int id; bool operator <(const Node &a) const { return val>a.val; } }node[maxn]; int res[maxn],num[maxn]; int dcmp(double x) { if(fabs(x)<eps) return 0; return x>0?1:-1; } int main() { //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); int n,sum=0,total=0; double tmp; scanf("%d",&n); for(int i=1;i<=n;++i) { scanf("%d",&num[i]); total+=num[i]; } for(int i=1;i<=n;++i) { if(num[i]==0) res[i]=0,node[i].val=0; else { tmp=(double)num[i]/total*100+eps; res[i]=(int)tmp; node[i].val=tmp-res[i]; } node[i].id=i; sum+=res[i]; } sum=100-sum; sort(node+1,node+n+1); int i=1; while(sum) { if(dcmp(node[i].val)==0) break; res[node[i].id]++; i++; sum--; } if(sum) { printf("No solution\n"); return 0; } printf("%d",res[1]); for(int i=2;i<=n;++i) printf(" %d",res[i]); printf("\n"); return 0; }
[ "123u@loyings-public-folder.local" ]
123u@loyings-public-folder.local
a831f0df9a359cdb559fffb3b0087b8559059a53
6408738dcb8909f9c130bfe20044e9895b2b042a
/RenderView.h
03adada613a2c66387627eea294f1f90390052d3
[]
no_license
fangchuan/AcceleratorCalculationSystem
9f47865f1809dabb3ff0deee5f282c949e694e50
af04cd0d9f4b0627a6ec1383ca19fa9fc05a6b83
refs/heads/master
2021-01-21T19:54:27.199018
2018-10-20T00:56:23
2018-10-20T00:56:23
92,176,020
1
1
null
null
null
null
GB18030
C++
false
false
5,900
h
#ifndef RenderView_H #define RenderView_H /* Qt headers */ #include <QtWidgets/QApplication> #include <QtGui/QKeyEvent> #include <QtGui/QWindow> #include <QVector3D> /* Ogre3D header */ #include <Ogre.h> /* Changed SdkCameraMan implementation to work with QKeyEvent, QMouseEvent, QWheelEvent */ #include "SdkQtCameraMan.h" namespace QtRenderView{ // #define LIGHT_NAME "MainLight" #define SCENE_CAMERA_NAME "MainCamera" #define COORDINATE_CAMERA_NAME "CoordinateCamera" //SceneNode name #define ACCEL_BOX_NAME "AccelBoxNode" #define ACCEL_CHASSIS_NAME "AccelChassisNode" #define ACCEL_CONNECT_NAME "AccelConnectNode" #define ACCEL_BEDBOARD_NAME "BedBoardNode" #define ACCEL_BED_CONNECT1_NAME "BedConnect1Node" #define ACCEL_BED_CONNECT2_NAME "BedConnect2Node" #define ACCEL_BED_STRECH_NAME "BedStrechNode" #define ACCEL_BEDBOTTOM_NAME "BedBottomNode" #define SOFT_ISOCENTER_NAME "SoftISOCenterNode" #define LASER_ISOCENTER_NAME "LaserISOCenterNode" #define LIGHT_CENTER_NAME "LightCenterNode" #define MARKER_POINT_NAME "MarkerPointNode" #define X_AXIS_NODE_NAME "XAxisNode" #define Y_AXIS_NODE_NAME "YAxisNode" #define VERTICAL_LINE_NODE_NAME "VerticalLineNode" // ManualObject name #define YAXIS_LINE_NAME "YAxis" #define XAXIS_LINE_NAME "XAxis" #define VERTICAL_LINE_NAME "VerticalLine" #define ACCEL_BOX_BIAS Ogre::Vector3(-36.0f,0.0f,0.0f) #define ACCEL_CONNECT_BIAS Ogre::Vector3(4.25f, 0.0f, 0.0f) #define ACCEL_CHASSIS_BIAS Ogre::Vector3(0.5f, 0.0f, 0.0f) #define ACCEL_BED_BOTTOM_BIAS Ogre::Vector3(9.0f, -16.0f, 0.0f) #define ACCEL_BED_STRECH_BIAS Ogre::Vector3(1.5f, 0.85f, 0.0f) #define ACCEL_BED_CONNECT2_BIAS Ogre::Vector3(0.0f, 0.7f, 0.0f) #define ACCEL_BED_CONNECT1_BIAS Ogre::Vector3(0.0f, 0.3f, 0.0f) #define ACCEL_BED_BOARD_BIAS Ogre::Vector3(-1.0f, 0.25f, 0.0f) #define BED_TRANSLATE_PROPOTATION 0.001f /* //3D SCENE COORIDNATE // //**************************** // /|\ Y _ X // | /| // | / // | / // | / // | / // | / // |/_ _ _ _ _ _ _ _ _ _ _\ Z // O / // */ enum LineStyle{ LS_SOLIDLINE = 0, LS_DOTLINE = 1, LS_RAYLINE = 2, LS_SEGEMENTLINE = 3 }; /* With the headers included we now need to inherit from QWindow. */ class RenderView : public QWindow, public Ogre::FrameListener { Q_OBJECT public: explicit RenderView(QWindow *parent = NULL); ~RenderView(); // We declare these methods virtual to allow for further inheritance. virtual void render(QPainter *painter); virtual void render(); virtual void initialize(); virtual void createScene(); #if OGRE_VERSION >= ((2 << 16) | (0 << 8) | 0) virtual void createCompositor(); #endif //复位场景 void resetScene(); // void setAnimating(bool animating); //确定等中心 void setISOCenter(const QVector3D& center); //旋转机架,degree是绝对角度,不是相对上一次的角度差 void rotateGantry(float degree); //旋转辐射头,degree是绝对角度,不是相对上一次的角度差 void rotateCollimator(float degree); //旋转CBCT,degree是绝对角度,不是相对上一次的角度差 void rotateCbct(float degree); //旋转机床,degree是绝对角度,不是相对上一次的角度差 void rotateBed(float degree); //延Z轴移动机床 void translateBedAlongZ(float z_mm); //延X轴移动机床 void translateBedAlongX(float x_mm); //延Y轴移动机床 void translateBedAlongY(float y_mm); //三维场景里的X轴对应机架旋转轴线 void drawGantryAxis(const QVector3D& start, const QVector3D& end, const QColor& color = QColor(Qt::black)); //三维场景里的Y轴对应机床旋转轴线 void drawBedAxis(const QVector3D& start, const QVector3D& end, const QColor& color = QColor(Qt::black)); //画出等中心 void drawSoftISOCenter(const double x, const double y, const double z); //画激光灯中心 void drawLaserISOCenter(const double x, const double y, const double z); //画模拟光野中心 void drawLightCenter(const double x, const double y, const double z); //画屏幕左下方的参考坐标系 void drawCoordinate(); //画出标定球位置 void drawMarkerPoint(const double x, const double y, const double z); //画两个轴线的公垂线 void drawVerticalLine(const double footA[3], const double footB[3]); public slots: virtual void renderLater(); virtual void renderNow(); // We use an event filter to be able to capture keyboard/mouse events. More on this later. virtual bool eventFilter(QObject *target, QEvent *event); signals: //Event for clicking on an entity. void entitySelected(Ogre::Entity* entity); void ISOCenterSelected(); protected: Ogre::Root* mOgreRoot; Ogre::RenderWindow* mOgreWindow; Ogre::SceneManager* mOgreSceneMgr; Ogre::SceneManager* mCorSceneMgr; Ogre::SceneNode* mOgreNode; Ogre::Camera* mOgreCamera; Ogre::ColourValue mOgreBackground; OgreQtBites::SdkQtCameraMan* mCameraMan; Ogre::SceneNode* mOgreSoftCenterNode; Ogre::SceneNode* mOgreLaserCenterNode; Ogre::SceneNode* mOgreLightCenterNode; Ogre::SceneNode* mOgreMarkerNode; bool m_update_pending; bool m_animating; virtual void keyPressEvent(QKeyEvent * ev); virtual void keyReleaseEvent(QKeyEvent * ev); virtual void mouseMoveEvent(QMouseEvent* e); virtual void wheelEvent(QWheelEvent* e); virtual void mousePressEvent(QMouseEvent* e); virtual void mouseReleaseEvent(QMouseEvent* e); virtual void exposeEvent(QExposeEvent *event); virtual bool event(QEvent *event); // FrameListener method virtual bool frameRenderingQueued(const Ogre::FrameEvent& evt); }; } #endif // RenderView_H
[ "1457737815@qq.com" ]
1457737815@qq.com
fb3e1b823e50ea43b0a4e43bf33a401dc68e55f5
be4966d25a7d8aa2aba3f44e0f459fd88b59a646
/test/unittests/api/isolate-unittest.cc
bdede4cbe3463ec47159d9d6b4888edb05f1e3ac
[ "BSD-3-Clause", "bzip2-1.0.6", "Apache-2.0", "SunPro" ]
permissive
fullyouth/v8
94a14598b1b29826381a2dc30f09f5d6fe0bbf8e
e846ad9fa5109428be50b1989314e0e4e7267919
refs/heads/master
2020-05-27T20:26:49.384097
2019-05-27T04:22:57
2019-05-27T05:04:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,911
cc
// Copyright 2017 the V8 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. #include "testing/gtest/include/gtest/gtest.h" #include "include/libplatform/libplatform.h" #include "include/v8-platform.h" #include "include/v8.h" #include "src/base/macros.h" #include "src/base/platform/semaphore.h" #include "src/base/template-utils.h" #include "src/execution/execution.h" #include "src/execution/isolate.h" #include "src/init/v8.h" #include "test/unittests/test-utils.h" namespace v8 { typedef TestWithIsolate IsolateTest; namespace { class MemoryPressureTask : public v8::Task { public: MemoryPressureTask(Isolate* isolate, base::Semaphore* semaphore) : isolate_(isolate), semaphore_(semaphore) {} ~MemoryPressureTask() override = default; // v8::Task implementation. void Run() override { isolate_->MemoryPressureNotification(MemoryPressureLevel::kCritical); semaphore_->Signal(); } private: Isolate* isolate_; base::Semaphore* semaphore_; DISALLOW_COPY_AND_ASSIGN(MemoryPressureTask); }; } // namespace // Check that triggering a memory pressure notification on the isolate thread // doesn't request a GC interrupt. TEST_F(IsolateTest, MemoryPressureNotificationForeground) { internal::Isolate* i_isolate = reinterpret_cast<internal::Isolate*>(isolate()); ASSERT_FALSE(i_isolate->stack_guard()->CheckGC()); isolate()->MemoryPressureNotification(MemoryPressureLevel::kCritical); ASSERT_FALSE(i_isolate->stack_guard()->CheckGC()); } // Check that triggering a memory pressure notification on an background thread // requests a GC interrupt. TEST_F(IsolateTest, MemoryPressureNotificationBackground) { internal::Isolate* i_isolate = reinterpret_cast<internal::Isolate*>(isolate()); base::Semaphore semaphore(0); internal::V8::GetCurrentPlatform()->CallOnWorkerThread( base::make_unique<MemoryPressureTask>(isolate(), &semaphore)); semaphore.Wait(); ASSERT_TRUE(i_isolate->stack_guard()->CheckGC()); v8::platform::PumpMessageLoop(internal::V8::GetCurrentPlatform(), isolate()); } using IncumbentContextTest = TestWithIsolate; // Check that Isolate::GetIncumbentContext() returns the correct one in basic // scenarios. TEST_F(IncumbentContextTest, Basic) { auto Str = [&](const char* s) { return String::NewFromUtf8(isolate(), s, NewStringType::kNormal) .ToLocalChecked(); }; auto Run = [&](Local<Context> context, const char* script) { Context::Scope scope(context); return Script::Compile(context, Str(script)) .ToLocalChecked() ->Run(context) .ToLocalChecked(); }; // Set up the test environment; three contexts with getIncumbentGlobal() // function. Local<FunctionTemplate> get_incumbent_global = FunctionTemplate::New( isolate(), [](const FunctionCallbackInfo<Value>& info) { Local<Context> incumbent_context = info.GetIsolate()->GetIncumbentContext(); info.GetReturnValue().Set(incumbent_context->Global()); }); Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate()); global_template->Set(Str("getIncumbentGlobal"), get_incumbent_global); Local<Context> context_a = Context::New(isolate(), nullptr, global_template); Local<Context> context_b = Context::New(isolate(), nullptr, global_template); Local<Context> context_c = Context::New(isolate(), nullptr, global_template); Local<Object> global_a = context_a->Global(); Local<Object> global_b = context_b->Global(); Local<Object> global_c = context_c->Global(); Local<String> security_token = Str("security_token"); context_a->SetSecurityToken(security_token); context_b->SetSecurityToken(security_token); context_c->SetSecurityToken(security_token); global_a->Set(context_a, Str("b"), global_b).ToChecked(); global_b->Set(context_b, Str("c"), global_c).ToChecked(); // Test scenario 2: A -> B -> C, then the incumbent is C. Run(context_a, "funcA = function() { return b.funcB(); }"); Run(context_b, "funcB = function() { return c.getIncumbentGlobal(); }"); // Without BackupIncumbentScope. EXPECT_EQ(global_b, Run(context_a, "funcA()")); { // With BackupIncumbentScope. Context::BackupIncumbentScope backup_incumbent(context_a); EXPECT_EQ(global_b, Run(context_a, "funcA()")); } // Test scenario 2: A -> B -> C -> C, then the incumbent is C. Run(context_a, "funcA = function() { return b.funcB(); }"); Run(context_b, "funcB = function() { return c.funcC(); }"); Run(context_c, "funcC = function() { return getIncumbentGlobal(); }"); // Without BackupIncumbentScope. EXPECT_EQ(global_c, Run(context_a, "funcA()")); { // With BackupIncumbentScope. Context::BackupIncumbentScope backup_incumbent(context_a); EXPECT_EQ(global_c, Run(context_a, "funcA()")); } } } // namespace v8
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
83801af816ec1c215e574b6f460b5f5ca5d3871b
e79a4fb59ead906489e8c8a0457407d4f559604f
/tests/AddressTests.h
5916d4f41ae952c6a0e00fbcc2bec16550c3aff4
[]
no_license
Furkanzmc/QStripe
034cc7c26711debdd38bdcbaa5fbed5ce8a27307
7b77c0bd5620a4df3a665755bff9cfb3ec1b9a75
refs/heads/master
2021-04-03T07:25:49.561526
2019-04-09T22:23:44
2019-04-22T20:48:52
124,796,188
6
0
null
null
null
null
UTF-8
C++
false
false
438
h
#pragma once #include <QObject> class AddressTests : public QObject { Q_OBJECT public: explicit AddressTests(QObject *parent = nullptr); private: QVariantMap getAddressData() const; private slots: void testAddressEquals(); void testAddressNotEquals(); void testAddressChangeSignals(); void testAddressFromJson(); void testAddressSet(); void testAddressJsonString(); void testAddressJson(); };
[ "furkanuzumcu@gmail.com" ]
furkanuzumcu@gmail.com
5b61bac479b15873918327219b11d0ebb27a3251
4208e553a243a386ed41a093a515632e4bedebc6
/answer_2.cpp
8e90edd4c778cf05b22fe48ccd9deea4aa6bf185
[]
no_license
lightningwar/c_ImageProcessing100Wen
ad39611528c693d834cc118b446de56ba2aaaeab
7e16755c544be117911cd09e1008b41d10e6c832
refs/heads/master
2022-12-03T12:06:55.737562
2020-08-23T06:30:40
2020-08-23T06:30:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
908
cpp
// // Created by YunShao on 2020/7/12. // 灰度化 // 灰度图像即图像3通道不同权重的值 // #include <opencv2/core.hpp> #include <opencv2/highgui.hpp> #include <iostream> using namespace cv; //todo gpu如何加速 Mat BGR2GRAY(Mat img) { int width = img.cols, height = img.rows; Mat out = Mat::zeros(height,width,CV_8UC1); for(int y=0;y<height;y++){ for(int x=0;x<width;x++){ out.at<uchar>(y,x) = 0.216 * (float) img.at<Vec3b>(y,x)[2] + 0.7152 * (float)img.at<Vec3b>(y,x)[1] + 0.0722 * (float)img.at<cv::Vec3b>(y, x)[0]; } } return out; } int main(int argc, const char* argv[]){ // read image cv::Mat img = cv::imread("../imori.jpg", cv::IMREAD_COLOR); // BGR -> Gray cv::Mat out = BGR2GRAY(img); //cv::imwrite("out.jpg", out); cv::imwrite("sample.jpg", out); return 0; }
[ "yunshao" ]
yunshao
426d93eaa55bcb13b9a287cc14c09d524f90ee4a
a1087d21429b052cb2263087e6df730169b0bed8
/TorusFluid/OnCleanup.cpp
7993efff2ed60ccb2ff533aac6a9fd6a1d5f82da
[]
no_license
ellishg/TorusFluid
577aac3c60bb954adaad203c32673a63f9db1044
8f2f6ea68ca25cb8e50eed0cbd479ee6b37b26c8
refs/heads/master
2021-06-07T12:13:47.452943
2015-10-15T21:58:31
2015-10-15T21:58:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
492
cpp
// // OnInit.cpp // // // Created by Ellis Sparky Hoag on 6/15/14. // // #include "World.h" bool World::OnCleanup() { delete torus; delete fluid; glDeleteBuffers(1, &torusVertexBufferObject); glDeleteBuffers(1, &torusIndexBufferObject); glDeleteBuffers(1, &torusTextureObject); delete [] torusTextureData; SDL_DestroyWindow(SDLWindow); SDL_GL_DeleteContext(GLContext); SDL_Quit(); return true; }
[ "ellis.sparky.hoag@gmail.com" ]
ellis.sparky.hoag@gmail.com
7dab16cb10512c44a0f7c0e9b7a2daeefd9009c0
1fccc3615b400a119e43ee85d10b739430ee17d4
/include/ozo/impl/result.h
4abae6224a8ab867bad67622aa9bc28020324e63
[]
permissive
yandex/ozo
c34de66e75dc8c11ed211e933149c498966cb272
abb098aea4b992b6d06391f892e100d829e50188
refs/heads/master
2023-03-20T07:40:24.181802
2023-03-10T07:33:30
2023-03-10T11:40:08
106,461,599
229
48
PostgreSQL
2023-03-10T11:40:09
2017-10-10T19:24:45
C++
UTF-8
C++
false
false
2,654
h
#pragma once #include <ozo/pg/handle.h> #include <ozo/type_traits.h> #include <libpq-fe.h> namespace ozo::impl { enum class result_format : int { text = 0, binary = 1, }; namespace pq { inline oid_t pq_field_type(const PGresult& res, int column) noexcept { return PQftype(std::addressof(res), column); } inline result_format pq_field_format(const PGresult& res, int column) noexcept { return static_cast<result_format>(PQfformat(std::addressof(res), column)); } inline const char* pq_get_value(const PGresult& res, int row, int column) noexcept { return PQgetvalue(std::addressof(res), row, column); } inline std::size_t pq_get_length(const PGresult& res, int row, int column) noexcept { return static_cast<std::size_t>(PQgetlength(std::addressof(res), row, column)); } inline bool pq_get_isnull(const PGresult& res, int row, int column) noexcept { return PQgetisnull(std::addressof(res), row, column); } inline int pq_field_number(const PGresult& res, const char* name) noexcept { return PQfnumber(std::addressof(res), name); } inline int pq_nfields(const PGresult& res) noexcept { return PQnfields(std::addressof(res)); } inline int pq_ntuples(const PGresult& res) noexcept { return PQntuples(std::addressof(res)); } } // namespace pq template <typename T> inline oid_t field_type(T&& res, int column) noexcept { using pq::pq_field_type; return pq_field_type(std::forward<T>(res), column); } template <typename T> inline result_format field_format(T&& res, int column) noexcept { using pq::pq_field_format; return pq_field_format(std::forward<T>(res), column); } template <typename T> inline const char* get_value(T&& res, int row, int column) noexcept { using pq::pq_get_value; return pq_get_value(std::forward<T>(res), row, column); } template <typename T> inline std::size_t get_length(T&& res, int row, int column) noexcept { using pq::pq_get_length; return pq_get_length(std::forward<T>(res), row, column); } template <typename T> inline bool get_isnull(T&& res, int row, int column) noexcept { using pq::pq_get_isnull; return pq_get_isnull(std::forward<T>(res), row, column); } template <typename T> inline int field_number(T&& res, const char* name) noexcept { using pq::pq_field_number; return pq_field_number(std::forward<T>(res), name); } template <typename T> inline int nfields(T&& res) noexcept { using pq::pq_nfields; return pq_nfields(std::forward<T>(res)); } template <typename T> inline int ntuples(T&& res) noexcept { using pq::pq_ntuples; return pq_ntuples(std::forward<T>(res)); } } // namespace ozo::impl
[ "orionstation@yandex.ru" ]
orionstation@yandex.ru
4f8c964ad760ff739842069a72dc266ff128b153
a82aa98d0fbfe4af649592ca8b59aaed35f74925
/codeforces/1027 - Educational Codeforces Round 49 (Rated for Div. 2)/a.cpp
006658af119910cd3281783493be0655725d572a
[]
no_license
mrtakata/competitive-programming
17693d870170dee70537c35aa5afb6360c97f3a9
78d84acef766599fe042f19e2785bf7a6a620e2b
refs/heads/master
2022-08-19T05:27:24.074623
2022-07-22T20:31:22
2022-07-22T20:31:22
170,547,443
0
0
null
null
null
null
UTF-8
C++
false
false
667
cpp
#include <bits/stdc++.h> using namespace std; // define macros #define ll long long int bool isPalindrome(string s){ for(int i = 0; i <= s.size()/2; i++){ char begin = s[i], end = s[s.size()-1-i]; if(abs(end - begin) > 0 && abs(end - begin) != 2){ return false; } } return true; } int main(){ cin.tie(0); ios_base::sync_with_stdio(0); int n; cin >> n; for(int i = 0; i < n; i++){ int len; string s; cin >> len >> s; if(isPalindrome(s)){ cout << "YES" << endl; } else{ cout << "NO" << endl; } } return 0; }
[ "matheus.takata@gmail.com" ]
matheus.takata@gmail.com
42211b58e6f15f944e7b2f952f4a0e0fe4c376da
55d560fe6678a3edc9232ef14de8fafd7b7ece12
/libs/wave/samples/list_includes/lexertl/lexertl_lexer.hpp
2ecd94b5b2f87b0f5f77dd434ddcf2c373b41217
[ "BSL-1.0" ]
permissive
stardog-union/boost
ec3abeeef1b45389228df031bf25b470d3d123c5
caa4a540db892caa92e5346e0094c63dea51cbfb
refs/heads/stardog/develop
2021-06-25T02:15:10.697006
2020-11-17T19:50:35
2020-11-17T19:50:35
148,681,713
0
0
BSL-1.0
2020-11-17T19:50:36
2018-09-13T18:38:54
C++
UTF-8
C++
false
false
32,651
hpp
/*============================================================================= Boost.Wave: A Standard compliant C++ preprocessor library http://www.boost.org/ Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #if !defined(BOOST_WAVE_LEXERTL_LEXER_HPP_INCLUDED) #define BOOST_WAVE_LEXERTL_LEXER_HPP_INCLUDED #include <fstream> #include <boost/iterator/iterator_traits.hpp> #include <boost/wave/wave_config.hpp> #include <boost/wave/language_support.hpp> #include <boost/wave/token_ids.hpp> #include <boost/wave/util/time_conversion_helper.hpp> #include <boost/wave/cpplexer/validate_universal_char.hpp> #include <boost/wave/cpplexer/convert_trigraphs.hpp> #include <boost/wave/cpplexer/cpplexer_exceptions.hpp> #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0 #include <boost/wave/cpplexer/detect_include_guards.hpp> #endif #include "wave_lexertl_config.hpp" #include "../lexertl_iterator.hpp" #if BOOST_WAVE_LEXERTL_USE_STATIC_TABLES != 0 #include "wave_lexertl_tables.hpp" #else #include <boost/spirit/home/support/detail/lexer/generator.hpp> #include <boost/spirit/home/support/detail/lexer/rules.hpp> #include <boost/spirit/home/support/detail/lexer/state_machine.hpp> #include <boost/spirit/home/support/detail/lexer/consts.hpp> //#include "lexertl/examples/serialise.hpp> // #if BOOST_WAVE_LEXERTL_GENERATE_CPP_CODE != 0 // #include "lexertl/examples/cpp_code.hpp" // #endif #endif /////////////////////////////////////////////////////////////////////////////// namespace boost { namespace wave { namespace cpplexer { namespace lexertl { #if BOOST_WAVE_LEXERTL_USE_STATIC_TABLES == 0 /////////////////////////////////////////////////////////////////////////////// // The following numbers are the array sizes of the token regex's which we // need to specify to make the CW compiler happy (at least up to V9.5). #if BOOST_WAVE_SUPPORT_MS_EXTENSIONS != 0 #define INIT_DATA_SIZE 176 #else #define INIT_DATA_SIZE 159 #endif #define INIT_DATA_CPP_SIZE 15 #define INIT_DATA_PP_NUMBER_SIZE 2 #define INIT_MACRO_DATA_SIZE 27 #endif // #if BOOST_WAVE_LEXERTL_USE_STATIC_TABLES == 0 // this is just a hack to have a unique token id not otherwise used by Wave #define T_ANYCTRL T_LAST_TOKEN_ID /////////////////////////////////////////////////////////////////////////////// namespace lexer { /////////////////////////////////////////////////////////////////////////////// // this is the wrapper for the lexertl lexer library template <typename Iterator, typename Position> class lexertl { private: typedef BOOST_WAVE_STRINGTYPE string_type; typedef typename boost::detail::iterator_traits<Iterator>::value_type char_type; public: wave::token_id next_token(Iterator &first, Iterator const &last, string_type& token_value); #if BOOST_WAVE_LEXERTL_USE_STATIC_TABLES != 0 lexertl() {} void init_dfa(wave::language_support lang, Position const& pos, bool force_reinit = false) {} bool is_initialized() const { return true; } #else lexertl() : has_compiled_dfa_(false) {} bool init_dfa(wave::language_support lang, Position const& pos, bool force_reinit = false); bool is_initialized() const { return has_compiled_dfa_; } // get time of last compilation static std::time_t get_compilation_time() { return compilation_time.get_time(); } bool load (std::istream& instrm); bool save (std::ostream& outstrm); private: boost::lexer::state_machine state_machine_; bool has_compiled_dfa_; // initialization data (regular expressions for the token definitions) struct lexer_macro_data { char_type const *name; // macro name char_type const *macro; // associated macro definition }; static lexer_macro_data const init_macro_data[INIT_MACRO_DATA_SIZE]; // macro patterns struct lexer_data { token_id tokenid; // token data char_type const *tokenregex; // associated token to match }; static lexer_data const init_data[INIT_DATA_SIZE]; // common patterns static lexer_data const init_data_cpp[INIT_DATA_CPP_SIZE]; // C++ only patterns static lexer_data const init_data_pp_number[INIT_DATA_PP_NUMBER_SIZE]; // pp-number only patterns // helper for calculation of the time of last compilation static boost::wave::util::time_conversion_helper compilation_time; #endif // #if BOOST_WAVE_LEXERTL_USE_STATIC_TABLES == 0 }; #if BOOST_WAVE_LEXERTL_USE_STATIC_TABLES == 0 /////////////////////////////////////////////////////////////////////////////// // get time of last compilation of this file template <typename IteratorT, typename PositionT> boost::wave::util::time_conversion_helper lexertl<IteratorT, PositionT>::compilation_time(__DATE__ " " __TIME__); /////////////////////////////////////////////////////////////////////////////// // token regex definitions // helper for initializing token data and macro definitions #define Q(c) "\\" c #define TRI(c) "{TRI}" c #define OR "|" #define MACRO_DATA(name, macro) { name, macro } #define TOKEN_DATA(id, regex) { id, regex } // lexertl macro definitions template <typename Iterator, typename Position> typename lexertl<Iterator, Position>::lexer_macro_data const lexertl<Iterator, Position>::init_macro_data[INIT_MACRO_DATA_SIZE] = { MACRO_DATA("ANY", "[\t\v\f\r\n\\040-\\377]"), MACRO_DATA("ANYCTRL", "[\\000-\\037]"), MACRO_DATA("TRI", "\\?\\?"), MACRO_DATA("BLANK", "[ \t\v\f]"), MACRO_DATA("CCOMMENT", "\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/"), MACRO_DATA("PPSPACE", "(" "{BLANK}" OR "{CCOMMENT}" ")*"), MACRO_DATA("OCTALDIGIT", "[0-7]"), MACRO_DATA("DIGIT", "[0-9]"), MACRO_DATA("HEXDIGIT", "[0-9a-fA-F]"), MACRO_DATA("OPTSIGN", "[-+]?"), MACRO_DATA("EXPSTART", "[eE][-+]"), MACRO_DATA("EXPONENT", "([eE]{OPTSIGN}{DIGIT}+)"), MACRO_DATA("NONDIGIT", "[a-zA-Z_]"), MACRO_DATA("INTEGER", "(" "(0x|0X){HEXDIGIT}+" OR "0{OCTALDIGIT}*" OR "[1-9]{DIGIT}*" ")"), MACRO_DATA("INTEGER_SUFFIX", "(" "[uU][lL]?" OR "[lL][uU]?" ")"), #if BOOST_WAVE_SUPPORT_MS_EXTENSIONS != 0 MACRO_DATA("LONGINTEGER_SUFFIX", "([uU]([lL][lL])|([lL][lL])[uU]?|i64)"), #else MACRO_DATA("LONGINTEGER_SUFFIX", "([uU]([lL][lL])|([lL][lL])[uU]?)"), #endif MACRO_DATA("FLOAT_SUFFIX", "(" "[fF][lL]?" OR "[lL][fF]?" ")"), MACRO_DATA("CHAR_SPEC", "L?"), MACRO_DATA("BACKSLASH", "(" Q("\\") OR TRI(Q("/")) ")"), MACRO_DATA("ESCAPESEQ", "{BACKSLASH}([abfnrtv?'\"]|{BACKSLASH}|x{HEXDIGIT}+|{OCTALDIGIT}{1,3})"), MACRO_DATA("HEXQUAD", "{HEXDIGIT}{4}"), MACRO_DATA("UNIVERSALCHAR", "{BACKSLASH}(u{HEXQUAD}|U{HEXQUAD}{2})"), MACRO_DATA("POUNDDEF", "(" "#" OR TRI("=") OR Q("%:") ")"), MACRO_DATA("NEWLINEDEF", "(" "\\n" OR "\\r" OR "\\r\\n" ")"), #if BOOST_WAVE_SUPPORT_INCLUDE_NEXT != 0 MACRO_DATA("INCLUDEDEF", "(include|include_next)"), #else MACRO_DATA("INCLUDEDEF", "include"), #endif MACRO_DATA("PP_NUMBERDEF", "\\.?{DIGIT}({DIGIT}|{NONDIGIT}|{EXPSTART}|\\.)*"), MACRO_DATA(NULL, NULL) // should be the last entry }; // common C++/C99 token definitions template <typename Iterator, typename Position> typename lexertl<Iterator, Position>::lexer_data const lexertl<Iterator, Position>::init_data[INIT_DATA_SIZE] = { TOKEN_DATA(T_AND, "&"), TOKEN_DATA(T_ANDAND, "&&"), TOKEN_DATA(T_ASSIGN, "="), TOKEN_DATA(T_ANDASSIGN, "&="), TOKEN_DATA(T_OR, Q("|")), TOKEN_DATA(T_OR_TRIGRAPH, "{TRI}!"), TOKEN_DATA(T_ORASSIGN, Q("|=")), TOKEN_DATA(T_ORASSIGN_TRIGRAPH, "{TRI}!="), TOKEN_DATA(T_XOR, Q("^")), TOKEN_DATA(T_XOR_TRIGRAPH, "{TRI}'"), TOKEN_DATA(T_XORASSIGN, Q("^=")), TOKEN_DATA(T_XORASSIGN_TRIGRAPH, "{TRI}'="), TOKEN_DATA(T_COMMA, ","), TOKEN_DATA(T_COLON, ":"), TOKEN_DATA(T_DIVIDEASSIGN, Q("/=")), TOKEN_DATA(T_DIVIDE, Q("/")), TOKEN_DATA(T_DOT, Q(".")), TOKEN_DATA(T_ELLIPSIS, Q(".") "{3}"), TOKEN_DATA(T_EQUAL, "=="), TOKEN_DATA(T_GREATER, ">"), TOKEN_DATA(T_GREATEREQUAL, ">="), TOKEN_DATA(T_LEFTBRACE, Q("{")), TOKEN_DATA(T_LEFTBRACE_ALT, "<" Q("%")), TOKEN_DATA(T_LEFTBRACE_TRIGRAPH, "{TRI}<"), TOKEN_DATA(T_LESS, "<"), TOKEN_DATA(T_LESSEQUAL, "<="), TOKEN_DATA(T_LEFTPAREN, Q("(")), TOKEN_DATA(T_LEFTBRACKET, Q("[")), TOKEN_DATA(T_LEFTBRACKET_ALT, "<:"), TOKEN_DATA(T_LEFTBRACKET_TRIGRAPH, "{TRI}" Q("(")), TOKEN_DATA(T_MINUS, Q("-")), TOKEN_DATA(T_MINUSASSIGN, Q("-=")), TOKEN_DATA(T_MINUSMINUS, Q("-") "{2}"), TOKEN_DATA(T_PERCENT, Q("%")), TOKEN_DATA(T_PERCENTASSIGN, Q("%=")), TOKEN_DATA(T_NOT, "!"), TOKEN_DATA(T_NOTEQUAL, "!="), TOKEN_DATA(T_OROR, Q("|") "{2}"), TOKEN_DATA(T_OROR_TRIGRAPH, "{TRI}!\\||\\|{TRI}!|{TRI}!{TRI}!"), TOKEN_DATA(T_PLUS, Q("+")), TOKEN_DATA(T_PLUSASSIGN, Q("+=")), TOKEN_DATA(T_PLUSPLUS, Q("+") "{2}"), TOKEN_DATA(T_ARROW, Q("->")), TOKEN_DATA(T_QUESTION_MARK, Q("?")), TOKEN_DATA(T_RIGHTBRACE, Q("}")), TOKEN_DATA(T_RIGHTBRACE_ALT, Q("%>")), TOKEN_DATA(T_RIGHTBRACE_TRIGRAPH, "{TRI}>"), TOKEN_DATA(T_RIGHTPAREN, Q(")")), TOKEN_DATA(T_RIGHTBRACKET, Q("]")), TOKEN_DATA(T_RIGHTBRACKET_ALT, ":>"), TOKEN_DATA(T_RIGHTBRACKET_TRIGRAPH, "{TRI}" Q(")")), TOKEN_DATA(T_SEMICOLON, ";"), TOKEN_DATA(T_SHIFTLEFT, "<<"), TOKEN_DATA(T_SHIFTLEFTASSIGN, "<<="), TOKEN_DATA(T_SHIFTRIGHT, ">>"), TOKEN_DATA(T_SHIFTRIGHTASSIGN, ">>="), TOKEN_DATA(T_STAR, Q("*")), TOKEN_DATA(T_COMPL, Q("~")), TOKEN_DATA(T_COMPL_TRIGRAPH, "{TRI}-"), TOKEN_DATA(T_STARASSIGN, Q("*=")), TOKEN_DATA(T_ASM, "asm"), TOKEN_DATA(T_AUTO, "auto"), TOKEN_DATA(T_BOOL, "bool"), TOKEN_DATA(T_FALSE, "false"), TOKEN_DATA(T_TRUE, "true"), TOKEN_DATA(T_BREAK, "break"), TOKEN_DATA(T_CASE, "case"), TOKEN_DATA(T_CATCH, "catch"), TOKEN_DATA(T_CHAR, "char"), TOKEN_DATA(T_CLASS, "class"), TOKEN_DATA(T_CONST, "const"), TOKEN_DATA(T_CONSTCAST, "const_cast"), TOKEN_DATA(T_CONTINUE, "continue"), TOKEN_DATA(T_DEFAULT, "default"), TOKEN_DATA(T_DELETE, "delete"), TOKEN_DATA(T_DO, "do"), TOKEN_DATA(T_DOUBLE, "double"), TOKEN_DATA(T_DYNAMICCAST, "dynamic_cast"), TOKEN_DATA(T_ELSE, "else"), TOKEN_DATA(T_ENUM, "enum"), TOKEN_DATA(T_EXPLICIT, "explicit"), TOKEN_DATA(T_EXPORT, "export"), TOKEN_DATA(T_EXTERN, "extern"), TOKEN_DATA(T_FLOAT, "float"), TOKEN_DATA(T_FOR, "for"), TOKEN_DATA(T_FRIEND, "friend"), TOKEN_DATA(T_GOTO, "goto"), TOKEN_DATA(T_IF, "if"), TOKEN_DATA(T_INLINE, "inline"), TOKEN_DATA(T_INT, "int"), TOKEN_DATA(T_LONG, "long"), TOKEN_DATA(T_MUTABLE, "mutable"), TOKEN_DATA(T_NAMESPACE, "namespace"), TOKEN_DATA(T_NEW, "new"), TOKEN_DATA(T_OPERATOR, "operator"), TOKEN_DATA(T_PRIVATE, "private"), TOKEN_DATA(T_PROTECTED, "protected"), TOKEN_DATA(T_PUBLIC, "public"), TOKEN_DATA(T_REGISTER, "register"), TOKEN_DATA(T_REINTERPRETCAST, "reinterpret_cast"), TOKEN_DATA(T_RETURN, "return"), TOKEN_DATA(T_SHORT, "short"), TOKEN_DATA(T_SIGNED, "signed"), TOKEN_DATA(T_SIZEOF, "sizeof"), TOKEN_DATA(T_STATIC, "static"), TOKEN_DATA(T_STATICCAST, "static_cast"), TOKEN_DATA(T_STRUCT, "struct"), TOKEN_DATA(T_SWITCH, "switch"), TOKEN_DATA(T_TEMPLATE, "template"), TOKEN_DATA(T_THIS, "this"), TOKEN_DATA(T_THROW, "throw"), TOKEN_DATA(T_TRY, "try"), TOKEN_DATA(T_TYPEDEF, "typedef"), TOKEN_DATA(T_TYPEID, "typeid"), TOKEN_DATA(T_TYPENAME, "typename"), TOKEN_DATA(T_UNION, "union"), TOKEN_DATA(T_UNSIGNED, "unsigned"), TOKEN_DATA(T_USING, "using"), TOKEN_DATA(T_VIRTUAL, "virtual"), TOKEN_DATA(T_VOID, "void"), TOKEN_DATA(T_VOLATILE, "volatile"), TOKEN_DATA(T_WCHART, "wchar_t"), TOKEN_DATA(T_WHILE, "while"), TOKEN_DATA(T_PP_DEFINE, "{POUNDDEF}{PPSPACE}define"), TOKEN_DATA(T_PP_IF, "{POUNDDEF}{PPSPACE}if"), TOKEN_DATA(T_PP_IFDEF, "{POUNDDEF}{PPSPACE}ifdef"), TOKEN_DATA(T_PP_IFNDEF, "{POUNDDEF}{PPSPACE}ifndef"), TOKEN_DATA(T_PP_ELSE, "{POUNDDEF}{PPSPACE}else"), TOKEN_DATA(T_PP_ELIF, "{POUNDDEF}{PPSPACE}elif"), TOKEN_DATA(T_PP_ENDIF, "{POUNDDEF}{PPSPACE}endif"), TOKEN_DATA(T_PP_ERROR, "{POUNDDEF}{PPSPACE}error"), TOKEN_DATA(T_PP_QHEADER, "{POUNDDEF}{PPSPACE}{INCLUDEDEF}{PPSPACE}" Q("\"") "[^\\n\\r\"]+" Q("\"")), TOKEN_DATA(T_PP_HHEADER, "{POUNDDEF}{PPSPACE}{INCLUDEDEF}{PPSPACE}" "<" "[^\\n\\r>]+" ">"), TOKEN_DATA(T_PP_INCLUDE, "{POUNDDEF}{PPSPACE}{INCLUDEDEF}{PPSPACE}"), TOKEN_DATA(T_PP_LINE, "{POUNDDEF}{PPSPACE}line"), TOKEN_DATA(T_PP_PRAGMA, "{POUNDDEF}{PPSPACE}pragma"), TOKEN_DATA(T_PP_UNDEF, "{POUNDDEF}{PPSPACE}undef"), TOKEN_DATA(T_PP_WARNING, "{POUNDDEF}{PPSPACE}warning"), #if BOOST_WAVE_SUPPORT_MS_EXTENSIONS != 0 TOKEN_DATA(T_MSEXT_INT8, "__int8"), TOKEN_DATA(T_MSEXT_INT16, "__int16"), TOKEN_DATA(T_MSEXT_INT32, "__int32"), TOKEN_DATA(T_MSEXT_INT64, "__int64"), TOKEN_DATA(T_MSEXT_BASED, "_?" "_based"), TOKEN_DATA(T_MSEXT_DECLSPEC, "_?" "_declspec"), TOKEN_DATA(T_MSEXT_CDECL, "_?" "_cdecl"), TOKEN_DATA(T_MSEXT_FASTCALL, "_?" "_fastcall"), TOKEN_DATA(T_MSEXT_STDCALL, "_?" "_stdcall"), TOKEN_DATA(T_MSEXT_TRY , "__try"), TOKEN_DATA(T_MSEXT_EXCEPT, "__except"), TOKEN_DATA(T_MSEXT_FINALLY, "__finally"), TOKEN_DATA(T_MSEXT_LEAVE, "__leave"), TOKEN_DATA(T_MSEXT_INLINE, "_?" "_inline"), TOKEN_DATA(T_MSEXT_ASM, "_?" "_asm"), TOKEN_DATA(T_MSEXT_PP_REGION, "{POUNDDEF}{PPSPACE}region"), TOKEN_DATA(T_MSEXT_PP_ENDREGION, "{POUNDDEF}{PPSPACE}endregion"), #endif // BOOST_WAVE_SUPPORT_MS_EXTENSIONS != 0 TOKEN_DATA(T_LONGINTLIT, "{INTEGER}{LONGINTEGER_SUFFIX}"), TOKEN_DATA(T_INTLIT, "{INTEGER}{INTEGER_SUFFIX}?"), TOKEN_DATA(T_FLOATLIT, "(" "{DIGIT}*" Q(".") "{DIGIT}+" OR "{DIGIT}+" Q(".") "){EXPONENT}?{FLOAT_SUFFIX}?" OR "{DIGIT}+{EXPONENT}{FLOAT_SUFFIX}?"), #if BOOST_WAVE_USE_STRICT_LEXER != 0 TOKEN_DATA(T_IDENTIFIER, "(" "{NONDIGIT}" OR "{UNIVERSALCHAR}" ")" "(" "{NONDIGIT}" OR "{DIGIT}" OR "{UNIVERSALCHAR}" ")*"), #else TOKEN_DATA(T_IDENTIFIER, "(" "{NONDIGIT}" OR Q("$") OR "{UNIVERSALCHAR}" ")" "(" "{NONDIGIT}" OR Q("$") OR "{DIGIT}" OR "{UNIVERSALCHAR}" ")*"), #endif TOKEN_DATA(T_CCOMMENT, "{CCOMMENT}"), TOKEN_DATA(T_CPPCOMMENT, Q("/") Q("/[^\\n\\r]*") "{NEWLINEDEF}" ), TOKEN_DATA(T_CHARLIT, "{CHAR_SPEC}" "'" "({ESCAPESEQ}|[^\\n\\r']|{UNIVERSALCHAR})+" "'"), TOKEN_DATA(T_STRINGLIT, "{CHAR_SPEC}" Q("\"") "({ESCAPESEQ}|[^\\n\\r\"]|{UNIVERSALCHAR})*" Q("\"")), TOKEN_DATA(T_SPACE, "{BLANK}+"), TOKEN_DATA(T_CONTLINE, Q("\\") "\\n"), TOKEN_DATA(T_NEWLINE, "{NEWLINEDEF}"), TOKEN_DATA(T_POUND_POUND, "##"), TOKEN_DATA(T_POUND_POUND_ALT, Q("%:") Q("%:")), TOKEN_DATA(T_POUND_POUND_TRIGRAPH, "({TRI}=){2}"), TOKEN_DATA(T_POUND, "#"), TOKEN_DATA(T_POUND_ALT, Q("%:")), TOKEN_DATA(T_POUND_TRIGRAPH, "{TRI}="), TOKEN_DATA(T_ANY_TRIGRAPH, "{TRI}\\/"), TOKEN_DATA(T_ANY, "{ANY}"), TOKEN_DATA(T_ANYCTRL, "{ANYCTRL}"), // this should be the last recognized token { token_id(0) } // this should be the last entry }; // C++ only token definitions template <typename Iterator, typename Position> typename lexertl<Iterator, Position>::lexer_data const lexertl<Iterator, Position>::init_data_cpp[INIT_DATA_CPP_SIZE] = { TOKEN_DATA(T_AND_ALT, "bitand"), TOKEN_DATA(T_ANDASSIGN_ALT, "and_eq"), TOKEN_DATA(T_ANDAND_ALT, "and"), TOKEN_DATA(T_OR_ALT, "bitor"), TOKEN_DATA(T_ORASSIGN_ALT, "or_eq"), TOKEN_DATA(T_OROR_ALT, "or"), TOKEN_DATA(T_XORASSIGN_ALT, "xor_eq"), TOKEN_DATA(T_XOR_ALT, "xor"), TOKEN_DATA(T_NOTEQUAL_ALT, "not_eq"), TOKEN_DATA(T_NOT_ALT, "not"), TOKEN_DATA(T_COMPL_ALT, "compl"), #if BOOST_WAVE_SUPPORT_IMPORT_KEYWORD != 0 TOKEN_DATA(T_IMPORT, "import"), #endif TOKEN_DATA(T_ARROWSTAR, Q("->") Q("*")), TOKEN_DATA(T_DOTSTAR, Q(".") Q("*")), TOKEN_DATA(T_COLON_COLON, "::"), { token_id(0) } // this should be the last entry }; // pp-number specific token definitions template <typename Iterator, typename Position> typename lexertl<Iterator, Position>::lexer_data const lexertl<Iterator, Position>::init_data_pp_number[INIT_DATA_PP_NUMBER_SIZE] = { TOKEN_DATA(T_PP_NUMBER, "{PP_NUMBERDEF}"), { token_id(0) } // this should be the last entry }; #undef MACRO_DATA #undef TOKEN_DATA #undef OR #undef TRI #undef Q /////////////////////////////////////////////////////////////////////////////// // initialize lexertl lexer from C++ token regex's template <typename Iterator, typename Position> inline bool lexertl<Iterator, Position>::init_dfa(wave::language_support lang, Position const& pos, bool force_reinit) { if (has_compiled_dfa_) return true; std::ifstream dfa_in("wave_lexertl_lexer.dfa", std::ios::in|std::ios::binary); if (force_reinit || !dfa_in.is_open() || !load (dfa_in)) { dfa_in.close(); state_machine_.clear(); // register macro definitions boost::lexer::rules rules; for (int k = 0; NULL != init_macro_data[k].name; ++k) { rules.add_macro(init_macro_data[k].name, init_macro_data[k].macro); } // if pp-numbers should be preferred, insert the corresponding rule first if (wave::need_prefer_pp_numbers(lang)) { for (int j = 0; 0 != init_data_pp_number[j].tokenid; ++j) { rules.add(init_data_pp_number[j].tokenregex, init_data_pp_number[j].tokenid); } } // if in C99 mode, some of the keywords are not valid if (!wave::need_c99(lang)) { for (int j = 0; 0 != init_data_cpp[j].tokenid; ++j) { rules.add(init_data_cpp[j].tokenregex, init_data_cpp[j].tokenid); } } for (int i = 0; 0 != init_data[i].tokenid; ++i) { rules.add(init_data[i].tokenregex, init_data[i].tokenid); } // generate minimized DFA try { boost::lexer::generator::build (rules, state_machine_); boost::lexer::generator::minimise (state_machine_); } catch (std::runtime_error const& e) { string_type msg("lexertl initialization error: "); msg += e.what(); BOOST_WAVE_LEXER_THROW(wave::cpplexer::lexing_exception, unexpected_error, msg.c_str(), pos.get_line(), pos.get_column(), pos.get_file().c_str()); return false; } std::ofstream dfa_out ("wave_lexertl_lexer.dfa", std::ios::out|std::ios::binary|std::ios::trunc); if (dfa_out.is_open()) save (dfa_out); } has_compiled_dfa_ = true; return true; } #endif // BOOST_WAVE_LEXERTL_USE_STATIC_TABLES == 0 /////////////////////////////////////////////////////////////////////////////// // return next token from the input stream template <typename Iterator, typename Position> inline wave::token_id lexertl<Iterator, Position>::next_token(Iterator &first, Iterator const &last, string_type& token_value) { #if BOOST_WAVE_LEXERTL_USE_STATIC_TABLES == 0 size_t const* const lookup = &state_machine_.data()._lookup[0]->front (); size_t const dfa_alphabet = state_machine_.data()._dfa_alphabet[0]; size_t const* dfa = &state_machine_.data()._dfa[0]->front(); size_t const* ptr = dfa + dfa_alphabet + boost::lexer::dfa_offset; #else const std::size_t *ptr = dfa + dfa_offset; #endif // BOOST_WAVE_LEXERTL_USE_STATIC_TABLES == 0 Iterator curr = first; Iterator end_token = first; bool end_state = (*ptr != 0); size_t id = *(ptr + 1); while (curr != last) { size_t const state = ptr[lookup[int(*curr)]]; if (0 == state) break; ++curr; #if BOOST_WAVE_LEXERTL_USE_STATIC_TABLES == 0 ptr = &dfa[state * (dfa_alphabet + boost::lexer::dfa_offset)]; #else ptr = &dfa[state * dfa_offset]; #endif // BOOST_WAVE_LEXERTL_USE_STATIC_TABLES == 0 if (0 != *ptr) { end_state = true; id = *(ptr + 1); end_token = curr; } } if (end_state) { if (T_ANY == id) { id = TOKEN_FROM_ID(*first, UnknownTokenType); } // return longest match string_type str(first, end_token); token_value.swap(str); first = end_token; return wave::token_id(id); } return T_EOF; } #if BOOST_WAVE_LEXERTL_USE_STATIC_TABLES == 0 /////////////////////////////////////////////////////////////////////////////// // load the DFA tables to/from a stream template <typename Iterator, typename Position> inline bool lexertl<Iterator, Position>::load (std::istream& instrm) { // #if !defined(BOOST_WAVE_LEXERTL_GENERATE_CPP_CODE) // std::size_t version = 0; // boost::lexer::serialise::load_as_binary(instrm, state_machine_, version); // if (version != (std::size_t)get_compilation_time()) // return false; // too new for us // return instrm.good(); // #else return false; // always create the dfa when generating the C++ code // #endif } /////////////////////////////////////////////////////////////////////////////// // save the DFA tables to/from a stream template <typename Iterator, typename Position> inline bool lexertl<Iterator, Position>::save (std::ostream& outstrm) { // #if defined(BOOST_WAVE_LEXERTL_GENERATE_CPP_CODE) // cpp_code::generate(state_machine_, outstrm); // #else // boost::lexer::serialise::save_as_binary(state_machine_, outstrm, // (std::size_t)get_compilation_time()); // #endif return outstrm.good(); } #endif // #if BOOST_WAVE_LEXERTL_USE_STATIC_TABLES == 0 /////////////////////////////////////////////////////////////////////////////// } // namespace lexer /////////////////////////////////////////////////////////////////////////////// template <typename Iterator, typename Position = wave::util::file_position_type> class lexertl_functor : public lexertl_input_interface<wave::cpplexer::lex_token<Position> > { public: typedef wave::util::position_iterator<Iterator, Position> iterator_type; typedef typename boost::detail::iterator_traits<Iterator>::value_type char_type; typedef BOOST_WAVE_STRINGTYPE string_type; typedef wave::cpplexer::lex_token<Position> token_type; lexertl_functor(Iterator const &first_, Iterator const &last_, Position const &pos_, wave::language_support language) : first(first_, last_, pos_), language(language), at_eof(false) { lexer_.init_dfa(language, pos_); } ~lexertl_functor() {} // get the next token from the input stream token_type& get(token_type& result) { if (lexer_.is_initialized() && !at_eof) { do { // generate and return the next token string_type token_val; Position pos = first.get_position(); // begin of token position wave::token_id id = lexer_.next_token(first, last, token_val); if (T_CONTLINE != id) { // The cast should avoid spurious warnings about missing case labels // for the other token ids's. switch (id) { case T_IDENTIFIER: // test identifier characters for validity (throws if // invalid chars found) if (!wave::need_no_character_validation(language)) { using wave::cpplexer::impl::validate_identifier_name; validate_identifier_name(token_val, pos.get_line(), pos.get_column(), pos.get_file()); } break; case T_STRINGLIT: case T_CHARLIT: // test literal characters for validity (throws if invalid // chars found) if (wave::need_convert_trigraphs(language)) { using wave::cpplexer::impl::convert_trigraphs; token_val = convert_trigraphs(token_val); } if (!wave::need_no_character_validation(language)) { using wave::cpplexer::impl::validate_literal; validate_literal(token_val, pos.get_line(), pos.get_column(), pos.get_file()); } break; case T_LONGINTLIT: // supported in C99 and long_long mode if (!wave::need_long_long(language)) { // syntax error: not allowed in C++ mode BOOST_WAVE_LEXER_THROW( wave::cpplexer::lexing_exception, invalid_long_long_literal, token_val.c_str(), pos.get_line(), pos.get_column(), pos.get_file().c_str()); } break; #if BOOST_WAVE_SUPPORT_INCLUDE_NEXT != 0 case T_PP_HHEADER: case T_PP_QHEADER: case T_PP_INCLUDE: // convert to the corresponding ..._next token, if appropriate { // Skip '#' and whitespace and see whether we find an // 'include_next' here. typename string_type::size_type start = token_val.find("include"); if (0 == token_val.compare(start, 12, "include_next", 12)) id = token_id(id | AltTokenType); } break; #endif // BOOST_WAVE_SUPPORT_INCLUDE_NEXT != 0 case T_EOF: // T_EOF is returned as a valid token, the next call will // return T_EOI, i.e. the actual end of input at_eof = true; token_val.clear(); break; case T_OR_TRIGRAPH: case T_XOR_TRIGRAPH: case T_LEFTBRACE_TRIGRAPH: case T_RIGHTBRACE_TRIGRAPH: case T_LEFTBRACKET_TRIGRAPH: case T_RIGHTBRACKET_TRIGRAPH: case T_COMPL_TRIGRAPH: case T_POUND_TRIGRAPH: case T_ANY_TRIGRAPH: if (wave::need_convert_trigraphs(language)) { using wave::cpplexer::impl::convert_trigraph; token_val = convert_trigraph(token_val); } break; case T_ANYCTRL: // matched some unexpected character { // 21 is the max required size for a 64 bit integer // represented as a string char buffer[22]; string_type msg("invalid character in input stream: '0x"); // for some systems sprintf is in namespace std using namespace std; sprintf(buffer, "%02x'", token_val[0]); msg += buffer; BOOST_WAVE_LEXER_THROW( wave::cpplexer::lexing_exception, generic_lexing_error, msg.c_str(), pos.get_line(), pos.get_column(), pos.get_file().c_str()); } break; } result = token_type(id, token_val, pos); #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0 return guards.detect_guard(result); #else return result; #endif } } while (true); // skip the T_CONTLINE token } return result = token_type(); // return T_EOI } void set_position(Position const &pos) { // set position has to change the file name and line number only first.get_position().set_file(pos.get_file()); first.get_position().set_line(pos.get_line()); } #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0 bool has_include_guards(std::string& guard_name) const { return guards.detected(guard_name); } #endif private: iterator_type first; iterator_type last; wave::language_support language; bool at_eof; #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0 include_guards<token_type> guards; #endif static lexer::lexertl<iterator_type, Position> lexer_; }; template <typename Iterator, typename Position> lexer::lexertl< typename lexertl_functor<Iterator, Position>::iterator_type, Position> lexertl_functor<Iterator, Position>::lexer_; #undef INIT_DATA_SIZE #undef INIT_DATA_CPP_SIZE #undef INIT_DATA_PP_NUMBER_SIZE #undef INIT_MACRO_DATA_SIZE #undef T_ANYCTRL /////////////////////////////////////////////////////////////////////////////// // // The new_lexer_gen<>::new_lexer function (declared in lexertl_interface.hpp) // should be defined inline, if the lex_functor shouldn't be instantiated // separately from the lex_iterator. // // Separate (explicit) instantiation helps to reduce compilation time. // /////////////////////////////////////////////////////////////////////////////// #if BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0 #define BOOST_WAVE_FLEX_NEW_LEXER_INLINE #else #define BOOST_WAVE_FLEX_NEW_LEXER_INLINE inline #endif /////////////////////////////////////////////////////////////////////////////// // // The 'new_lexer' function allows the opaque generation of a new lexer object. // It is coupled to the iterator type to allow to decouple the lexer/iterator // configurations at compile time. // // This function is declared inside the xlex_interface.hpp file, which is // referenced by the source file calling the lexer and the source file, which // instantiates the lex_functor. But it is defined here, so it will be // instantiated only while compiling the source file, which instantiates the // lex_functor. While the xlex_interface.hpp file may be included everywhere, // this file (xlex_lexer.hpp) should be included only once. This allows // to decouple the lexer interface from the lexer implementation and reduces // compilation time. // /////////////////////////////////////////////////////////////////////////////// template <typename Iterator, typename Position> BOOST_WAVE_FLEX_NEW_LEXER_INLINE wave::cpplexer::lex_input_interface<wave::cpplexer::lex_token<Position> > * new_lexer_gen<Iterator, Position>::new_lexer(Iterator const &first, Iterator const &last, Position const &pos, wave::language_support language) { return new lexertl_functor<Iterator, Position>(first, last, pos, language); } #undef BOOST_WAVE_FLEX_NEW_LEXER_INLINE /////////////////////////////////////////////////////////////////////////////// }}}} // namespace boost::wave::cpplexer::lexertl #endif // !defined(BOOST_WAVE_LEXERTL_LEXER_HPP_INCLUDED)
[ "james.pack@stardog.com" ]
james.pack@stardog.com
4adafd29d68b0ad4989bf0ebfee0735debb3dab7
e1ecd3146b56dcd9b4ffaf1d343ef64e8c42dc64
/Baekjoon/baek_2644_촌수계산/main.cpp
05561acd752d010a33b5c7a3a02d3df5138ec358
[]
no_license
wjddlsy/Algorithm
7bbeca6b5d21867355c88de8b4218bcfe8eeea75
385247c63337cae1cf3d9adbf8be38d6f62f2945
refs/heads/master
2022-12-04T19:35:48.763646
2020-08-23T08:14:29
2020-08-23T08:14:29
198,079,854
1
0
null
null
null
null
UTF-8
C++
false
false
824
cpp
#include <iostream> #include <vector> #include <queue> using namespace std; vector<vector<int>> adj; int discovered[101]; int bfs(int start, int end){ queue<int> q; q.push(start); while(!q.empty()){ int here=q.front(); q.pop(); if(here==end) return discovered[here]; for(auto there:adj[here]){ if(!discovered[there]){ discovered[there]=discovered[here]+1; q.push(there); } } } return -1; } int main() { int n, a, b, m; cin>>n>>a>>b>>m; adj=vector<vector<int>>(n+1); for(int i=0; i<m; ++i){ int x, y; cin>>x>>y; adj[x].push_back(y); adj[y].push_back(x); } cout<<bfs(a, b); //std::cout << "Hello, World!" << std::endl; return 0; }
[ "asdff2002@gmail.com" ]
asdff2002@gmail.com
5efa5961b3c7a46d0220b7a19d23cf76d9957cc6
fbd5c976a908789529c6dd593c4bbe6e7ad7e63d
/apps/taylor-angle-xy/data_export.h
a4f8ebc3e7203c159198b048a12165c78d7143e2
[ "BSD-3-Clause", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
xiajingjie/FiVoNAGI
3e47d090223de91a89463e738bcce14e7f1162bd
67053e333b923010164720b74c25cf3888dc9515
refs/heads/master
2020-08-13T12:30:22.985349
2017-02-24T00:22:14
2017-02-24T00:22:14
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,268
h
#ifndef INC_DATA_EXPORT_H #define INC_DATA_EXPORT_H #include <iomanip> #include <iostream> #include <fstream> #include <string> #include <sstream> #include <cufft.h> using namespace std; // taylor-angle-xy template <typename TTT> void dataExport (TTT *measure1, TTT *u1, TTT *u2, TTT *u3, cufftComplex *spectrum, int *frame, int *n, int *MDX, int *MDY, TTT *T, int status) { // status variable indicates the contents of the spectum variable as // follows: // 0 - nothing, before applying the fft // 1 - fft of u1 before filtering // 2 - fft of u1 after filtering, but before applying the inverse fft // 3 - filtered version of u1, that is, after applying the inverse fft if ( status == 0 ) { int gridBitSize = NX * NY * sizeof(TTT); TTT *localgrid = (TTT*)malloc( gridBitSize ); string dgname = "u1"; // Export u1 for the whole domain : GPUGD_EC( cudaMemcpy( localgrid, u1, gridBitSize, cudaMemcpyDeviceToHost ) ); ostringstream Convert; Convert << setfill('0') << setw(4); Convert << (*frame); string frameStr = Convert.str(); ofstream resfile; string filename = deployPath + "/" + dgname + "-" + frameStr + ".dat"; resfile.open(filename.c_str(), ios::trunc); ostringstream ConvertT; ConvertT << setprecision(5) << *T; string Tstr = ConvertT.str(); resfile << "# T=" << Tstr << endl; resfile << "# Lines are parallel to y-axis, an columns parallel to x-axis." << endl; resfile << "# First line are y values, and first column x values." << endl; resfile << "# Left-top corner is the number of columns" << endl; // TODO: switch x-y in this file, switch it in the plot scripts too. resfile << NY << " "; for(int j=0; j<=NY-1; j++) { float y = static_cast<float>(j+(*MDY)-NY/2)/static_cast<float>(ETA); resfile << y << " "; } resfile << " \n"; for (int i=0; i<=NX-1; i++) { float x = static_cast<float>(i+(*MDX))/static_cast<float>(ETA); resfile << x << " "; for (int j=0; j<=NY-1; j++) { resfile << localgrid[i+j*NX] << " "; } resfile << " \n"; } resfile.close(); // Export u1 (numeric and analytic) for the cut : GPUGD_EC( cudaMemcpy( localgrid, measure1, gridBitSize, cudaMemcpyDeviceToHost ) ); filename = deployPath + "/" + dgname + "-cut-" + frameStr + ".dat"; resfile.open(filename.c_str(), ios::trunc); resfile << "# T=" << Tstr << endl; resfile << "# i xi numeric analytic \n"; int length = 2*static_cast<int>(5.0*ETA*cos(ISPTHETA)); float x; float error_L1_tmp1, error_L1_tmp2; float error_L2_tmp1, error_L2_tmp2; float error_Li_tmp1, error_Li_tmp2; error_L1_tmp1 = 0; error_L1_tmp2 = 0; error_L2_tmp1 = 0; error_L2_tmp2 = 0; error_Li_tmp1 = 0; error_Li_tmp2 = 0; for (int i=0; i<=length-1; i++) { x = - 5.0 + static_cast<float>(i)/(static_cast<float>(ETA)*cos(ISPTHETA)); resfile << i << " "; resfile << x << " "; resfile << localgrid[i+2*NX] << " "; // numeric resfile << localgrid[i+3*NX] << " "; // analytic resfile << " \n"; error_L1_tmp1 += abs(localgrid[i+3*NX] - localgrid[i+2*NX]); error_L1_tmp2 += abs(localgrid[i+3*NX]); error_L2_tmp1 += pow(localgrid[i+3*NX] - localgrid[i+2*NX], 2); error_L2_tmp2 += pow(localgrid[i+3*NX], 2); error_Li_tmp1 = max(abs(localgrid[i+3*NX] - localgrid[i+2*NX]), error_Li_tmp1); error_Li_tmp2 = max(abs(localgrid[i+3*NX]), error_Li_tmp2); } resfile.close(); // NaN values arise here for T<0 error_L1_tmp1 = error_L1_tmp1/error_L1_tmp2; error_L2_tmp1 = pow(error_L2_tmp1/error_L2_tmp2, 0.5); error_Li_tmp1 = error_Li_tmp1/error_Li_tmp2; // Export measured errors : filename = deployPath + "/u1-error.dat"; if ((*frame)==0) { resfile.open(filename.c_str(), ios::trunc); resfile << "# frame T error_L1 error_L2 error_Li" << endl; } else { resfile.open(filename.c_str(), ios::app); } resfile << (*frame) << " "; resfile << Tstr << " "; resfile << error_L1_tmp1 << " "; resfile << error_L2_tmp1 << " "; resfile << error_Li_tmp1; resfile << "\n"; resfile.close(); // Export cfl values : static float cfl_std_tmp; static int first = 1; static int previous_n = 0; filename = deployPath + "/u1-cfl.dat"; if ((*frame)==0) { resfile.open(filename.c_str(), ios::trunc); resfile << "# n T frame cfl std" << endl; cfl_std_tmp = 0; } else { resfile.open(filename.c_str(), ios::app); } for (int i_T=0; i_T<(*n)-previous_n; i_T++) { if ( localgrid[i_T+0*NX] > 0 ) { if ( first == 0 ) { cfl_std_tmp += pow(localgrid[i_T+1*NX] - CFLWHISH,2); resfile << i_T + previous_n + 1; resfile << " "; resfile << localgrid[i_T+0*NX]; resfile << " "; resfile << (*frame); resfile << " "; resfile << localgrid[i_T+1*NX]; resfile << " "; resfile << pow(cfl_std_tmp/((*frame)+1),0.5); resfile << "\n"; } first = 0; } } resfile.close(); free (localgrid); previous_n = (*n); } } #endif /* INC_DATA_EXPORT_H */
[ "rdroberto@gmail.com" ]
rdroberto@gmail.com
4d9cd608960ac35975f39b0ef35592d2cccd3b27
1053f458f9133c2ddfc595a6f94743a960f98269
/lab2/parser.cpp
e65dcd69bbf36f660d9b78c160d04acc9187f432
[]
no_license
StarOrpheus/mt2019
65a19dbafda82ce5067145485fa733d253d6e9f5
02f8bcae05ff6578c7589c995c404715633cc099
refs/heads/master
2020-09-22T14:03:35.462299
2020-02-20T10:09:05
2020-02-20T10:09:05
225,231,929
0
0
null
null
null
null
UTF-8
C++
false
false
15,129
cpp
#include <cassert> #include <unordered_map> #include <sstream> #include "parser.h" template<class... Ts> struct overloaded : Ts... { using Ts::operator()...; }; // (1) template<class... Ts> overloaded(Ts...) -> overloaded<Ts...>; // (2) template<typename VarT, typename T> bool variant_eq(VarT const& var, T&& val) { return var == VarT(std::forward<T>(val)); } static inline ast_ptr parse_type_qualifier_list(lexer& lex) { ast_ptr result = std::make_unique<ast_node>(); result->kind = node_kind::TYPE_QUALIFIER_LIST; while (lex.get_current().index() == 2) { result->args.push_back(std::make_unique<ast_node>()); result->args.back()->kind = node_kind::TYPE_QUALIFIER; result->args.back()->data = lex.get_current(); lex.read_token(); } if (result->args.size() == 1) return std::move(result->args[0]); else return std::move(result); } static inline ast_ptr parse_pointer(lexer& lex) { ast_ptr result = std::make_unique<ast_node>(); result->kind = node_kind::POINTER; assert(variant_eq(lex.get_current(), special_symbols::ASTERISK)); result->args.push_back(std::make_unique<ast_node>(lex.get_current())); auto& cur = lex.read_token(); if (cur.index() == 2) result->args.push_back(parse_type_qualifier_list(lex)); if (variant_eq(lex.get_current(), special_symbols::ASTERISK)) result->args.push_back(parse_pointer(lex)); return std::move(result); } static inline ast_ptr parse_declarator(lexer& lex); static inline ast_ptr parse_direct_declarator(lexer& lex) { ast_ptr result = std::make_unique<ast_node>(); result->kind = node_kind::DIRECT_DECLARATOR; std::visit( overloaded { [&lex] (storage_class_specifier) { assert(false); }, [&lex] (type_specifier) { assert(false); }, [&lex] (type_qualifier) { assert(false); }, [&lex, &result] (std::string const&) { result->data = std::move(lex.get_current()); lex.read_token(); }, [&lex, &result] (special_symbols sym) { if (sym != special_symbols::OPEN_PARANTHESIS) throw std::runtime_error("Unexpected token"); result->args.push_back(std::make_unique<ast_node>(lex.get_current())); auto& tok = lex.read_token(); result->args.push_back(parse_declarator(lex)); result->args.push_back(std::make_unique<ast_node>(lex.get_current())); assert(variant_eq(lex.get_current(), special_symbols::CLOSE_PARANTHESIS)); lex.read_token(); }, }, lex.get_current() ); return std::move(result); } static inline ast_ptr parse_declarator(lexer& lex) { auto result = std::make_unique<ast_node>(); result->kind = node_kind::DECLARATOR; std::visit( overloaded { [&lex] (storage_class_specifier) { assert(false); }, [&lex] (type_specifier) { assert(false); }, [&lex] (type_qualifier) { assert(false); }, [&lex, &result] (std::string const&) { result->kind = node_kind::DIRECT_DECLARATOR; result->data = std::move(lex.get_current()); lex.read_token(); }, [&lex, &result] (special_symbols sym) { if (sym == special_symbols::ASTERISK) result->args.push_back(parse_pointer(lex)); result->args.push_back(parse_direct_declarator(lex)); }, }, lex.get_current() ); return std::move(result); } static inline ast_ptr parse_declarator_list(lexer& lex) { ast_ptr result = std::make_unique<ast_node>(); while (lex.get_current().index() > 2) { bool stop = false; std::visit ( overloaded { [&result, &lex] (std::string const&) { result->args.push_back(parse_declarator(lex)); }, [&result, &lex, &stop] (special_symbols symb) { if (symb == special_symbols::OPEN_PARANTHESIS || symb == special_symbols::ASTERISK) result->args.push_back(parse_declarator(lex)); else stop = true; }, [] (storage_class_specifier) { assert(false); }, [] (type_specifier) { assert(false); }, [] (type_qualifier) { assert(false); }, }, lex.get_current() ); if (stop) break; if (!variant_eq(lex.get_current(), special_symbols::COMMA)) break; result->args.push_back(std::make_unique<ast_node>(lex.get_current())); lex.read_token(); } if (result->args.size() == 1) { result->kind = node_kind::DECLARATOR; return std::move(result->args[0]); } result->kind = node_kind::DECLARATOR_LIST; return std::move(result); } static inline ast_ptr parse_decl_specifiers(lexer& lex) { ast_ptr result = std::make_unique<ast_node>(); result->kind = node_kind::DECLARATION_SPECIFIERS; while (lex.get_current().index() <= 2) { result->args.push_back(std::make_unique<ast_node>()); result->args.back()->kind = std::visit( overloaded { [] (storage_class_specifier) -> node_kind { return node_kind::STORAGE_CLASS_SPECIFIER; }, [] (type_specifier) -> node_kind { return node_kind::TYPE_SPECIFIER; }, [] (type_qualifier) -> node_kind { return node_kind::TYPE_QUALIFIER; }, [] (std::string const&) -> node_kind { assert(false); }, [] (special_symbols) -> node_kind { assert(false); }, }, lex.get_current() ); result->args.back()->data = lex.get_current(); lex.read_token(); } return std::move(result); } static inline ast_ptr parse_decl(lexer& lex) { auto& tok = lex.read_token(); bool got_semicolon = false; ast_ptr current_node = std::make_unique<ast_node>(); current_node->kind = node_kind::DECLARATION; current_node->args.push_back( std::visit( overloaded { [&lex] (storage_class_specifier) -> ast_ptr { return parse_decl_specifiers(lex); }, [&lex] (type_specifier) -> ast_ptr { return parse_decl_specifiers(lex); }, [&lex] (type_qualifier) -> ast_ptr { return parse_decl_specifiers(lex); }, [&lex] (std::string const&) -> ast_ptr { return parse_declarator_list(lex); }, [&lex] (special_symbols sym) -> ast_ptr { return parse_declarator_list(lex); }, }, tok ) ); current_node->args.push_back( std::visit( overloaded { [&lex] (storage_class_specifier) -> ast_ptr { assert(false); }, [&lex] (type_specifier) -> ast_ptr { assert(false); }, [&lex] (type_qualifier) -> ast_ptr { assert(false); }, [&lex] (std::string const&) -> ast_ptr { return parse_declarator_list(lex); }, [&lex, &got_semicolon] (special_symbols sym) -> ast_ptr { if (sym != special_symbols::SEMICOLON) return parse_declarator_list(lex); else return nullptr; }, }, lex.get_current() ) ); if (!current_node->args.empty() && current_node->args.back() == nullptr) current_node->args.pop_back(); if (variant_eq(lex.get_current(), special_symbols::SEMICOLON)) current_node->args.push_back(std::make_unique<ast_node>(lex.get_current())); // if (got_semicolon) // current_node->args.pop_back(); return std::move(current_node); } ast_ptr parse(std::istream& input) { lexer lex(input); return parse_decl(lex); } static inline void to_string_impl(std::stringstream& ss, storage_class_specifier specifier) { static const std::unordered_map<storage_class_specifier, std::string> spec_to_str = { {storage_class_specifier::EXTERN, "extern"}, {storage_class_specifier::STATIC, "static"}, {storage_class_specifier::AUTO, "auto"}, {storage_class_specifier::REGISTER, "register"} }; auto it = spec_to_str.find(specifier); assert(it != spec_to_str.end()); ss << it->second; switch (specifier) { case storage_class_specifier::EXTERN: ss << "extern"; break; case storage_class_specifier::STATIC: ss << "static"; break; case storage_class_specifier::AUTO: ss << "auto"; break; case storage_class_specifier::REGISTER: ss << "register"; break; default: assert(false); } } static inline void to_string_impl(std::stringstream& ss, type_specifier specifier) { switch (specifier) { case type_specifier::VOID: ss << "void"; break; case type_specifier::CHAR: ss << "char"; break; case type_specifier::SHORT: ss << "short"; break; case type_specifier::INT: ss << "int"; break; case type_specifier::LONG: ss << "long"; break; case type_specifier::FLOAT: ss << "float"; break; case type_specifier::DOUBLE: ss << "double"; break; case type_specifier::SIGNED: ss << "signed"; break; case type_specifier::UNSIGNED: ss << "unsigned"; break; default: assert(false); } } static inline void to_string_impl(std::stringstream& ss, type_qualifier specifier) { switch (specifier) { case type_qualifier::CONST: ss << "const"; break; case type_qualifier::VOLATILE: ss << "volatile"; break; default: assert(false); } } static inline void to_string_impl(std::stringstream& ss, special_symbols specifier) { switch (specifier) { case special_symbols::ASTERISK: ss << '*'; break; case special_symbols::SEMICOLON: ss << ';'; break; case special_symbols::OPEN_PARANTHESIS: ss << '('; break; case special_symbols::CLOSE_PARANTHESIS: ss << ')'; break; case special_symbols::COMMA: ss << ','; break; case special_symbols::END: default: assert(false); break; } } static inline void to_string_impl(std::stringstream& ss, node_kind kind) { static const std::unordered_map<node_kind, std::string> char_to_spec_symbol = { {node_kind::TERMINAL, ""}, {node_kind::STORAGE_CLASS_SPECIFIER, "[storage class specifier]"}, {node_kind::TYPE_SPECIFIER, "[type specifier]"}, {node_kind::TYPE_QUALIFIER, "[type qualifier]"}, {node_kind::TYPE_QUALIFIER_LIST, "[type qualifier list]"}, {node_kind::POINTER, "[pointer]"}, {node_kind::DIRECT_DECLARATOR, "[direct declarator]"}, {node_kind::DECLARATOR_LIST, "[declarator list]"}, {node_kind::DECLARATOR, "[declarator]"}, {node_kind::DECLARATION_SPECIFIERS, "[declaration specifiers]"}, {node_kind::DECLARATION, "[declaration]"}, }; auto it = char_to_spec_symbol.find(kind); assert(it != char_to_spec_symbol.end()); ss << it->second; } static inline void to_string_impl(std::stringstream& ss, token_t const& tok) { std::visit( overloaded { [&ss] (storage_class_specifier spec) { to_string_impl(ss, spec); }, [&ss] (type_specifier spec) { to_string_impl(ss, spec); }, [&ss] (type_qualifier spec) { to_string_impl(ss, spec); }, [&ss] (std::string const& str) { ss << "$" << str; }, [&ss] (special_symbols spec) { to_string_impl(ss, spec); }, }, tok ); } void to_string_impl(std::stringstream& ss, ast_ptr const& ptr) { ss << '('; to_string_impl(ss, ptr->kind); ss << " "; if (ptr->data) { to_string_impl(ss, *ptr->data); ss << " "; } for (auto&& x : ptr->args) to_string_impl(ss, x); ss << ')'; } std::string to_string(ast_ptr const& ast) { std::stringstream ss; to_string_impl(ss, ast); return ss.str(); } static inline char const* get_dot_color(std::stringstream& ss, node_kind kind) { switch (kind) { case node_kind::TERMINAL: return "#b1bac1"; case node_kind::STORAGE_CLASS_SPECIFIER: return "#151d1f"; case node_kind::TYPE_SPECIFIER: return "#262d33"; case node_kind::TYPE_QUALIFIER: return "#807b77"; case node_kind::TYPE_QUALIFIER_LIST: return "#e6e1de"; case node_kind::POINTER: return "#b1bac1"; case node_kind::DIRECT_DECLARATOR: return "#92afbf"; case node_kind::DECLARATOR: return "#4f8ba7"; case node_kind::DECLARATOR_LIST: return "#103e55"; case node_kind::DECLARATION_SPECIFIERS: return "#021d28"; case node_kind::DECLARATION: return "#000d16"; default: assert(false); return "#000000"; } } static inline void echo_node_info(std::stringstream& ss, ast_ptr const& ast) { ss << "\tx" << ast.get() << " [label=\""; if (ast->data) to_string_impl(ss, *ast->data); else to_string_impl(ss, ast->kind); ss << "\" color=\"" << get_dot_color(ss, ast->kind) << "\"];\n"; } void to_dot_repr(std::stringstream& ss, ast_ptr const& ast) { for (auto&& chld : ast->args) { echo_node_info(ss, chld); ss << "\tx" << ast.get() << " -> x" << chld.get() << ";\n"; to_dot_repr(ss, chld); } } std::string to_dot_repr(ast_ptr const& ast) { std::stringstream ss; ss << "digraph AST {\n"; echo_node_info(ss, ast); to_dot_repr(ss, ast); ss << "}"; return ss.str(); } ast_node::ast_node(token_t tok) : kind{node_kind::TERMINAL}, data(std::move(tok)), args{} {}
[ "ellesterate@gmail.com" ]
ellesterate@gmail.com
ff8df36085bdc5370135cb17621230c7070c38fa
b6aaef99338cd4492ec792877522db1821a25fc4
/Methods_of_programming/L/main.cpp
b39cc63169ddfe582bc3ad48a68c44ec92a20b32
[]
no_license
MikalaiNavitski/uj-first-year
303894a89aa424719457d118d35bb34eada69c66
5af102e012cd9f2db9240a0e6db898ebbf81b191
refs/heads/master
2023-06-22T19:32:15.939468
2021-07-20T09:10:49
2021-07-20T09:10:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,443
cpp
#include <iostream> #include <queue> #include <vector> class Solver { std::vector < std::vector <int> > g; std::vector < std::vector < std::pair < int , std::pair <int , int> > > >task; std::vector < int > dpEven, dpOdd; int n, m, k; void bfs(int start) { fill(dpEven.begin(), dpEven.end(), -1); fill(dpOdd.begin(), dpOdd.end(), -1); dpEven[start] = 0; std::queue < std::pair < int, bool> > q; q.push({start, 1}); while(!q.empty()) { int v = q.front().first; bool even = q.front().second; q.pop(); for (int to : g[v]) { if (even) { if (dpOdd[to] == -1) { q.push({to, !even}); dpOdd[to] = dpEven[v] + 1; } else dpOdd[to] = std::min(dpEven[v] + 1, dpOdd[to]); } else { if (dpEven[to] == -1) { q.push({to, !even}); dpEven[to] = dpOdd[v] + 1; } else dpEven[to] = std::min(dpOdd[v] + 1, dpEven[to]); } } } } public: void Solve() { std::cin >> n >> m >> k; g.resize(n); dpEven.resize(n); dpOdd.resize(n); task.resize(n); for (int i = 0; i < m; ++i) { int a, b; std::cin >> a >> b; --a; --b; g[a].push_back(b); g[b].push_back(a); } bool ans[k]; for (int i = 0; i < k; ++i) { int a, b, len; std::cin >> a >> b >> len; --a; --b; if (a > b) std::swap(a, b); task[a].push_back({b, {len, i}}); } for (int i = 0; i < n; ++i) if (!task[i].empty()) { bfs(i); for (std::pair < int , std::pair < int , int > > item : task[i]) { int len = item.second.first; int ind = item.second.second; int end = item.first; if (len % 2) { if (dpOdd[end] <= len && dpOdd[end] != -1) ans[ind] = true; else ans[ind] = false; } else { if (dpEven[end] <= len && dpEven[end] != -1) ans[ind] = true; else ans[ind] = false; } } } for (int i = 0; i < k; ++i) std::cout << (ans[i] ? "TAK" : "NIE") << '\n'; } }; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); #ifdef Estb_probitie freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int z; std::cin >> z; while(z--) { Solver s; s.Solve(); } }
[ "andrey8daletsky@gmail.com" ]
andrey8daletsky@gmail.com
b8cef09a12bcc479d64bfc55b78b8fe3d7b8abe7
a3259fa72ce413de87c309bc61da606dcfe13c03
/experiment/deprecated/wasi_experiments/simple_example.cpp
d89d8fa6445c04c7c02acc84d510b81efaf7e69e
[]
no_license
nhuhoang0701/wasabi
6d4a7d7e68233268e24298f7f3218bc4d67497e5
2a72ff73bf245fe5ce2533f8a4dd32cf1db2cdeb
refs/heads/master
2023-07-29T08:06:39.123199
2021-09-09T15:43:13
2021-09-09T15:43:13
388,215,854
0
0
null
null
null
null
UTF-8
C++
false
false
289
cpp
// This is an example file as part of Modern-CMake #include "simple_lib.hpp" #include <iostream> int main() { //std::cout << "Simple example C++ compiled correctly and ran." << std::endl; //std::cout << simple_lib_function() << std::endl; return simple_lib_function(); }
[ "ghislain.hude@sap.com" ]
ghislain.hude@sap.com
b741b1052582fe20b2463eb639f28c3c768fa992
b1aa67666ec7c8f4036a8769498cb37e16027076
/src/PrimitiveNodes/SimulinkCoderFSM.cpp
1b4f41adf035ed7cb6fc22337af1341a1433fa71
[ "BSD-3-Clause" ]
permissive
ucb-cyarp/vitis
acbd5fedc65afd422fbf141512eb92697461b764
e928047652d1569f2af57dd3094c8fe90b7d6cb5
refs/heads/master
2023-04-12T19:39:40.121305
2022-05-06T22:01:10
2022-05-06T22:01:10
138,628,803
1
0
null
null
null
null
UTF-8
C++
false
false
23,145
cpp
// // Created by Christopher Yarp on 2019-01-28. // #include "SimulinkCoderFSM.h" #include "GraphMLTools/GraphMLImporter.h" #include "GraphMLTools/GraphMLExporter.h" #include "General/ErrorHelpers.h" SimulinkCoderFSM::SimulinkCoderFSM() : simulinkExportReusableFunction(false) { } SimulinkCoderFSM::SimulinkCoderFSM(std::shared_ptr<SubSystem> parent) : BlackBox(parent), simulinkExportReusableFunction(false) { } SimulinkCoderFSM::SimulinkCoderFSM(std::shared_ptr<SubSystem> parent, SimulinkCoderFSM *orig) : BlackBox(parent, orig), inputsStructName(orig->inputsStructName), outputsStructName(orig->outputsStructName), stateStructName(orig->stateStructName), simulinkExportReusableFunction(orig->simulinkExportReusableFunction), rtModelStructType(orig->rtModelStructType), rtModelStatePtrName(orig->rtModelStatePtrName), stateStructType(orig->stateStructType), generatedReset(orig->generatedReset) { } std::shared_ptr<BlackBox> SimulinkCoderFSM::createFromGraphML(int id, std::string name, std::map<std::string, std::string> dataKeyValueMap, std::shared_ptr<SubSystem> parent, GraphMLDialect dialect) { std::shared_ptr<SimulinkCoderFSM> newNode = NodeFactory::createNode<SimulinkCoderFSM>(parent); newNode->populatePropertiesFromGraphML(id, name, dataKeyValueMap, parent, dialect); //Import Port Names (used to set port types) GraphMLImporter::importNodePortNames(newNode, dataKeyValueMap, dialect); //Get Stateflow specific properties std::string initFctnStr; std::string outputFunctionStr; std::string stateUpdateFunctionStr; std::string inputsStructNameStr; std::string outputsStructNameStr; std::string stateStructNameStr; if(dataKeyValueMap.find("init_function") != dataKeyValueMap.end()) { initFctnStr = dataKeyValueMap.at("init_function"); }else{ throw std::runtime_error(ErrorHelpers::genErrorStr("Stateflow Module Missing Init Function", newNode)); } if(dataKeyValueMap.find("output_function") != dataKeyValueMap.end()) { outputFunctionStr = dataKeyValueMap.at("output_function"); }else{ throw std::runtime_error(ErrorHelpers::genErrorStr("Stateflow Module Missing Output Function", newNode)); } if(dataKeyValueMap.find("state_update_function") != dataKeyValueMap.end()) { stateUpdateFunctionStr = dataKeyValueMap.at("state_update_function"); }else{ throw std::runtime_error(ErrorHelpers::genErrorStr("Stateflow Module Missing State Update Function", newNode)); } if(dataKeyValueMap.find("inputs_struct_name") != dataKeyValueMap.end()) { inputsStructNameStr = dataKeyValueMap.at("inputs_struct_name"); }else{ throw std::runtime_error(ErrorHelpers::genErrorStr("Stateflow Module Missing Input Structure Name", newNode)); } if(dataKeyValueMap.find("outputs_struct_name") != dataKeyValueMap.end()) { outputsStructNameStr = dataKeyValueMap.at("outputs_struct_name"); }else{ throw std::runtime_error(ErrorHelpers::genErrorStr("Stateflow Module Missing Output Structure Name", newNode)); } if(dataKeyValueMap.find("state_struct_name") != dataKeyValueMap.end()) { stateStructNameStr = dataKeyValueMap.at("state_struct_name"); }else{ throw std::runtime_error(ErrorHelpers::genErrorStr("Stateflow Module Missing State Structure Name", newNode)); } //Set parameters newNode->setInputsStructName(inputsStructNameStr); newNode->setOutputsStructName(outputsStructNameStr); newNode->setStateStructName(stateStructNameStr); //Set BlackBox Parameters from Stateflow Parameters (often one-to-one but with a name change) newNode->setExeCombinationalName(outputFunctionStr); newNode->setExeCombinationalRtnType(""); //Output is to external global newNode->setStateUpdateName(stateUpdateFunctionStr); //Body and header contents imported in populateProperties method above newNode->setStateful(true); newNode->setReSuffix(".re"); //In the current simulink settings, complex types are structures newNode->setImSuffix(".im"); //Set the origionally generated reset function name //Note that the reset function in the blackbox superclass is set to a different reset function if(dialect == GraphMLDialect::SIMULINK_EXPORT){ newNode->setGeneratedReset(initFctnStr); }else if(dialect == GraphMLDialect::VITIS){ std::string origResetFctn; if(dataKeyValueMap.find("generatedReset") != dataKeyValueMap.end()) { origResetFctn = dataKeyValueMap.at("generatedReset"); }else{ throw std::runtime_error(ErrorHelpers::genErrorStr("Stateflow Module Missing Orig Reset Function", newNode)); } newNode->setGeneratedReset(origResetFctn); }else{ throw std::runtime_error(ErrorHelpers::genErrorStr("Unknown GraphML Dialect", newNode->getSharedPointer())); } //Check if the export from simulink included re-usable functions bool reusableFctn = false; if(dataKeyValueMap.find("exported_reusable_fctns") != dataKeyValueMap.end()) { if(dataKeyValueMap["exported_reusable_fctns"] == "yes" || dataKeyValueMap["exported_reusable_fctns"] == "Yes" || dataKeyValueMap["exported_reusable_fctns"] == "YES" || dataKeyValueMap["exported_reusable_fctns"] == "true" || dataKeyValueMap["exported_reusable_fctns"] == "True" || dataKeyValueMap["exported_reusable_fctns"] == "TRUE"){ reusableFctn = true; newNode->setSimulinkExportReusableFunction(true); std::string rtModelType; if(dataKeyValueMap.find("rtModelType") != dataKeyValueMap.end()) { rtModelType = dataKeyValueMap.at("rtModelType"); }else{ throw std::runtime_error(ErrorHelpers::genErrorStr("Stateflow Module Missing RT Model Type", newNode)); } std::string stateStructType; if(dataKeyValueMap.find("stateStructType") != dataKeyValueMap.end()) { stateStructType = dataKeyValueMap.at("stateStructType"); }else{ throw std::runtime_error(ErrorHelpers::genErrorStr("Stateflow Module Missing State Struct Type", newNode)); } std::string rtStateMemberPtrName; if(dataKeyValueMap.find("rtStateMemberPtrName") != dataKeyValueMap.end()) { rtStateMemberPtrName = dataKeyValueMap.at("rtStateMemberPtrName"); }else{ throw std::runtime_error(ErrorHelpers::genErrorStr("Stateflow Module Missing RT State Ptr Name", newNode)); } newNode->setRtModelStructType(rtModelType); newNode->setStateStructType(stateStructType); newNode->setRtModelStatePtrName(rtStateMemberPtrName); //Reset name is set in call to getResetFunctionCall }else{ newNode->setSimulinkExportReusableFunction(false); newNode->setResetName(initFctnStr); //It appears that in the Simulink Coder Stateflow Generated C, init accomplishes the same as reset } }else{ newNode->setSimulinkExportReusableFunction(false); newNode->setResetName(initFctnStr); //It appears that in the Simulink Coder Stateflow Generated C, init accomplishes the same as reset } //Input ports are external for the non-reusable style of Simulink Code Generation //Input ports are arguments for reusable style of Simulink Code Generation std::vector<std::shared_ptr<InputPort>> inputPorts = newNode->getInputPorts(); std::vector<BlackBox::InputMethod> inputMethods; std::vector<std::string> inputAccess; for(unsigned long i = 0; i<inputPorts.size(); i++){ if(reusableFctn){ inputMethods.push_back(BlackBox::InputMethod::FUNCTION_ARG); }else { inputMethods.push_back(BlackBox::InputMethod::EXT); inputAccess.push_back( inputsStructNameStr + "." + newNode->getInputPort(i)->getName()); //Prepend stucture name here } } newNode->setInputMethods(inputMethods); newNode->setInputAccess(inputAccess); //Output ports are external for the non-reusable style of Simulink Code Generation //Output ports are pointer arguments for the reusable style of Simulink Code Generation // HOWEVER! Output ports can also be part of the state for stateflow charts! // If a state variable is declared as an output, it (at least with the settings used // in the current incarnation of the Simulink export script) will not be included // in the external state structure. The output is passed as a pointer but it is // expected by stateflow/simulink that the value is preserved between calls. if(reusableFctn){ std::string imSuffix = "_im"; std::string reSuffix = "_re"; newNode->setImSuffix(imSuffix); newNode->setReSuffix(reSuffix); //Output access used for description std::vector<std::shared_ptr<OutputPort>> outputPorts = newNode->getOutputPorts(); std::vector<std::string> outputAccess; for (unsigned long i = 0; i < outputPorts.size(); i++) { std::shared_ptr<OutputPort> outputPort = outputPorts[i]; std::string descr = outputPort->getName(); if(!descr.empty()){ descr = "_" + descr; } outputAccess.push_back(std::string(VITIS_STATE_STRUCT_NAME) + "->blackbox" + GeneralHelper::to_string(outputPort->getParent()->getId()) + "_out" + descr + "_port" + GeneralHelper::to_string(i)); } newNode->setOutputAccess(outputAccess); newNode->setReturnMethod(BlackBox::ReturnMethod::PTR_ARG); }else { std::vector<std::shared_ptr<OutputPort>> outputPorts = newNode->getOutputPorts(); std::vector<std::string> outputAccess; for (unsigned long i = 0; i < outputPorts.size(); i++) { outputAccess.push_back(outputsStructNameStr + "." + newNode->getOutputPort(i)->getName()); } newNode->setOutputAccess(outputAccess); newNode->setReturnMethod(BlackBox::ReturnMethod::EXT); } //Assume that no output ports are registered* //TODO: refine std::vector<int> registeredOutputPorts; newNode->setRegisteredOutputPorts(registeredOutputPorts); if(reusableFctn){ // Set state variables in state structure Variable fsmStateVar = Variable(name+"_n"+GeneralHelper::to_string(id)+"_state", DataType(), {}, false, true); fsmStateVar.setOverrideType(newNode->getStateStructType()); Variable fsmRTModelVar = Variable(name+"_n"+GeneralHelper::to_string(id)+"_rtModel", DataType(), {}, false, true); fsmRTModelVar.setOverrideType(newNode->getRtModelStructType()); std::vector<Variable> stateVars = {fsmStateVar, fsmRTModelVar}; //Need to include outputs as state variables as well //However, we need to know their types which we learn in the //propogateProperties step //defer adding these until the propragateProperties step. newNode->setStateVars(stateVars); //Add additional args to functions (for passing state) //Need to pass a pointer to the rtModel rather than a copy of the structure std::vector<std::pair<std::string, int>> additionalArgsComboStateUpdate = {std::pair<std::string, int> ("(&(" + fsmRTModelVar.getCVarName(false, true, true) + "))", 0)}; newNode->setAdditionalArgsComboFctn(additionalArgsComboStateUpdate); newNode->setAdditionalArgsStateUpdateFctn(additionalArgsComboStateUpdate); std::vector<std::pair<std::string, int>> additionalArgsRst = {std::pair<std::string, int> (VITIS_STATE_STRUCT_NAME, 0)}; newNode->setAdditionalArgsResetFctn(additionalArgsRst); } //TODO: Add importing/exporting output port types. return newNode; } std::string SimulinkCoderFSM::getInputsStructName() const { return inputsStructName; } void SimulinkCoderFSM::setInputsStructName(const std::string &inputsStructName) { SimulinkCoderFSM::inputsStructName = inputsStructName; } std::string SimulinkCoderFSM::getOutputsStructName() const { return outputsStructName; } void SimulinkCoderFSM::setOutputsStructName(const std::string &outputsStructName) { SimulinkCoderFSM::outputsStructName = outputsStructName; } std::string SimulinkCoderFSM::getStateStructName() const { return stateStructName; } void SimulinkCoderFSM::setStateStructName(const std::string &stateStructName) { SimulinkCoderFSM::stateStructName = stateStructName; } xercesc::DOMElement * SimulinkCoderFSM::emitGraphML(xercesc::DOMDocument *doc, xercesc::DOMElement *graphNode, bool include_block_node_type) { xercesc::DOMElement* thisNode = emitGraphMLBasics(doc, graphNode); if(include_block_node_type) { GraphMLHelper::addDataNode(doc, thisNode, "block_node_type", "Stateflow"); } GraphMLHelper::addDataNode(doc, thisNode, "block_function", "Stateflow"); emitGraphMLCommon(doc, thisNode); GraphMLExporter::exportPortNames(getSharedPointer(), doc, thisNode); GraphMLHelper::addDataNode(doc, thisNode, "init_function", getResetName()); GraphMLHelper::addDataNode(doc, thisNode, "output_function", getExeCombinationalName()); GraphMLHelper::addDataNode(doc, thisNode, "state_update_function", getStateUpdateName()); GraphMLHelper::addDataNode(doc, thisNode, "inputs_struct_name", getInputsStructName()); GraphMLHelper::addDataNode(doc, thisNode, "outputs_struct_name", getOutputsStructName()); GraphMLHelper::addDataNode(doc, thisNode, "state_struct_name", getStateStructName()); GraphMLHelper::addDataNode(doc, thisNode, "exported_reusable_fctns", isSimulinkExportReusableFunction() ? "Yes" : "No"); GraphMLHelper::addDataNode(doc, thisNode, "rtModelType", getRtModelStructType()); GraphMLHelper::addDataNode(doc, thisNode, "stateStructType", getStateStructType()); GraphMLHelper::addDataNode(doc, thisNode, "rtStateMemberPtrName", getRtModelStatePtrName()); GraphMLHelper::addDataNode(doc, thisNode, "generatedReset", getGeneratedReset()); return thisNode; } std::set<GraphMLParameter> SimulinkCoderFSM::graphMLParameters() { std::set<GraphMLParameter> parameters = graphMLParametersCommon(); GraphMLExporter::addPortNameProperties(getSharedPointer(), parameters); parameters.insert(GraphMLParameter("init_function", "string", true)); parameters.insert(GraphMLParameter("output_function", "string", true)); parameters.insert(GraphMLParameter("state_update_function", "string", true)); parameters.insert(GraphMLParameter("inputs_struct_name", "string", true)); parameters.insert(GraphMLParameter("outputs_struct_name", "string", true)); parameters.insert(GraphMLParameter("state_struct_name", "string", true)); parameters.insert(GraphMLParameter("exported_reusable_fctns", "string", true)); parameters.insert(GraphMLParameter("rtModelType", "string", true)); parameters.insert(GraphMLParameter("stateStructType", "string", true)); parameters.insert(GraphMLParameter("rtStateMemberPtrName", "string", true)); parameters.insert(GraphMLParameter("generatedReset", "string", true)); return parameters; } std::string SimulinkCoderFSM::typeNameStr(){ return "SimulinkCoderFSM"; } bool SimulinkCoderFSM::isSimulinkExportReusableFunction() const { return simulinkExportReusableFunction; } void SimulinkCoderFSM::setSimulinkExportReusableFunction(bool simulinkExportReusableFunction) { SimulinkCoderFSM::simulinkExportReusableFunction = simulinkExportReusableFunction; } std::string SimulinkCoderFSM::getRtModelStructType() const { return rtModelStructType; } void SimulinkCoderFSM::setRtModelStructType(const std::string &rtModelStructType) { SimulinkCoderFSM::rtModelStructType = rtModelStructType; } std::string SimulinkCoderFSM::getRtModelStatePtrName() const { return rtModelStatePtrName; } void SimulinkCoderFSM::setRtModelStatePtrName(const std::string &rtModelStatePtrName) { SimulinkCoderFSM::rtModelStatePtrName = rtModelStatePtrName; } std::string SimulinkCoderFSM::getStateStructType() const { return stateStructType; } void SimulinkCoderFSM::setStateStructType(const std::string &stateStructType) { SimulinkCoderFSM::stateStructType = stateStructType; } std::string SimulinkCoderFSM::getCppBodyContent() const { std::string cppBody = BlackBox::getCppBodyContent(); if(isSimulinkExportReusableFunction()){ std::string rstName = "node"+GeneralHelper::to_string(id)+"_rst"; Variable fsmStateVar = Variable(name+"_n"+GeneralHelper::to_string(id)+"_state", DataType(), {}, false, true); fsmStateVar.setOverrideType(getStateStructType()); Variable fsmRTModelVar = Variable(name+"_n"+GeneralHelper::to_string(id)+"_rtModel", DataType(), {}, false, true); fsmRTModelVar.setOverrideType(getRtModelStructType()); cppBody += getResetFunctionPrototype() + "{\n"; //Set the ptr in rtModel cppBody += "\t" + fsmRTModelVar.getCVarName(false) + "." + rtModelStatePtrName + " = &(" + fsmStateVar.getCVarName(false) + ");\n"; //Note that these vars were passed as ptrs //Call the init function provided by the exported FSM, passing the RT model ptr and dummy variables for the inputs and outputs std::vector<Variable> dummyVars; for(int i = 0; i<inputPorts.size(); i++){ //TODO: assumes no discontinuity in ports and are in sorted order DataType dt = inputPorts[i]->getDataType(); int portNum = inputPorts[i]->getPortNum(); if(portNum != i){ throw std::runtime_error(ErrorHelpers::genErrorStr("Unexpected port numbering ")); } Variable dummyInVar = Variable("dummyIn" + GeneralHelper::to_string(i), dt); dummyInVar.getCVarDecl(false, true, false, true, false, false); if(dt.isComplex()){ dummyInVar.getCVarDecl(true, true, false, true, false, false); } dummyVars.push_back(dummyInVar); } std::vector<DataType> outputTypes = getOutputTypes(); //Only declare dummy output vars if output access is not provided std::vector<std::string> outputAccess = getOutputAccess(); if(outputAccess.empty()) { for (int i = 0; i < outputPorts.size(); i++) { //TODO: assumes no discontinuity in ports and are in sorted order DataType dt = outputTypes[i]; int portNum = outputPorts[i]->getPortNum(); if (portNum != i) { throw std::runtime_error(ErrorHelpers::genErrorStr("Unexpected port numbering ")); } Variable dummyOutVar = Variable("dummyOut" + GeneralHelper::to_string(i), dt); dummyOutVar.getCVarDecl(false, true, false, true, false, false); if (dt.isComplex()) { dummyOutVar.getCVarDecl(true, true, false, true, false, false); } dummyVars.push_back(dummyOutVar); } } for(int i = 0; i<dummyVars.size(); i++){ cppBody += "\t" + dummyVars[i].getCVarDecl(false, true, false, true, false, false) + ";\n"; if(dummyVars[i].getDataType().isComplex()){ cppBody += "\t" + dummyVars[i].getCVarDecl(true, true, false, true, false, false) + ";\n"; } } cppBody += "\t" + getGeneratedReset() + "("; cppBody += "&(" + fsmRTModelVar.getCVarName(false) + ")"; //Pass the FSM state //Pass the dummy vars for(int i = 0; i<dummyVars.size(); i++){ cppBody += ", &" + dummyVars[i].getCVarName(false); if(dummyVars[i].getDataType().isComplex()){ cppBody += ", &" + dummyVars[i].getCVarName(true); } } //If output access was provided, emit that if(!outputAccess.empty()){ for(int i = 0; i<outputTypes.size(); i++){ cppBody += ", &(" + outputAccess[i] + getReSuffix() + ")"; if(outputTypes[i].isComplex()){ cppBody += ", &(" + outputAccess[i] + getImSuffix() + ")"; } } } cppBody += ");\n"; cppBody += "}\n"; } return cppBody; } std::string SimulinkCoderFSM::getResetFunctionCall() { if(isSimulinkExportReusableFunction()){ //Need to set the reset function to be the wrapping reset function emitted by this node. Need the ID to be set //first std::string rstName = "node"+GeneralHelper::to_string(id)+"_rst"; setResetName(rstName); } return BlackBox::getResetFunctionCall(); } std::string SimulinkCoderFSM::getResetFunctionPrototype() const{ //Need the ID to be set before doing this std::string rstName = "node"+GeneralHelper::to_string(id)+"_rst"; std::string typeName = "Partition"+(partitionNum >= 0?GeneralHelper::to_string(partitionNum):"N"+GeneralHelper::to_string(-partitionNum))+"_state_t"; std::string proto = "void " + rstName + "("; //Pass pointers to RT model structure and FSM state structure proto += typeName + " *" + VITIS_STATE_STRUCT_NAME; proto += ")"; return proto; } std::string SimulinkCoderFSM::getGeneratedReset() const { return generatedReset; } void SimulinkCoderFSM::setGeneratedReset(const std::string &generatedReset) { SimulinkCoderFSM::generatedReset = generatedReset; } void SimulinkCoderFSM::propagateProperties() { BlackBox::propagateProperties(); //Get the datatypes of the output ports if(isSimulinkExportReusableFunction()){ //Need to add output variables to the state array std::vector<Variable> stateVars = getStateVars(); std::vector<DataType> outputTypes = getOutputTypes(); int outputPortCount = outputPorts.size(); for(int i = 0; i<outputPortCount; i++){ std::shared_ptr<OutputPort> outputPort = getOutputPort(i); std::string descr = outputPort->getName(); if(!descr.empty()){ descr = "_" + descr; } stateVars.push_back(Variable("blackbox" + GeneralHelper::to_string(outputPort->getParent()->getId()) + "_out" + descr + "_port" + GeneralHelper::to_string(i), outputTypes[i])); } setStateVars(stateVars); } } std::string SimulinkCoderFSM::getDeclAfterState() { //Declare reset function after the structure defn if(isSimulinkExportReusableFunction()){ return "#ifndef _H_NODE"+GeneralHelper::to_string(id)+"\n" + "#define _H_NODE"+GeneralHelper::to_string(id)+"\n" + getResetFunctionPrototype() + ";\n" + "#endif\n"; } return ""; }
[ "cyarp@eecs.berkeley.edu" ]
cyarp@eecs.berkeley.edu
3fae86c79feee3ebfa9be7f218aa1c9f6439cd54
339c7e861e1d010a037388d4e7a193f3795f8575
/Middlewares/ST/touchgfx/framework/source/touchgfx/containers/clock/DigitalClock.cpp
45d9e8fce4899292f316098d7b992c03ac7af824
[]
no_license
vanbuong/STM32F429_Disco
476ac360de3227f5ecfc302d1347d82937f4eb17
9ee6eb5024e376d527f235540fb8cbe766b0bee8
refs/heads/master
2023-03-18T14:45:19.634522
2021-03-17T05:35:50
2021-03-17T05:35:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,271
cpp
/** ****************************************************************************** * This file is part of the TouchGFX 4.13.0 distribution. * * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under Ultimate Liberty license * SLA0044, the "License"; You may not use this file except in compliance with * the License. You may obtain a copy of the License at: * www.st.com/SLA0044 * ****************************************************************************** */ #include <touchgfx/containers/clock/DigitalClock.hpp> namespace touchgfx { DigitalClock::DigitalClock() : AbstractClock(), displayMode(DISPLAY_24_HOUR), useLeadingZeroForHourIndicator(false) { buffer[0] = '\0'; text.setXY(0, 0); text.setWildcard(buffer); Container::add(text); } DigitalClock::~DigitalClock() { } void DigitalClock::setWidth(int16_t width) { Container::setWidth(width); text.setWidth(width); } void DigitalClock::setHeight(int16_t height) { Container::setHeight(height); text.setHeight(height); } void DigitalClock::setBaselineY(int16_t baselineY) { if (text.getTypedText().hasValidId()) { moveTo(getX(), baselineY - text.getTypedText().getFont()->getFontHeight()); } } void DigitalClock::displayLeadingZeroForHourIndicator(bool displayLeadingZero) { useLeadingZeroForHourIndicator = displayLeadingZero; } void DigitalClock::setAlpha(uint8_t alpha) { text.setAlpha(alpha); } uint8_t DigitalClock::getAlpha() const { return text.getAlpha(); } void DigitalClock::setTypedText(TypedText typedText) { text.setTypedText(typedText); text.invalidate(); } void DigitalClock::setColor(colortype color) { text.setColor(color); text.invalidate(); } void DigitalClock::setCurrentHour( const uint8_t& val ) { currentHour = val; } void DigitalClock::setCurrentMinute( const uint8_t& val ) { currentMinute = val; } void DigitalClock::setCurrentSecond( const uint8_t& val ) { currentSecond = val; } void DigitalClock::updateClock() { if (displayMode == DISPLAY_12_HOUR_NO_SECONDS) { const char* format = useLeadingZeroForHourIndicator ? "%02d:%02d %cM" : "%d:%02d %cM"; Unicode::snprintf(buffer, BUFFER_SIZE, format, ((currentHour + 11) % 12) + 1, currentMinute, currentHour < 12 ? 'A' : 'P'); } else if (displayMode == DISPLAY_24_HOUR_NO_SECONDS) { const char* format = useLeadingZeroForHourIndicator ? "%02d:%02d" : "%d:%02d"; Unicode::snprintf(buffer, BUFFER_SIZE, format, currentHour, currentMinute); } else if (displayMode == DISPLAY_12_HOUR) { const char* format = useLeadingZeroForHourIndicator ? "%02d:%02d:%02d %cM" : "%d:%02d:%02d %cM"; Unicode::snprintf(buffer, BUFFER_SIZE, format, ((currentHour + 11) % 12) + 1, currentMinute, currentSecond, currentHour < 12 ? 'A' : 'P'); } else if (displayMode == DISPLAY_24_HOUR) { const char* format = useLeadingZeroForHourIndicator ? "%02d:%02d:%02d" : "%d:%02d:%02d"; Unicode::snprintf(buffer, BUFFER_SIZE, format, currentHour, currentMinute, currentSecond); } text.invalidate(); } }
[ "embeddedcrab@users.noreply.github.com" ]
embeddedcrab@users.noreply.github.com
a08f9ebbf3af109bf7e9167faa0a6fb7ded54575
fa38db3bb819d6e07b37e14103cd12f57477de8f
/Management/include/IMouseEventHandler.hpp
d946af09f36cdf80b019114353976aff8e56d4f4
[]
no_license
wjackson2112/2DEngine
d64f2823b08e0a83a4975843bdd847df4b3d2114
9f63fc6df92b730f56c8bac0349ad283e50e81c7
refs/heads/master
2020-04-06T03:43:36.782723
2016-11-12T21:16:16
2016-11-12T21:16:16
68,382,394
0
0
null
null
null
null
UTF-8
C++
false
false
363
hpp
#ifndef IMOUSE_EVENT_HANDLER_H #define IMOUSE_EVENT_HANDLER_H #include <SDL2/SDL.h> class IMouseEventHandler { public: virtual void handleMousePress(int mouseButton, int x, int y) = 0; virtual void handleMouseDrag(int mouseButton, int prevX, int prevY, int currX, int currY) = 0; virtual void handleMouseRelease(int mouseButton, int x, int y) = 0; }; #endif
[ "wjackson2112@gmail.com" ]
wjackson2112@gmail.com
5e1a3b0121347e8a2fead69df67b5a2042a0556f
f473d77f67841bfadc9f03bebf3ce51235baa5e4
/src/WinExtras.cpp
58d53fce005a713be8420a6ef0b5290a76dee05f
[]
no_license
SxyHack/BossEngine
f1cd9a044be0585b00e442d23e64dca8c78b6223
976abae4689e36c53f0b0bca480c2ea62493435d
refs/heads/master
2023-06-22T08:06:10.168873
2021-06-11T10:50:01
2021-06-11T10:50:01
371,025,411
0
0
null
null
null
null
UTF-8
C++
false
false
9,820
cpp
#include "WinExtras.h" #include "libs/ntdll/ntdll.h" #include "global.h" #include <psapi.h> #include <QtDebug> WinExtras::WinExtras() : QObject(nullptr) , _DebugPrivilege(FALSE) { } WinExtras::~WinExtras() { } BOOL WinExtras::AdjustPrivilege() { //NTSTATUS status = RtlAdjustPrivilege(SE_DEBUG_PRIVILEGE, TRUE, FALSE, &_DebugPrivilege); //if (!NT_SUCCESS(status)) { // return FALSE; //} //return _DebugPrivilege; return FALSE; } BOOL WinExtras::EnableDebugPrivilege(BOOL bEnable) { // 附给本进程特权,以便访问系统进程 BOOL bOk = FALSE; HANDLE hToken; // 打开一个进程的访问令牌 if (::OpenProcessToken(::GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken)) { // 取得特权名称为“SetDebugPrivilege”的LUID LUID uID; ::LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &uID); // 调整特权级别 TOKEN_PRIVILEGES tp; tp.PrivilegeCount = 1; tp.Privileges[0].Luid = uID; tp.Privileges[0].Attributes = bEnable ? SE_PRIVILEGE_ENABLED : 0; ::AdjustTokenPrivileges(hToken, FALSE, &tp, sizeof(tp), NULL, NULL); bOk = (::GetLastError() == ERROR_SUCCESS); // 关闭访问令牌句柄 ::CloseHandle(hToken); } return bOk; } HWND WinExtras::QueryWindowHandle(DWORD dwTargetPID) { DWORD dwPID = 0; HWND hTargetWnd = NULL; HWND hWnd = ::GetTopWindow(NULL); while (hWnd) { DWORD dwThreadID = ::GetWindowThreadProcessId(hWnd, &dwPID); if (dwThreadID == 0) continue; if (dwPID == dwTargetPID) { hTargetWnd = hWnd; break; } hWnd = ::GetNextWindow(hWnd, GW_HWNDNEXT); } if (hTargetWnd != NULL) { HWND hParent = NULL; // 循环查找父窗口,以便保证返回的句柄是最顶层的窗口句柄 while ((hParent = ::GetParent(hTargetWnd)) != NULL) { hTargetWnd = hParent; } } return hTargetWnd; } BOOL WinExtras::GetProcessICON(DWORD dwTargetPID, QPixmap& pixmap) { HICON hIcon = NULL; HWND hWnd = QueryWindowHandle(dwTargetPID); if (hWnd == NULL) { return FALSE; } LRESULT ret = ::SendMessageTimeout(hWnd, WM_GETICON, 0, 0, SMTO_BLOCK | SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR)&hIcon); if (!ret) { DWORD dwlastError = GetLastError(); QString lastMessage = FormatLastError(dwlastError); qCritical("SendMessageTimeout Failed, Code:%x, Msg:%s", dwlastError, lastMessage.toUtf8().data()); return FALSE; } if (hIcon == NULL) { hIcon = (HICON)::GetClassLongPtr(hWnd, GCLP_HICONSM); } if (hIcon == NULL) { return FALSE; } pixmap = QtWin::fromHICON(hIcon); return TRUE; } QString WinExtras::FormatLastError(DWORD lastErr) { LPTSTR lpMsgBuf; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, lastErr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL); #ifdef UNICODE return QString::fromWCharArray(lpMsgBuf); #else return QString::fromLocal8Bit(lpMsgBuf); #endif } DWORD WinExtras::SetNtLastError(NTSTATUS status) { DWORD dwErrCode = RtlNtStatusToDosError(status); SetLastError(dwErrCode); return dwErrCode; } QString WinExtras::FormatMemoryProtection(DWORD value) { if (value == 0) return "PAGE_CALLER_NOT_ACCESS(0)"; QString qsFormat; if (value & PAGE_EXECUTE) qsFormat += "PAGE_EXECUTE|"; if (value & PAGE_EXECUTE_READ) qsFormat += "PAGE_EXECUTE_READ|"; if (value & PAGE_EXECUTE_READWRITE) qsFormat += "PAGE_EXECUTE_READWRITE|"; if (value & PAGE_EXECUTE_WRITECOPY) qsFormat += "PAGE_EXECUTE_WRITECOPY|"; if (value & PAGE_NOACCESS) qsFormat += "PAGE_NOACCESS|"; if (value & PAGE_READONLY) qsFormat += "PAGE_READONLY|"; if (value & PAGE_READWRITE) qsFormat += "PAGE_READWRITE|"; if (value & PAGE_WRITECOPY) qsFormat += "PAGE_WRITECOPY|"; if (value & PAGE_TARGETS_INVALID) qsFormat += "PAGE_TARGETS_INVALID|"; if (value & PAGE_GUARD) qsFormat += "PAGE_GUARD|"; if (value & PAGE_NOCACHE) qsFormat += "PAGE_NOCACHE|"; if (value & PAGE_WRITECOMBINE) qsFormat += "PAGE_WRITECOMBINE|"; if (qsFormat.isEmpty()) qsFormat = QString("PAGE_PROTECT_ERROR(0x%1)").arg(value, 0, 16); else qsFormat = qsFormat.left(qsFormat.length() - 1); // 删除最后一个'|' return qsFormat; } QString WinExtras::FormatMemoryState(DWORD state) { QString qsFormat; if (state & MEM_COMMIT) qsFormat += "MEM_COMMIT|"; if (state & MEM_FREE) qsFormat += "MEM_FREE|"; if (state & MEM_RESERVE) qsFormat += "MEM_RESERVE|"; if (qsFormat.isEmpty()) qsFormat = QString("MEM_STATE_ERROR(0x%1)").arg(state, 0, 16); else qsFormat = qsFormat.left(qsFormat.length() - 1); // 删除最后一个'|' return qsFormat; //switch (state) //{ //case 0x1000: return "MEM_COMMIT"; //case 0x10000: return "MEM_FREE"; //case 0x2000: return "MEM_RESERVE"; //default: return QString("MEM_STATE_ERROR(0x%1)").arg(state, 0, 16); //} } QString WinExtras::FormatMemoryType(DWORD value) { QString qsFormat; if (value & MEM_IMAGE) qsFormat += "MEM_IMAGE|"; if (value & MEM_MAPPED) qsFormat += "MEM_MAPPED|"; if (value & MEM_PRIVATE) qsFormat += "MEM_PRIVATE|"; if (qsFormat.isEmpty()) qsFormat = QString("MEM_TYPE_ERROR(0x%1)").arg(value, 0, 16); else qsFormat = qsFormat.left(qsFormat.length() - 1); // 删除最后一个'|' return qsFormat; } BOOL WinExtras::EnumProcessModulesNT(IN HANDLE hProcess) { DWORD cbBytesNeeded = 0; EnumProcessModulesEx(hProcess, NULL, 0, &cbBytesNeeded, LIST_MODULES_ALL); DWORD cb = cbBytesNeeded + 0x1000; HMODULE* lpModuleEntry = (HMODULE*)malloc(cb); if (lpModuleEntry == NULL) { qCritical("malloc error"); return FALSE; } EnumProcessModulesEx(hProcess, lpModuleEntry, cb, &cbBytesNeeded, LIST_MODULES_ALL); DWORD dwLength = cbBytesNeeded / sizeof(HMODULE); MODULEINFO moduleInfo; for (int i = 0; i < dwLength; i++) { HMODULE hMod = lpModuleEntry[i]; DWORD cbModule = sizeof(MODULEINFO); GetModuleInformation(hProcess, hMod, &moduleInfo, cbModule); TCHAR szModFile[1024]; GetModuleFileName(hMod, szModFile, 1024); qDebug("Mod: %c Base:0x%08x Size:%d Entry:0x%08x", szModFile, moduleInfo.lpBaseOfDll, moduleInfo.SizeOfImage, moduleInfo.EntryPoint); } return TRUE; } BOOL WinExtras::EnumProcessModulesTH(IN DWORD dwPID, OUT LIST_MODULE& modules) { BOOL ret = FALSE; MODULEENTRY32 moduleEntry = { 0 }; moduleEntry.dwSize = sizeof(MODULEENTRY32); HANDLE hSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwPID); if (hSnap == INVALID_HANDLE_VALUE) { DWORD dwLastError = GetLastError(); auto message = FormatLastError(dwLastError); qWarning("CreateToolhelp32Snapshot FAIL, 0x%08X %s", dwLastError, message.toUtf8().data()); return FALSE; } ret = Module32First(hSnap, &moduleEntry); do { modules.append(moduleEntry); } while (ret = Module32Next(hSnap, &moduleEntry)); CloseHandle(hSnap); return !modules.isEmpty(); } BOOL WinExtras::QueryProcessMemory(HANDLE hProcess, ULONG_PTR lpAddress, LIST_MEMORY& results) { MEMORY_BASIC_INFORMATION mbi = { 0 }; ULONG_PTR ulQueryAddr = lpAddress; while (::VirtualQueryEx(hProcess, (LPCVOID)ulQueryAddr, &mbi, sizeof(MEMORY_BASIC_INFORMATION))) { ulQueryAddr += mbi.RegionSize; auto qsAllocMemProtect = FormatMemoryProtection(mbi.AllocationProtect); auto qsMemProtect = FormatMemoryProtection(mbi.Protect); auto qsMemState = FormatMemoryState(mbi.State); auto qsMemType = FormatMemoryType(mbi.Type); TCHAR szModName[MAX_PATH]; auto size = sizeof(szModName) / sizeof(TCHAR); ::GetModuleFileNameEx(hProcess, (HMODULE)mbi.AllocationBase, szModName, size); qDebug("VM(%d): %p %p %u %s %s %s %s", mbi.PartitionId, mbi.BaseAddress, mbi.AllocationBase, mbi.RegionSize, qsAllocMemProtect.toUtf8().data(), qsMemProtect.toUtf8().data(), qsMemState.toUtf8().data(), qsMemType.toUtf8().data() ); qDebug() << QString::fromWCharArray(szModName); } return TRUE; } QString WinExtras::GetSystemDir() { TCHAR szPath[512] = { 0 }; UINT nSize = GetSystemDirectory(szPath, 512); return QString::fromWCharArray(szPath, nSize); } QString WinExtras::TranslateNativeName(TCHAR* szName) { TCHAR szTranslatedName[MAX_FILE_PATH_SIZE] = { 0 }; TCHAR szDeviceName[3] = L"A:"; TCHAR szDeviceCOMName[5] = L"COM0"; int CurrentDeviceLen; while (szDeviceName[0] <= 0x5A) { RtlZeroMemory(szTranslatedName, MAX_FILE_PATH_SIZE); if (QueryDosDevice(szDeviceName, szTranslatedName, MAX_PATH * 2) > NULL) { CurrentDeviceLen = lstrlen(szTranslatedName); lstrcat(szTranslatedName, (LPTSTR)(szName + CurrentDeviceLen)); if (lstrcmpi(szTranslatedName, szName) == NULL) { RtlZeroMemory(szTranslatedName, MAX_FILE_PATH_SIZE); lstrcat(szTranslatedName, szDeviceName); lstrcat(szTranslatedName, (LPTSTR)(szName + CurrentDeviceLen)); return QString::fromWCharArray(szTranslatedName); } } szDeviceName[0]++; } while (szDeviceCOMName[3] <= 0x39) { RtlZeroMemory(szTranslatedName, MAX_FILE_PATH_SIZE); if (QueryDosDevice(szDeviceCOMName, szTranslatedName, MAX_PATH * 2) > NULL) { CurrentDeviceLen = lstrlen(szTranslatedName); lstrcat(szTranslatedName, szName + CurrentDeviceLen); if (lstrcmpi(szTranslatedName, szName) == NULL) { RtlZeroMemory(szTranslatedName, MAX_FILE_PATH_SIZE); lstrcat(szTranslatedName, szDeviceCOMName); lstrcat(szTranslatedName, szName + CurrentDeviceLen); return QString::fromWCharArray(szTranslatedName); } } szDeviceCOMName[3]++; } return QString(); } //BOOL WinExtras::QueryProcessInformation(HANDLE hProcess) //{ // PPEB lpPEB; // PROCESS_BASIC_INFORMATION pbi; // ULONG ulPEBSize = sizeof(PROCESS_BASIC_INFORMATION); // ULONG ulReturnSize = 0; // // NTSTATUS status = NtQueryInformationProcess(hProcess, ProcessBasicInformation, &pbi, ulPEBSize, &ulReturnSize); // if (!NT_SUCCESS(status)) // { // return FALSE; // } // // return TRUE; //}
[ "tangxy85718@gmail.com" ]
tangxy85718@gmail.com
16c25f3af53ab5613b56d526a8daad4351ad6884
b4233974a492cafab28fb74e3a1f5ee75fd7c6aa
/MD_MPU_9250/MD_MPU_9250.ino
8968dcfec11d47b0cef98f97d95ff59cdfff01f0
[]
no_license
okuna291/jacket
b51f9c76bf2d34b5b945002fb9ccebf23d1eb587
24be58c1c901f976a49bd52e3c41484a7afda0a6
refs/heads/master
2021-01-10T05:50:06.090665
2016-01-06T15:41:28
2016-01-06T15:41:28
48,956,451
0
0
null
null
null
null
UTF-8
C++
false
false
52,211
ino
#include <Wire.h> // See also MPU-9250 Register Map and Descriptions, Revision 4.0, RM-MPU-9250A-00, Rev. 1.4, 9/9/2013 for registers not listed in // above document; the MPU9250 and MPU9150 are virtually identical but the latter has a different register map // //Magnetometer Registers #define AK8963_ADDRESS 0x0C #define WHO_AM_I_AK8963 0x00 // should return 0x48 #define INFO 0x01 #define AK8963_ST1 0x02 // data ready status bit 0 #define AK8963_XOUT_L 0x03 // data #define AK8963_XOUT_H 0x04 #define AK8963_YOUT_L 0x05 #define AK8963_YOUT_H 0x06 #define AK8963_ZOUT_L 0x07 #define AK8963_ZOUT_H 0x08 #define AK8963_ST2 0x09 // Data overflow bit 3 and data read error status bit 2 #define AK8963_CNTL 0x0A // Power down (0000), single-measurement (0001), self-test (1000) and Fuse ROM (1111) modes on bits 3:0 #define AK8963_ASTC 0x0C // Self test control #define AK8963_I2CDIS 0x0F // I2C disable #define AK8963_ASAX 0x10 // Fuse ROM x-axis sensitivity adjustment value #define AK8963_ASAY 0x11 // Fuse ROM y-axis sensitivity adjustment value #define AK8963_ASAZ 0x12 // Fuse ROM z-axis sensitivity adjustment value #define SELF_TEST_X_GYRO 0x00 #define SELF_TEST_Y_GYRO 0x01 #define SELF_TEST_Z_GYRO 0x02 #define X_FINE_GAIN 0x03 // [7:0] fine gain #define Y_FINE_GAIN 0x04 #define Z_FINE_GAIN 0x05 #define XA_OFFSET_H 0x06 // User-defined trim values for accelerometer #define XA_OFFSET_L_TC 0x07 #define YA_OFFSET_H 0x08 #define YA_OFFSET_L_TC 0x09 #define ZA_OFFSET_H 0x0A #define ZA_OFFSET_L_TC 0x0B #define SELF_TEST_X_ACCEL 0x0D #define SELF_TEST_Y_ACCEL 0x0E #define SELF_TEST_Z_ACCEL 0x0F #define SELF_TEST_A 0x10 #define XG_OFFSET_H 0x13 // User-defined trim values for gyroscope #define XG_OFFSET_L 0x14 #define YG_OFFSET_H 0x15 #define YG_OFFSET_L 0x16 #define ZG_OFFSET_H 0x17 #define ZG_OFFSET_L 0x18 #define SMPLRT_DIV 0x19 #define CONFIG 0x1A #define GYRO_CONFIG 0x1B #define ACCEL_CONFIG 0x1C #define ACCEL_CONFIG2 0x1D #define LP_ACCEL_ODR 0x1E #define WOM_THR 0x1F #define MOT_DUR 0x20 // Duration counter threshold for motion interrupt generation, 1 kHz rate, LSB = 1 ms #define ZMOT_THR 0x21 // Zero-motion detection threshold bits [7:0] #define ZRMOT_DUR 0x22 // Duration counter threshold for zero motion interrupt generation, 16 Hz rate, LSB = 64 ms #define FIFO_EN 0x23 #define I2C_MST_CTRL 0x24 #define I2C_SLV0_ADDR 0x25 #define I2C_SLV0_REG 0x26 #define I2C_SLV0_CTRL 0x27 #define I2C_SLV1_ADDR 0x28 #define I2C_SLV1_REG 0x29 #define I2C_SLV1_CTRL 0x2A #define I2C_SLV2_ADDR 0x2B #define I2C_SLV2_REG 0x2C #define I2C_SLV2_CTRL 0x2D #define I2C_SLV3_ADDR 0x2E #define I2C_SLV3_REG 0x2F #define I2C_SLV3_CTRL 0x30 #define I2C_SLV4_ADDR 0x31 #define I2C_SLV4_REG 0x32 #define I2C_SLV4_DO 0x33 #define I2C_SLV4_CTRL 0x34 #define I2C_SLV4_DI 0x35 #define I2C_MST_STATUS 0x36 #define INT_PIN_CFG 0x37 #define INT_ENABLE 0x38 #define DMP_INT_STATUS 0x39 // Check DMP interrupt #define INT_STATUS 0x3A #define ACCEL_XOUT_H 0x3B #define ACCEL_XOUT_L 0x3C #define ACCEL_YOUT_H 0x3D #define ACCEL_YOUT_L 0x3E #define ACCEL_ZOUT_H 0x3F #define ACCEL_ZOUT_L 0x40 #define TEMP_OUT_H 0x41 #define TEMP_OUT_L 0x42 #define GYRO_XOUT_H 0x43 #define GYRO_XOUT_L 0x44 #define GYRO_YOUT_H 0x45 #define GYRO_YOUT_L 0x46 #define GYRO_ZOUT_H 0x47 #define GYRO_ZOUT_L 0x48 #define EXT_SENS_DATA_00 0x49 #define EXT_SENS_DATA_01 0x4A #define EXT_SENS_DATA_02 0x4B #define EXT_SENS_DATA_03 0x4C #define EXT_SENS_DATA_04 0x4D #define EXT_SENS_DATA_05 0x4E #define EXT_SENS_DATA_06 0x4F #define EXT_SENS_DATA_07 0x50 #define EXT_SENS_DATA_08 0x51 #define EXT_SENS_DATA_09 0x52 #define EXT_SENS_DATA_10 0x53 #define EXT_SENS_DATA_11 0x54 #define EXT_SENS_DATA_12 0x55 #define EXT_SENS_DATA_13 0x56 #define EXT_SENS_DATA_14 0x57 #define EXT_SENS_DATA_15 0x58 #define EXT_SENS_DATA_16 0x59 #define EXT_SENS_DATA_17 0x5A #define EXT_SENS_DATA_18 0x5B #define EXT_SENS_DATA_19 0x5C #define EXT_SENS_DATA_20 0x5D #define EXT_SENS_DATA_21 0x5E #define EXT_SENS_DATA_22 0x5F #define EXT_SENS_DATA_23 0x60 #define MOT_DETECT_STATUS 0x61 #define I2C_SLV0_DO 0x63 #define I2C_SLV1_DO 0x64 #define I2C_SLV2_DO 0x65 #define I2C_SLV3_DO 0x66 #define I2C_MST_DELAY_CTRL 0x67 #define SIGNAL_PATH_RESET 0x68 #define MOT_DETECT_CTRL 0x69 #define USER_CTRL 0x6A // Bit 7 enable DMP, bit 3 reset DMP #define PWR_MGMT_1 0x6B // Device defaults to the SLEEP mode #define PWR_MGMT_2 0x6C #define DMP_BANK 0x6D // Activates a specific bank in the DMP #define DMP_RW_PNT 0x6E // Set read/write pointer to a specific start address in specified DMP bank #define DMP_REG 0x6F // Register in DMP from which to read or to which to write #define DMP_REG_1 0x70 #define DMP_REG_2 0x71 #define FIFO_COUNTH 0x72 #define FIFO_COUNTL 0x73 #define FIFO_R_W 0x74 #define WHO_AM_I_MPU9250 0x75 // Should return 0x71 #define XA_OFFSET_H 0x77 #define XA_OFFSET_L 0x78 #define YA_OFFSET_H 0x7A #define YA_OFFSET_L 0x7B #define ZA_OFFSET_H 0x7D #define ZA_OFFSET_L 0x7E // Using the MSENSR-9250 breakout board, ADO is set to 0 // Seven-bit device address is 110100 for ADO = 0 and 110101 for ADO = 1 #define ADO 0 #if ADO #define MPU9250_ADDRESS 0x69 // Device address when ADO = 1 #else #define MPU9250_ADDRESS 0x68 // Device address when ADO = 0 #define AK8963_ADDRESS 0x0C // Address of magnetometer #endif #define AHRS true // set to false for basic data read #define SerialDebug true // set to true to get Serial output for debugging // Set initial input parameters enum Ascale { AFS_2G = 0, AFS_4G, AFS_8G, AFS_16G }; enum Gscale { GFS_250DPS = 0, GFS_500DPS, GFS_1000DPS, GFS_2000DPS }; enum Mscale { MFS_14BITS = 0, // 0.6 mG per LSB MFS_16BITS // 0.15 mG per LSB }; // Specify sensor full scale uint8_t Gscale = GFS_250DPS; uint8_t Ascale = AFS_2G; uint8_t Mscale = MFS_16BITS; // Choose either 14-bit or 16-bit magnetometer resolution uint8_t Mmode = 0x02; // 2 for 8 Hz, 6 for 100 Hz continuous magnetometer data read float aRes, gRes, mRes; // scale resolutions per LSB for the sensors int16_t accelCount[3]; // Stores the 16-bit signed accelerometer sensor output int16_t gyroCount[3]; // Stores the 16-bit signed gyro sensor output int16_t magCount[3]; // Stores the 16-bit signed magnetometer sensor output float magCalibration[3] = {0, 0, 0}, magbias[3] = {0, 0, 0}; // Factory mag calibration and mag bias float gyroBias[3] = {0, 0, 0}, accelBias[3] = {0, 0, 0}; // Bias corrections for gyro and accelerometer float SelfTest[6]; // holds results of gyro and accelerometer self test // global constants for 9 DoF fusion and AHRS (Attitude and Heading Reference System) float GyroMeasError = PI * (40.0f / 180.0f); // gyroscope measurement error in rads/s (start at 40 deg/s) float GyroMeasDrift = PI * (0.0f / 180.0f); // gyroscope measurement drift in rad/s/s (start at 0.0 deg/s/s) // There is a tradeoff in the beta parameter between accuracy and response speed. // In the original Madgwick study, beta of 0.041 (corresponding to GyroMeasError of 2.7 degrees/s) was found to give optimal accuracy. // However, with this value, the LSM9SD0 response time is about 10 seconds to a stable initial quaternion. // Subsequent changes also require a longish lag time to a stable output, not fast enough for a quadcopter or robot car! // By increasing beta (GyroMeasError) by about a factor of fifteen, the response time constant is reduced to ~2 sec // I haven't noticed any reduction in solution accuracy. This is essentially the I coefficient in a PID control sense; // the bigger the feedback coefficient, the faster the solution converges, usually at the expense of accuracy. // In any case, this is the free parameter in the Madgwick filtering and fusion scheme. float beta = sqrt(3.0f / 4.0f) * GyroMeasError; // compute beta float zeta = sqrt(3.0f / 4.0f) * GyroMeasDrift; // compute zeta, the other free parameter in the Madgwick scheme usually set to a small or zero value #define Kp 2.0f * 5.0f // these are the free parameters in the Mahony filter and fusion scheme, Kp for proportional feedback, Ki for integral #define Ki 0.0f uint32_t delt_t = 0; // used to control display output rate uint32_t count = 0, sumCount = 0; // used to control display output rate float pitch, yaw, roll; float deltat = 0.0f, sum = 0.0f; // integration interval for both filter schemes uint32_t lastUpdate = 0, firstUpdate = 0; // used to calculate integration interval uint32_t Now = 0; // used to calculate integration interval float ax, ay, az, gx, gy, gz, mx, my, mz; // variables to hold latest sensor data values float q[4] = {1.0f, 0.0f, 0.0f, 0.0f}; // vector to hold quaternion float eInt[3] = {0.0f, 0.0f, 0.0f}; // vector to hold integral error for Mahony method //struct var //{ // float yawa; // float pitcha; // float rolla; // int a=1; //}; // //var qu; void setup() { Wire.begin(); // TWBR = 12; // 400 kbit/sec I2C speed Serial.begin(9600); Serial1.begin(9600); pinMode(13,OUTPUT); digitalWrite(13,HIGH); // Set up the interrupt pin, its set as active high, push-pull // Read the WHO_AM_I register, this is a good test of communication byte c = readByte(MPU9250_ADDRESS, WHO_AM_I_MPU9250); // Read WHO_AM_I register for MPU-9250 // Serial.print("MPU9250 "); Serial.print("I AM "); Serial.print(c, HEX); Serial.print(" I should be "); Serial.println(0x71, HEX); if (c == 0x71) // WHO_AM_I should always be 0x68 { // Serial.println("MPU9250 is online..."); MPU9250SelfTest(SelfTest); // Start by performing self test and reporting values // Serial.print("x-axis self test: acceleration trim within : "); Serial.print(SelfTest[0],1); Serial.println("% of factory value"); // Serial.print("y-axis self test: acceleration trim within : "); Serial.print(SelfTest[1],1); Serial.println("% of factory value"); // Serial.print("z-axis self test: acceleration trim within : "); Serial.print(SelfTest[2],1); Serial.println("% of factory value"); // Serial.print("x-axis self test: gyration trim within : "); Serial.print(SelfTest[3],1); Serial.println("% of factory value"); // Serial.print("y-axis self test: gyration trim within : "); Serial.print(SelfTest[4],1); Serial.println("% of factory value"); // Serial.print("z-axis self test: gyration trim within : "); Serial.print(SelfTest[5],1); Serial.println("% of factory value"); // calibrateMPU9250(gyroBias, accelBias); // Calibrate gyro and accelerometers, load biases in bias registers initMPU9250(); // Serial.println("MPU9250 initialized for active data mode...."); // Initialize device for active mode read of acclerometer, gyroscope, and temperature // Read the WHO_AM_I register of the magnetometer, this is a good test of communication byte d = readByte(AK8963_ADDRESS, WHO_AM_I_AK8963); // Read WHO_AM_I register for AK8963 // Serial.print("AK8963 "); Serial.print("I AM "); Serial.print(d, HEX); Serial.print(" I should be "); Serial.println(0x48, HEX); // Get magnetometer calibration from AK8963 ROM initAK8963(magCalibration); //Serial.println("AK8963 initialized for active data mode...."); // Initialize device for active mode read of magnetometer if(SerialDebug) { // Serial.println("Calibration values: "); // Serial.print("X-Axis sensitivity adjustment value "); Serial.println(magCalibration[0], 2); // Serial.print("Y-Axis sensitivity adjustment value "); Serial.println(magCalibration[1], 2); // Serial.print("Z-Axis sensitivity adjustment value "); Serial.println(magCalibration[2], 2); } } else { // Serial.print("Could not connect to MPU9250: 0x"); // Serial.println(c, HEX); while(1) ; // Loop forever if communication doesn't happen } } void loop() { digitalWrite(13,LOW); // If intPin goes high, all data registers have new data if (readByte(MPU9250_ADDRESS, INT_STATUS) & 0x01) { // On interrupt, check if data ready interrupt readAccelData(accelCount); // Read the x/y/z adc values getAres(); // Now we'll calculate the accleration value into actual g's ax = (float)accelCount[0]*aRes; // - accelBias[0]; // get actual g value, this depends on scale being set ay = (float)accelCount[1]*aRes; // - accelBias[1]; az = (float)accelCount[2]*aRes; // - accelBias[2]; readGyroData(gyroCount); // Read the x/y/z adc values getGres(); // Calculate the gyro value into actual degrees per second gx = (float)gyroCount[0]*gRes; // get actual gyro value, this depends on scale being set gy = (float)gyroCount[1]*gRes; gz = (float)gyroCount[2]*gRes; readMagData(magCount); // Read the x/y/z adc values getMres(); magbias[0] = +470.; // User environmental x-axis correction in milliGauss, should be automatically calculated magbias[1] = +120.; // User environmental x-axis correction in milliGauss magbias[2] = +125.; // User environmental x-axis correction in milliGauss // Calculate the magnetometer values in milliGauss // Include factory calibration per data sheet and user environmental corrections mx = (float)magCount[0]*mRes*magCalibration[0] - magbias[0]; // get actual magnetometer value, this depends on scale being set my = (float)magCount[1]*mRes*magCalibration[1] - magbias[1]; mz = (float)magCount[2]*mRes*magCalibration[2] - magbias[2]; } Now = micros(); deltat = ((Now - lastUpdate)/1000000.0f); // set integration time by time elapsed since last filter update lastUpdate = Now; sum += deltat; // sum for averaging filter update rate sumCount++; // Sensors x (y)-axis of the accelerometer is aligned with the y (x)-axis of the magnetometer; // the magnetometer z-axis (+ down) is opposite to z-axis (+ up) of accelerometer and gyro! // We have to make some allowance for this orientationmismatch in feeding the output to the quaternion filter. // For the MPU-9250, we have chosen a magnetic rotation that keeps the sensor forward along the x-axis just like // in the LSM9DS0 sensor. This rotation can be modified to allow any convenient orientation convention. // This is ok by aircraft orientation standards! // Pass gyro rate as rad/s MadgwickQuaternionUpdate(ax, ay, az, gx*PI/180.0f, gy*PI/180.0f, gz*PI/180.0f, my, mx, mz); //MahonyQuaternionUpdate(ax, ay, az, gx*PI/180.0f, gy*PI/180.0f, gz*PI/180.0f, my, mx, mz); if (!AHRS) { delt_t = millis() - count; if(delt_t > 500) { count = millis(); } } else { // Serial print and/or display at 0.5 s rate independent of data rates delt_t = millis() - count; if (delt_t > 25) { // update LCD once per half-second independent of read rate // Define output variables from updated quaternion---these are Tait-Bryan angles, commonly used in aircraft orientation. // In this coordinate system, the positive z-axis is down toward Earth. // Yaw is the angle between Sensor x-axis and Earth magnetic North (or true North if corrected for local declination, looking down on the sensor positive yaw is counterclockwise. // Pitch is angle between sensor x-axis and Earth ground plane, toward the Earth is positive, up toward the sky is negative. // Roll is angle between sensor y-axis and Earth ground plane, y-axis up is positive roll. // These arise from the definition of the homogeneous rotation matrix constructed from quaternions. // Tait-Bryan angles as well as Euler angles are non-commutative; that is, the get the correct orientation the rotations must be // applied in the correct order which for this configuration is yaw, pitch, and then roll. // For more see http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles which has additional links. yaw = atan2(2.0f * (q[1] * q[2] + q[0] * q[3]), q[0] * q[0] + q[1] * q[1] - q[2] * q[2] - q[3] * q[3]); pitch = -asin(2.0f * (q[1] * q[3] - q[0] * q[2])); roll = atan2(2.0f * (q[0] * q[1] + q[2] * q[3]), q[0] * q[0] - q[1] * q[1] - q[2] * q[2] + q[3] * q[3]); pitch *= 180.0f / PI; yaw *= 180.0f / PI; yaw -= 13.8; // Declination at Danville, California is 13 degrees 48 minutes and 47 seconds on 2014-04-04 roll *= 180.0f / PI; // qu.yawa=yaw; // qu.pitcha=pitch; // qu.rolla=roll; String yaws = String(yaw, 2); String pitchs = String(pitch,2); String rolls = String(roll,2); String final = "e,"+yaws+","+pitchs+","+rolls+","+"a"; if(SerialDebug) { // Serial.print(yaw, 2); // Serial.print(","); // Serial.print(pitch, 2); // Serial.print(","); // Serial.println(roll, 2); Serial.println(final); Serial1.println(final); } if(Serial1.available()) { // Serial1.flush(); digitalWrite(13,HIGH); // Serial1.print("-12.34"); // Serial1.print(","); // Serial1.print("-54.65"); // Serial1.print(","); // Serial1.print("-118.24"); // Serial1.print(","); // Serial1.print("a"); // Serial1.println(final); } // With these settings the filter is updating at a ~145 Hz rate using the Madgwick scheme and // >200 Hz using the Mahony scheme even though the display refreshes at only 2 Hz. // The filter update rate is determined mostly by the mathematical steps in the respective algorithms, // the processor speed (8 MHz for the 3.3V Pro Mini), and the magnetometer ODR: // an ODR of 10 Hz for the magnetometer produce the above rates, maximum magnetometer ODR of 100 Hz produces // filter update rates of 36 - 145 and ~38 Hz for the Madgwick and Mahony schemes, respectively. // This is presumably because the magnetometer read takes longer than the gyro or accelerometer reads. // This filter update rate should be fast enough to maintain accurate platform orientation for // stabilization control of a fast-moving robot or quadcopter. Compare to the update rate of 200 Hz // produced by the on-board Digital Motion Processor of Invensense's MPU6050 6 DoF and MPU9150 9DoF sensors. // The 3.3 V 8 MHz Pro Mini is doing pretty well! // display.setCursor(0, 40); display.print("rt: "); display.print((float) sumCount / sum, 2); display.print(" Hz"); // display.display(); count = millis(); sumCount = 0; sum = 0; } } } //=================================================================================================================== //====== Set of useful function to access acceleration. gyroscope, magnetometer, and temperature data //=================================================================================================================== void getMres() { switch (Mscale) { // Possible magnetometer scales (and their register bit settings) are: // 14 bit resolution (0) and 16 bit resolution (1) case MFS_14BITS: mRes = 10.*4912./8190.; // Proper scale to return milliGauss break; case MFS_16BITS: mRes = 10.*4912./32760.0; // Proper scale to return milliGauss break; } } void getGres() { switch (Gscale) { // Possible gyro scales (and their register bit settings) are: // 250 DPS (00), 500 DPS (01), 1000 DPS (10), and 2000 DPS (11). // Here's a bit of an algorith to calculate DPS/(ADC tick) based on that 2-bit value: case GFS_250DPS: gRes = 250.0/32768.0; break; case GFS_500DPS: gRes = 500.0/32768.0; break; case GFS_1000DPS: gRes = 1000.0/32768.0; break; case GFS_2000DPS: gRes = 2000.0/32768.0; break; } } void getAres() { switch (Ascale) { // Possible accelerometer scales (and their register bit settings) are: // 2 Gs (00), 4 Gs (01), 8 Gs (10), and 16 Gs (11). // Here's a bit of an algorith to calculate DPS/(ADC tick) based on that 2-bit value: case AFS_2G: aRes = 2.0/32768.0; break; case AFS_4G: aRes = 4.0/32768.0; break; case AFS_8G: aRes = 8.0/32768.0; break; case AFS_16G: aRes = 16.0/32768.0; break; } } void readAccelData(int16_t * destination) { uint8_t rawData[6]; // x/y/z accel register data stored here readBytes(MPU9250_ADDRESS, ACCEL_XOUT_H, 6, &rawData[0]); // Read the six raw data registers into data array destination[0] = ((int16_t)rawData[0] << 8) | rawData[1] ; // Turn the MSB and LSB into a signed 16-bit value destination[1] = ((int16_t)rawData[2] << 8) | rawData[3] ; destination[2] = ((int16_t)rawData[4] << 8) | rawData[5] ; } void readGyroData(int16_t * destination) { uint8_t rawData[6]; // x/y/z gyro register data stored here readBytes(MPU9250_ADDRESS, GYRO_XOUT_H, 6, &rawData[0]); // Read the six raw data registers sequentially into data array destination[0] = ((int16_t)rawData[0] << 8) | rawData[1] ; // Turn the MSB and LSB into a signed 16-bit value destination[1] = ((int16_t)rawData[2] << 8) | rawData[3] ; destination[2] = ((int16_t)rawData[4] << 8) | rawData[5] ; } void readMagData(int16_t * destination) { uint8_t rawData[7]; // x/y/z gyro register data, ST2 register stored here, must read ST2 at end of data acquisition if(readByte(AK8963_ADDRESS, AK8963_ST1) & 0x01) { // wait for magnetometer data ready bit to be set readBytes(AK8963_ADDRESS, AK8963_XOUT_L, 7, &rawData[0]); // Read the six raw data and ST2 registers sequentially into data array uint8_t c = rawData[6]; // End data read by reading ST2 register if(!(c & 0x08)) { // Check if magnetic sensor overflow set, if not then report data destination[0] = ((int16_t)rawData[1] << 8) | rawData[0] ; // Turn the MSB and LSB into a signed 16-bit value destination[1] = ((int16_t)rawData[3] << 8) | rawData[2] ; // Data stored as little Endian destination[2] = ((int16_t)rawData[5] << 8) | rawData[4] ; } } } int16_t readTempData() { uint8_t rawData[2]; // x/y/z gyro register data stored here readBytes(MPU9250_ADDRESS, TEMP_OUT_H, 2, &rawData[0]); // Read the two raw data registers sequentially into data array return ((int16_t)rawData[0] << 8) | rawData[1] ; // Turn the MSB and LSB into a 16-bit value } void initAK8963(float * destination) { // First extract the factory calibration for each magnetometer axis uint8_t rawData[3]; // x/y/z gyro calibration data stored here writeByte(AK8963_ADDRESS, AK8963_CNTL, 0x00); // Power down magnetometer delay(10); writeByte(AK8963_ADDRESS, AK8963_CNTL, 0x0F); // Enter Fuse ROM access mode delay(10); readBytes(AK8963_ADDRESS, AK8963_ASAX, 3, &rawData[0]); // Read the x-, y-, and z-axis calibration values destination[0] = (float)(rawData[0] - 128)/256. + 1.; // Return x-axis sensitivity adjustment values, etc. destination[1] = (float)(rawData[1] - 128)/256. + 1.; destination[2] = (float)(rawData[2] - 128)/256. + 1.; writeByte(AK8963_ADDRESS, AK8963_CNTL, 0x00); // Power down magnetometer delay(10); // Configure the magnetometer for continuous read and highest resolution // set Mscale bit 4 to 1 (0) to enable 16 (14) bit resolution in CNTL register, // and enable continuous mode data acquisition Mmode (bits [3:0]), 0010 for 8 Hz and 0110 for 100 Hz sample rates writeByte(AK8963_ADDRESS, AK8963_CNTL, Mscale << 4 | Mmode); // Set magnetometer data resolution and sample ODR delay(10); } void initMPU9250() { // wake up device writeByte(MPU9250_ADDRESS, PWR_MGMT_1, 0x00); // Clear sleep mode bit (6), enable all sensors delay(100); // Wait for all registers to reset // get stable time source writeByte(MPU9250_ADDRESS, PWR_MGMT_1, 0x01); // Auto select clock source to be PLL gyroscope reference if ready else delay(200); // Configure Gyro and Thermometer // Disable FSYNC and set thermometer and gyro bandwidth to 41 and 42 Hz, respectively; // minimum delay time for this setting is 5.9 ms, which means sensor fusion update rates cannot // be higher than 1 / 0.0059 = 170 Hz // DLPF_CFG = bits 2:0 = 011; this limits the sample rate to 1000 Hz for both // With the MPU9250, it is possible to get gyro sample rates of 32 kHz (!), 8 kHz, or 1 kHz writeByte(MPU9250_ADDRESS, CONFIG, 0x03); // Set sample rate = gyroscope output rate/(1 + SMPLRT_DIV) writeByte(MPU9250_ADDRESS, SMPLRT_DIV, 0x04); // Use a 200 Hz rate; a rate consistent with the filter update rate // determined inset in CONFIG above // Set gyroscope full scale range // Range selects FS_SEL and AFS_SEL are 0 - 3, so 2-bit values are left-shifted into positions 4:3 uint8_t c = readByte(MPU9250_ADDRESS, GYRO_CONFIG); // writeRegister(GYRO_CONFIG, c & ~0xE0); // Clear self-test bits [7:5] writeByte(MPU9250_ADDRESS, GYRO_CONFIG, c & ~0x02); // Clear Fchoice bits [1:0] writeByte(MPU9250_ADDRESS, GYRO_CONFIG, c & ~0x18); // Clear AFS bits [4:3] writeByte(MPU9250_ADDRESS, GYRO_CONFIG, c | Gscale << 3); // Set full scale range for the gyro // writeRegister(GYRO_CONFIG, c | 0x00); // Set Fchoice for the gyro to 11 by writing its inverse to bits 1:0 of GYRO_CONFIG // Set accelerometer full-scale range configuration c = readByte(MPU9250_ADDRESS, ACCEL_CONFIG); // writeRegister(ACCEL_CONFIG, c & ~0xE0); // Clear self-test bits [7:5] writeByte(MPU9250_ADDRESS, ACCEL_CONFIG, c & ~0x18); // Clear AFS bits [4:3] writeByte(MPU9250_ADDRESS, ACCEL_CONFIG, c | Ascale << 3); // Set full scale range for the accelerometer // Set accelerometer sample rate configuration // It is possible to get a 4 kHz sample rate from the accelerometer by choosing 1 for // accel_fchoice_b bit [3]; in this case the bandwidth is 1.13 kHz c = readByte(MPU9250_ADDRESS, ACCEL_CONFIG2); writeByte(MPU9250_ADDRESS, ACCEL_CONFIG2, c & ~0x0F); // Clear accel_fchoice_b (bit 3) and A_DLPFG (bits [2:0]) writeByte(MPU9250_ADDRESS, ACCEL_CONFIG2, c | 0x03); // Set accelerometer rate to 1 kHz and bandwidth to 41 Hz // The accelerometer, gyro, and thermometer are set to 1 kHz sample rates, // but all these rates are further reduced by a factor of 5 to 200 Hz because of the SMPLRT_DIV setting // Configure Interrupts and Bypass Enable // Set interrupt pin active high, push-pull, hold interrupt pin level HIGH until interrupt cleared, // clear on read of INT_STATUS, and enable I2C_BYPASS_EN so additional chips // can join the I2C bus and all can be controlled by the Arduino as master writeByte(MPU9250_ADDRESS, INT_PIN_CFG, 0x22); writeByte(MPU9250_ADDRESS, INT_ENABLE, 0x01); // Enable data ready (bit 0) interrupt delay(100); } // Function which accumulates gyro and accelerometer data after device initialization. It calculates the average // of the at-rest readings and then loads the resulting offsets into accelerometer and gyro bias registers. void calibrateMPU9250(float * dest1, float * dest2) { uint8_t data[12]; // data array to hold accelerometer and gyro x, y, z, data uint16_t ii, packet_count, fifo_count; int32_t gyro_bias[3] = {0, 0, 0}, accel_bias[3] = {0, 0, 0}; // reset device writeByte(MPU9250_ADDRESS, PWR_MGMT_1, 0x80); // Write a one to bit 7 reset bit; toggle reset device delay(100); // get stable time source; Auto select clock source to be PLL gyroscope reference if ready // else use the internal oscillator, bits 2:0 = 001 writeByte(MPU9250_ADDRESS, PWR_MGMT_1, 0x01); writeByte(MPU9250_ADDRESS, PWR_MGMT_2, 0x00); delay(200); // Configure device for bias calculation writeByte(MPU9250_ADDRESS, INT_ENABLE, 0x00); // Disable all interrupts writeByte(MPU9250_ADDRESS, FIFO_EN, 0x00); // Disable FIFO writeByte(MPU9250_ADDRESS, PWR_MGMT_1, 0x00); // Turn on internal clock source writeByte(MPU9250_ADDRESS, I2C_MST_CTRL, 0x00); // Disable I2C master writeByte(MPU9250_ADDRESS, USER_CTRL, 0x00); // Disable FIFO and I2C master modes writeByte(MPU9250_ADDRESS, USER_CTRL, 0x0C); // Reset FIFO and DMP delay(15); // Configure MPU6050 gyro and accelerometer for bias calculation writeByte(MPU9250_ADDRESS, CONFIG, 0x01); // Set low-pass filter to 188 Hz writeByte(MPU9250_ADDRESS, SMPLRT_DIV, 0x00); // Set sample rate to 1 kHz writeByte(MPU9250_ADDRESS, GYRO_CONFIG, 0x00); // Set gyro full-scale to 250 degrees per second, maximum sensitivity writeByte(MPU9250_ADDRESS, ACCEL_CONFIG, 0x00); // Set accelerometer full-scale to 2 g, maximum sensitivity uint16_t gyrosensitivity = 131; // = 131 LSB/degrees/sec uint16_t accelsensitivity = 16384; // = 16384 LSB/g // Configure FIFO to capture accelerometer and gyro data for bias calculation writeByte(MPU9250_ADDRESS, USER_CTRL, 0x40); // Enable FIFO writeByte(MPU9250_ADDRESS, FIFO_EN, 0x78); // Enable gyro and accelerometer sensors for FIFO (max size 512 bytes in MPU-9150) delay(40); // accumulate 40 samples in 40 milliseconds = 480 bytes // At end of sample accumulation, turn off FIFO sensor read writeByte(MPU9250_ADDRESS, FIFO_EN, 0x00); // Disable gyro and accelerometer sensors for FIFO readBytes(MPU9250_ADDRESS, FIFO_COUNTH, 2, &data[0]); // read FIFO sample count fifo_count = ((uint16_t)data[0] << 8) | data[1]; packet_count = fifo_count/12;// How many sets of full gyro and accelerometer data for averaging for (ii = 0; ii < packet_count; ii++) { int16_t accel_temp[3] = {0, 0, 0}, gyro_temp[3] = {0, 0, 0}; readBytes(MPU9250_ADDRESS, FIFO_R_W, 12, &data[0]); // read data for averaging accel_temp[0] = (int16_t) (((int16_t)data[0] << 8) | data[1] ) ; // Form signed 16-bit integer for each sample in FIFO accel_temp[1] = (int16_t) (((int16_t)data[2] << 8) | data[3] ) ; accel_temp[2] = (int16_t) (((int16_t)data[4] << 8) | data[5] ) ; gyro_temp[0] = (int16_t) (((int16_t)data[6] << 8) | data[7] ) ; gyro_temp[1] = (int16_t) (((int16_t)data[8] << 8) | data[9] ) ; gyro_temp[2] = (int16_t) (((int16_t)data[10] << 8) | data[11]) ; accel_bias[0] += (int32_t) accel_temp[0]; // Sum individual signed 16-bit biases to get accumulated signed 32-bit biases accel_bias[1] += (int32_t) accel_temp[1]; accel_bias[2] += (int32_t) accel_temp[2]; gyro_bias[0] += (int32_t) gyro_temp[0]; gyro_bias[1] += (int32_t) gyro_temp[1]; gyro_bias[2] += (int32_t) gyro_temp[2]; } accel_bias[0] /= (int32_t) packet_count; // Normalize sums to get average count biases accel_bias[1] /= (int32_t) packet_count; accel_bias[2] /= (int32_t) packet_count; gyro_bias[0] /= (int32_t) packet_count; gyro_bias[1] /= (int32_t) packet_count; gyro_bias[2] /= (int32_t) packet_count; if(accel_bias[2] > 0L) {accel_bias[2] -= (int32_t) accelsensitivity;} // Remove gravity from the z-axis accelerometer bias calculation else {accel_bias[2] += (int32_t) accelsensitivity;} // Construct the gyro biases for push to the hardware gyro bias registers, which are reset to zero upon device startup data[0] = (-gyro_bias[0]/4 >> 8) & 0xFF; // Divide by 4 to get 32.9 LSB per deg/s to conform to expected bias input format data[1] = (-gyro_bias[0]/4) & 0xFF; // Biases are additive, so change sign on calculated average gyro biases data[2] = (-gyro_bias[1]/4 >> 8) & 0xFF; data[3] = (-gyro_bias[1]/4) & 0xFF; data[4] = (-gyro_bias[2]/4 >> 8) & 0xFF; data[5] = (-gyro_bias[2]/4) & 0xFF; // Push gyro biases to hardware registers writeByte(MPU9250_ADDRESS, XG_OFFSET_H, data[0]); writeByte(MPU9250_ADDRESS, XG_OFFSET_L, data[1]); writeByte(MPU9250_ADDRESS, YG_OFFSET_H, data[2]); writeByte(MPU9250_ADDRESS, YG_OFFSET_L, data[3]); writeByte(MPU9250_ADDRESS, ZG_OFFSET_H, data[4]); writeByte(MPU9250_ADDRESS, ZG_OFFSET_L, data[5]); // Output scaled gyro biases for display in the main program dest1[0] = (float) gyro_bias[0]/(float) gyrosensitivity; dest1[1] = (float) gyro_bias[1]/(float) gyrosensitivity; dest1[2] = (float) gyro_bias[2]/(float) gyrosensitivity; // Construct the accelerometer biases for push to the hardware accelerometer bias registers. These registers contain // factory trim values which must be added to the calculated accelerometer biases; on boot up these registers will hold // non-zero values. In addition, bit 0 of the lower byte must be preserved since it is used for temperature // compensation calculations. Accelerometer bias registers expect bias input as 2048 LSB per g, so that // the accelerometer biases calculated above must be divided by 8. int32_t accel_bias_reg[3] = {0, 0, 0}; // A place to hold the factory accelerometer trim biases readBytes(MPU9250_ADDRESS, XA_OFFSET_H, 2, &data[0]); // Read factory accelerometer trim values accel_bias_reg[0] = (int32_t) (((int16_t)data[0] << 8) | data[1]); readBytes(MPU9250_ADDRESS, YA_OFFSET_H, 2, &data[0]); accel_bias_reg[1] = (int32_t) (((int16_t)data[0] << 8) | data[1]); readBytes(MPU9250_ADDRESS, ZA_OFFSET_H, 2, &data[0]); accel_bias_reg[2] = (int32_t) (((int16_t)data[0] << 8) | data[1]); uint32_t mask = 1uL; // Define mask for temperature compensation bit 0 of lower byte of accelerometer bias registers uint8_t mask_bit[3] = {0, 0, 0}; // Define array to hold mask bit for each accelerometer bias axis for(ii = 0; ii < 3; ii++) { if((accel_bias_reg[ii] & mask)) mask_bit[ii] = 0x01; // If temperature compensation bit is set, record that fact in mask_bit } // Construct total accelerometer bias, including calculated average accelerometer bias from above accel_bias_reg[0] -= (accel_bias[0]/8); // Subtract calculated averaged accelerometer bias scaled to 2048 LSB/g (16 g full scale) accel_bias_reg[1] -= (accel_bias[1]/8); accel_bias_reg[2] -= (accel_bias[2]/8); data[0] = (accel_bias_reg[0] >> 8) & 0xFF; data[1] = (accel_bias_reg[0]) & 0xFF; data[1] = data[1] | mask_bit[0]; // preserve temperature compensation bit when writing back to accelerometer bias registers data[2] = (accel_bias_reg[1] >> 8) & 0xFF; data[3] = (accel_bias_reg[1]) & 0xFF; data[3] = data[3] | mask_bit[1]; // preserve temperature compensation bit when writing back to accelerometer bias registers data[4] = (accel_bias_reg[2] >> 8) & 0xFF; data[5] = (accel_bias_reg[2]) & 0xFF; data[5] = data[5] | mask_bit[2]; // preserve temperature compensation bit when writing back to accelerometer bias registers // Apparently this is not working for the acceleration biases in the MPU-9250 // Are we handling the temperature correction bit properly? // Push accelerometer biases to hardware registers writeByte(MPU9250_ADDRESS, XA_OFFSET_H, data[0]); writeByte(MPU9250_ADDRESS, XA_OFFSET_L, data[1]); writeByte(MPU9250_ADDRESS, YA_OFFSET_H, data[2]); writeByte(MPU9250_ADDRESS, YA_OFFSET_L, data[3]); writeByte(MPU9250_ADDRESS, ZA_OFFSET_H, data[4]); writeByte(MPU9250_ADDRESS, ZA_OFFSET_L, data[5]); // Output scaled accelerometer biases for display in the main program dest2[0] = (float)accel_bias[0]/(float)accelsensitivity; dest2[1] = (float)accel_bias[1]/(float)accelsensitivity; dest2[2] = (float)accel_bias[2]/(float)accelsensitivity; } // Accelerometer and gyroscope self test; check calibration wrt factory settings void MPU9250SelfTest(float * destination) // Should return percent deviation from factory trim values, +/- 14 or less deviation is a pass { uint8_t rawData[6] = {0, 0, 0, 0, 0, 0}; uint8_t selfTest[6]; int16_t gAvg[3], aAvg[3], aSTAvg[3], gSTAvg[3]; float factoryTrim[6]; uint8_t FS = 0; writeByte(MPU9250_ADDRESS, SMPLRT_DIV, 0x00); // Set gyro sample rate to 1 kHz writeByte(MPU9250_ADDRESS, CONFIG, 0x02); // Set gyro sample rate to 1 kHz and DLPF to 92 Hz writeByte(MPU9250_ADDRESS, GYRO_CONFIG, 1<<FS); // Set full scale range for the gyro to 250 dps writeByte(MPU9250_ADDRESS, ACCEL_CONFIG2, 0x02); // Set accelerometer rate to 1 kHz and bandwidth to 92 Hz writeByte(MPU9250_ADDRESS, ACCEL_CONFIG, 1<<FS); // Set full scale range for the accelerometer to 2 g for( int ii = 0; ii < 200; ii++) { // get average current values of gyro and acclerometer readBytes(MPU9250_ADDRESS, ACCEL_XOUT_H, 6, &rawData[0]); // Read the six raw data registers into data array aAvg[0] += (int16_t)(((int16_t)rawData[0] << 8) | rawData[1]) ; // Turn the MSB and LSB into a signed 16-bit value aAvg[1] += (int16_t)(((int16_t)rawData[2] << 8) | rawData[3]) ; aAvg[2] += (int16_t)(((int16_t)rawData[4] << 8) | rawData[5]) ; readBytes(MPU9250_ADDRESS, GYRO_XOUT_H, 6, &rawData[0]); // Read the six raw data registers sequentially into data array gAvg[0] += (int16_t)(((int16_t)rawData[0] << 8) | rawData[1]) ; // Turn the MSB and LSB into a signed 16-bit value gAvg[1] += (int16_t)(((int16_t)rawData[2] << 8) | rawData[3]) ; gAvg[2] += (int16_t)(((int16_t)rawData[4] << 8) | rawData[5]) ; } for (int ii =0; ii < 3; ii++) { // Get average of 200 values and store as average current readings aAvg[ii] /= 200; gAvg[ii] /= 200; } // Configure the accelerometer for self-test writeByte(MPU9250_ADDRESS, ACCEL_CONFIG, 0xE0); // Enable self test on all three axes and set accelerometer range to +/- 2 g writeByte(MPU9250_ADDRESS, GYRO_CONFIG, 0xE0); // Enable self test on all three axes and set gyro range to +/- 250 degrees/s delay(25); // Delay a while to let the device stabilize for( int ii = 0; ii < 200; ii++) { // get average self-test values of gyro and acclerometer readBytes(MPU9250_ADDRESS, ACCEL_XOUT_H, 6, &rawData[0]); // Read the six raw data registers into data array aSTAvg[0] += (int16_t)(((int16_t)rawData[0] << 8) | rawData[1]) ; // Turn the MSB and LSB into a signed 16-bit value aSTAvg[1] += (int16_t)(((int16_t)rawData[2] << 8) | rawData[3]) ; aSTAvg[2] += (int16_t)(((int16_t)rawData[4] << 8) | rawData[5]) ; readBytes(MPU9250_ADDRESS, GYRO_XOUT_H, 6, &rawData[0]); // Read the six raw data registers sequentially into data array gSTAvg[0] += (int16_t)(((int16_t)rawData[0] << 8) | rawData[1]) ; // Turn the MSB and LSB into a signed 16-bit value gSTAvg[1] += (int16_t)(((int16_t)rawData[2] << 8) | rawData[3]) ; gSTAvg[2] += (int16_t)(((int16_t)rawData[4] << 8) | rawData[5]) ; } for (int ii =0; ii < 3; ii++) { // Get average of 200 values and store as average self-test readings aSTAvg[ii] /= 200; gSTAvg[ii] /= 200; } // Configure the gyro and accelerometer for normal operation writeByte(MPU9250_ADDRESS, ACCEL_CONFIG, 0x00); writeByte(MPU9250_ADDRESS, GYRO_CONFIG, 0x00); delay(25); // Delay a while to let the device stabilize // Retrieve accelerometer and gyro factory Self-Test Code from USR_Reg selfTest[0] = readByte(MPU9250_ADDRESS, SELF_TEST_X_ACCEL); // X-axis accel self-test results selfTest[1] = readByte(MPU9250_ADDRESS, SELF_TEST_Y_ACCEL); // Y-axis accel self-test results selfTest[2] = readByte(MPU9250_ADDRESS, SELF_TEST_Z_ACCEL); // Z-axis accel self-test results selfTest[3] = readByte(MPU9250_ADDRESS, SELF_TEST_X_GYRO); // X-axis gyro self-test results selfTest[4] = readByte(MPU9250_ADDRESS, SELF_TEST_Y_GYRO); // Y-axis gyro self-test results selfTest[5] = readByte(MPU9250_ADDRESS, SELF_TEST_Z_GYRO); // Z-axis gyro self-test results // Retrieve factory self-test value from self-test code reads factoryTrim[0] = (float)(2620/1<<FS)*(pow( 1.01 , ((float)selfTest[0] - 1.0) )); // FT[Xa] factory trim calculation factoryTrim[1] = (float)(2620/1<<FS)*(pow( 1.01 , ((float)selfTest[1] - 1.0) )); // FT[Ya] factory trim calculation factoryTrim[2] = (float)(2620/1<<FS)*(pow( 1.01 , ((float)selfTest[2] - 1.0) )); // FT[Za] factory trim calculation factoryTrim[3] = (float)(2620/1<<FS)*(pow( 1.01 , ((float)selfTest[3] - 1.0) )); // FT[Xg] factory trim calculation factoryTrim[4] = (float)(2620/1<<FS)*(pow( 1.01 , ((float)selfTest[4] - 1.0) )); // FT[Yg] factory trim calculation factoryTrim[5] = (float)(2620/1<<FS)*(pow( 1.01 , ((float)selfTest[5] - 1.0) )); // FT[Zg] factory trim calculation // Report results as a ratio of (STR - FT)/FT; the change from Factory Trim of the Self-Test Response // To get percent, must multiply by 100 for (int i = 0; i < 3; i++) { destination[i] = 100.0*((float)(aSTAvg[i] - aAvg[i]))/factoryTrim[i]; // Report percent differences destination[i+3] = 100.0*((float)(gSTAvg[i] - gAvg[i]))/factoryTrim[i+3]; // Report percent differences } } // Wire.h read and write protocols void writeByte(uint8_t address, uint8_t subAddress, uint8_t data) { Wire.beginTransmission(address); // Initialize the Tx buffer Wire.write(subAddress); // Put slave register address in Tx buffer Wire.write(data); // Put data in Tx buffer Wire.endTransmission(); // Send the Tx buffer } uint8_t readByte(uint8_t address, uint8_t subAddress) { uint8_t data; // `data` will store the register data Wire.beginTransmission(address); // Initialize the Tx buffer Wire.write(subAddress); // Put slave register address in Tx buffer Wire.endTransmission(false); // Send the Tx buffer, but send a restart to keep connection alive Wire.requestFrom(address, (uint8_t) 1); // Read one byte from slave register address data = Wire.read(); // Fill Rx buffer with result return data; // Return data read from slave register } void readBytes(uint8_t address, uint8_t subAddress, uint8_t count, uint8_t * dest) { Wire.beginTransmission(address); // Initialize the Tx buffer Wire.write(subAddress); // Put slave register address in Tx buffer Wire.endTransmission(false); // Send the Tx buffer, but send a restart to keep connection alive uint8_t i = 0; Wire.requestFrom(address, count); // Read bytes from slave register address while (Wire.available()) { dest[i++] = Wire.read(); } // Put read results in the Rx buffer } // Implementation of Sebastian Madgwick's "...efficient orientation filter for... inertial/magnetic sensor arrays" // (see http://www.x-io.co.uk/category/open-source/ for examples and more details) // which fuses acceleration, rotation rate, and magnetic moments to produce a quaternion-based estimate of absolute // device orientation -- which can be converted to yaw, pitch, and roll. Useful for stabilizing quadcopters, etc. // The performance of the orientation filter is at least as good as conventional Kalman-based filtering algorithms // but is much less computationally intensive---it can be performed on a 3.3 V Pro Mini operating at 8 MHz! void MadgwickQuaternionUpdate(float ax, float ay, float az, float gx, float gy, float gz, float mx, float my, float mz) { float q1 = q[0], q2 = q[1], q3 = q[2], q4 = q[3]; // short name local variable for readability float norm; float hx, hy, _2bx, _2bz; float s1, s2, s3, s4; float qDot1, qDot2, qDot3, qDot4; // Auxiliary variables to avoid repeated arithmetic float _2q1mx; float _2q1my; float _2q1mz; float _2q2mx; float _4bx; float _4bz; float _2q1 = 2.0f * q1; float _2q2 = 2.0f * q2; float _2q3 = 2.0f * q3; float _2q4 = 2.0f * q4; float _2q1q3 = 2.0f * q1 * q3; float _2q3q4 = 2.0f * q3 * q4; float q1q1 = q1 * q1; float q1q2 = q1 * q2; float q1q3 = q1 * q3; float q1q4 = q1 * q4; float q2q2 = q2 * q2; float q2q3 = q2 * q3; float q2q4 = q2 * q4; float q3q3 = q3 * q3; float q3q4 = q3 * q4; float q4q4 = q4 * q4; // Normalise accelerometer measurement norm = sqrt(ax * ax + ay * ay + az * az); if (norm == 0.0f) return; // handle NaN norm = 1.0f/norm; ax *= norm; ay *= norm; az *= norm; // Normalise magnetometer measurement norm = sqrt(mx * mx + my * my + mz * mz); if (norm == 0.0f) return; // handle NaN norm = 1.0f/norm; mx *= norm; my *= norm; mz *= norm; // Reference direction of Earth's magnetic field _2q1mx = 2.0f * q1 * mx; _2q1my = 2.0f * q1 * my; _2q1mz = 2.0f * q1 * mz; _2q2mx = 2.0f * q2 * mx; hx = mx * q1q1 - _2q1my * q4 + _2q1mz * q3 + mx * q2q2 + _2q2 * my * q3 + _2q2 * mz * q4 - mx * q3q3 - mx * q4q4; hy = _2q1mx * q4 + my * q1q1 - _2q1mz * q2 + _2q2mx * q3 - my * q2q2 + my * q3q3 + _2q3 * mz * q4 - my * q4q4; _2bx = sqrt(hx * hx + hy * hy); _2bz = -_2q1mx * q3 + _2q1my * q2 + mz * q1q1 + _2q2mx * q4 - mz * q2q2 + _2q3 * my * q4 - mz * q3q3 + mz * q4q4; _4bx = 2.0f * _2bx; _4bz = 2.0f * _2bz; // Gradient decent algorithm corrective step s1 = -_2q3 * (2.0f * q2q4 - _2q1q3 - ax) + _2q2 * (2.0f * q1q2 + _2q3q4 - ay) - _2bz * q3 * (_2bx * (0.5f - q3q3 - q4q4) + _2bz * (q2q4 - q1q3) - mx) + (-_2bx * q4 + _2bz * q2) * (_2bx * (q2q3 - q1q4) + _2bz * (q1q2 + q3q4) - my) + _2bx * q3 * (_2bx * (q1q3 + q2q4) + _2bz * (0.5f - q2q2 - q3q3) - mz); s2 = _2q4 * (2.0f * q2q4 - _2q1q3 - ax) + _2q1 * (2.0f * q1q2 + _2q3q4 - ay) - 4.0f * q2 * (1.0f - 2.0f * q2q2 - 2.0f * q3q3 - az) + _2bz * q4 * (_2bx * (0.5f - q3q3 - q4q4) + _2bz * (q2q4 - q1q3) - mx) + (_2bx * q3 + _2bz * q1) * (_2bx * (q2q3 - q1q4) + _2bz * (q1q2 + q3q4) - my) + (_2bx * q4 - _4bz * q2) * (_2bx * (q1q3 + q2q4) + _2bz * (0.5f - q2q2 - q3q3) - mz); s3 = -_2q1 * (2.0f * q2q4 - _2q1q3 - ax) + _2q4 * (2.0f * q1q2 + _2q3q4 - ay) - 4.0f * q3 * (1.0f - 2.0f * q2q2 - 2.0f * q3q3 - az) + (-_4bx * q3 - _2bz * q1) * (_2bx * (0.5f - q3q3 - q4q4) + _2bz * (q2q4 - q1q3) - mx) + (_2bx * q2 + _2bz * q4) * (_2bx * (q2q3 - q1q4) + _2bz * (q1q2 + q3q4) - my) + (_2bx * q1 - _4bz * q3) * (_2bx * (q1q3 + q2q4) + _2bz * (0.5f - q2q2 - q3q3) - mz); s4 = _2q2 * (2.0f * q2q4 - _2q1q3 - ax) + _2q3 * (2.0f * q1q2 + _2q3q4 - ay) + (-_4bx * q4 + _2bz * q2) * (_2bx * (0.5f - q3q3 - q4q4) + _2bz * (q2q4 - q1q3) - mx) + (-_2bx * q1 + _2bz * q3) * (_2bx * (q2q3 - q1q4) + _2bz * (q1q2 + q3q4) - my) + _2bx * q2 * (_2bx * (q1q3 + q2q4) + _2bz * (0.5f - q2q2 - q3q3) - mz); norm = sqrt(s1 * s1 + s2 * s2 + s3 * s3 + s4 * s4); // normalise step magnitude norm = 1.0f/norm; s1 *= norm; s2 *= norm; s3 *= norm; s4 *= norm; // Compute rate of change of quaternion qDot1 = 0.5f * (-q2 * gx - q3 * gy - q4 * gz) - beta * s1; qDot2 = 0.5f * (q1 * gx + q3 * gz - q4 * gy) - beta * s2; qDot3 = 0.5f * (q1 * gy - q2 * gz + q4 * gx) - beta * s3; qDot4 = 0.5f * (q1 * gz + q2 * gy - q3 * gx) - beta * s4; // Integrate to yield quaternion q1 += qDot1 * deltat; q2 += qDot2 * deltat; q3 += qDot3 * deltat; q4 += qDot4 * deltat; norm = sqrt(q1 * q1 + q2 * q2 + q3 * q3 + q4 * q4); // normalise quaternion norm = 1.0f/norm; q[0] = q1 * norm; q[1] = q2 * norm; q[2] = q3 * norm; q[3] = q4 * norm; } // Similar to Madgwick scheme but uses proportional and integral filtering on the error between estimated reference vectors and // measured ones. void MahonyQuaternionUpdate(float ax, float ay, float az, float gx, float gy, float gz, float mx, float my, float mz) { float q1 = q[0], q2 = q[1], q3 = q[2], q4 = q[3]; // short name local variable for readability float norm; float hx, hy, bx, bz; float vx, vy, vz, wx, wy, wz; float ex, ey, ez; float pa, pb, pc; // Auxiliary variables to avoid repeated arithmetic float q1q1 = q1 * q1; float q1q2 = q1 * q2; float q1q3 = q1 * q3; float q1q4 = q1 * q4; float q2q2 = q2 * q2; float q2q3 = q2 * q3; float q2q4 = q2 * q4; float q3q3 = q3 * q3; float q3q4 = q3 * q4; float q4q4 = q4 * q4; // Normalise accelerometer measurement norm = sqrt(ax * ax + ay * ay + az * az); if (norm == 0.0f) return; // handle NaN norm = 1.0f / norm; // use reciprocal for division ax *= norm; ay *= norm; az *= norm; // Normalise magnetometer measurement norm = sqrt(mx * mx + my * my + mz * mz); if (norm == 0.0f) return; // handle NaN norm = 1.0f / norm; // use reciprocal for division mx *= norm; my *= norm; mz *= norm; // Reference direction of Earth's magnetic field hx = 2.0f * mx * (0.5f - q3q3 - q4q4) + 2.0f * my * (q2q3 - q1q4) + 2.0f * mz * (q2q4 + q1q3); hy = 2.0f * mx * (q2q3 + q1q4) + 2.0f * my * (0.5f - q2q2 - q4q4) + 2.0f * mz * (q3q4 - q1q2); bx = sqrt((hx * hx) + (hy * hy)); bz = 2.0f * mx * (q2q4 - q1q3) + 2.0f * my * (q3q4 + q1q2) + 2.0f * mz * (0.5f - q2q2 - q3q3); // Estimated direction of gravity and magnetic field vx = 2.0f * (q2q4 - q1q3); vy = 2.0f * (q1q2 + q3q4); vz = q1q1 - q2q2 - q3q3 + q4q4; wx = 2.0f * bx * (0.5f - q3q3 - q4q4) + 2.0f * bz * (q2q4 - q1q3); wy = 2.0f * bx * (q2q3 - q1q4) + 2.0f * bz * (q1q2 + q3q4); wz = 2.0f * bx * (q1q3 + q2q4) + 2.0f * bz * (0.5f - q2q2 - q3q3); // Error is cross product between estimated direction and measured direction of gravity ex = (ay * vz - az * vy) + (my * wz - mz * wy); ey = (az * vx - ax * vz) + (mz * wx - mx * wz); ez = (ax * vy - ay * vx) + (mx * wy - my * wx); if (Ki > 0.0f) { eInt[0] += ex; // accumulate integral error eInt[1] += ey; eInt[2] += ez; } else { eInt[0] = 0.0f; // prevent integral wind up eInt[1] = 0.0f; eInt[2] = 0.0f; } // Apply feedback terms gx = gx + Kp * ex + Ki * eInt[0]; gy = gy + Kp * ey + Ki * eInt[1]; gz = gz + Kp * ez + Ki * eInt[2]; // Integrate rate of change of quaternion pa = q2; pb = q3; pc = q4; q1 = q1 + (-q2 * gx - q3 * gy - q4 * gz) * (0.5f * deltat); q2 = pa + (q1 * gx + pb * gz - pc * gy) * (0.5f * deltat); q3 = pb + (q1 * gy - pa * gz + pc * gx) * (0.5f * deltat); q4 = pc + (q1 * gz + pa * gy - pb * gx) * (0.5f * deltat); // Normalise quaternion norm = sqrt(q1 * q1 + q2 * q2 + q3 * q3 + q4 * q4); norm = 1.0f / norm; q[0] = q1 * norm; q[1] = q2 * norm; q[2] = q3 * norm; q[3] = q4 * norm; }
[ "dtrocketeers@gmail.com" ]
dtrocketeers@gmail.com
2607de0b828f4c3ae63dcdab816c686e0b491525
2407298d87c1f9aecb11d6f8a6485e8c60341202
/OrdersQueue/AmarieiMarinel7A-POO/FelPrincipal.h
402e34f1ca4acdd5bc7b26e70d77d636dd18ab29
[]
no_license
amarieimarinel97/ordersqueue
8411aff700694c8ad42707ddbce06c3c85c78f5f
4bca37985fb237f1330df11872f5fdedb0d03499
refs/heads/master
2021-08-08T20:22:05.170348
2020-05-09T11:44:49
2020-05-09T11:44:49
175,460,140
0
0
null
null
null
null
UTF-8
C++
false
false
774
h
#pragma once #include "Ierarhie.h" class FelPrincipal : public Produs { protected: int portii; public: FelPrincipal(); FelPrincipal(bool i, string num,int p); void afisare(void); ~FelPrincipal() {} virtual void Set(void); void fafisare(void); void fSet(void); }; class Supa : public FelPrincipal { string ingredient; public: Supa(); Supa(bool i, string num,int p,string ing); ~Supa() {} virtual void afisare(void); virtual void Set(void); void fafisare(void); void fSet(void); }; class Friptura : public FelPrincipal { string animal; string garnitura; public: Friptura(); Friptura(bool i, string num,int p,string anim, string garnit); virtual void afisare(void); ~Friptura() {} virtual void Set(void); void fafisare(void); void fSet(void); };
[ "48449560+amarieimarinel97@users.noreply.github.com" ]
48449560+amarieimarinel97@users.noreply.github.com
2b623411116911fefe9e8f12fb2f7f2100d882ff
a8e5155ecc010b57fddf83b1451ca7206da2623d
/SDK/ES2_BPI_Condition_EMP_classes.hpp
610e4a5847ab2a27a770adbc242439494309be85
[]
no_license
RussellJerome/EverSpace2-SDK
3d1c114ddcf79633ce6999aa8de735df6f3dc947
bb52c5ddf14aef595bb2c43310dc5ee0bc71732b
refs/heads/master
2022-12-12T04:59:55.403652
2020-08-30T00:56:25
2020-08-30T00:56:25
291,374,170
0
0
null
null
null
null
UTF-8
C++
false
false
741
hpp
#pragma once // Everspace2_Prototype SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "ES2_BPI_Condition_EMP_structs.hpp" namespace SDK { //--------------------------------------------------------------------------- //Classes //--------------------------------------------------------------------------- // BlueprintGeneratedClass BPI_Condition_EMP.BPI_Condition_EMP_C // 0x0000 (0x0028 - 0x0028) class UBPI_Condition_EMP_C : public UInterface { public: static UClass* StaticClass() { static auto ptr = UObject::FindClass("BlueprintGeneratedClass BPI_Condition_EMP.BPI_Condition_EMP_C"); return ptr; } void RemoveEMP(); void ApplyEMP(class AActor** Instigator); }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "darkmanvoo@gmail.com" ]
darkmanvoo@gmail.com
0d7264e2c4751e4462307b74445ce5791c2f7e69
918ea9f38a533406855a67810efecf814bf1ea95
/src/system/proto/heartbeat.pb.h
24f0cba7588137a08254ea138293e3e300da3216
[ "Apache-2.0" ]
permissive
hjk41/parameter_server
9183119a87b04e0e562dfec03e682f52a1fbdc49
31f3b4c1d23baf8f876d62cbdef05e471e2ee918
refs/heads/master
2021-01-15T18:45:16.986082
2015-06-10T04:35:38
2015-06-10T04:35:38
30,173,400
1
2
null
2015-02-02T05:59:39
2015-02-02T05:59:37
null
UTF-8
C++
false
true
22,496
h
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: system/proto/heartbeat.proto #ifndef PROTOBUF_system_2fproto_2fheartbeat_2eproto__INCLUDED #define PROTOBUF_system_2fproto_2fheartbeat_2eproto__INCLUDED #include <string> #include <google/protobuf/stubs/common.h> #if GOOGLE_PROTOBUF_VERSION < 2005000 #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 2005000 < GOOGLE_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/generated_message_util.h> #include <google/protobuf/message.h> #include <google/protobuf/repeated_field.h> #include <google/protobuf/extension_set.h> #include <google/protobuf/unknown_field_set.h> // @@protoc_insertion_point(includes) namespace PS { // Internal implementation detail -- do not call these. void protobuf_AddDesc_system_2fproto_2fheartbeat_2eproto(); void protobuf_AssignDesc_system_2fproto_2fheartbeat_2eproto(); void protobuf_ShutdownFile_system_2fproto_2fheartbeat_2eproto(); class HeartbeatReport; // =================================================================== class HeartbeatReport : public ::google::protobuf::Message { public: HeartbeatReport(); virtual ~HeartbeatReport(); HeartbeatReport(const HeartbeatReport& from); inline HeartbeatReport& operator=(const HeartbeatReport& from) { CopyFrom(from); return *this; } inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { return _unknown_fields_; } inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { return &_unknown_fields_; } static const ::google::protobuf::Descriptor* descriptor(); static const HeartbeatReport& default_instance(); void Swap(HeartbeatReport* other); // implements Message ---------------------------------------------- HeartbeatReport* New() const; void CopyFrom(const ::google::protobuf::Message& from); void MergeFrom(const ::google::protobuf::Message& from); void CopyFrom(const HeartbeatReport& from); void MergeFrom(const HeartbeatReport& from); void Clear(); bool IsInitialized() const; int ByteSize() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const; ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; int GetCachedSize() const { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // optional int32 task_id = 1 [default = 0]; inline bool has_task_id() const; inline void clear_task_id(); static const int kTaskIdFieldNumber = 1; inline ::google::protobuf::int32 task_id() const; inline void set_task_id(::google::protobuf::int32 value); // optional string hostname = 14; inline bool has_hostname() const; inline void clear_hostname(); static const int kHostnameFieldNumber = 14; inline const ::std::string& hostname() const; inline void set_hostname(const ::std::string& value); inline void set_hostname(const char* value); inline void set_hostname(const char* value, size_t size); inline ::std::string* mutable_hostname(); inline ::std::string* release_hostname(); inline void set_allocated_hostname(::std::string* hostname); // optional uint32 seconds_since_epoch = 2; inline bool has_seconds_since_epoch() const; inline void clear_seconds_since_epoch(); static const int kSecondsSinceEpochFieldNumber = 2; inline ::google::protobuf::uint32 seconds_since_epoch() const; inline void set_seconds_since_epoch(::google::protobuf::uint32 value); // optional uint32 total_time_milli = 13; inline bool has_total_time_milli() const; inline void clear_total_time_milli(); static const int kTotalTimeMilliFieldNumber = 13; inline ::google::protobuf::uint32 total_time_milli() const; inline void set_total_time_milli(::google::protobuf::uint32 value); // optional uint32 busy_time_milli = 3; inline bool has_busy_time_milli() const; inline void clear_busy_time_milli(); static const int kBusyTimeMilliFieldNumber = 3; inline ::google::protobuf::uint32 busy_time_milli() const; inline void set_busy_time_milli(::google::protobuf::uint32 value); // optional uint32 net_in_mb = 4; inline bool has_net_in_mb() const; inline void clear_net_in_mb(); static const int kNetInMbFieldNumber = 4; inline ::google::protobuf::uint32 net_in_mb() const; inline void set_net_in_mb(::google::protobuf::uint32 value); // optional uint32 net_out_mb = 5; inline bool has_net_out_mb() const; inline void clear_net_out_mb(); static const int kNetOutMbFieldNumber = 5; inline ::google::protobuf::uint32 net_out_mb() const; inline void set_net_out_mb(::google::protobuf::uint32 value); // optional uint32 process_cpu_usage = 6; inline bool has_process_cpu_usage() const; inline void clear_process_cpu_usage(); static const int kProcessCpuUsageFieldNumber = 6; inline ::google::protobuf::uint32 process_cpu_usage() const; inline void set_process_cpu_usage(::google::protobuf::uint32 value); // optional uint32 host_cpu_usage = 7; inline bool has_host_cpu_usage() const; inline void clear_host_cpu_usage(); static const int kHostCpuUsageFieldNumber = 7; inline ::google::protobuf::uint32 host_cpu_usage() const; inline void set_host_cpu_usage(::google::protobuf::uint32 value); // optional uint32 process_rss_mb = 8; inline bool has_process_rss_mb() const; inline void clear_process_rss_mb(); static const int kProcessRssMbFieldNumber = 8; inline ::google::protobuf::uint32 process_rss_mb() const; inline void set_process_rss_mb(::google::protobuf::uint32 value); // optional uint32 process_virt_mb = 9; inline bool has_process_virt_mb() const; inline void clear_process_virt_mb(); static const int kProcessVirtMbFieldNumber = 9; inline ::google::protobuf::uint32 process_virt_mb() const; inline void set_process_virt_mb(::google::protobuf::uint32 value); // optional uint32 host_in_use_gb = 10; inline bool has_host_in_use_gb() const; inline void clear_host_in_use_gb(); static const int kHostInUseGbFieldNumber = 10; inline ::google::protobuf::uint32 host_in_use_gb() const; inline void set_host_in_use_gb(::google::protobuf::uint32 value); // optional uint32 host_in_use_percentage = 15; inline bool has_host_in_use_percentage() const; inline void clear_host_in_use_percentage(); static const int kHostInUsePercentageFieldNumber = 15; inline ::google::protobuf::uint32 host_in_use_percentage() const; inline void set_host_in_use_percentage(::google::protobuf::uint32 value); // optional uint32 host_net_in_bw = 11; inline bool has_host_net_in_bw() const; inline void clear_host_net_in_bw(); static const int kHostNetInBwFieldNumber = 11; inline ::google::protobuf::uint32 host_net_in_bw() const; inline void set_host_net_in_bw(::google::protobuf::uint32 value); // optional uint32 host_net_out_bw = 12; inline bool has_host_net_out_bw() const; inline void clear_host_net_out_bw(); static const int kHostNetOutBwFieldNumber = 12; inline ::google::protobuf::uint32 host_net_out_bw() const; inline void set_host_net_out_bw(::google::protobuf::uint32 value); // @@protoc_insertion_point(class_scope:PS.HeartbeatReport) private: inline void set_has_task_id(); inline void clear_has_task_id(); inline void set_has_hostname(); inline void clear_has_hostname(); inline void set_has_seconds_since_epoch(); inline void clear_has_seconds_since_epoch(); inline void set_has_total_time_milli(); inline void clear_has_total_time_milli(); inline void set_has_busy_time_milli(); inline void clear_has_busy_time_milli(); inline void set_has_net_in_mb(); inline void clear_has_net_in_mb(); inline void set_has_net_out_mb(); inline void clear_has_net_out_mb(); inline void set_has_process_cpu_usage(); inline void clear_has_process_cpu_usage(); inline void set_has_host_cpu_usage(); inline void clear_has_host_cpu_usage(); inline void set_has_process_rss_mb(); inline void clear_has_process_rss_mb(); inline void set_has_process_virt_mb(); inline void clear_has_process_virt_mb(); inline void set_has_host_in_use_gb(); inline void clear_has_host_in_use_gb(); inline void set_has_host_in_use_percentage(); inline void clear_has_host_in_use_percentage(); inline void set_has_host_net_in_bw(); inline void clear_has_host_net_in_bw(); inline void set_has_host_net_out_bw(); inline void clear_has_host_net_out_bw(); ::google::protobuf::UnknownFieldSet _unknown_fields_; ::std::string* hostname_; ::google::protobuf::int32 task_id_; ::google::protobuf::uint32 seconds_since_epoch_; ::google::protobuf::uint32 total_time_milli_; ::google::protobuf::uint32 busy_time_milli_; ::google::protobuf::uint32 net_in_mb_; ::google::protobuf::uint32 net_out_mb_; ::google::protobuf::uint32 process_cpu_usage_; ::google::protobuf::uint32 host_cpu_usage_; ::google::protobuf::uint32 process_rss_mb_; ::google::protobuf::uint32 process_virt_mb_; ::google::protobuf::uint32 host_in_use_gb_; ::google::protobuf::uint32 host_in_use_percentage_; ::google::protobuf::uint32 host_net_in_bw_; ::google::protobuf::uint32 host_net_out_bw_; mutable int _cached_size_; ::google::protobuf::uint32 _has_bits_[(15 + 31) / 32]; friend void protobuf_AddDesc_system_2fproto_2fheartbeat_2eproto(); friend void protobuf_AssignDesc_system_2fproto_2fheartbeat_2eproto(); friend void protobuf_ShutdownFile_system_2fproto_2fheartbeat_2eproto(); void InitAsDefaultInstance(); static HeartbeatReport* default_instance_; }; // =================================================================== // =================================================================== // HeartbeatReport // optional int32 task_id = 1 [default = 0]; inline bool HeartbeatReport::has_task_id() const { return (_has_bits_[0] & 0x00000001u) != 0; } inline void HeartbeatReport::set_has_task_id() { _has_bits_[0] |= 0x00000001u; } inline void HeartbeatReport::clear_has_task_id() { _has_bits_[0] &= ~0x00000001u; } inline void HeartbeatReport::clear_task_id() { task_id_ = 0; clear_has_task_id(); } inline ::google::protobuf::int32 HeartbeatReport::task_id() const { return task_id_; } inline void HeartbeatReport::set_task_id(::google::protobuf::int32 value) { set_has_task_id(); task_id_ = value; } // optional string hostname = 14; inline bool HeartbeatReport::has_hostname() const { return (_has_bits_[0] & 0x00000002u) != 0; } inline void HeartbeatReport::set_has_hostname() { _has_bits_[0] |= 0x00000002u; } inline void HeartbeatReport::clear_has_hostname() { _has_bits_[0] &= ~0x00000002u; } inline void HeartbeatReport::clear_hostname() { if (hostname_ != &::google::protobuf::internal::kEmptyString) { hostname_->clear(); } clear_has_hostname(); } inline const ::std::string& HeartbeatReport::hostname() const { return *hostname_; } inline void HeartbeatReport::set_hostname(const ::std::string& value) { set_has_hostname(); if (hostname_ == &::google::protobuf::internal::kEmptyString) { hostname_ = new ::std::string; } hostname_->assign(value); } inline void HeartbeatReport::set_hostname(const char* value) { set_has_hostname(); if (hostname_ == &::google::protobuf::internal::kEmptyString) { hostname_ = new ::std::string; } hostname_->assign(value); } inline void HeartbeatReport::set_hostname(const char* value, size_t size) { set_has_hostname(); if (hostname_ == &::google::protobuf::internal::kEmptyString) { hostname_ = new ::std::string; } hostname_->assign(reinterpret_cast<const char*>(value), size); } inline ::std::string* HeartbeatReport::mutable_hostname() { set_has_hostname(); if (hostname_ == &::google::protobuf::internal::kEmptyString) { hostname_ = new ::std::string; } return hostname_; } inline ::std::string* HeartbeatReport::release_hostname() { clear_has_hostname(); if (hostname_ == &::google::protobuf::internal::kEmptyString) { return NULL; } else { ::std::string* temp = hostname_; hostname_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); return temp; } } inline void HeartbeatReport::set_allocated_hostname(::std::string* hostname) { if (hostname_ != &::google::protobuf::internal::kEmptyString) { delete hostname_; } if (hostname) { set_has_hostname(); hostname_ = hostname; } else { clear_has_hostname(); hostname_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); } } // optional uint32 seconds_since_epoch = 2; inline bool HeartbeatReport::has_seconds_since_epoch() const { return (_has_bits_[0] & 0x00000004u) != 0; } inline void HeartbeatReport::set_has_seconds_since_epoch() { _has_bits_[0] |= 0x00000004u; } inline void HeartbeatReport::clear_has_seconds_since_epoch() { _has_bits_[0] &= ~0x00000004u; } inline void HeartbeatReport::clear_seconds_since_epoch() { seconds_since_epoch_ = 0u; clear_has_seconds_since_epoch(); } inline ::google::protobuf::uint32 HeartbeatReport::seconds_since_epoch() const { return seconds_since_epoch_; } inline void HeartbeatReport::set_seconds_since_epoch(::google::protobuf::uint32 value) { set_has_seconds_since_epoch(); seconds_since_epoch_ = value; } // optional uint32 total_time_milli = 13; inline bool HeartbeatReport::has_total_time_milli() const { return (_has_bits_[0] & 0x00000008u) != 0; } inline void HeartbeatReport::set_has_total_time_milli() { _has_bits_[0] |= 0x00000008u; } inline void HeartbeatReport::clear_has_total_time_milli() { _has_bits_[0] &= ~0x00000008u; } inline void HeartbeatReport::clear_total_time_milli() { total_time_milli_ = 0u; clear_has_total_time_milli(); } inline ::google::protobuf::uint32 HeartbeatReport::total_time_milli() const { return total_time_milli_; } inline void HeartbeatReport::set_total_time_milli(::google::protobuf::uint32 value) { set_has_total_time_milli(); total_time_milli_ = value; } // optional uint32 busy_time_milli = 3; inline bool HeartbeatReport::has_busy_time_milli() const { return (_has_bits_[0] & 0x00000010u) != 0; } inline void HeartbeatReport::set_has_busy_time_milli() { _has_bits_[0] |= 0x00000010u; } inline void HeartbeatReport::clear_has_busy_time_milli() { _has_bits_[0] &= ~0x00000010u; } inline void HeartbeatReport::clear_busy_time_milli() { busy_time_milli_ = 0u; clear_has_busy_time_milli(); } inline ::google::protobuf::uint32 HeartbeatReport::busy_time_milli() const { return busy_time_milli_; } inline void HeartbeatReport::set_busy_time_milli(::google::protobuf::uint32 value) { set_has_busy_time_milli(); busy_time_milli_ = value; } // optional uint32 net_in_mb = 4; inline bool HeartbeatReport::has_net_in_mb() const { return (_has_bits_[0] & 0x00000020u) != 0; } inline void HeartbeatReport::set_has_net_in_mb() { _has_bits_[0] |= 0x00000020u; } inline void HeartbeatReport::clear_has_net_in_mb() { _has_bits_[0] &= ~0x00000020u; } inline void HeartbeatReport::clear_net_in_mb() { net_in_mb_ = 0u; clear_has_net_in_mb(); } inline ::google::protobuf::uint32 HeartbeatReport::net_in_mb() const { return net_in_mb_; } inline void HeartbeatReport::set_net_in_mb(::google::protobuf::uint32 value) { set_has_net_in_mb(); net_in_mb_ = value; } // optional uint32 net_out_mb = 5; inline bool HeartbeatReport::has_net_out_mb() const { return (_has_bits_[0] & 0x00000040u) != 0; } inline void HeartbeatReport::set_has_net_out_mb() { _has_bits_[0] |= 0x00000040u; } inline void HeartbeatReport::clear_has_net_out_mb() { _has_bits_[0] &= ~0x00000040u; } inline void HeartbeatReport::clear_net_out_mb() { net_out_mb_ = 0u; clear_has_net_out_mb(); } inline ::google::protobuf::uint32 HeartbeatReport::net_out_mb() const { return net_out_mb_; } inline void HeartbeatReport::set_net_out_mb(::google::protobuf::uint32 value) { set_has_net_out_mb(); net_out_mb_ = value; } // optional uint32 process_cpu_usage = 6; inline bool HeartbeatReport::has_process_cpu_usage() const { return (_has_bits_[0] & 0x00000080u) != 0; } inline void HeartbeatReport::set_has_process_cpu_usage() { _has_bits_[0] |= 0x00000080u; } inline void HeartbeatReport::clear_has_process_cpu_usage() { _has_bits_[0] &= ~0x00000080u; } inline void HeartbeatReport::clear_process_cpu_usage() { process_cpu_usage_ = 0u; clear_has_process_cpu_usage(); } inline ::google::protobuf::uint32 HeartbeatReport::process_cpu_usage() const { return process_cpu_usage_; } inline void HeartbeatReport::set_process_cpu_usage(::google::protobuf::uint32 value) { set_has_process_cpu_usage(); process_cpu_usage_ = value; } // optional uint32 host_cpu_usage = 7; inline bool HeartbeatReport::has_host_cpu_usage() const { return (_has_bits_[0] & 0x00000100u) != 0; } inline void HeartbeatReport::set_has_host_cpu_usage() { _has_bits_[0] |= 0x00000100u; } inline void HeartbeatReport::clear_has_host_cpu_usage() { _has_bits_[0] &= ~0x00000100u; } inline void HeartbeatReport::clear_host_cpu_usage() { host_cpu_usage_ = 0u; clear_has_host_cpu_usage(); } inline ::google::protobuf::uint32 HeartbeatReport::host_cpu_usage() const { return host_cpu_usage_; } inline void HeartbeatReport::set_host_cpu_usage(::google::protobuf::uint32 value) { set_has_host_cpu_usage(); host_cpu_usage_ = value; } // optional uint32 process_rss_mb = 8; inline bool HeartbeatReport::has_process_rss_mb() const { return (_has_bits_[0] & 0x00000200u) != 0; } inline void HeartbeatReport::set_has_process_rss_mb() { _has_bits_[0] |= 0x00000200u; } inline void HeartbeatReport::clear_has_process_rss_mb() { _has_bits_[0] &= ~0x00000200u; } inline void HeartbeatReport::clear_process_rss_mb() { process_rss_mb_ = 0u; clear_has_process_rss_mb(); } inline ::google::protobuf::uint32 HeartbeatReport::process_rss_mb() const { return process_rss_mb_; } inline void HeartbeatReport::set_process_rss_mb(::google::protobuf::uint32 value) { set_has_process_rss_mb(); process_rss_mb_ = value; } // optional uint32 process_virt_mb = 9; inline bool HeartbeatReport::has_process_virt_mb() const { return (_has_bits_[0] & 0x00000400u) != 0; } inline void HeartbeatReport::set_has_process_virt_mb() { _has_bits_[0] |= 0x00000400u; } inline void HeartbeatReport::clear_has_process_virt_mb() { _has_bits_[0] &= ~0x00000400u; } inline void HeartbeatReport::clear_process_virt_mb() { process_virt_mb_ = 0u; clear_has_process_virt_mb(); } inline ::google::protobuf::uint32 HeartbeatReport::process_virt_mb() const { return process_virt_mb_; } inline void HeartbeatReport::set_process_virt_mb(::google::protobuf::uint32 value) { set_has_process_virt_mb(); process_virt_mb_ = value; } // optional uint32 host_in_use_gb = 10; inline bool HeartbeatReport::has_host_in_use_gb() const { return (_has_bits_[0] & 0x00000800u) != 0; } inline void HeartbeatReport::set_has_host_in_use_gb() { _has_bits_[0] |= 0x00000800u; } inline void HeartbeatReport::clear_has_host_in_use_gb() { _has_bits_[0] &= ~0x00000800u; } inline void HeartbeatReport::clear_host_in_use_gb() { host_in_use_gb_ = 0u; clear_has_host_in_use_gb(); } inline ::google::protobuf::uint32 HeartbeatReport::host_in_use_gb() const { return host_in_use_gb_; } inline void HeartbeatReport::set_host_in_use_gb(::google::protobuf::uint32 value) { set_has_host_in_use_gb(); host_in_use_gb_ = value; } // optional uint32 host_in_use_percentage = 15; inline bool HeartbeatReport::has_host_in_use_percentage() const { return (_has_bits_[0] & 0x00001000u) != 0; } inline void HeartbeatReport::set_has_host_in_use_percentage() { _has_bits_[0] |= 0x00001000u; } inline void HeartbeatReport::clear_has_host_in_use_percentage() { _has_bits_[0] &= ~0x00001000u; } inline void HeartbeatReport::clear_host_in_use_percentage() { host_in_use_percentage_ = 0u; clear_has_host_in_use_percentage(); } inline ::google::protobuf::uint32 HeartbeatReport::host_in_use_percentage() const { return host_in_use_percentage_; } inline void HeartbeatReport::set_host_in_use_percentage(::google::protobuf::uint32 value) { set_has_host_in_use_percentage(); host_in_use_percentage_ = value; } // optional uint32 host_net_in_bw = 11; inline bool HeartbeatReport::has_host_net_in_bw() const { return (_has_bits_[0] & 0x00002000u) != 0; } inline void HeartbeatReport::set_has_host_net_in_bw() { _has_bits_[0] |= 0x00002000u; } inline void HeartbeatReport::clear_has_host_net_in_bw() { _has_bits_[0] &= ~0x00002000u; } inline void HeartbeatReport::clear_host_net_in_bw() { host_net_in_bw_ = 0u; clear_has_host_net_in_bw(); } inline ::google::protobuf::uint32 HeartbeatReport::host_net_in_bw() const { return host_net_in_bw_; } inline void HeartbeatReport::set_host_net_in_bw(::google::protobuf::uint32 value) { set_has_host_net_in_bw(); host_net_in_bw_ = value; } // optional uint32 host_net_out_bw = 12; inline bool HeartbeatReport::has_host_net_out_bw() const { return (_has_bits_[0] & 0x00004000u) != 0; } inline void HeartbeatReport::set_has_host_net_out_bw() { _has_bits_[0] |= 0x00004000u; } inline void HeartbeatReport::clear_has_host_net_out_bw() { _has_bits_[0] &= ~0x00004000u; } inline void HeartbeatReport::clear_host_net_out_bw() { host_net_out_bw_ = 0u; clear_has_host_net_out_bw(); } inline ::google::protobuf::uint32 HeartbeatReport::host_net_out_bw() const { return host_net_out_bw_; } inline void HeartbeatReport::set_host_net_out_bw(::google::protobuf::uint32 value) { set_has_host_net_out_bw(); host_net_out_bw_ = value; } // @@protoc_insertion_point(namespace_scope) } // namespace PS #ifndef SWIG namespace google { namespace protobuf { } // namespace google } // namespace protobuf #endif // SWIG // @@protoc_insertion_point(global_scope) #endif // PROTOBUF_system_2fproto_2fheartbeat_2eproto__INCLUDED
[ "muli@cs.cmu.edu" ]
muli@cs.cmu.edu
6388dab0ebdfd529ef7f9e70797ce89104cdbc68
7ad527bad3bd0d7eb94d1d8a0fe08df67aa26c3e
/软件学院/高级语言程序设计(C++)/答案/ch21solutions/Ex08_45/Ex08_45.cpp
dddda4010ffe01844eeba3147fc1f793adc29b3a
[]
no_license
SCUTMSC/SCUT-Course
67e67ac494aef7fc73de17f61b7fab8450f17952
90f884a9032e951ebc9421cc88ca807b9ec211da
refs/heads/master
2020-07-16T22:22:53.359477
2019-09-07T08:28:09
2019-09-07T08:28:09
205,880,291
10
6
null
null
null
null
UTF-8
C++
false
false
2,577
cpp
// Exercise 8.45 Solution: Ex08_45.cpp // NOTE: THIS PROGRAM ONLY HANDLES VALUES UP TO $99.99 // The program is easily modified to process larger values #include <iostream> using namespace std; int main() { // array representing string of values from 1-9 const char *digits[ 10 ] = { "", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE" }; // array representing string of values from 10-19 const char *teens[ 10 ] = { "TEN", "ELEVEN", "TWELVE", "THIRTEEN", "FOURTEEN", "FIFTEEN", "SIXTEEN", "SEVENTEEN", "EIGHTEEN", "NINETEEN"}; // array representing string of values from 10-90 const char *tens[ 10 ] = { "", "TEN", "TWENTY", "THIRTY", "FORTY", "FIFTY", "SIXTY", "SEVENTY", "EIGHTY", "NINETY" }; int dollars; int cents; int digit1; int digit2; cout << "Enter the check amount (0.00 to 99.99): "; cin >> dollars; cin.ignore(); cin >> cents; cout << "The check amount in words is:\n"; // test if the integer amount correspond to a certain array if ( dollars < 10 ) cout << digits[ dollars ] << ' '; else if ( dollars < 20 ) cout << teens[ dollars - 10 ] << ' '; else { digit1 = dollars / 10; digit2 = dollars % 10; if ( !digit2 ) cout << tens[ digit1 ] << ' '; else cout << tens[ digit1 ] << "-" << digits[ digit2 ] << ' '; } // end else cout << "and " << cents << "/100" << endl; } // end main /************************************************************************** * (C) Copyright 1992-2010 by Deitel & Associates, Inc. and * * Pearson Education, Inc. All Rights Reserved. * * * * DISCLAIMER: The authors and publisher of this book have used their * * best efforts in preparing the book. These efforts include the * * development, research, and testing of the theories and programs * * to determine their effectiveness. The authors and publisher make * * no warranty of any kind, expressed or implied, with regard to these * * programs or to the documentation contained in these books. The authors * * and publisher shall not be liable in any event for incidental or * * consequential damages in connection with, or arising out of, the * * furnishing, performance, or use of these programs. * **************************************************************************/
[ "LotteWong21@gmail.com" ]
LotteWong21@gmail.com
eadc35ac17c37f9706cc755a104698ad8f420d5c
74b43294bab1e9fd9ccffe8b0152bfad9bc04571
/codeforces - 1085C - Connect Three.cpp
e1113598cce5d71d6140ff59c49267be66d06fd0
[]
no_license
Mohaymin/CompetitiveProgramming
2c87fe9bef61b6e1ee14e035fe70b700e359dd1c
39588f696649bf72f3812ec2a0444ca3a25358d3
refs/heads/master
2020-04-13T18:26:25.964668
2019-07-24T15:29:33
2019-07-24T15:29:33
163,374,273
1
0
null
null
null
null
UTF-8
C++
false
false
2,652
cpp
#include<bits/stdc++.h> using namespace std; typedef pair<int, int> mypair; vector<mypair> v; stack<mypair> s; set<mypair> st; mypair dummy; int dist[4]; int a, b; bool isEligible() { if(s.top()!=dummy) { if(binary_search(st.begin(), st.end(), dummy)) { return true; } } st.insert(dummy); return false; } void increasingX(mypair from, mypair to) { for(int i=from.first; i<=to.first; i++) { dummy = make_pair(i, from.second); if(isEligible()) { s.push(dummy); } } } void decreasingX(mypair from, mypair to) { for(int i=from.first; i>=to.first; i--) { dummy = make_pair(i, from.second); if(isEligible()) { s.push(dummy); } } } void increasingY(mypair from, mypair to) { for(int i=from.second+1; i<=to.second; i++) { dummy = make_pair(from.first, i); if(isEligible()) { s.push(dummy); } } } void decreasingY(mypair from, mypair to) { for(int i=from.second-1; i>=to.second; i--) { dummy = make_pair(from.first, i); if(isEligible()) { s.push(dummy); } } } void gofrom(mypair from, mypair to) { if(from.first < to.first) { increasingX(from, to); } else { decreasingX(from, to); } from.first = to.first; if(from.second < to.second) { increasingY(from, to); } else { decreasingY(from, to); } } int main() { //freopen("_in.txt", "r", stdin); ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); int x, y; for(int i=0; i<3; i++) { cin >> x >> y; v.push_back(make_pair(x, y)); } int i=0; s.push(make_pair(-1, -1)); st.insert(make_pair(-1, -1)); do { a = fabs(v[i].first-v[(i+1)%3].first); b = fabs(v[i].second-v[(i+1)%3].second); dist[i] = a+b; i = (i+1)%3; } while(i!=0); dist[3] = dist[0]; int k = numeric_limits<int>::max(); int minindex; for(int i=0; i<3; i++) { if(dist[i]+dist[(i+1)%3] < k) { minindex = i; k = dist[i]; } } int startindex = minindex; int endindex = (minindex+3)%3; do { gofrom(v[startindex], v[(startindex+1)%3]); startindex = (startindex+1)%3; } while(startindex!=endindex); k = s.size()-1; cout << k << "\n"; while(s.size()>1) { cout << s.top().first << " " << s.top().second << "\n"; s.pop(); } return 0; }
[ "cabdsrijon@gmail.com" ]
cabdsrijon@gmail.com
4fb0a0b1ab2122313e4472ce696e834c21a48805
08b8cf38e1936e8cec27f84af0d3727321cec9c4
/data/crawl/squid/new_hunk_7877.cpp
3df9f15e906b5a61648c1745a8364e371aac66f6
[]
no_license
ccdxc/logSurvey
eaf28e9c2d6307140b17986d5c05106d1fd8e943
6b80226e1667c1e0760ab39160893ee19b0e9fb1
refs/heads/master
2022-01-07T21:31:55.446839
2018-04-21T14:12:43
2018-04-21T14:12:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
274
cpp
if (syslog_enable) syslog(LOG_ALERT, message); #endif fprintf(debug_log, "FATAL: %s\n", message); fprintf(debug_log, "Harvest Cache (Version %s): Terminated abnormally.\n", SQUID_VERSION); fflush(debug_log); PrintRusage(NULL, debug_log); } /* fatal */
[ "993273596@qq.com" ]
993273596@qq.com
4dfc7805283ec10ea2945d421e1854bd2473637b
9030ce2789a58888904d0c50c21591632eddffd7
/SDK/ARKSurvivalEvolved_PrimalItemArmor_TransparentRiotShield_structs.hpp
3b157e96fd11b8c4b42a6c9dc4da9edb44f88548
[ "MIT" ]
permissive
2bite/ARK-SDK
8ce93f504b2e3bd4f8e7ced184980b13f127b7bf
ce1f4906ccf82ed38518558c0163c4f92f5f7b14
refs/heads/master
2022-09-19T06:28:20.076298
2022-09-03T17:21:00
2022-09-03T17:21:00
232,411,353
14
5
null
null
null
null
UTF-8
C++
false
false
265
hpp
#pragma once // ARKSurvivalEvolved (332.8) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "ARKSurvivalEvolved_Basic.hpp" #include "ARKSurvivalEvolved_PrimalItemArmor_Shield_classes.hpp" namespace sdk { } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "sergey.2bite@gmail.com" ]
sergey.2bite@gmail.com
5f5ccf665d9ff69eb7704a20c78908addcce1600
91e3d3494819be1f5f04239c8aaf93989e6b2f34
/rpc/rpcupgrades.cpp
f165b0de6af774fca78b01712b77813041ebbc57
[]
no_license
filecoinwallet/ebzz_public
1c5e38d64b26da77cb4a50002c94ac65e63e5e4a
708fbb8e498f58b03921517d0fa3489ff8b2d861
refs/heads/main
2023-06-21T22:18:04.861369
2021-07-22T20:08:19
2021-07-22T20:08:19
385,140,291
3
0
null
null
null
null
UTF-8
C++
false
false
33,142
cpp
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2014-2016 The _ebzz_ebzz Core developers // Original code was distributed under the MIT software license. // Copyright (c) 2014-2019 Coin Sciences Ltd // bzz code distributed under the GPLv3 license, see COPYING file. #include "rpc/rpcwallet.h" bool AddParamNameValueToScript(const string param_name,const Value param_value,mc_Script *lpDetailsScript,int version,int *errorCode,string *strError); int CreateUpgradeLists(int current_height,vector<mc_UpgradedParameter> *vParams,vector<mc_UpgradeStatus> *vUpgrades); Value createupgradefromcmd(const Array& params, bool fHelp) { if (fHelp || params.size() < 5) throw runtime_error("Help message not found\n"); if (strcmp(params[1].get_str().c_str(),"upgrade")) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid entity type, should be stream"); CWalletTx wtx; mc_Script *lpScript=mc_gState->m_TmpBuffers->m_RpcScript3; lpScript->Clear(); mc_Script *lpDetailsScript=mc_gState->m_TmpBuffers->m_RpcScript1; lpDetailsScript->Clear(); mc_Script *lpDetails=mc_gState->m_TmpBuffers->m_RpcScript2; lpDetails->Clear(); int ret,type; string upgrade_name=""; string strError=""; int errorCode=RPC_INVALID_PARAMETER; if (params[2].type() != str_type) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid upgrade name, should be string"); if(!params[2].get_str().empty()) { upgrade_name=params[2].get_str(); } if(upgrade_name == "*") { throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid upgrade name: *"); } unsigned char buf_a[MC_AST_ASSET_REF_SIZE]; if(AssetRefDecode(buf_a,upgrade_name.c_str(),upgrade_name.size())) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid upgrade name, looks like a upgrade reference"); } if(upgrade_name.size()) { ret=ParseAssetKey(upgrade_name.c_str(),NULL,NULL,NULL,NULL,&type,MC_ENT_TYPE_ANY); if(ret != MC_ASSET_KEY_INVALID_NAME) { if(type == MC_ENT_KEYTYPE_NAME) { throw JSONRPCError(RPC_DUPLICATE_NAME, "Entity with this name already exists"); } else { throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid upgrade name"); } } } vector<CTxDestination> addresses; vector<CTxDestination> fromaddresses; EnsureWalletIsUnlocked(); if(params[0].get_str() != "*") { fromaddresses=ParseAddresses(params[0].get_str(),false,false); if(fromaddresses.size() != 1) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Single from-address should be specified"); } if( (IsMine(*pwalletMain, fromaddresses[0]) & ISMINE_SPENDABLE) != ISMINE_SPENDABLE ) { throw JSONRPCError(RPC_WALLET_ADDRESS_NOT_FOUND, "Private key for from-address is not found in this wallet"); } set<CTxDestination> thisFromAddresses; BOOST_FOREACH(const CTxDestination& fromaddress, fromaddresses) { thisFromAddresses.insert(fromaddress); } CPubKey pkey; if(!pwalletMain->GetKeyFromAddressBook(pkey,MC_PTP_CREATE | MC_PTP_ADMIN,&thisFromAddresses)) { throw JSONRPCError(RPC_INSUFFICIENT_PERMISSIONS, "from-address doesn't have create or admin permission"); } } else { BOOST_FOREACH(const PAIRTYPE(C_ebzz_ebzzAddress, CAddressBookData)& item, pwalletMain->mapAddressBook) { const C_ebzz_ebzzAddress& address = item.first; CKeyID keyID; if(address.GetKeyID(keyID)) { if( IsMine(*pwalletMain, keyID) & ISMINE_SPENDABLE ) { if(mc_gState->m_Permissions->CanCreate(NULL,(unsigned char*)(&keyID))) { if(mc_gState->m_Permissions->CanAdmin(NULL,(unsigned char*)(&keyID))) { fromaddresses.push_back(keyID); } } } } } CPubKey pkey; if(fromaddresses.size() == 0) { throw JSONRPCError(RPC_INSUFFICIENT_PERMISSIONS, "This wallet doesn't have keys with create and admin permission"); } } lpScript->Clear(); lpDetails->Clear(); lpDetails->AddElement(); if(upgrade_name.size()) { lpDetails->SetSpecialParamValue(MC_ENT_SPRM_NAME,(unsigned char*)(upgrade_name.c_str()),upgrade_name.size());//+1); } if(params[3].type() != bool_type) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid open flag, should be boolean"); if(params[3].get_bool()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid open flag, should be false"); bool protocol_version_found=false; int protocol_version; int start_block; CScript scriptOpReturn=CScript(); lpDetailsScript->Clear(); lpDetailsScript->AddElement(); if(params[4].type() == obj_type) { Object objParams = params[4].get_obj(); BOOST_FOREACH(const Pair& s, objParams) { if(s.name_ == "protocol-version") { if(s.value_.type() != int_type) { strError="Invalid protocol version, expecting integer"; goto exitlbl; } protocol_version_found=true; protocol_version=s.value_.get_int(); if( (protocol_version < mc_gState->MinProtocolVersion()) || ( -mc_gState->VersionInfo(protocol_version) != mc_gState->GetNumericVersion() ) ) { strError=strprintf("Invalid value for protocol version. Valid range: %s\n",mc_SupportedProtocols().c_str()); errorCode=RPC_NOT_ALLOWED; goto exitlbl; } if( protocol_version < mc_gState->MinProtocolDowngradeVersion() ) { strError="Invalid protocol version, cannot downgrade to this version"; errorCode=RPC_NOT_ALLOWED; goto exitlbl; } if( mc_gState->m_NetworkParams->ProtocolVersion() >= mc_gState->MinProtocolForbiddenDowngradeVersion() ) { if(protocol_version < mc_gState->m_NetworkParams->ProtocolVersion()) { strError="Invalid protocol version, cannot downgrade from current version"; errorCode=RPC_NOT_ALLOWED; goto exitlbl; } } lpDetails->SetSpecialParamValue(MC_ENT_SPRM_UPGRADE_PROTOCOL_VERSION,(unsigned char*)&protocol_version,4); } else { if(s.name_ == "startblock") { if(s.value_.type() != int_type) { strError="Invalid start block, expecting integer"; goto exitlbl; } start_block=s.value_.get_int(); lpDetails->SetSpecialParamValue(MC_ENT_SPRM_UPGRADE_START_BLOCK,(unsigned char*)&start_block,4); } else { if(mc_gState->m_Features->ParameterUpgrades()) { if(!AddParamNameValueToScript(s.name_,s.value_,lpDetailsScript,0,&errorCode,&strError)) { goto exitlbl; } } else { strError="Some upgrade parameters are not supported by the current protocol, please upgrade protocol separately first."; errorCode=RPC_NOT_SUPPORTED; goto exitlbl; } // lpDetails->SetParamValue(s.name_.c_str(),s.name_.size(),(unsigned char*)s.value_.get_str().c_str(),s.value_.get_str().size()); } } } } else { strError="Invalid custom fields, expecting object"; goto exitlbl; } size_t bytes; const unsigned char *script; script = lpDetailsScript->GetData(0,&bytes); if( !protocol_version_found && (bytes == 0) ) { strError="Missing protocol-version"; if(mc_gState->m_Features->ParameterUpgrades()) { strError+=" or other parameters"; } goto exitlbl; } if(bytes) { lpDetails->SetSpecialParamValue(MC_ENT_SPRM_UPGRADE_CHAIN_PARAMS,script,bytes); } script=lpDetails->GetData(0,&bytes); int err; size_t elem_size; const unsigned char *elem; lpDetailsScript->Clear(); err=lpDetailsScript->SetNewEntityType(MC_ENT_TYPE_UPGRADE,0,script,bytes); if(err) { strError="Invalid custom fields or upgrade name, too long"; goto exitlbl; } elem = lpDetailsScript->GetData(0,&elem_size); scriptOpReturn << vector<unsigned char>(elem, elem + elem_size) << OP_DROP << OP_RETURN; { LOCK (pwalletMain->cs_wallet_send); SendMoneyToSeveralAddresses(addresses, 0, wtx, lpScript, scriptOpReturn,fromaddresses); } exitlbl: if(strError.size()) { throw JSONRPCError(errorCode, strError); } return wtx.GetHash().GetHex(); } bool ParseLibraryApproval(Value param,mc_EntityDetails *library_entity,mc_EntityDetails *update_entity) { bool field_parsed,update_found,approve_found; bool approval=false; if(param.type() == obj_type) { Object objParams = param.get_obj(); update_found=false; approve_found=false; BOOST_FOREACH(const Pair& s, objParams) { field_parsed=false; if(s.name_ == "updatename") { if(update_found) { throw JSONRPCError(RPC_INVALID_PARAMETER,"update field can appear only once in the object"); } if(s.value_.type() == str_type) { if(s.value_.get_str().size() == 0) { throw JSONRPCError(RPC_NOT_SUPPORTED, "Approval is not required for original library code"); } if(mc_gState->m_Assets->FindUpdateByName(update_entity,library_entity->GetTxID(),s.value_.get_str().c_str()) == 0) { throw JSONRPCError(RPC_ENTITY_NOT_FOUND, "Library update not found"); } LogPrintf("mchn: Library update found: %s (%s)\n",s.value_.get_str().c_str(),((uint256*)update_entity->GetTxID())->ToString().c_str()); } else { throw JSONRPCError(RPC_INVALID_PARAMETER,"update field should be string"); } field_parsed=true; update_found=true; } if(s.name_ == "approve") { if(approve_found) { throw JSONRPCError(RPC_INVALID_PARAMETER,"approve field can appear only once in the object"); } if(s.value_.type() == bool_type) { approval=s.value_.get_bool(); } else { throw JSONRPCError(RPC_INVALID_PARAMETER,"approve should be boolean"); } field_parsed=true; approve_found=true; } if(!field_parsed) { throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid field: %s",s.name_.c_str())); } } if(!update_found) { throw JSONRPCError(RPC_INVALID_PARAMETER,"missing update field"); } if(!approve_found) { throw JSONRPCError(RPC_INVALID_PARAMETER,"missing approve filed"); } } else { throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid library approval, should be object"); } return approval; } bool ParseStreamFilterApproval(Value param,mc_EntityDetails *stream_entity) { bool field_parsed,for_found,approve_found; bool approval=false; if(param.type() == obj_type) { Object objParams = param.get_obj(); for_found=false; approve_found=false; BOOST_FOREACH(const Pair& s, objParams) { field_parsed=false; if(s.name_ == "for") { if(for_found) { throw JSONRPCError(RPC_INVALID_PARAMETER,"for field can appear only once in the object"); } if(s.value_.type() == str_type) { ParseEntityIdentifier(s.value_.get_str(),stream_entity, MC_ENT_TYPE_STREAM); } else { throw JSONRPCError(RPC_INVALID_PARAMETER,"stream identifier should be string"); } field_parsed=true; for_found=true; } if(s.name_ == "approve") { if(approve_found) { throw JSONRPCError(RPC_INVALID_PARAMETER,"approve field can appear only once in the object"); } if(s.value_.type() == bool_type) { approval=s.value_.get_bool(); } else { throw JSONRPCError(RPC_INVALID_PARAMETER,"approve should be boolean"); } field_parsed=true; approve_found=true; } if(!field_parsed) { throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid field: %s",s.name_.c_str())); } } if(!for_found) { throw JSONRPCError(RPC_INVALID_PARAMETER,"missing stream identifier"); } if(!approve_found) { throw JSONRPCError(RPC_INVALID_PARAMETER,"missing approve filed"); } } else { throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid stream filter approval, should be object"); } return approval; } Value approvefrom(const json_spirit::Array& params, bool fHelp) { if (fHelp || params.size() < 3) throw runtime_error("Help message not found\n"); vector<CTxDestination> addresses; set<C_ebzz_ebzzAddress> setAddress; uint32_t approval,timestamp; string entity_identifier; entity_identifier=params[1].get_str(); timestamp=mc_TimeNowAsUInt(); mc_EntityDetails entity; entity.Zero(); ParseEntityIdentifier(entity_identifier,&entity, MC_ENT_TYPE_ANY); string entity_nameU; string entity_nameL; bool fIsUpgrade=true; bool fIsStreamFilter=false; bool fIsLibrary=false; switch(entity.GetEntityType()) { case MC_ENT_TYPE_UPGRADE: entity_nameU="Upgrade"; entity_nameL="upgrade"; break; case MC_ENT_TYPE_FILTER: if(mc_gState->m_Features->Filters() == 0) { throw JSONRPCError(RPC_NOT_SUPPORTED, "API is not supported with this protocol version."); } if(entity.GetFilterType() != MC_FLT_TYPE_TX) { if(mc_gState->m_Features->StreamFilters() == 0) { throw JSONRPCError(RPC_NOT_SUPPORTED, "Only Tx filters can be approved/disapproved in this protocol version."); } if(entity.GetFilterType() == MC_FLT_TYPE_STREAM) { fIsStreamFilter=true; } } entity_nameU="Filter"; entity_nameL="filter"; fIsUpgrade=false; break; case MC_ENT_TYPE_LIBRARY: if(mc_gState->m_Features->Libraries() == 0) { throw JSONRPCError(RPC_NOT_SUPPORTED, "API is not supported with this protocol version."); } if(entity.ApproveRequired() == 0) { throw JSONRPCError(RPC_NOT_SUPPORTED, "Approval is not required for this library"); } entity_nameU="Library"; entity_nameL="library"; fIsUpgrade=false; fIsLibrary=true; break; default: throw JSONRPCError(RPC_ENTITY_NOT_FOUND, "Invalid identifier, should be upgrade or filter"); break; } mc_EntityDetails stream_entity; mc_EntityDetails update_entity; stream_entity.Zero(); if(fIsStreamFilter) { if (params.size() <= 2) { throw JSONRPCError(RPC_INVALID_PARAMS, "Missing stream identifier"); } approval=ParseStreamFilterApproval(params[2],&stream_entity); } else { if(fIsLibrary) { if (params.size() <= 2) { throw JSONRPCError(RPC_INVALID_PARAMS, "Missing library upddate"); } approval=ParseLibraryApproval(params[2],&entity,&update_entity); } else { approval=1; if (params.size() > 2) { if(!paramtobool(params[2])) { approval=0; } } } } if(fIsUpgrade) { if( mc_gState->m_NetworkParams->ProtocolVersion() >= mc_gState->MinProtocolForbiddenDowngradeVersion() ) { if(entity.UpgradeProtocolVersion()) { if(entity.UpgradeProtocolVersion() < mc_gState->m_NetworkParams->ProtocolVersion()) { throw JSONRPCError(RPC_NOT_ALLOWED, "Invalid protocol version, cannot downgrade from current version"); } } } } if(fIsUpgrade) { if(mc_gState->m_Permissions->IsApproved(entity.GetTxID()+MC_AST_SHORT_TXID_OFFSET,0)) { throw JSONRPCError(RPC_NOT_ALLOWED, "Upgrade already approved"); } } vector<CTxDestination> fromaddresses; fromaddresses=ParseAddresses(params[0].get_str(),false,false); EnsureWalletIsUnlocked(); if(fromaddresses.size() != 1) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Single from-address should be specified"); } if( (IsMine(*pwalletMain, fromaddresses[0]) & ISMINE_SPENDABLE) != ISMINE_SPENDABLE ) { throw JSONRPCError(RPC_WALLET_ADDRESS_NOT_FOUND, "Private key for from-address is not found in this wallet"); } CKeyID *lpKeyID=boost::get<CKeyID> (&fromaddresses[0]); if(fIsStreamFilter) { if(lpKeyID != NULL) { if(mc_gState->m_Permissions->CanAdmin(stream_entity.GetTxID(),(unsigned char*)(lpKeyID)) == 0) { throw JSONRPCError(RPC_INSUFFICIENT_PERMISSIONS, "from-address doesn't have admin permission for specified stream"); } } else { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Please use raw transactions to approve filters from P2SH addresses"); } } else { if(lpKeyID != NULL) { if(mc_gState->m_Permissions->CanAdmin(NULL,(unsigned char*)(lpKeyID)) == 0) { throw JSONRPCError(RPC_INSUFFICIENT_PERMISSIONS, "from-address doesn't have admin permission"); } } else { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Please use raw transactions to approve upgrades from P2SH addresses"); } } mc_Script *lpScript=mc_gState->m_TmpBuffers->m_RpcScript3; lpScript->Clear(); CScript scriptOpReturn=CScript(); if(fIsUpgrade) { lpScript->SetEntity(entity.GetTxID()+MC_AST_SHORT_TXID_OFFSET); lpScript->SetApproval(approval, timestamp); size_t elem_size; const unsigned char *elem; for(int e=0;e<lpScript->GetNumElements();e++) { elem = lpScript->GetData(e,&elem_size); scriptOpReturn << vector<unsigned char>(elem, elem + elem_size) << OP_DROP; } scriptOpReturn << OP_RETURN; } else { if(fIsStreamFilter) { lpScript->SetEntity(stream_entity.GetTxID()+MC_AST_SHORT_TXID_OFFSET); } lpScript->SetPermission(MC_PTP_FILTER,0,approval ? 4294967295U : 0,timestamp); uint160 filter_address; filter_address=0; if(fIsLibrary) { // memcpy(&filter_address,update_entity.GetTxID()+MC_AST_SHORT_TXID_OFFSET,MC_AST_SHORT_TXID_SIZE); memcpy(&filter_address,entity.GetTxID()+MC_AST_SHORT_TXID_OFFSET,MC_AST_SHORT_TXID_SIZE); unsigned char *ptr; size_t bytes; ptr=(unsigned char *)update_entity.GetSpecialParam(MC_ENT_SPRM_CHAIN_INDEX,&bytes); if(ptr) { if((bytes>0) && (bytes<=4)) { memcpy(((unsigned char*)&filter_address)+MC_AST_SHORT_TXID_SIZE,ptr,bytes); } } else { throw JSONRPCError(RPC_INTERNAL_ERROR, "Corrupted Library database"); } } else { memcpy(&filter_address,entity.GetTxID()+MC_AST_SHORT_TXID_OFFSET,MC_AST_SHORT_TXID_SIZE); } addresses.push_back(CKeyID(filter_address)); } LogPrintf("mchn: %s %s %s (%s) from address %s\n",(approval != 0) ? "Approving" : "Disapproving",entity_nameL.c_str(), ((uint256*)entity.GetTxID())->ToString().c_str(),entity.GetName(),C_ebzz_ebzzAddress(fromaddresses[0]).ToString().c_str()); CWalletTx wtx; LOCK (pwalletMain->cs_wallet_send); SendMoneyToSeveralAddresses(addresses, 0, wtx, lpScript, scriptOpReturn, fromaddresses); return wtx.GetHash().GetHex(); } Value listupgrades(const json_spirit::Array& params, bool fHelp) { if (fHelp || params.size() > 1) throw runtime_error("Help message not found\n"); Array results; mc_Buffer *upgrades; set<uint160> inputUpgrades; upgrades=NULL; vector<string> inputStrings; if (params.size() > 0 && params[0].type() != null_type && ((params[0].type() != str_type) || (params[0].get_str() !="*" ) ) ) { if(params[0].type() == str_type) { inputStrings.push_back(params[0].get_str()); if(params[0].get_str() == "") { return results; } } else { inputStrings=ParseStringList(params[0]); if(inputStrings.size() == 0) { return results; } } } for(int is=0;is<(int)inputStrings.size();is++) { string param=inputStrings[is]; mc_EntityDetails upgrade_entity; ParseEntityIdentifier(param,&upgrade_entity, MC_ENT_TYPE_UPGRADE); uint160 hash=0; memcpy(&hash,upgrade_entity.GetTxID() + MC_AST_SHORT_TXID_OFFSET,MC_AST_SHORT_TXID_SIZE); inputUpgrades.insert(hash); } vector<mc_UpgradedParameter> vParams; vector<mc_UpgradeStatus> vUpgrades; uint32_t current_height=chainActive.Height(); CreateUpgradeLists(chainActive.Height(),&vParams,&vUpgrades); for(int u=0;u<(int)vUpgrades.size();u++) { Object entry; Object applied_params; Object skipped_params; mc_PermissionDetails *plsRow; mc_PermissionDetails *plsDet; mc_EntityDetails upgrade_entity; int consensus; Value null_value; string param_name; uint160 hash=0; memcpy(&hash,vUpgrades[u].m_EntityShortTxID,sizeof(uint160)); if( (inputUpgrades.size() == 0) || (inputUpgrades.count(hash) > 0) ) { upgrade_entity.Zero(); mc_gState->m_Assets->FindEntityByShortTxID(&upgrade_entity,vUpgrades[u].m_EntityShortTxID); entry=UpgradeEntry(upgrade_entity.GetTxID()); entry.push_back(Pair("approved", (vUpgrades[u].m_ApprovedBlock <= current_height+1))); for(uint32_t p=vUpgrades[u].m_FirstParam;p<vUpgrades[u].m_LastParam;p++) { param_name=string(vParams[p].m_Param->m_DisplayName); if(vParams[p].m_Skipped == MC_PSK_APPLIED) { if(vParams[p].m_Param->m_Type & MC_PRM_DECIMAL) { applied_params.push_back(Pair(param_name,mc_gState->m_NetworkParams->Int64ToDecimal(vParams[p].m_Value))); } else { switch(vParams[p].m_Param->m_Type & MC_PRM_DATA_TYPE_MASK) { case MC_PRM_BOOLEAN: applied_params.push_back(Pair(param_name,(vParams[p].m_Value != 0))); break; case MC_PRM_INT32: applied_params.push_back(Pair(param_name,(int)vParams[p].m_Value)); case MC_PRM_UINT32: case MC_PRM_INT64: applied_params.push_back(Pair(param_name,vParams[p].m_Value)); break; } } } else { string param_err; switch(vParams[p].m_Skipped) { case MC_PSK_INTERNAL_ERROR: param_err="Parameter not applied because of internal error, please report this"; break; case MC_PSK_NOT_FOUND: param_err="Parameter name not recognized"; break; case MC_PSK_WRONG_SIZE: param_err="Parameter is encoded with wrong size"; break; case MC_PSK_OUT_OF_RANGE: param_err="Parameter value is out of range"; break; case MC_PSK_FRESH_UPGRADE: param_err=strprintf("Parameter is upgraded less than %d blocks ago",MIN_BLOCKS_BETWEEN_UPGRADES); break; case MC_PSK_DOUBLE_RANGE: param_err="New parameter value must be between half and double previous value"; break; case MC_PSK_NOT_SUPPORTED: param_err="This parameter cannot be upgraded in this protocol version"; break; case MC_PSK_NEW_NOT_DOWNGRADABLE: param_err="Cannot downgrade to this version"; break; case MC_PSK_OLD_NOT_DOWNGRADABLE: param_err="Downgrades are not allowed in this protocol version"; break; default: param_err="Parameter not applied because of internal error, please report this"; break; } skipped_params.push_back(Pair(param_name,param_err)); } } if(vUpgrades[u].m_AppliedBlock <= current_height) { entry.push_back(Pair("appliedblock", (int64_t)vUpgrades[u].m_AppliedBlock)); entry.push_back(Pair("appliedparams", applied_params)); entry.push_back(Pair("skippedparams", skipped_params)); } else { entry.push_back(Pair("appliedblock", null_value)); entry.push_back(Pair("appliedparams", null_value)); entry.push_back(Pair("skippedparams", null_value)); } upgrades=mc_gState->m_Permissions->GetUpgradeList(upgrade_entity.GetTxID() + MC_AST_SHORT_TXID_OFFSET,upgrades); if(upgrades->GetCount()) { plsRow=(mc_PermissionDetails *)(upgrades->GetRow(upgrades->GetCount()-1)); consensus=plsRow->m_RequiredAdmins; if(plsRow->m_Type != MC_PTP_UPGRADE) { plsRow->m_BlockTo=0; } Array admins; Array pending; mc_Buffer *details; if(plsRow->m_Type == MC_PTP_UPGRADE) { details=mc_gState->m_Permissions->GetPermissionDetails(plsRow); } else { details=NULL; } if(details) { for(int j=0;j<details->GetCount();j++) { plsDet=(mc_PermissionDetails *)(details->GetRow(j)); if(plsDet->m_BlockFrom < plsDet->m_BlockTo) { uint160 addr; memcpy(&addr,plsDet->m_LastAdmin,sizeof(uint160)); CKeyID lpKeyID=CKeyID(addr); admins.push_back(C_ebzz_ebzzAddress(lpKeyID).ToString()); } } consensus=plsRow->m_RequiredAdmins; } if(admins.size() == 0) { if(plsRow->m_BlockFrom < plsRow->m_BlockTo) { uint160 addr; memcpy(&addr,plsRow->m_LastAdmin,sizeof(uint160)); CKeyID lpKeyID=CKeyID(addr); admins.push_back(C_ebzz_ebzzAddress(lpKeyID).ToString()); } } entry.push_back(Pair("admins", admins)); entry.push_back(Pair("required", (int64_t)(consensus-admins.size()))); } upgrades->Clear(); results.push_back(entry); } } mc_gState->m_Permissions->FreePermissionList(upgrades); return results; }
[ "86972302+bzzio@users.noreply.github.com" ]
86972302+bzzio@users.noreply.github.com
f8fa7af182602e8470a6c8847c9cb517547bbb65
d58f5e22717dbac802faca8a1748f9f9a10dbb11
/vulkan/include/vulkan/Fence.h
5c56b4206410f0c2817be73e8c7e652cd977a76a
[ "BSD-3-Clause" ]
permissive
mtezych/cpp
f5705bfd1fc31f8727b17773a732b86269f4830d
ea000b4d86faa112a2bfa3cc2e62638c8e14fd15
refs/heads/master
2023-05-25T16:04:00.964687
2023-05-09T03:44:18
2023-05-09T03:44:18
79,068,122
2
2
null
null
null
null
UTF-8
C++
false
false
901
h
#ifndef VULKAN_FENCE #define VULKAN_FENCE #include <vulkan/vulkan.h> #include <limits> #include <vector> namespace vk { struct Device; struct Fence { const Device* device; VkFence vkFence; explicit Fence (const Device& device); Fence (const Device& device, const VkFenceCreateFlags flags); ~Fence(); Fence (Fence&& fence); Fence (const Fence& fence) = delete; Fence& operator = (Fence&& fence); Fence& operator = (const Fence& fence) = delete; // // @note: returns true if fence is signaled; false otherwise // bool GetStatus () const; void Reset (); // // @note: returns false if time out occurred; false otherwise // bool Wait (const uint64_t timeOut = std::numeric_limits<uint64_t>::max()); static bool WaitAny ( const std::vector<Fence>& fences, const uint64_t timeOut = std::numeric_limits<uint64_t>::max() ); }; } #endif
[ "mte.zych@gmail.com" ]
mte.zych@gmail.com
2e7aaaad89fa28491d21a541516d071f8b3e9180
f5892fc6800b43517a5f6d317140e37ec305ad53
/src/core/bind/mimas_Menu.cpp
ce21470bf55945e3095f9d0d8245882af760499d
[]
no_license
lubyk/mimas
32272ed4518f3a689c8ed27d1f186993b11444ca
202b73a2325cb1424ca76dd1b8bfa438fc10c0c8
refs/heads/master
2020-03-29T13:17:02.412415
2013-04-11T10:51:44
2013-04-11T10:51:44
3,227,183
1
0
null
null
null
null
UTF-8
C++
false
false
26,486
cpp
/** * * MACHINE GENERATED FILE. DO NOT EDIT. * * Bindings for class Menu * * This file has been generated by dub 2.1.~. */ #include "dub/dub.h" #include "mimas/Menu.h" /** Cast (class_name) * */ static int Menu__cast_(lua_State *L) { Menu *self = *((Menu **)dub_checksdata_n(L, 1, "mimas.Menu")); const char *key = luaL_checkstring(L, 2); void **retval__ = (void**)lua_newuserdata(L, sizeof(void*)); int key_h = dub_hash(key, 6); switch(key_h) { case 1: { if (DUB_ASSERT_KEY(key, "mimas.QMenu")) break; *retval__ = static_cast<QMenu *>(self); return 1; } case 4: { if (DUB_ASSERT_KEY(key, "mimas.QWidget")) break; *retval__ = static_cast<QWidget *>(self); return 1; } case 5: { if (DUB_ASSERT_KEY(key, "mimas.QObject")) break; *retval__ = static_cast<QObject *>(self); return 1; } } return 0; } /** Menu::Menu(const char *name="") * include/mimas/Menu.h:52 */ static int Menu_Menu(lua_State *L) { try { int top__ = lua_gettop(L); if (top__ >= 1) { const char *name = dub_checkstring(L, 1); Menu *retval__ = new Menu(name); retval__->pushobject(L, retval__, "mimas.Menu", true); return 1; } else { Menu *retval__ = new Menu(); retval__->pushobject(L, retval__, "mimas.Menu", true); return 1; } } catch (std::exception &e) { lua_pushfstring(L, "new: %s", e.what()); } catch (...) { lua_pushfstring(L, "new: Unknown exception"); } return dub_error(L); } /** Menu::~Menu() * include/mimas/Menu.h:55 */ static int Menu__Menu(lua_State *L) { try { DubUserdata *userdata = ((DubUserdata*)dub_checksdata_d(L, 1, "mimas.Menu")); if (userdata->gc) { Menu *self = (Menu *)userdata->ptr; delete self; } userdata->gc = false; return 0; } catch (std::exception &e) { lua_pushfstring(L, "__gc: %s", e.what()); } catch (...) { lua_pushfstring(L, "__gc: Unknown exception"); } return dub_error(L); } /** void Menu::popup(int gx, int gy) * include/mimas/Menu.h:58 */ static int Menu_popup(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); int gx = dub_checkint(L, 2); int gy = dub_checkint(L, 3); self->popup(gx, gy); return 0; } catch (std::exception &e) { lua_pushfstring(L, "popup: %s", e.what()); } catch (...) { lua_pushfstring(L, "popup: Unknown exception"); } return dub_error(L); } /** void QMenu::addAction(Action *action) * bind/QMenu.h:10 */ static int Menu_addAction(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); Action *action = *((Action **)dub_checksdata(L, 2, "mimas.Action")); self->addAction(action); return 0; } catch (std::exception &e) { lua_pushfstring(L, "addAction: %s", e.what()); } catch (...) { lua_pushfstring(L, "addAction: Unknown exception"); } return dub_error(L); } /** void QMenu::addSeparator() * bind/QMenu.h:11 */ static int Menu_addSeparator(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); self->addSeparator(); return 0; } catch (std::exception &e) { lua_pushfstring(L, "addSeparator: %s", e.what()); } catch (...) { lua_pushfstring(L, "addSeparator: Unknown exception"); } return dub_error(L); } /** void QMenu::clear() * bind/QMenu.h:14 */ static int Menu_clear(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); self->clear(); return 0; } catch (std::exception &e) { lua_pushfstring(L, "clear: %s", e.what()); } catch (...) { lua_pushfstring(L, "clear: Unknown exception"); } return dub_error(L); } /** void QWidget::move(int x, int y) * bind/QWidget.h:10 */ static int Menu_move(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); int x = dub_checkint(L, 2); int y = dub_checkint(L, 3); self->move(x, y); return 0; } catch (std::exception &e) { lua_pushfstring(L, "move: %s", e.what()); } catch (...) { lua_pushfstring(L, "move: Unknown exception"); } return dub_error(L); } /** void QWidget::resize(int w, int h) * bind/QWidget.h:11 */ static int Menu_resize(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); int w = dub_checkint(L, 2); int h = dub_checkint(L, 3); self->resize(w, h); return 0; } catch (std::exception &e) { lua_pushfstring(L, "resize: %s", e.what()); } catch (...) { lua_pushfstring(L, "resize: Unknown exception"); } return dub_error(L); } /** int QWidget::x() * bind/QWidget.h:12 */ static int Menu_x(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); lua_pushnumber(L, self->x()); return 1; } catch (std::exception &e) { lua_pushfstring(L, "x: %s", e.what()); } catch (...) { lua_pushfstring(L, "x: Unknown exception"); } return dub_error(L); } /** int QWidget::y() * bind/QWidget.h:13 */ static int Menu_y(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); lua_pushnumber(L, self->y()); return 1; } catch (std::exception &e) { lua_pushfstring(L, "y: %s", e.what()); } catch (...) { lua_pushfstring(L, "y: Unknown exception"); } return dub_error(L); } /** int QWidget::width() * bind/QWidget.h:14 */ static int Menu_width(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); lua_pushnumber(L, self->width()); return 1; } catch (std::exception &e) { lua_pushfstring(L, "width: %s", e.what()); } catch (...) { lua_pushfstring(L, "width: Unknown exception"); } return dub_error(L); } /** int QWidget::height() * bind/QWidget.h:15 */ static int Menu_height(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); lua_pushnumber(L, self->height()); return 1; } catch (std::exception &e) { lua_pushfstring(L, "height: %s", e.what()); } catch (...) { lua_pushfstring(L, "height: Unknown exception"); } return dub_error(L); } /** void QWidget::setParent(QWidget *parent) * bind/QWidget.h:16 */ static int Menu_setParent(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); QWidget *parent = *((QWidget **)dub_checksdata(L, 2, "mimas.QWidget")); self->setParent(parent); return 0; } catch (std::exception &e) { lua_pushfstring(L, "setParent: %s", e.what()); } catch (...) { lua_pushfstring(L, "setParent: Unknown exception"); } return dub_error(L); } /** QWidget* QWidget::parentWidget() * bind/QWidget.h:17 */ static int Menu_parentWidget(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); QWidget *retval__ = self->parentWidget(); if (!retval__) return 0; dub_pushudata(L, retval__, "mimas.QWidget", false); return 1; } catch (std::exception &e) { lua_pushfstring(L, "parentWidget: %s", e.what()); } catch (...) { lua_pushfstring(L, "parentWidget: Unknown exception"); } return dub_error(L); } /** void QWidget::update() * bind/QWidget.h:18 */ static int Menu_update(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); self->update(); return 0; } catch (std::exception &e) { lua_pushfstring(L, "update: %s", e.what()); } catch (...) { lua_pushfstring(L, "update: Unknown exception"); } return dub_error(L); } /** void QWidget::adjustSize() * bind/QWidget.h:19 */ static int Menu_adjustSize(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); self->adjustSize(); return 0; } catch (std::exception &e) { lua_pushfstring(L, "adjustSize: %s", e.what()); } catch (...) { lua_pushfstring(L, "adjustSize: Unknown exception"); } return dub_error(L); } /** void QWidget::setFocus() * bind/QWidget.h:20 */ static int Menu_setFocus(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); self->setFocus(Qt::OtherFocusReason); return 0; } catch (std::exception &e) { lua_pushfstring(L, "setFocus: %s", e.what()); } catch (...) { lua_pushfstring(L, "setFocus: Unknown exception"); } return dub_error(L); } /** void QWidget::setFocusPolicy(int policy) * bind/QWidget.h:21 */ static int Menu_setFocusPolicy(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); int policy = dub_checkint(L, 2); self->setFocusPolicy((Qt::FocusPolicy)policy); return 0; } catch (std::exception &e) { lua_pushfstring(L, "setFocusPolicy: %s", e.what()); } catch (...) { lua_pushfstring(L, "setFocusPolicy: Unknown exception"); } return dub_error(L); } /** void QWidget::setAttribute(int attr, bool enabled) * bind/QWidget.h:22 */ static int Menu_setAttribute(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); int attr = dub_checkint(L, 2); bool enabled = dub_checkboolean(L, 3); self->setAttribute((Qt::WidgetAttribute)attr, enabled); return 0; } catch (std::exception &e) { lua_pushfstring(L, "setAttribute: %s", e.what()); } catch (...) { lua_pushfstring(L, "setAttribute: Unknown exception"); } return dub_error(L); } /** void QWidget::setMinimumSize(float w, float h) * bind/QWidget.h:25 */ static int Menu_setMinimumSize(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); float w = dub_checknumber(L, 2); float h = dub_checknumber(L, 3); self->setMinimumSize(w, h); return 0; } catch (std::exception &e) { lua_pushfstring(L, "setMinimumSize: %s", e.what()); } catch (...) { lua_pushfstring(L, "setMinimumSize: Unknown exception"); } return dub_error(L); } /** void QWidget::setMouseTracking(bool enable) * bind/QWidget.h:28 */ static int Menu_setMouseTracking(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); bool enable = dub_checkboolean(L, 2); self->setMouseTracking(enable); return 0; } catch (std::exception &e) { lua_pushfstring(L, "setMouseTracking: %s", e.what()); } catch (...) { lua_pushfstring(L, "setMouseTracking: Unknown exception"); } return dub_error(L); } /** bool QWidget::close() * bind/QWidget.h:29 */ static int Menu_close(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); lua_pushboolean(L, self->close()); return 1; } catch (std::exception &e) { lua_pushfstring(L, "close: %s", e.what()); } catch (...) { lua_pushfstring(L, "close: Unknown exception"); } return dub_error(L); } /** bool QWidget::isVisible() * bind/QWidget.h:30 */ static int Menu_isVisible(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); lua_pushboolean(L, self->isVisible()); return 1; } catch (std::exception &e) { lua_pushfstring(L, "isVisible: %s", e.what()); } catch (...) { lua_pushfstring(L, "isVisible: Unknown exception"); } return dub_error(L); } /** void QWidget::show() * bind/QWidget.h:31 */ static int Menu_show(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); self->show(); return 0; } catch (std::exception &e) { lua_pushfstring(L, "show: %s", e.what()); } catch (...) { lua_pushfstring(L, "show: Unknown exception"); } return dub_error(L); } /** void QWidget::hide() * bind/QWidget.h:32 */ static int Menu_hide(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); self->hide(); return 0; } catch (std::exception &e) { lua_pushfstring(L, "hide: %s", e.what()); } catch (...) { lua_pushfstring(L, "hide: Unknown exception"); } return dub_error(L); } /** void QWidget::lower() * bind/QWidget.h:33 */ static int Menu_lower(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); self->lower(); return 0; } catch (std::exception &e) { lua_pushfstring(L, "lower: %s", e.what()); } catch (...) { lua_pushfstring(L, "lower: Unknown exception"); } return dub_error(L); } /** void QWidget::raise() * bind/QWidget.h:34 */ static int Menu_raise(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); self->raise(); return 0; } catch (std::exception &e) { lua_pushfstring(L, "raise: %s", e.what()); } catch (...) { lua_pushfstring(L, "raise: Unknown exception"); } return dub_error(L); } /** void QWidget::activateWindow() * bind/QWidget.h:35 */ static int Menu_activateWindow(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); self->activateWindow(); return 0; } catch (std::exception &e) { lua_pushfstring(L, "activateWindow: %s", e.what()); } catch (...) { lua_pushfstring(L, "activateWindow: Unknown exception"); } return dub_error(L); } /** bool QWidget::isFullScreen() * bind/QWidget.h:36 */ static int Menu_isFullScreen(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); lua_pushboolean(L, self->isFullScreen()); return 1; } catch (std::exception &e) { lua_pushfstring(L, "isFullScreen: %s", e.what()); } catch (...) { lua_pushfstring(L, "isFullScreen: Unknown exception"); } return dub_error(L); } /** void QWidget::setWindowTitle(const QString &text) * bind/QWidget.h:38 */ static int Menu_setWindowTitle(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); size_t text_sz_; const char *text = dub_checklstring(L, 2, &text_sz_); self->setWindowTitle(QString::fromUtf8(text, text_sz_)); return 0; } catch (std::exception &e) { lua_pushfstring(L, "setWindowTitle: %s", e.what()); } catch (...) { lua_pushfstring(L, "setWindowTitle: Unknown exception"); } return dub_error(L); } /** void QWidget::setToolTip(const QString &text) * bind/QWidget.h:39 */ static int Menu_setToolTip(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); size_t text_sz_; const char *text = dub_checklstring(L, 2, &text_sz_); self->setToolTip(QString::fromUtf8(text, text_sz_)); return 0; } catch (std::exception &e) { lua_pushfstring(L, "setToolTip: %s", e.what()); } catch (...) { lua_pushfstring(L, "setToolTip: Unknown exception"); } return dub_error(L); } /** QString QWidget::windowTitle() * bind/QWidget.h:40 */ static int Menu_windowTitle(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); lua_pushstring(L, self->windowTitle().toUtf8()); return 1; } catch (std::exception &e) { lua_pushfstring(L, "windowTitle: %s", e.what()); } catch (...) { lua_pushfstring(L, "windowTitle: Unknown exception"); } return dub_error(L); } /** void QWidget::addWidget(QWidget *widget) * bind/QWidget.h:46 */ static int Menu_addWidget(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); QWidget *widget = *((QWidget **)dub_checksdata(L, 2, "mimas.QWidget")); widget->setParent(self); return 0; } catch (std::exception &e) { lua_pushfstring(L, "addWidget: %s", e.what()); } catch (...) { lua_pushfstring(L, "addWidget: Unknown exception"); } return dub_error(L); } /** LuaStackSize QWidget::size() * bind/QWidget.h:50 */ static int Menu_size(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); QRect rect = self->geometry(); lua_pushnumber(L, rect.width()); lua_pushnumber(L, rect.height()); return 2; } catch (std::exception &e) { lua_pushfstring(L, "size: %s", e.what()); } catch (...) { lua_pushfstring(L, "size: Unknown exception"); } return dub_error(L); } /** void QWidget::setStyle(const char *text) * bind/QWidget.h:51 */ static int Menu_setStyle(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); const char *text = dub_checkstring(L, 2); self->setStyleSheet(QString("%1 { %2 }").arg(self->metaObject()->className()).arg(text)); return 0; } catch (std::exception &e) { lua_pushfstring(L, "setStyle: %s", e.what()); } catch (...) { lua_pushfstring(L, "setStyle: Unknown exception"); } return dub_error(L); } /** void QWidget::setStyleSheet(const char *text) * bind/QWidget.h:52 */ static int Menu_setStyleSheet(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); const char *text = dub_checkstring(L, 2); self->setStyleSheet(text); return 0; } catch (std::exception &e) { lua_pushfstring(L, "setStyleSheet: %s", e.what()); } catch (...) { lua_pushfstring(L, "setStyleSheet: Unknown exception"); } return dub_error(L); } /** void QWidget::textSize(const char *text) * bind/QWidget.h:55 */ static int Menu_textSize(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); const char *text = dub_checkstring(L, 2); lua_pushnumber(L, self->fontMetrics().width(text)); lua_pushnumber(L, self->fontMetrics().height()); return 2; } catch (std::exception &e) { lua_pushfstring(L, "textSize: %s", e.what()); } catch (...) { lua_pushfstring(L, "textSize: Unknown exception"); } return dub_error(L); } /** void QWidget::setSizePolicy(int horizontal, int vertical) * bind/QWidget.h:59 */ static int Menu_setSizePolicy(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); int horizontal = dub_checkint(L, 2); int vertical = dub_checkint(L, 3); self->setSizePolicy((QSizePolicy::Policy)horizontal, (QSizePolicy::Policy)vertical); self->updateGeometry(); return 0; } catch (std::exception &e) { lua_pushfstring(L, "setSizePolicy: %s", e.what()); } catch (...) { lua_pushfstring(L, "setSizePolicy: Unknown exception"); } return dub_error(L); } /** void QWidget::showFullScreen(bool enable=true) * bind/QWidget.h:61 */ static int Menu_showFullScreen(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); int top__ = lua_gettop(L); if (top__ >= 2) { bool enable = dub_checkboolean(L, 2); if (enable) { self->showFullScreen(); } else { self->showNormal(); } return 0; } else { self->showFullScreen(); return 0; } } catch (std::exception &e) { lua_pushfstring(L, "showFullScreen: %s", e.what()); } catch (...) { lua_pushfstring(L, "showFullScreen: Unknown exception"); } return dub_error(L); } /** void QWidget::swapFullScreen() * bind/QWidget.h:65 */ static int Menu_swapFullScreen(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); if (!self->isFullScreen()) { self->showFullScreen(); } else { self->showNormal(); } return 0; } catch (std::exception &e) { lua_pushfstring(L, "swapFullScreen: %s", e.what()); } catch (...) { lua_pushfstring(L, "swapFullScreen: Unknown exception"); } return dub_error(L); } /** LuaStackSize QWidget::globalPosition() * bind/QWidget.h:70 */ static int Menu_globalPosition(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); QPoint pt = self->mapToGlobal(QPoint(0, 0)); lua_pushnumber(L, pt.x()); lua_pushnumber(L, pt.y()); return 2; } catch (std::exception &e) { lua_pushfstring(L, "globalPosition: %s", e.what()); } catch (...) { lua_pushfstring(L, "globalPosition: Unknown exception"); } return dub_error(L); } /** LuaStackSize QWidget::position() * bind/QWidget.h:75 */ static int Menu_position(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); lua_pushnumber(L, self->x()); lua_pushnumber(L, self->y()); return 2; } catch (std::exception &e) { lua_pushfstring(L, "position: %s", e.what()); } catch (...) { lua_pushfstring(L, "position: Unknown exception"); } return dub_error(L); } /** void QWidget::globalMove(float x, float y) * bind/QWidget.h:79 */ static int Menu_globalMove(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); float x = dub_checknumber(L, 2); float y = dub_checknumber(L, 3); self->move( self->mapToParent( self->mapFromGlobal(QPoint(x, y)) ) ); return 0; } catch (std::exception &e) { lua_pushfstring(L, "globalMove: %s", e.what()); } catch (...) { lua_pushfstring(L, "globalMove: Unknown exception"); } return dub_error(L); } /** QString QObject::objectName() const * bind/QObject.h:7 */ static int Menu_objectName(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); QByteArray str_(self->objectName().toUtf8()); lua_pushlstring(L, str_.constData(), str_.size()); return 1; } catch (std::exception &e) { lua_pushfstring(L, "objectName: %s", e.what()); } catch (...) { lua_pushfstring(L, "objectName: Unknown exception"); } return dub_error(L); } /** void QObject::setObjectName(const QString &name) * bind/QObject.h:8 */ static int Menu_setObjectName(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); size_t name_sz_; const char *name = dub_checklstring(L, 2, &name_sz_); self->setObjectName(QString::fromUtf8(name, name_sz_)); return 0; } catch (std::exception &e) { lua_pushfstring(L, "setObjectName: %s", e.what()); } catch (...) { lua_pushfstring(L, "setObjectName: Unknown exception"); } return dub_error(L); } /** QVariant QObject::property(const char *name) * bind/QObject.h:9 */ static int Menu_property(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); const char *name = dub_checkstring(L, 2); return pushVariantInLua(L, self->property(name)); } catch (std::exception &e) { lua_pushfstring(L, "property: %s", e.what()); } catch (...) { lua_pushfstring(L, "property: Unknown exception"); } return dub_error(L); } /** bool QObject::setProperty(const char *name, const QVariant &value) * bind/QObject.h:10 */ static int Menu_setProperty(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); const char *name = dub_checkstring(L, 2); QVariant value(variantFromLua(L, 3)); lua_pushboolean(L, self->setProperty(name, value)); return 1; } catch (std::exception &e) { lua_pushfstring(L, "setProperty: %s", e.what()); } catch (...) { lua_pushfstring(L, "setProperty: Unknown exception"); } return dub_error(L); } /** QObject* QObject::parent() * bind/QObject.h:12 */ static int Menu_parent(lua_State *L) { try { Menu *self = *((Menu **)dub_checksdata(L, 1, "mimas.Menu")); QObject *retval__ = self->parent(); if (!retval__) return 0; dub_pushudata(L, retval__, "mimas.QObject", false); return 1; } catch (std::exception &e) { lua_pushfstring(L, "parent: %s", e.what()); } catch (...) { lua_pushfstring(L, "parent: Unknown exception"); } return dub_error(L); } // --=============================================== __tostring static int Menu___tostring(lua_State *L) { Menu *self = *((Menu **)dub_checksdata_n(L, 1, "mimas.Menu")); lua_pushfstring(L, "mimas.Menu: %p", self); return 1; } // --=============================================== METHODS static const struct luaL_Reg Menu_member_methods[] = { { "_cast_" , Menu__cast_ }, { "new" , Menu_Menu }, { "__gc" , Menu__Menu }, { "popup" , Menu_popup }, { "addAction" , Menu_addAction }, { "addSeparator" , Menu_addSeparator }, { "clear" , Menu_clear }, { "move" , Menu_move }, { "resize" , Menu_resize }, { "x" , Menu_x }, { "y" , Menu_y }, { "width" , Menu_width }, { "height" , Menu_height }, { "setParent" , Menu_setParent }, { "parentWidget" , Menu_parentWidget }, { "update" , Menu_update }, { "adjustSize" , Menu_adjustSize }, { "setFocus" , Menu_setFocus }, { "setFocusPolicy", Menu_setFocusPolicy }, { "setAttribute" , Menu_setAttribute }, { "setMinimumSize", Menu_setMinimumSize }, { "setMouseTracking", Menu_setMouseTracking }, { "close" , Menu_close }, { "isVisible" , Menu_isVisible }, { "show" , Menu_show }, { "hide" , Menu_hide }, { "lower" , Menu_lower }, { "raise" , Menu_raise }, { "activateWindow", Menu_activateWindow }, { "isFullScreen" , Menu_isFullScreen }, { "setWindowTitle", Menu_setWindowTitle }, { "setToolTip" , Menu_setToolTip }, { "windowTitle" , Menu_windowTitle }, { "addWidget" , Menu_addWidget }, { "size" , Menu_size }, { "setStyle" , Menu_setStyle }, { "setStyleSheet", Menu_setStyleSheet }, { "textSize" , Menu_textSize }, { "setSizePolicy", Menu_setSizePolicy }, { "showFullScreen", Menu_showFullScreen }, { "swapFullScreen", Menu_swapFullScreen }, { "globalPosition", Menu_globalPosition }, { "position" , Menu_position }, { "globalMove" , Menu_globalMove }, { "objectName" , Menu_objectName }, { "setObjectName", Menu_setObjectName }, { "property" , Menu_property }, { "setProperty" , Menu_setProperty }, { "parent" , Menu_parent }, { "__tostring" , Menu___tostring }, { "deleted" , dub_isDeleted }, { NULL, NULL}, }; extern "C" int luaopen_mimas_Menu(lua_State *L) { // Create the metatable which will contain all the member methods luaL_newmetatable(L, "mimas.Menu"); // <mt> // register member methods luaL_register(L, NULL, Menu_member_methods); // save meta-table in mimas dub_register(L, "mimas", "Menu_core", "Menu"); // <mt> lua_pop(L, 1); return 0; }
[ "gaspard@teti.ch" ]
gaspard@teti.ch
8625a0ecb2fd2aee4504f3446b679061118624c8
2419bc479df7824af6558715c21e02aa87f32086
/priority_queue/priority_queue.h
be544a01416f5a74b2e1eb79be9dc0c283fd8556
[]
no_license
OlgaGorbacheva/4th-semester
98e1dfb899e9f64892cd95ea1dafe0ac023b0ca3
51b96c0ea95e54bf3557c911ed7e329ec0ba930d
refs/heads/master
2021-01-25T03:27:45.595423
2015-04-11T14:21:59
2015-04-11T14:21:59
33,777,433
0
0
null
null
null
null
UTF-8
C++
false
false
1,262
h
#ifndef P_QUEUE_H #define P_QUEUE_H #include <boost/thread.hpp> #include <boost/smart_ptr/detail/spinlock.hpp> #include <vector> #include <memory> #include <iostream> namespace my { template <class KeyT, class ValueT> class priority_queue; template <class KeyT, class ValueT> class node; template <class T> void swap(T &a, T &b); } template <class KeyT, class ValueT> class my::priority_queue { private: public: std::vector<my::node<KeyT, ValueT>> heap; boost::condition_variable cv; boost::shared_mutex sh_mutex; boost::shared_mutex heapify_mutex; boost::mutex u_mutex; bool on; size_t parent(size_t i); size_t left(size_t i); size_t right(size_t i); void down_heapify(size_t i); // многопоточный public: priority_queue(); ~priority_queue(); void put(ValueT const &value, KeyT const &key = 0); // однопоточный bool get(ValueT &result); // многопоточный void finish(); bool is_finished(); bool empty(); }; template <class KeyT, class ValueT> class my::node { public: node(KeyT k, ValueT v); node(); ~node(); KeyT key; ValueT value; boost::detail::spinlock n_mutex; }; #include "priority_queue.hpp" #endif //P_QUEUE_H
[ "olga.gorbacheva@phystech.edu" ]
olga.gorbacheva@phystech.edu
325b43fe15bd60e26d620b61fb67db897ef027f6
7d9e50d1e5b0748180440d70fe16fc3b447f2e8d
/Practice/Exams/20121/I/questao5/instrument.h
15890755a4e47006f74b3e9823f7f89a26353363
[]
no_license
cjlcarvalho/patterns
b880c5e04e57d82b081e863b09e3deb54698b086
4f9cf15df161bb82ecd52d3524ae7d44ada8b991
refs/heads/master
2021-09-13T02:23:48.068664
2018-04-23T23:17:34
2018-04-23T23:17:34
111,008,981
1
1
null
null
null
null
UTF-8
C++
false
false
183
h
#ifndef INSTRUMENT_H #define INSTRUMENT_H class Instrument { public: virtual ~Instrument(); virtual void build() = 0; virtual void play() = 0; }; #endif // INSTRUMENT_H
[ "caiojcarvalho@gmail.com" ]
caiojcarvalho@gmail.com
7062531a76d914730df8ec0ba41ae47c425adaae
2c148e207664a55a5809a3436cbbd23b447bf7fb
/src/components/drive/chromeos/change_list_loader.cc
1c0f78700aad0b3ce2a047921d7950c57d4be108
[ "BSD-3-Clause" ]
permissive
nuzumglobal/Elastos.Trinity.Alpha.Android
2bae061d281ba764d544990f2e1b2419b8e1e6b2
4c6dad6b1f24d43cadb162fb1dbec4798a8c05f3
refs/heads/master
2020-05-21T17:30:46.563321
2018-09-03T05:16:16
2018-09-03T05:16:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
21,019
cc
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/drive/chromeos/change_list_loader.h" #include <stddef.h> #include <set> #include <utility> #include "base/callback.h" #include "base/callback_helpers.h" #include "base/macros.h" #include "base/metrics/histogram_macros.h" #include "base/strings/string_number_conversions.h" #include "base/synchronization/cancellation_flag.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "components/drive/chromeos/about_resource_loader.h" #include "components/drive/chromeos/change_list_loader_observer.h" #include "components/drive/chromeos/change_list_processor.h" #include "components/drive/chromeos/resource_metadata.h" #include "components/drive/drive_api_util.h" #include "components/drive/event_logger.h" #include "components/drive/file_system_core_util.h" #include "components/drive/job_scheduler.h" #include "google_apis/drive/drive_api_parser.h" #include "url/gurl.h" namespace drive { namespace internal { typedef base::Callback<void(FileError, std::vector<std::unique_ptr<ChangeList>>)> FeedFetcherCallback; class ChangeListLoader::FeedFetcher { public: virtual ~FeedFetcher() {} virtual void Run(const FeedFetcherCallback& callback) = 0; }; namespace { // Fetches the list of team drives from the server. class TeamDriveListFetcher : public ChangeListLoader::FeedFetcher { public: TeamDriveListFetcher(JobScheduler* scheduler) : scheduler_(scheduler), weak_ptr_factory_(this) {} ~TeamDriveListFetcher() override {} void Run(const FeedFetcherCallback& callback) override { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!callback.is_null()); scheduler_->GetAllTeamDriveList( base::Bind(&TeamDriveListFetcher::OnTeamDriveListFetched, weak_ptr_factory_.GetWeakPtr(), callback)); } private: void OnTeamDriveListFetched( const FeedFetcherCallback& callback, google_apis::DriveApiErrorCode status, std::unique_ptr<google_apis::TeamDriveList> team_drives) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!callback.is_null()); FileError error = GDataToFileError(status); if (error != FILE_ERROR_OK) { callback.Run(error, std::vector<std::unique_ptr<ChangeList>>()); return; } change_lists_.push_back(std::make_unique<ChangeList>(*team_drives)); // Fetch more drives, if there are more. if (!team_drives->next_page_token().empty()) { scheduler_->GetRemainingTeamDriveList( team_drives->next_page_token(), base::Bind(&TeamDriveListFetcher::OnTeamDriveListFetched, weak_ptr_factory_.GetWeakPtr(), callback)); return; } // Note: The fetcher is managed by ChangeListLoader, and the instance // will be deleted in the callback. Do not touch the fields after this // invocation. callback.Run(FILE_ERROR_OK, std::move(change_lists_)); } JobScheduler* scheduler_; std::vector<std::unique_ptr<ChangeList>> change_lists_; base::ThreadChecker thread_checker_; base::WeakPtrFactory<TeamDriveListFetcher> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(TeamDriveListFetcher); }; // Fetches all the (currently available) resource entries from the server. class FullFeedFetcher : public ChangeListLoader::FeedFetcher { public: FullFeedFetcher(JobScheduler* scheduler) : scheduler_(scheduler), weak_ptr_factory_(this) {} ~FullFeedFetcher() override {} void Run(const FeedFetcherCallback& callback) override { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!callback.is_null()); // Remember the time stamp for usage stats. start_time_ = base::TimeTicks::Now(); // This is full resource list fetch. // // NOTE: Because we already know the largest change ID, here we can use // files.list instead of changes.list for speed. crbug.com/287602 scheduler_->GetAllFileList( base::Bind(&FullFeedFetcher::OnFileListFetched, weak_ptr_factory_.GetWeakPtr(), callback)); } private: void OnFileListFetched(const FeedFetcherCallback& callback, google_apis::DriveApiErrorCode status, std::unique_ptr<google_apis::FileList> file_list) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!callback.is_null()); FileError error = GDataToFileError(status); if (error != FILE_ERROR_OK) { callback.Run(error, std::vector<std::unique_ptr<ChangeList>>()); return; } DCHECK(file_list); change_lists_.push_back(std::make_unique<ChangeList>(*file_list)); if (!file_list->next_link().is_empty()) { // There is the remaining result so fetch it. scheduler_->GetRemainingFileList( file_list->next_link(), base::Bind(&FullFeedFetcher::OnFileListFetched, weak_ptr_factory_.GetWeakPtr(), callback)); return; } UMA_HISTOGRAM_LONG_TIMES("Drive.FullFeedLoadTime", base::TimeTicks::Now() - start_time_); // Note: The fetcher is managed by ChangeListLoader, and the instance // will be deleted in the callback. Do not touch the fields after this // invocation. callback.Run(FILE_ERROR_OK, std::move(change_lists_)); } JobScheduler* scheduler_; std::vector<std::unique_ptr<ChangeList>> change_lists_; base::TimeTicks start_time_; base::ThreadChecker thread_checker_; base::WeakPtrFactory<FullFeedFetcher> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(FullFeedFetcher); }; // Fetches the delta changes since |start_change_id|. class DeltaFeedFetcher : public ChangeListLoader::FeedFetcher { public: DeltaFeedFetcher(JobScheduler* scheduler, int64_t start_change_id) : scheduler_(scheduler), start_change_id_(start_change_id), weak_ptr_factory_(this) {} ~DeltaFeedFetcher() override {} void Run(const FeedFetcherCallback& callback) override { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!callback.is_null()); scheduler_->GetChangeList( start_change_id_, base::Bind(&DeltaFeedFetcher::OnChangeListFetched, weak_ptr_factory_.GetWeakPtr(), callback)); } private: void OnChangeListFetched( const FeedFetcherCallback& callback, google_apis::DriveApiErrorCode status, std::unique_ptr<google_apis::ChangeList> change_list) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!callback.is_null()); FileError error = GDataToFileError(status); if (error != FILE_ERROR_OK) { callback.Run(error, std::vector<std::unique_ptr<ChangeList>>()); return; } DCHECK(change_list); change_lists_.push_back(std::make_unique<ChangeList>(*change_list)); if (!change_list->next_link().is_empty()) { // There is the remaining result so fetch it. scheduler_->GetRemainingChangeList( change_list->next_link(), base::Bind(&DeltaFeedFetcher::OnChangeListFetched, weak_ptr_factory_.GetWeakPtr(), callback)); return; } // Note: The fetcher is managed by ChangeListLoader, and the instance // will be deleted in the callback. Do not touch the fields after this // invocation. callback.Run(FILE_ERROR_OK, std::move(change_lists_)); } JobScheduler* scheduler_; int64_t start_change_id_; std::vector<std::unique_ptr<ChangeList>> change_lists_; base::ThreadChecker thread_checker_; base::WeakPtrFactory<DeltaFeedFetcher> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(DeltaFeedFetcher); }; } // namespace LoaderController::LoaderController() : lock_count_(0), weak_ptr_factory_(this) { } LoaderController::~LoaderController() { DCHECK(thread_checker_.CalledOnValidThread()); } std::unique_ptr<base::ScopedClosureRunner> LoaderController::GetLock() { DCHECK(thread_checker_.CalledOnValidThread()); ++lock_count_; return std::make_unique<base::ScopedClosureRunner>( base::Bind(&LoaderController::Unlock, weak_ptr_factory_.GetWeakPtr())); } void LoaderController::ScheduleRun(const base::Closure& task) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!task.is_null()); if (lock_count_ > 0) { pending_tasks_.push_back(task); } else { task.Run(); } } void LoaderController::Unlock() { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_LT(0, lock_count_); if (--lock_count_ > 0) return; std::vector<base::Closure> tasks; tasks.swap(pending_tasks_); for (size_t i = 0; i < tasks.size(); ++i) tasks[i].Run(); } ChangeListLoader::ChangeListLoader( EventLogger* logger, base::SequencedTaskRunner* blocking_task_runner, ResourceMetadata* resource_metadata, JobScheduler* scheduler, AboutResourceLoader* about_resource_loader, LoaderController* loader_controller) : logger_(logger), blocking_task_runner_(blocking_task_runner), in_shutdown_(new base::CancellationFlag), resource_metadata_(resource_metadata), scheduler_(scheduler), about_resource_loader_(about_resource_loader), loader_controller_(loader_controller), loaded_(false), weak_ptr_factory_(this) { } ChangeListLoader::~ChangeListLoader() { in_shutdown_->Set(); // Delete |in_shutdown_| with the blocking task runner so that it gets deleted // after all active ChangeListProcessors. blocking_task_runner_->DeleteSoon(FROM_HERE, in_shutdown_.release()); } bool ChangeListLoader::IsRefreshing() const { // Callback for change list loading is stored in pending_load_callback_. // It is non-empty if and only if there is an in-flight loading operation. return !pending_load_callback_.empty(); } void ChangeListLoader::AddObserver(ChangeListLoaderObserver* observer) { DCHECK(thread_checker_.CalledOnValidThread()); observers_.AddObserver(observer); } void ChangeListLoader::RemoveObserver(ChangeListLoaderObserver* observer) { DCHECK(thread_checker_.CalledOnValidThread()); observers_.RemoveObserver(observer); } void ChangeListLoader::CheckForUpdates(const FileOperationCallback& callback) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!callback.is_null()); // We only start to check for updates iff the load is done. // I.e., we ignore checking updates if not loaded to avoid starting the // load without user's explicit interaction (such as opening Drive). if (!loaded_ && !IsRefreshing()) return; // For each CheckForUpdates() request, always refresh the changestamp info. about_resource_loader_->UpdateAboutResource( base::Bind(&ChangeListLoader::OnAboutResourceUpdated, weak_ptr_factory_.GetWeakPtr())); if (IsRefreshing()) { // There is in-flight loading. So keep the callback here, and check for // updates when the in-flight loading is completed. pending_update_check_callback_ = callback; return; } DCHECK(loaded_); logger_->Log(logging::LOG_INFO, "Checking for updates"); Load(callback); } void ChangeListLoader::LoadIfNeeded(const FileOperationCallback& callback) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!callback.is_null()); // If the metadata is not yet loaded, start loading. if (!loaded_ && !IsRefreshing()) Load(callback); } void ChangeListLoader::Load(const FileOperationCallback& callback) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!callback.is_null()); // Check if this is the first time this ChangeListLoader do loading. // Note: IsRefreshing() depends on pending_load_callback_ so check in advance. const bool is_initial_load = (!loaded_ && !IsRefreshing()); // Register the callback function to be called when it is loaded. pending_load_callback_.push_back(callback); // If loading task is already running, do nothing. if (pending_load_callback_.size() > 1) return; // Check the current status of local metadata, and start loading if needed. int64_t* local_changestamp = new int64_t(0); base::PostTaskAndReplyWithResult( blocking_task_runner_.get(), FROM_HERE, base::Bind(&ResourceMetadata::GetLargestChangestamp, base::Unretained(resource_metadata_), local_changestamp), base::Bind(&ChangeListLoader::LoadAfterGetLargestChangestamp, weak_ptr_factory_.GetWeakPtr(), is_initial_load, base::Owned(local_changestamp))); } void ChangeListLoader::LoadAfterGetLargestChangestamp( bool is_initial_load, const int64_t* local_changestamp, FileError error) { DCHECK(thread_checker_.CalledOnValidThread()); if (error != FILE_ERROR_OK) { OnChangeListLoadComplete(error); return; } if (is_initial_load && *local_changestamp > 0) { // The local data is usable. Flush callbacks to tell loading was successful. OnChangeListLoadComplete(FILE_ERROR_OK); // Continues to load from server in background. // Put dummy callbacks to indicate that fetching is still continuing. pending_load_callback_.push_back(base::DoNothing()); } about_resource_loader_->GetAboutResource( base::Bind(&ChangeListLoader::LoadAfterGetAboutResource, weak_ptr_factory_.GetWeakPtr(), *local_changestamp)); } void ChangeListLoader::LoadAfterGetAboutResource( int64_t local_changestamp, google_apis::DriveApiErrorCode status, std::unique_ptr<google_apis::AboutResource> about_resource) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!change_feed_fetcher_); FileError error = GDataToFileError(status); if (error != FILE_ERROR_OK) { OnChangeListLoadComplete(error); return; } DCHECK(about_resource); // Fetch Team Drive before File list, so that files can be stored under root // directories of each Team Drive like /team_drive/My Team Drive/. if (google_apis::GetTeamDrivesIntegrationSwitch() == google_apis::TEAM_DRIVES_INTEGRATION_ENABLED) { change_feed_fetcher_.reset(new TeamDriveListFetcher(scheduler_)); change_feed_fetcher_->Run( base::Bind(&ChangeListLoader::LoadChangeListFromServer, weak_ptr_factory_.GetWeakPtr(), base::Passed(&about_resource), local_changestamp)); } else { // If there are no team drives listings, the changelist starts as empty. LoadChangeListFromServer(std::move(about_resource), local_changestamp, FILE_ERROR_OK, std::vector<std::unique_ptr<ChangeList>>()); } } void ChangeListLoader::OnChangeListLoadComplete(FileError error) { DCHECK(thread_checker_.CalledOnValidThread()); if (!loaded_ && error == FILE_ERROR_OK) { loaded_ = true; for (auto& observer : observers_) observer.OnInitialLoadComplete(); } for (size_t i = 0; i < pending_load_callback_.size(); ++i) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(pending_load_callback_[i], error)); } pending_load_callback_.clear(); // If there is pending update check, try to load the change from the server // again, because there may exist an update during the completed loading. if (!pending_update_check_callback_.is_null()) { Load(base::ResetAndReturn(&pending_update_check_callback_)); } } void ChangeListLoader::OnAboutResourceUpdated( google_apis::DriveApiErrorCode error, std::unique_ptr<google_apis::AboutResource> resource) { DCHECK(thread_checker_.CalledOnValidThread()); if (drive::GDataToFileError(error) != drive::FILE_ERROR_OK) { logger_->Log(logging::LOG_ERROR, "Failed to update the about resource: %s", google_apis::DriveApiErrorCodeToString(error).c_str()); return; } logger_->Log(logging::LOG_INFO, "About resource updated to: %s", base::Int64ToString(resource->largest_change_id()).c_str()); } void ChangeListLoader::LoadChangeListFromServer( std::unique_ptr<google_apis::AboutResource> about_resource, int64_t local_changestamp, FileError error, std::vector<std::unique_ptr<ChangeList>> team_drives_change_lists) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(about_resource); if (error != FILE_ERROR_OK) { OnChangeListLoadComplete(error); return; } int64_t remote_changestamp = about_resource->largest_change_id(); int64_t start_changestamp = local_changestamp > 0 ? local_changestamp + 1 : 0; if (local_changestamp >= remote_changestamp) { if (local_changestamp > remote_changestamp) { LOG(WARNING) << "Local resource metadata is fresher than server, " << "local = " << local_changestamp << ", server = " << remote_changestamp; } // If there are team drives change lists, update those without running a // feed fetcher. if (!team_drives_change_lists.empty()) { LoadChangeListFromServerAfterLoadChangeList( std::move(about_resource), true, std::move(team_drives_change_lists), FILE_ERROR_OK, std::vector<std::unique_ptr<ChangeList>>()); return; } // No changes detected, tell the client that the loading was successful. OnChangeListLoadComplete(FILE_ERROR_OK); return; } // Set up feed fetcher. bool is_delta_update = start_changestamp != 0; if (is_delta_update) { change_feed_fetcher_.reset( new DeltaFeedFetcher(scheduler_, start_changestamp)); } else { change_feed_fetcher_.reset(new FullFeedFetcher(scheduler_)); } // Make a copy of cached_about_resource_ to remember at which changestamp we // are fetching change list. change_feed_fetcher_->Run( base::Bind(&ChangeListLoader::LoadChangeListFromServerAfterLoadChangeList, weak_ptr_factory_.GetWeakPtr(), base::Passed(&about_resource), is_delta_update, base::Passed(&team_drives_change_lists))); } void ChangeListLoader::LoadChangeListFromServerAfterLoadChangeList( std::unique_ptr<google_apis::AboutResource> about_resource, bool is_delta_update, std::vector<std::unique_ptr<ChangeList>> team_drives_change_lists, FileError error, std::vector<std::unique_ptr<ChangeList>> change_lists) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(about_resource); // Delete the fetcher first. change_feed_fetcher_.reset(); if (error != FILE_ERROR_OK) { OnChangeListLoadComplete(error); return; } // Merge the change lists - first team drives, then changes. std::vector<std::unique_ptr<ChangeList>> merged_change_lists; merged_change_lists.insert( merged_change_lists.end(), std::make_move_iterator(team_drives_change_lists.begin()), std::make_move_iterator(team_drives_change_lists.end())); merged_change_lists.insert(merged_change_lists.end(), std::make_move_iterator(change_lists.begin()), std::make_move_iterator(change_lists.end())); ChangeListProcessor* change_list_processor = new ChangeListProcessor(resource_metadata_, in_shutdown_.get()); // Don't send directory content change notification while performing // the initial content retrieval. const bool should_notify_changed_directories = is_delta_update; logger_->Log(logging::LOG_INFO, "Apply change lists (is delta: %d)", is_delta_update); loader_controller_->ScheduleRun(base::Bind( &drive::util::RunAsyncTask, base::RetainedRef(blocking_task_runner_), FROM_HERE, base::Bind(&ChangeListProcessor::ApplyUserChangeList, base::Unretained(change_list_processor), base::Passed(&about_resource), base::Passed(&merged_change_lists), is_delta_update), base::Bind(&ChangeListLoader::LoadChangeListFromServerAfterUpdate, weak_ptr_factory_.GetWeakPtr(), base::Owned(change_list_processor), should_notify_changed_directories, base::Time::Now()))); } void ChangeListLoader::LoadChangeListFromServerAfterUpdate( ChangeListProcessor* change_list_processor, bool should_notify_changed_directories, const base::Time& start_time, FileError error) { DCHECK(thread_checker_.CalledOnValidThread()); const base::TimeDelta elapsed = base::Time::Now() - start_time; logger_->Log(logging::LOG_INFO, "Change lists applied (elapsed time: %sms)", base::Int64ToString(elapsed.InMilliseconds()).c_str()); if (should_notify_changed_directories) { for (auto& observer : observers_) observer.OnFileChanged(change_list_processor->changed_files()); } OnChangeListLoadComplete(error); for (auto& observer : observers_) observer.OnLoadFromServerComplete(); } } // namespace internal } // namespace drive
[ "jiawang.yu@spreadtrum.com" ]
jiawang.yu@spreadtrum.com
9c863728b439934b628c0945d50443e7d31fef19
d85b1f3ce9a3c24ba158ca4a51ea902d152ef7b9
/testcases/CWE78_OS_Command_Injection/s02/CWE78_OS_Command_Injection__char_console_w32_spawnvp_82.h
502927743df9341ef91237cb3b65a1b2794a38c7
[]
no_license
arichardson/juliet-test-suite-c
cb71a729716c6aa8f4b987752272b66b1916fdaa
e2e8cf80cd7d52f824e9a938bbb3aa658d23d6c9
refs/heads/master
2022-12-10T12:05:51.179384
2022-11-17T15:41:30
2022-12-01T15:25:16
179,281,349
34
34
null
2022-12-01T15:25:18
2019-04-03T12:03:21
null
UTF-8
C++
false
false
1,648
h
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_console_w32_spawnvp_82.h Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-82.tmpl.h */ /* * @description * CWE: 78 OS Command Injection * BadSource: console Read input from the console * GoodSource: Fixed string * BadSink : execute command with spawnvp * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT "cmd.exe" #define COMMAND_ARG1 "/c" #define COMMAND_ARG2 "dir " #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH "/bin/sh" #define COMMAND_INT "sh" #define COMMAND_ARG1 "-c" #define COMMAND_ARG2 "ls " #define COMMAND_ARG3 data #endif namespace CWE78_OS_Command_Injection__char_console_w32_spawnvp_82 { class CWE78_OS_Command_Injection__char_console_w32_spawnvp_82_base { public: /* pure virtual function */ virtual void action(char * data) = 0; }; #ifndef OMITBAD class CWE78_OS_Command_Injection__char_console_w32_spawnvp_82_bad : public CWE78_OS_Command_Injection__char_console_w32_spawnvp_82_base { public: void action(char * data); }; #endif /* OMITBAD */ #ifndef OMITGOOD class CWE78_OS_Command_Injection__char_console_w32_spawnvp_82_goodG2B : public CWE78_OS_Command_Injection__char_console_w32_spawnvp_82_base { public: void action(char * data); }; #endif /* OMITGOOD */ }
[ "Alexander.Richardson@cl.cam.ac.uk" ]
Alexander.Richardson@cl.cam.ac.uk
7d540a794a5836d33ab3855384ea473ed6f39cff
d11dfb3a629b1efca2e7f9ad15a6d134c7d051bc
/zlibrary/ui/src/gtk/filesystem/ZLGtkFSManager.h
bbe6a86232d53f44e668bdff8939281dc0b132f4
[]
no_license
stsg/fbreaderosx
2bbf5d5d09fd17d998187b528f0fcc4629d66fb8
a0971d6a7283a764068814ca8da16316359f57eb
refs/heads/master
2021-01-18T13:49:16.076718
2015-03-28T09:55:06
2015-03-28T09:55:06
33,026,187
1
0
null
null
null
null
UTF-8
C++
false
false
1,203
h
/* * Copyright (C) 2004-2009 Geometer Plus <contact@geometerplus.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ #ifndef __ZLGTKFSMANAGER_H__ #define __ZLGTKFSMANAGER_H__ #include "../../../../core/src/unix/filesystem/ZLUnixFSManager.h" class ZLGtkFSManager : public ZLUnixFSManager { public: static void createInstance() { ourInstance = new ZLGtkFSManager(); } private: ZLGtkFSManager() {} protected: std::string convertFilenameToUtf8(const std::string &name) const; }; #endif /* __ZLGTKFSMANAGER_H__ */
[ "sgobunov@c7c12182-09bc-11de-a1f0-819f45317607" ]
sgobunov@c7c12182-09bc-11de-a1f0-819f45317607
1d04cb0e901931d412c6577582676a50fa1b11c8
bb45f751474c0a160766b0c1012e388c4b9e78fd
/graphlearn/core/graph/storage/compressed_memory_edge_storage.cc
b2a134e46bcd2ba67ad4d0c33c21166baa0b3ebc
[ "Apache-2.0" ]
permissive
zkneverturnover/graph-learn
0d1c876aa5bfdcb87f66eb3fc1c415f001c6c86c
54cafee9db3054dc310a28b856be7f97c7d5aee9
refs/heads/master
2023-09-04T06:38:03.966011
2021-09-28T08:53:06
2021-09-28T08:53:06
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,669
cc
/* Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #include <vector> #include "graphlearn/common/base/log.h" #include "graphlearn/core/graph/storage/edge_storage.h" #include "graphlearn/include/config.h" namespace graphlearn { namespace io { class CompressedMemoryEdgeStorage : public EdgeStorage { public: CompressedMemoryEdgeStorage() : attributes_(nullptr) { int64_t estimate_size = GLOBAL_FLAG(AverageEdgeCount); src_ids_.reserve(estimate_size); dst_ids_.reserve(estimate_size); } virtual ~CompressedMemoryEdgeStorage() { delete attributes_; } void SetSideInfo(const SideInfo* info) override { if (!side_info_.IsInitialized()) { side_info_.CopyFrom(*info); if (side_info_.IsAttributed()) { attributes_ = NewDataHeldAttributeValue(); } } } const SideInfo* GetSideInfo() const override { return &side_info_; } void Build() override { src_ids_.shrink_to_fit(); dst_ids_.shrink_to_fit(); labels_.shrink_to_fit(); weights_.shrink_to_fit(); if (attributes_) { attributes_->Shrink(); } } IdType Size() const override { return src_ids_.size(); } IdType Add(EdgeValue* value) override { if (!Validate(value)) { LOG(WARNING) << "Ignore an invalid edge value"; return -1; } IdType edge_id = src_ids_.size(); src_ids_.push_back(value->src_id); dst_ids_.push_back(value->dst_id); if (side_info_.IsWeighted()) { weights_.push_back(value->weight); } if (side_info_.IsLabeled()) { labels_.push_back(value->label); } if (side_info_.IsAttributed()) { auto ints = value->attrs->GetInts(nullptr); for (int32_t i = 0; i < side_info_.i_num; ++i) { attributes_->Add(ints[i]); } auto floats = value->attrs->GetFloats(nullptr); for (int32_t i = 0; i < side_info_.f_num; ++i) { attributes_->Add(floats[i]); } auto ss = value->attrs->GetStrings(nullptr); for (int32_t i = 0; i < side_info_.s_num; ++i) { attributes_->Add(ss[i]); } } return edge_id; } IdType GetSrcId(IdType edge_id) const override { if (edge_id < Size()) { return src_ids_[edge_id]; } else { return -1; } } IdType GetDstId(IdType edge_id) const override { if (edge_id < Size()) { return dst_ids_[edge_id]; } else { return -1; } } float GetWeight(IdType edge_id) const override { if (edge_id < weights_.size()) { return weights_[edge_id]; } else { return 0.0; } } int32_t GetLabel(IdType edge_id) const override { if (edge_id < labels_.size()) { return labels_[edge_id]; } else { return -1; } } Attribute GetAttribute(IdType edge_id) const override { if (!side_info_.IsAttributed()) { return Attribute(); } if (edge_id < Size()) { auto value = NewDataRefAttributeValue(); if (side_info_.i_num > 0) { int64_t offset = edge_id * side_info_.i_num; value->Add(attributes_->GetInts(nullptr) + offset, side_info_.i_num); } if (side_info_.f_num > 0) { int64_t offset = edge_id * side_info_.f_num; value->Add(attributes_->GetFloats(nullptr) + offset, side_info_.f_num); } if (side_info_.s_num > 0) { int64_t offset = edge_id * side_info_.s_num; auto ss = attributes_->GetStrings(nullptr) + offset; for (int32_t i = 0; i < side_info_.s_num; ++i) { value->Add(ss[i].c_str(), ss[i].length()); } } return Attribute(value, true); } else { return Attribute(AttributeValue::Default(&side_info_), false); } } const IdList* GetSrcIds() const override { return &src_ids_; } const IdList* GetDstIds() const override { return &dst_ids_; } const std::vector<float>* GetWeights() const override { return &weights_; } const std::vector<int32_t>* GetLabels() const override { return &labels_; } const std::vector<Attribute>* GetAttributes() const override { return nullptr; } private: bool Validate(EdgeValue* value) { if (!side_info_.IsAttributed()) { return true; } int32_t len = 0; value->attrs->GetInts(&len); if (len != side_info_.i_num) { LOG(WARNING) << "Unmatched int attributes count"; return false; } value->attrs->GetFloats(&len); if (len != side_info_.f_num) { LOG(WARNING) << "Unmatched float attributes count"; return false; } value->attrs->GetStrings(&len); if (len != side_info_.s_num) { LOG(WARNING) << "Unmatched string attributes count"; return false; } return true; } private: IdList src_ids_; IdList dst_ids_; std::vector<float> weights_; std::vector<int32_t> labels_; AttributeValue* attributes_; SideInfo side_info_; }; EdgeStorage* NewCompressedMemoryEdgeStorage() { return new CompressedMemoryEdgeStorage(); } } // namespace io } // namespace graphlearn
[ "jackon.zhao@gmail.com" ]
jackon.zhao@gmail.com
08f47da1404114d5966ba6f972ffa9d39f35e9c5
51cbf8c9b58484ae9337d1fd27a99c4d8c73a225
/problems/B_TMT_Document.cpp
ee3d2dd3cfdb2b3992ce5d851cc8a0925b9882a3
[]
no_license
omarTantawy/Competitive-Programing
8d96227326afb1b07a6c085c1de0a2b4b5e900cf
6587523e240a1ea978defa650fc4fcba2ab7ae19
refs/heads/main
2023-07-06T06:58:22.569510
2021-07-31T21:06:15
2021-07-31T21:06:15
350,309,264
0
0
null
null
null
null
UTF-8
C++
false
false
2,631
cpp
#include <bits/stdc++.h> using namespace std; #define INF 2e18 #define fast_cin() \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) int t, n, temp; string s; int main() { fast_cin(); cin >> t; while (t--) { cin >> n >> s; int t = 0, m = 0; for (int i = 0; i < n; i++) { if (s[i] == 'M') m++; else t++; } if (t != m * 2) { cout << "NO\n"; continue; } t = 0; m = 0; string ans = "YES\n"; for (int i = 0; i < n; i++) { if (s[i] == 'M') { ++m; if (m > t) { ans = "NO\n"; break; } --t; --m; } else { ++t; } } t = 0; m = 0; for (int i = n - 1; i >= 0; i--) { if (s[i] == 'M') { ++m; if (m > t) { ans = "NO\n"; break; } --t; --m; } else { ++t; } } cout << ans; } return 0; } // if (minn - 1 > -1 && maxx + 1 < n) { // if (vec[maxx + 1] - vec[minn] < vec[maxx] - vec[minn - 1]) { // ans += vec[maxx + 1] - vec[minn]; // ++maxx; // } else { // ans += vec[maxx] - vec[minn - 1]; // --minn; // } // } else if (minn - 1 > -1) { // ans += vec[maxx] - vec[minn - 1]; // --minn; // } else { // ans += vec[maxx + 1] - vec[minn]; // ++maxx; // } // } // while (cnt != n) { // cnt++; // if (minn - 1 > -1 && maxx + 1 < n) { // if (vec[maxx + 1] - vec[minn] < vec[maxx] - vec[minn - 1]) { // ans += vec[maxx + 1] - vec[minn]; // ++maxx; // } else { // ans += vec[maxx] - vec[minn - 1]; // --minn; // } // } else if (minn - 1 > -1) { // ans += vec[maxx] - vec[minn - 1]; // --minn; // } else { // ans += vec[maxx + 1] - vec[minn]; // ++maxx; // } // } // cur = (n / 2) + 1, maxx = cur, minn = cur, cnt = 1; // while (cnt != n) { // cnt++; // if (minn - 1 > -1 && maxx + 1 < n) { // if (vec[maxx + 1] - vec[minn] < vec[maxx] - vec[minn - 1]) { // ans2 += vec[maxx + 1] - vec[minn]; // ++maxx; // } else { // ans2 += vec[maxx] - vec[minn - 1]; // --minn; // } // } else if (minn - 1 > -1) { // ans2 += vec[maxx] - vec[minn - 1]; // --minn; // } else { // ans2 += vec[maxx + 1] - vec[minn]; // ++maxx; // } // }
[ "omartantawy94@gmail.com" ]
omartantawy94@gmail.com
b8c2504f1e1f15206188631318e4e76f543af72a
2d7726ac7cb85d196ccb1ca8cd474dd2c5ed2ae5
/src/alignment/local_realignment.h
c8f82609f536335247bcd6f44181ccd0d606f663
[ "MIT" ]
permissive
Epibiome/graphmap
d94a7ea4071ffdf54ff9814a0a4fac4980b7c389
db1362c39748ba56374ac770a26adc0ae3ec054a
refs/heads/master
2020-12-25T22:36:50.952725
2015-11-16T00:52:31
2015-11-16T00:52:31
47,365,787
1
0
null
2015-12-03T22:47:12
2015-12-03T22:47:12
null
UTF-8
C++
false
false
8,105
h
/* * local_realignment.h * * Created on: Sep 3, 2014 * Author: Ivan Sovic */ #ifndef MYERS_WRAPPER_H_ #define MYERS_WRAPPER_H_ #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <dirent.h> #include <string> #include <sstream> #include <vector> #include "index/index_sa.h" #include "sequences/single_sequence.h" #include "utility/utility_general.h" #include "utility/program_parameters.h" #include "utility/utility_conversion-inl.h" #include "containers/path_graph_entry.h" #include "alignment/myers.h" #include "alignment/cigargen.h" #include "log_system/log_system.h" #include "containers/region.h" #include "seqan/basic.h" #include "seqan/align.h" #include "seqan/sequence.h" #include "seqan/stream.h" #include "alignment/local_realignment_wrappers.h" typedef int (*AlignmentFunctionType)(const int8_t*, int64_t, const int8_t*, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t*, int64_t*, int64_t*, std::vector<unsigned char> &); typedef int (*EditDistanceFunctionType)(const int8_t*, int64_t, const int8_t*, int64_t, int64_t*, int64_t*, int); typedef int (*AlignmentFunctionTypeMex)(const int8_t*, int64_t, const int8_t*, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t*, int64_t*, int64_t*, std::vector<unsigned char> &); int ClipCircularAlignment(int64_t alignment_start, int64_t alignment_end, unsigned char *alignment, int64_t alignment_length, int64_t read_length, int64_t reference_start, int64_t reference_length, int64_t split_region_start_offset, int64_t position_of_ref_end, unsigned char **ret_left_alignment, int64_t *ret_left_alignment_length, int64_t *ret_left_alignment_pos_start, int64_t *ret_left_alignment_pos_end, unsigned char **ret_right_alignment, int64_t *ret_right_alignment_length, int64_t *ret_right_alignment_pos_start, int64_t *ret_right_alignment_pos_end); int LocalRealignmentLinear(AlignmentFunctionType AlignmentFunction, const SingleSequence *read, const Index *index, const ProgramParameters &parameters, const PathGraphEntry *best_path, int64_t *ret_alignment_position_left_part, std::string *ret_cigar_left_part, int64_t *ret_AS_left_part, int64_t *ret_nonclipped_left_part, int64_t *ret_alignment_position_right_part, std::string *ret_cigar_right_part, int64_t *ret_AS_right_part, int64_t *ret_nonclipped_right_part, SeqOrientation *ret_orientation, int64_t *ret_reference_id, int64_t *ret_position_ambiguity, int64_t *ret_eq_op, int64_t *ret_x_op, int64_t *ret_i_op, int64_t *ret_d_op, bool perform_reverse_complement=true); int LocalRealignmentCircular(AlignmentFunctionType AlignmentFunction, const SingleSequence *read, const Index *index, const ProgramParameters &parameters, const PathGraphEntry *best_path, int64_t *ret_alignment_position_left_part, std::string *ret_cigar_left_part, int64_t *ret_AS_left_part, int64_t *ret_nonclipped_left_part, int64_t *ret_alignment_position_right_part, std::string *ret_cigar_right_part, int64_t *ret_AS_right_part, int64_t *ret_nonclipped_right_part, SeqOrientation *ret_orientation, int64_t *ret_reference_id, int64_t *ret_position_ambiguity, int64_t *ret_eq_op, int64_t *ret_x_op, int64_t *ret_i_op, int64_t *ret_d_op, bool perform_reverse_complement=true); int HybridRealignment(const SingleSequence *read, const Index *index, const ProgramParameters &parameters, const PathGraphEntry *best_path, int64_t *ret_alignment_position_left_part, std::string *ret_cigar_left_part, int64_t *ret_AS_left_part, int64_t *ret_nonclipped_left_part, int64_t *ret_alignment_position_right_part, std::string *ret_cigar_right_part, int64_t *ret_AS_right_part, int64_t *ret_nonclipped_right_part, SeqOrientation *ret_orientation, int64_t *ret_reference_id, int64_t *ret_position_ambiguity, int64_t *ret_eq_op, int64_t *ret_x_op, int64_t *ret_i_op, int64_t *ret_d_op, bool perform_reverse_complement=true); int AnchoredAlignmentLinear(AlignmentFunctionType AlignmentFunctionNW, AlignmentFunctionType AlignmentFunctionSemiglobal, const SingleSequence *read, const Index *index, const ProgramParameters &parameters, const PathGraphEntry *best_path, int64_t *ret_alignment_position_left_part, std::string *ret_cigar_left_part, int64_t *ret_AS_left_part, int64_t *ret_nonclipped_left_part, int64_t *ret_alignment_position_right_part, std::string *ret_cigar_right_part, int64_t *ret_AS_right_part, int64_t *ret_nonclipped_right_part, SeqOrientation *ret_orientation, int64_t *ret_reference_id, int64_t *ret_position_ambiguity, int64_t *ret_eq_op, int64_t *ret_x_op, int64_t *ret_i_op, int64_t *ret_d_op, bool perform_reverse_complement=true); int AnchoredAlignment(bool is_linear, bool end_to_end, AlignmentFunctionType AlignmentFunctionNW, AlignmentFunctionType AlignmentFunctionSHW, const SingleSequence *read, const Index *index, const ProgramParameters &parameters, const PathGraphEntry *best_path, int64_t *ret_alignment_position_left_part, std::string *ret_cigar_left_part, int64_t *ret_AS_left_part, int64_t *ret_nonclipped_left_part, int64_t *ret_alignment_position_right_part, std::string *ret_cigar_right_part, int64_t *ret_AS_right_part, int64_t *ret_nonclipped_right_part, SeqOrientation *ret_orientation, int64_t *ret_reference_id, int64_t *ret_position_ambiguity, int64_t *ret_eq_op, int64_t *ret_x_op, int64_t *ret_i_op, int64_t *ret_d_op, bool perform_reverse_complement=true); int AnchoredAlignmentMex(bool is_linear, bool end_to_end, AlignmentFunctionTypeMex AlignmentFunctionNW, AlignmentFunctionTypeMex AlignmentFunctionSHW, const SingleSequence *read, const Index *index, const ProgramParameters &parameters, const PathGraphEntry *best_path, int64_t *ret_alignment_position_left_part, std::string *ret_cigar_left_part, int64_t *ret_AS_left_part, int64_t *ret_nonclipped_left_part, int64_t *ret_alignment_position_right_part, std::string *ret_cigar_right_part, int64_t *ret_AS_right_part, int64_t *ret_nonclipped_right_part, SeqOrientation *ret_orientation, int64_t *ret_reference_id, int64_t *ret_position_ambiguity, int64_t *ret_eq_op, int64_t *ret_x_op, int64_t *ret_i_op, int64_t *ret_d_op, bool perform_reverse_complement=true); int CalcEditDistanceLinear(EditDistanceFunctionType EditDistanceFunction, const SingleSequence *read, const Index *index, const ProgramParameters &parameters, const PathGraphEntry *best_path, int64_t *ret_alignment_position, int64_t *ret_edit_distance); int CalcEditDistanceCircular(EditDistanceFunctionType EditDistanceFunction, const SingleSequence *read, const Index *index, const ProgramParameters &parameters, const PathGraphEntry *best_path, int64_t *ret_alignment_position, int64_t *ret_edit_distance); int CheckAlignmentSane(std::vector<unsigned char> &alignment, const SingleSequence* read=NULL, const Index* index=NULL, int64_t reference_hit_id=-1, int64_t reference_hit_pos=-1); int CountAlignmentOperations(std::vector<unsigned char> &alignment, const int8_t *read_data, const int8_t *ref_data, int64_t reference_hit_id, int64_t alignment_position_start, SeqOrientation orientation, int64_t match, int64_t mismatch, int64_t gap_open, int64_t gap_extend, int64_t *ret_eq, int64_t *ret_x, int64_t *ret_i, int64_t *ret_d, int64_t *ret_alignment_score, int64_t *ret_nonclipped_length); #endif /* MYERS_WRAPPER_H_ */
[ "ivan.sovic@gmail.com" ]
ivan.sovic@gmail.com
168afab5c3e363f26e77d9edd9e8b4e44d3ca79b
15af4bb43888728e906041a8a037a76a54127420
/Classes/Native/Il2CppCompilerCalculateTypeValues_4Table.cpp
7832dc37a3d090b1f5a71da1fba22f3633bf2cd1
[]
no_license
Elodine/Dodgers_iOS
a7542f364ba70536bcb62165e8a656e7aa175f83
218ab8caee9e346c027e9f193929792a38e29a2b
refs/heads/master
2020-03-11T15:58:16.520565
2018-04-18T19:10:07
2018-04-18T19:10:07
130,101,790
0
0
null
null
null
null
UTF-8
C++
false
false
154,104
cpp
#include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <cstring> #include <string.h> #include <stdio.h> #include <cmath> #include <limits> #include <assert.h> #include <stdint.h> #include "class-internals.h" #include "codegen/il2cpp-codegen.h" #include "object-internals.h" // System.Runtime.Remoting.Messaging.IMessageSink struct IMessageSink_t2514424906; // System.Runtime.Remoting.Contexts.SynchronizationAttribute struct SynchronizationAttribute_t3946661254; // System.Collections.ArrayList struct ArrayList_t2718874744; // System.Threading.Timer struct Timer_t716671026; // System.IntPtr[] struct IntPtrU5BU5D_t4013366056; // System.String struct String_t; // System.Collections.IDictionary struct IDictionary_t1363984059; // System.Int32[] struct Int32U5BU5D_t385246372; // System.Reflection.MethodBase struct MethodBase_t609368412; // System.Runtime.Remoting.Contexts.Context struct Context_t3285446944; // System.Collections.Hashtable struct Hashtable_t1853889766; // System.Runtime.Remoting.Messaging.CallContextRemotingData struct CallContextRemotingData_t2260963392; // System.Object[] struct ObjectU5BU5D_t2843939325; // System.Type[] struct TypeU5BU5D_t3940880105; // System.Runtime.Remoting.Messaging.LogicalCallContext struct LogicalCallContext_t3342013719; // System.Collections.Generic.Dictionary`2<System.String,System.Int32> struct Dictionary_2_t2736202052; // System.Runtime.Remoting.Messaging.IMethodMessage struct IMethodMessage_t3120117683; // System.String[] struct StringU5BU5D_t1281789340; // System.Runtime.Remoting.Messaging.MethodDictionary struct MethodDictionary_t207894204; // System.Collections.IDictionaryEnumerator struct IDictionaryEnumerator_t1693217257; // System.Reflection.MonoMethod struct MonoMethod_t; // System.Byte[] struct ByteU5BU5D_t4116647657; // System.Exception struct Exception_t1436737249; // System.Type struct Type_t; // System.Runtime.Remoting.Messaging.ObjRefSurrogate struct ObjRefSurrogate_t3860276170; // System.Runtime.Remoting.Messaging.RemotingSurrogate struct RemotingSurrogate_t2834579653; // System.Runtime.Serialization.ISurrogateSelector struct ISurrogateSelector_t3040401154; // System.Runtime.Remoting.Contexts.IDynamicProperty struct IDynamicProperty_t3462122824; // System.Runtime.Remoting.Contexts.IDynamicMessageSink struct IDynamicMessageSink_t625731443; // System.Runtime.Remoting.Activation.IActivator struct IActivator_t485815189; // System.Reflection.MethodInfo struct MethodInfo_t; // System.Runtime.Remoting.Contexts.CrossContextChannel struct CrossContextChannel_t4063984580; // System.Collections.IList struct IList_t2094931216; // System.Runtime.Remoting.ServerIdentity struct ServerIdentity_t2342208608; // System.Void struct Void_t1185182177; // System.Char[] struct CharU5BU5D_t3528271667; // System.Runtime.Remoting.Lifetime.LeaseManager struct LeaseManager_t3648745595; // System.Threading.WaitHandle struct WaitHandle_t1743403487; // System.Threading.ExecutionContext struct ExecutionContext_t1748372627; // System.Runtime.Remoting.Messaging.MonoMethodMessage struct MonoMethodMessage_t2807636944; // System.Runtime.Remoting.Messaging.IMessageCtrl struct IMessageCtrl_t317049502; // System.Runtime.Remoting.Messaging.IMessage struct IMessage_t3593512748; // System.Threading.Mutex struct Mutex_t3066672582; // System.Threading.Thread struct Thread_t2300836069; // System.Runtime.Remoting.Contexts.DynamicPropertyCollection struct DynamicPropertyCollection_t652373272; // System.Runtime.Remoting.Contexts.ContextCallbackObject struct ContextCallbackObject_t2292721408; #ifndef RUNTIMEOBJECT_H #define RUNTIMEOBJECT_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Object #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // RUNTIMEOBJECT_H #ifndef VALUETYPE_T3640485471_H #define VALUETYPE_T3640485471_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.ValueType struct ValueType_t3640485471 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif // Native definition for P/Invoke marshalling of System.ValueType struct ValueType_t3640485471_marshaled_pinvoke { }; // Native definition for COM marshalling of System.ValueType struct ValueType_t3640485471_marshaled_com { }; #endif // VALUETYPE_T3640485471_H #ifndef CRITICALFINALIZEROBJECT_T701527852_H #define CRITICALFINALIZEROBJECT_T701527852_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.ConstrainedExecution.CriticalFinalizerObject struct CriticalFinalizerObject_t701527852 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CRITICALFINALIZEROBJECT_T701527852_H #ifndef SYNCHRONIZEDCLIENTCONTEXTSINK_T1886771601_H #define SYNCHRONIZEDCLIENTCONTEXTSINK_T1886771601_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.SynchronizedClientContextSink struct SynchronizedClientContextSink_t1886771601 : public RuntimeObject { public: // System.Runtime.Remoting.Messaging.IMessageSink System.Runtime.Remoting.Contexts.SynchronizedClientContextSink::_next RuntimeObject* ____next_0; // System.Runtime.Remoting.Contexts.SynchronizationAttribute System.Runtime.Remoting.Contexts.SynchronizedClientContextSink::_att SynchronizationAttribute_t3946661254 * ____att_1; public: inline static int32_t get_offset_of__next_0() { return static_cast<int32_t>(offsetof(SynchronizedClientContextSink_t1886771601, ____next_0)); } inline RuntimeObject* get__next_0() const { return ____next_0; } inline RuntimeObject** get_address_of__next_0() { return &____next_0; } inline void set__next_0(RuntimeObject* value) { ____next_0 = value; Il2CppCodeGenWriteBarrier((&____next_0), value); } inline static int32_t get_offset_of__att_1() { return static_cast<int32_t>(offsetof(SynchronizedClientContextSink_t1886771601, ____att_1)); } inline SynchronizationAttribute_t3946661254 * get__att_1() const { return ____att_1; } inline SynchronizationAttribute_t3946661254 ** get_address_of__att_1() { return &____att_1; } inline void set__att_1(SynchronizationAttribute_t3946661254 * value) { ____att_1 = value; Il2CppCodeGenWriteBarrier((&____att_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // SYNCHRONIZEDCLIENTCONTEXTSINK_T1886771601_H #ifndef SYNCHRONIZEDSERVERCONTEXTSINK_T2776015682_H #define SYNCHRONIZEDSERVERCONTEXTSINK_T2776015682_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.SynchronizedServerContextSink struct SynchronizedServerContextSink_t2776015682 : public RuntimeObject { public: // System.Runtime.Remoting.Messaging.IMessageSink System.Runtime.Remoting.Contexts.SynchronizedServerContextSink::_next RuntimeObject* ____next_0; // System.Runtime.Remoting.Contexts.SynchronizationAttribute System.Runtime.Remoting.Contexts.SynchronizedServerContextSink::_att SynchronizationAttribute_t3946661254 * ____att_1; public: inline static int32_t get_offset_of__next_0() { return static_cast<int32_t>(offsetof(SynchronizedServerContextSink_t2776015682, ____next_0)); } inline RuntimeObject* get__next_0() const { return ____next_0; } inline RuntimeObject** get_address_of__next_0() { return &____next_0; } inline void set__next_0(RuntimeObject* value) { ____next_0 = value; Il2CppCodeGenWriteBarrier((&____next_0), value); } inline static int32_t get_offset_of__att_1() { return static_cast<int32_t>(offsetof(SynchronizedServerContextSink_t2776015682, ____att_1)); } inline SynchronizationAttribute_t3946661254 * get__att_1() const { return ____att_1; } inline SynchronizationAttribute_t3946661254 ** get_address_of__att_1() { return &____att_1; } inline void set__att_1(SynchronizationAttribute_t3946661254 * value) { ____att_1 = value; Il2CppCodeGenWriteBarrier((&____att_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // SYNCHRONIZEDSERVERCONTEXTSINK_T2776015682_H #ifndef LEASEMANAGER_T3648745595_H #define LEASEMANAGER_T3648745595_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Lifetime.LeaseManager struct LeaseManager_t3648745595 : public RuntimeObject { public: // System.Collections.ArrayList System.Runtime.Remoting.Lifetime.LeaseManager::_objects ArrayList_t2718874744 * ____objects_0; // System.Threading.Timer System.Runtime.Remoting.Lifetime.LeaseManager::_timer Timer_t716671026 * ____timer_1; public: inline static int32_t get_offset_of__objects_0() { return static_cast<int32_t>(offsetof(LeaseManager_t3648745595, ____objects_0)); } inline ArrayList_t2718874744 * get__objects_0() const { return ____objects_0; } inline ArrayList_t2718874744 ** get_address_of__objects_0() { return &____objects_0; } inline void set__objects_0(ArrayList_t2718874744 * value) { ____objects_0 = value; Il2CppCodeGenWriteBarrier((&____objects_0), value); } inline static int32_t get_offset_of__timer_1() { return static_cast<int32_t>(offsetof(LeaseManager_t3648745595, ____timer_1)); } inline Timer_t716671026 * get__timer_1() const { return ____timer_1; } inline Timer_t716671026 ** get_address_of__timer_1() { return &____timer_1; } inline void set__timer_1(Timer_t716671026 * value) { ____timer_1 = value; Il2CppCodeGenWriteBarrier((&____timer_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // LEASEMANAGER_T3648745595_H #ifndef LEASESINK_T3666380219_H #define LEASESINK_T3666380219_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Lifetime.LeaseSink struct LeaseSink_t3666380219 : public RuntimeObject { public: // System.Runtime.Remoting.Messaging.IMessageSink System.Runtime.Remoting.Lifetime.LeaseSink::_nextSink RuntimeObject* ____nextSink_0; public: inline static int32_t get_offset_of__nextSink_0() { return static_cast<int32_t>(offsetof(LeaseSink_t3666380219, ____nextSink_0)); } inline RuntimeObject* get__nextSink_0() const { return ____nextSink_0; } inline RuntimeObject** get_address_of__nextSink_0() { return &____nextSink_0; } inline void set__nextSink_0(RuntimeObject* value) { ____nextSink_0 = value; Il2CppCodeGenWriteBarrier((&____nextSink_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // LEASESINK_T3666380219_H #ifndef EXCEPTION_T1436737249_H #define EXCEPTION_T1436737249_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Exception struct Exception_t1436737249 : public RuntimeObject { public: // System.IntPtr[] System.Exception::trace_ips IntPtrU5BU5D_t4013366056* ___trace_ips_0; // System.Exception System.Exception::inner_exception Exception_t1436737249 * ___inner_exception_1; // System.String System.Exception::message String_t* ___message_2; // System.String System.Exception::help_link String_t* ___help_link_3; // System.String System.Exception::class_name String_t* ___class_name_4; // System.String System.Exception::stack_trace String_t* ___stack_trace_5; // System.String System.Exception::_remoteStackTraceString String_t* ____remoteStackTraceString_6; // System.Int32 System.Exception::remote_stack_index int32_t ___remote_stack_index_7; // System.Int32 System.Exception::hresult int32_t ___hresult_8; // System.String System.Exception::source String_t* ___source_9; // System.Collections.IDictionary System.Exception::_data RuntimeObject* ____data_10; public: inline static int32_t get_offset_of_trace_ips_0() { return static_cast<int32_t>(offsetof(Exception_t1436737249, ___trace_ips_0)); } inline IntPtrU5BU5D_t4013366056* get_trace_ips_0() const { return ___trace_ips_0; } inline IntPtrU5BU5D_t4013366056** get_address_of_trace_ips_0() { return &___trace_ips_0; } inline void set_trace_ips_0(IntPtrU5BU5D_t4013366056* value) { ___trace_ips_0 = value; Il2CppCodeGenWriteBarrier((&___trace_ips_0), value); } inline static int32_t get_offset_of_inner_exception_1() { return static_cast<int32_t>(offsetof(Exception_t1436737249, ___inner_exception_1)); } inline Exception_t1436737249 * get_inner_exception_1() const { return ___inner_exception_1; } inline Exception_t1436737249 ** get_address_of_inner_exception_1() { return &___inner_exception_1; } inline void set_inner_exception_1(Exception_t1436737249 * value) { ___inner_exception_1 = value; Il2CppCodeGenWriteBarrier((&___inner_exception_1), value); } inline static int32_t get_offset_of_message_2() { return static_cast<int32_t>(offsetof(Exception_t1436737249, ___message_2)); } inline String_t* get_message_2() const { return ___message_2; } inline String_t** get_address_of_message_2() { return &___message_2; } inline void set_message_2(String_t* value) { ___message_2 = value; Il2CppCodeGenWriteBarrier((&___message_2), value); } inline static int32_t get_offset_of_help_link_3() { return static_cast<int32_t>(offsetof(Exception_t1436737249, ___help_link_3)); } inline String_t* get_help_link_3() const { return ___help_link_3; } inline String_t** get_address_of_help_link_3() { return &___help_link_3; } inline void set_help_link_3(String_t* value) { ___help_link_3 = value; Il2CppCodeGenWriteBarrier((&___help_link_3), value); } inline static int32_t get_offset_of_class_name_4() { return static_cast<int32_t>(offsetof(Exception_t1436737249, ___class_name_4)); } inline String_t* get_class_name_4() const { return ___class_name_4; } inline String_t** get_address_of_class_name_4() { return &___class_name_4; } inline void set_class_name_4(String_t* value) { ___class_name_4 = value; Il2CppCodeGenWriteBarrier((&___class_name_4), value); } inline static int32_t get_offset_of_stack_trace_5() { return static_cast<int32_t>(offsetof(Exception_t1436737249, ___stack_trace_5)); } inline String_t* get_stack_trace_5() const { return ___stack_trace_5; } inline String_t** get_address_of_stack_trace_5() { return &___stack_trace_5; } inline void set_stack_trace_5(String_t* value) { ___stack_trace_5 = value; Il2CppCodeGenWriteBarrier((&___stack_trace_5), value); } inline static int32_t get_offset_of__remoteStackTraceString_6() { return static_cast<int32_t>(offsetof(Exception_t1436737249, ____remoteStackTraceString_6)); } inline String_t* get__remoteStackTraceString_6() const { return ____remoteStackTraceString_6; } inline String_t** get_address_of__remoteStackTraceString_6() { return &____remoteStackTraceString_6; } inline void set__remoteStackTraceString_6(String_t* value) { ____remoteStackTraceString_6 = value; Il2CppCodeGenWriteBarrier((&____remoteStackTraceString_6), value); } inline static int32_t get_offset_of_remote_stack_index_7() { return static_cast<int32_t>(offsetof(Exception_t1436737249, ___remote_stack_index_7)); } inline int32_t get_remote_stack_index_7() const { return ___remote_stack_index_7; } inline int32_t* get_address_of_remote_stack_index_7() { return &___remote_stack_index_7; } inline void set_remote_stack_index_7(int32_t value) { ___remote_stack_index_7 = value; } inline static int32_t get_offset_of_hresult_8() { return static_cast<int32_t>(offsetof(Exception_t1436737249, ___hresult_8)); } inline int32_t get_hresult_8() const { return ___hresult_8; } inline int32_t* get_address_of_hresult_8() { return &___hresult_8; } inline void set_hresult_8(int32_t value) { ___hresult_8 = value; } inline static int32_t get_offset_of_source_9() { return static_cast<int32_t>(offsetof(Exception_t1436737249, ___source_9)); } inline String_t* get_source_9() const { return ___source_9; } inline String_t** get_address_of_source_9() { return &___source_9; } inline void set_source_9(String_t* value) { ___source_9 = value; Il2CppCodeGenWriteBarrier((&___source_9), value); } inline static int32_t get_offset_of__data_10() { return static_cast<int32_t>(offsetof(Exception_t1436737249, ____data_10)); } inline RuntimeObject* get__data_10() const { return ____data_10; } inline RuntimeObject** get_address_of__data_10() { return &____data_10; } inline void set__data_10(RuntimeObject* value) { ____data_10 = value; Il2CppCodeGenWriteBarrier((&____data_10), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // EXCEPTION_T1436737249_H #ifndef ARGINFO_T3261134217_H #define ARGINFO_T3261134217_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.ArgInfo struct ArgInfo_t3261134217 : public RuntimeObject { public: // System.Int32[] System.Runtime.Remoting.Messaging.ArgInfo::_paramMap Int32U5BU5D_t385246372* ____paramMap_0; // System.Int32 System.Runtime.Remoting.Messaging.ArgInfo::_inoutArgCount int32_t ____inoutArgCount_1; // System.Reflection.MethodBase System.Runtime.Remoting.Messaging.ArgInfo::_method MethodBase_t609368412 * ____method_2; public: inline static int32_t get_offset_of__paramMap_0() { return static_cast<int32_t>(offsetof(ArgInfo_t3261134217, ____paramMap_0)); } inline Int32U5BU5D_t385246372* get__paramMap_0() const { return ____paramMap_0; } inline Int32U5BU5D_t385246372** get_address_of__paramMap_0() { return &____paramMap_0; } inline void set__paramMap_0(Int32U5BU5D_t385246372* value) { ____paramMap_0 = value; Il2CppCodeGenWriteBarrier((&____paramMap_0), value); } inline static int32_t get_offset_of__inoutArgCount_1() { return static_cast<int32_t>(offsetof(ArgInfo_t3261134217, ____inoutArgCount_1)); } inline int32_t get__inoutArgCount_1() const { return ____inoutArgCount_1; } inline int32_t* get_address_of__inoutArgCount_1() { return &____inoutArgCount_1; } inline void set__inoutArgCount_1(int32_t value) { ____inoutArgCount_1 = value; } inline static int32_t get_offset_of__method_2() { return static_cast<int32_t>(offsetof(ArgInfo_t3261134217, ____method_2)); } inline MethodBase_t609368412 * get__method_2() const { return ____method_2; } inline MethodBase_t609368412 ** get_address_of__method_2() { return &____method_2; } inline void set__method_2(MethodBase_t609368412 * value) { ____method_2 = value; Il2CppCodeGenWriteBarrier((&____method_2), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // ARGINFO_T3261134217_H #ifndef CLIENTCONTEXTTERMINATORSINK_T4064115021_H #define CLIENTCONTEXTTERMINATORSINK_T4064115021_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.ClientContextTerminatorSink struct ClientContextTerminatorSink_t4064115021 : public RuntimeObject { public: // System.Runtime.Remoting.Contexts.Context System.Runtime.Remoting.Messaging.ClientContextTerminatorSink::_context Context_t3285446944 * ____context_0; public: inline static int32_t get_offset_of__context_0() { return static_cast<int32_t>(offsetof(ClientContextTerminatorSink_t4064115021, ____context_0)); } inline Context_t3285446944 * get__context_0() const { return ____context_0; } inline Context_t3285446944 ** get_address_of__context_0() { return &____context_0; } inline void set__context_0(Context_t3285446944 * value) { ____context_0 = value; Il2CppCodeGenWriteBarrier((&____context_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CLIENTCONTEXTTERMINATORSINK_T4064115021_H #ifndef ENVOYTERMINATORSINK_T3654193516_H #define ENVOYTERMINATORSINK_T3654193516_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.EnvoyTerminatorSink struct EnvoyTerminatorSink_t3654193516 : public RuntimeObject { public: public: }; struct EnvoyTerminatorSink_t3654193516_StaticFields { public: // System.Runtime.Remoting.Messaging.EnvoyTerminatorSink System.Runtime.Remoting.Messaging.EnvoyTerminatorSink::Instance EnvoyTerminatorSink_t3654193516 * ___Instance_0; public: inline static int32_t get_offset_of_Instance_0() { return static_cast<int32_t>(offsetof(EnvoyTerminatorSink_t3654193516_StaticFields, ___Instance_0)); } inline EnvoyTerminatorSink_t3654193516 * get_Instance_0() const { return ___Instance_0; } inline EnvoyTerminatorSink_t3654193516 ** get_address_of_Instance_0() { return &___Instance_0; } inline void set_Instance_0(EnvoyTerminatorSink_t3654193516 * value) { ___Instance_0 = value; Il2CppCodeGenWriteBarrier((&___Instance_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // ENVOYTERMINATORSINK_T3654193516_H #ifndef HEADER_T549724581_H #define HEADER_T549724581_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.Header struct Header_t549724581 : public RuntimeObject { public: // System.String System.Runtime.Remoting.Messaging.Header::HeaderNamespace String_t* ___HeaderNamespace_0; // System.Boolean System.Runtime.Remoting.Messaging.Header::MustUnderstand bool ___MustUnderstand_1; // System.String System.Runtime.Remoting.Messaging.Header::Name String_t* ___Name_2; // System.Object System.Runtime.Remoting.Messaging.Header::Value RuntimeObject * ___Value_3; public: inline static int32_t get_offset_of_HeaderNamespace_0() { return static_cast<int32_t>(offsetof(Header_t549724581, ___HeaderNamespace_0)); } inline String_t* get_HeaderNamespace_0() const { return ___HeaderNamespace_0; } inline String_t** get_address_of_HeaderNamespace_0() { return &___HeaderNamespace_0; } inline void set_HeaderNamespace_0(String_t* value) { ___HeaderNamespace_0 = value; Il2CppCodeGenWriteBarrier((&___HeaderNamespace_0), value); } inline static int32_t get_offset_of_MustUnderstand_1() { return static_cast<int32_t>(offsetof(Header_t549724581, ___MustUnderstand_1)); } inline bool get_MustUnderstand_1() const { return ___MustUnderstand_1; } inline bool* get_address_of_MustUnderstand_1() { return &___MustUnderstand_1; } inline void set_MustUnderstand_1(bool value) { ___MustUnderstand_1 = value; } inline static int32_t get_offset_of_Name_2() { return static_cast<int32_t>(offsetof(Header_t549724581, ___Name_2)); } inline String_t* get_Name_2() const { return ___Name_2; } inline String_t** get_address_of_Name_2() { return &___Name_2; } inline void set_Name_2(String_t* value) { ___Name_2 = value; Il2CppCodeGenWriteBarrier((&___Name_2), value); } inline static int32_t get_offset_of_Value_3() { return static_cast<int32_t>(offsetof(Header_t549724581, ___Value_3)); } inline RuntimeObject * get_Value_3() const { return ___Value_3; } inline RuntimeObject ** get_address_of_Value_3() { return &___Value_3; } inline void set_Value_3(RuntimeObject * value) { ___Value_3 = value; Il2CppCodeGenWriteBarrier((&___Value_3), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // HEADER_T549724581_H #ifndef LOGICALCALLCONTEXT_T3342013719_H #define LOGICALCALLCONTEXT_T3342013719_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.LogicalCallContext struct LogicalCallContext_t3342013719 : public RuntimeObject { public: // System.Collections.Hashtable System.Runtime.Remoting.Messaging.LogicalCallContext::_data Hashtable_t1853889766 * ____data_0; // System.Runtime.Remoting.Messaging.CallContextRemotingData System.Runtime.Remoting.Messaging.LogicalCallContext::_remotingData CallContextRemotingData_t2260963392 * ____remotingData_1; public: inline static int32_t get_offset_of__data_0() { return static_cast<int32_t>(offsetof(LogicalCallContext_t3342013719, ____data_0)); } inline Hashtable_t1853889766 * get__data_0() const { return ____data_0; } inline Hashtable_t1853889766 ** get_address_of__data_0() { return &____data_0; } inline void set__data_0(Hashtable_t1853889766 * value) { ____data_0 = value; Il2CppCodeGenWriteBarrier((&____data_0), value); } inline static int32_t get_offset_of__remotingData_1() { return static_cast<int32_t>(offsetof(LogicalCallContext_t3342013719, ____remotingData_1)); } inline CallContextRemotingData_t2260963392 * get__remotingData_1() const { return ____remotingData_1; } inline CallContextRemotingData_t2260963392 ** get_address_of__remotingData_1() { return &____remotingData_1; } inline void set__remotingData_1(CallContextRemotingData_t2260963392 * value) { ____remotingData_1 = value; Il2CppCodeGenWriteBarrier((&____remotingData_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // LOGICALCALLCONTEXT_T3342013719_H #ifndef CALLCONTEXTREMOTINGDATA_T2260963392_H #define CALLCONTEXTREMOTINGDATA_T2260963392_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.CallContextRemotingData struct CallContextRemotingData_t2260963392 : public RuntimeObject { public: // System.String System.Runtime.Remoting.Messaging.CallContextRemotingData::_logicalCallID String_t* ____logicalCallID_0; public: inline static int32_t get_offset_of__logicalCallID_0() { return static_cast<int32_t>(offsetof(CallContextRemotingData_t2260963392, ____logicalCallID_0)); } inline String_t* get__logicalCallID_0() const { return ____logicalCallID_0; } inline String_t** get_address_of__logicalCallID_0() { return &____logicalCallID_0; } inline void set__logicalCallID_0(String_t* value) { ____logicalCallID_0 = value; Il2CppCodeGenWriteBarrier((&____logicalCallID_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CALLCONTEXTREMOTINGDATA_T2260963392_H #ifndef METHODCALL_T861078140_H #define METHODCALL_T861078140_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.MethodCall struct MethodCall_t861078140 : public RuntimeObject { public: // System.String System.Runtime.Remoting.Messaging.MethodCall::_uri String_t* ____uri_0; // System.String System.Runtime.Remoting.Messaging.MethodCall::_typeName String_t* ____typeName_1; // System.String System.Runtime.Remoting.Messaging.MethodCall::_methodName String_t* ____methodName_2; // System.Object[] System.Runtime.Remoting.Messaging.MethodCall::_args ObjectU5BU5D_t2843939325* ____args_3; // System.Type[] System.Runtime.Remoting.Messaging.MethodCall::_methodSignature TypeU5BU5D_t3940880105* ____methodSignature_4; // System.Reflection.MethodBase System.Runtime.Remoting.Messaging.MethodCall::_methodBase MethodBase_t609368412 * ____methodBase_5; // System.Runtime.Remoting.Messaging.LogicalCallContext System.Runtime.Remoting.Messaging.MethodCall::_callContext LogicalCallContext_t3342013719 * ____callContext_6; // System.Type[] System.Runtime.Remoting.Messaging.MethodCall::_genericArguments TypeU5BU5D_t3940880105* ____genericArguments_7; // System.Collections.IDictionary System.Runtime.Remoting.Messaging.MethodCall::ExternalProperties RuntimeObject* ___ExternalProperties_8; // System.Collections.IDictionary System.Runtime.Remoting.Messaging.MethodCall::InternalProperties RuntimeObject* ___InternalProperties_9; public: inline static int32_t get_offset_of__uri_0() { return static_cast<int32_t>(offsetof(MethodCall_t861078140, ____uri_0)); } inline String_t* get__uri_0() const { return ____uri_0; } inline String_t** get_address_of__uri_0() { return &____uri_0; } inline void set__uri_0(String_t* value) { ____uri_0 = value; Il2CppCodeGenWriteBarrier((&____uri_0), value); } inline static int32_t get_offset_of__typeName_1() { return static_cast<int32_t>(offsetof(MethodCall_t861078140, ____typeName_1)); } inline String_t* get__typeName_1() const { return ____typeName_1; } inline String_t** get_address_of__typeName_1() { return &____typeName_1; } inline void set__typeName_1(String_t* value) { ____typeName_1 = value; Il2CppCodeGenWriteBarrier((&____typeName_1), value); } inline static int32_t get_offset_of__methodName_2() { return static_cast<int32_t>(offsetof(MethodCall_t861078140, ____methodName_2)); } inline String_t* get__methodName_2() const { return ____methodName_2; } inline String_t** get_address_of__methodName_2() { return &____methodName_2; } inline void set__methodName_2(String_t* value) { ____methodName_2 = value; Il2CppCodeGenWriteBarrier((&____methodName_2), value); } inline static int32_t get_offset_of__args_3() { return static_cast<int32_t>(offsetof(MethodCall_t861078140, ____args_3)); } inline ObjectU5BU5D_t2843939325* get__args_3() const { return ____args_3; } inline ObjectU5BU5D_t2843939325** get_address_of__args_3() { return &____args_3; } inline void set__args_3(ObjectU5BU5D_t2843939325* value) { ____args_3 = value; Il2CppCodeGenWriteBarrier((&____args_3), value); } inline static int32_t get_offset_of__methodSignature_4() { return static_cast<int32_t>(offsetof(MethodCall_t861078140, ____methodSignature_4)); } inline TypeU5BU5D_t3940880105* get__methodSignature_4() const { return ____methodSignature_4; } inline TypeU5BU5D_t3940880105** get_address_of__methodSignature_4() { return &____methodSignature_4; } inline void set__methodSignature_4(TypeU5BU5D_t3940880105* value) { ____methodSignature_4 = value; Il2CppCodeGenWriteBarrier((&____methodSignature_4), value); } inline static int32_t get_offset_of__methodBase_5() { return static_cast<int32_t>(offsetof(MethodCall_t861078140, ____methodBase_5)); } inline MethodBase_t609368412 * get__methodBase_5() const { return ____methodBase_5; } inline MethodBase_t609368412 ** get_address_of__methodBase_5() { return &____methodBase_5; } inline void set__methodBase_5(MethodBase_t609368412 * value) { ____methodBase_5 = value; Il2CppCodeGenWriteBarrier((&____methodBase_5), value); } inline static int32_t get_offset_of__callContext_6() { return static_cast<int32_t>(offsetof(MethodCall_t861078140, ____callContext_6)); } inline LogicalCallContext_t3342013719 * get__callContext_6() const { return ____callContext_6; } inline LogicalCallContext_t3342013719 ** get_address_of__callContext_6() { return &____callContext_6; } inline void set__callContext_6(LogicalCallContext_t3342013719 * value) { ____callContext_6 = value; Il2CppCodeGenWriteBarrier((&____callContext_6), value); } inline static int32_t get_offset_of__genericArguments_7() { return static_cast<int32_t>(offsetof(MethodCall_t861078140, ____genericArguments_7)); } inline TypeU5BU5D_t3940880105* get__genericArguments_7() const { return ____genericArguments_7; } inline TypeU5BU5D_t3940880105** get_address_of__genericArguments_7() { return &____genericArguments_7; } inline void set__genericArguments_7(TypeU5BU5D_t3940880105* value) { ____genericArguments_7 = value; Il2CppCodeGenWriteBarrier((&____genericArguments_7), value); } inline static int32_t get_offset_of_ExternalProperties_8() { return static_cast<int32_t>(offsetof(MethodCall_t861078140, ___ExternalProperties_8)); } inline RuntimeObject* get_ExternalProperties_8() const { return ___ExternalProperties_8; } inline RuntimeObject** get_address_of_ExternalProperties_8() { return &___ExternalProperties_8; } inline void set_ExternalProperties_8(RuntimeObject* value) { ___ExternalProperties_8 = value; Il2CppCodeGenWriteBarrier((&___ExternalProperties_8), value); } inline static int32_t get_offset_of_InternalProperties_9() { return static_cast<int32_t>(offsetof(MethodCall_t861078140, ___InternalProperties_9)); } inline RuntimeObject* get_InternalProperties_9() const { return ___InternalProperties_9; } inline RuntimeObject** get_address_of_InternalProperties_9() { return &___InternalProperties_9; } inline void set_InternalProperties_9(RuntimeObject* value) { ___InternalProperties_9 = value; Il2CppCodeGenWriteBarrier((&___InternalProperties_9), value); } }; struct MethodCall_t861078140_StaticFields { public: // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Runtime.Remoting.Messaging.MethodCall::<>f__switch$map1F Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map1F_10; public: inline static int32_t get_offset_of_U3CU3Ef__switchU24map1F_10() { return static_cast<int32_t>(offsetof(MethodCall_t861078140_StaticFields, ___U3CU3Ef__switchU24map1F_10)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map1F_10() const { return ___U3CU3Ef__switchU24map1F_10; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map1F_10() { return &___U3CU3Ef__switchU24map1F_10; } inline void set_U3CU3Ef__switchU24map1F_10(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map1F_10 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map1F_10), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // METHODCALL_T861078140_H #ifndef METHODDICTIONARY_T207894204_H #define METHODDICTIONARY_T207894204_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.MethodDictionary struct MethodDictionary_t207894204 : public RuntimeObject { public: // System.Collections.IDictionary System.Runtime.Remoting.Messaging.MethodDictionary::_internalProperties RuntimeObject* ____internalProperties_0; // System.Runtime.Remoting.Messaging.IMethodMessage System.Runtime.Remoting.Messaging.MethodDictionary::_message RuntimeObject* ____message_1; // System.String[] System.Runtime.Remoting.Messaging.MethodDictionary::_methodKeys StringU5BU5D_t1281789340* ____methodKeys_2; // System.Boolean System.Runtime.Remoting.Messaging.MethodDictionary::_ownProperties bool ____ownProperties_3; public: inline static int32_t get_offset_of__internalProperties_0() { return static_cast<int32_t>(offsetof(MethodDictionary_t207894204, ____internalProperties_0)); } inline RuntimeObject* get__internalProperties_0() const { return ____internalProperties_0; } inline RuntimeObject** get_address_of__internalProperties_0() { return &____internalProperties_0; } inline void set__internalProperties_0(RuntimeObject* value) { ____internalProperties_0 = value; Il2CppCodeGenWriteBarrier((&____internalProperties_0), value); } inline static int32_t get_offset_of__message_1() { return static_cast<int32_t>(offsetof(MethodDictionary_t207894204, ____message_1)); } inline RuntimeObject* get__message_1() const { return ____message_1; } inline RuntimeObject** get_address_of__message_1() { return &____message_1; } inline void set__message_1(RuntimeObject* value) { ____message_1 = value; Il2CppCodeGenWriteBarrier((&____message_1), value); } inline static int32_t get_offset_of__methodKeys_2() { return static_cast<int32_t>(offsetof(MethodDictionary_t207894204, ____methodKeys_2)); } inline StringU5BU5D_t1281789340* get__methodKeys_2() const { return ____methodKeys_2; } inline StringU5BU5D_t1281789340** get_address_of__methodKeys_2() { return &____methodKeys_2; } inline void set__methodKeys_2(StringU5BU5D_t1281789340* value) { ____methodKeys_2 = value; Il2CppCodeGenWriteBarrier((&____methodKeys_2), value); } inline static int32_t get_offset_of__ownProperties_3() { return static_cast<int32_t>(offsetof(MethodDictionary_t207894204, ____ownProperties_3)); } inline bool get__ownProperties_3() const { return ____ownProperties_3; } inline bool* get_address_of__ownProperties_3() { return &____ownProperties_3; } inline void set__ownProperties_3(bool value) { ____ownProperties_3 = value; } }; struct MethodDictionary_t207894204_StaticFields { public: // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Runtime.Remoting.Messaging.MethodDictionary::<>f__switch$map21 Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map21_4; // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Runtime.Remoting.Messaging.MethodDictionary::<>f__switch$map22 Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map22_5; public: inline static int32_t get_offset_of_U3CU3Ef__switchU24map21_4() { return static_cast<int32_t>(offsetof(MethodDictionary_t207894204_StaticFields, ___U3CU3Ef__switchU24map21_4)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map21_4() const { return ___U3CU3Ef__switchU24map21_4; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map21_4() { return &___U3CU3Ef__switchU24map21_4; } inline void set_U3CU3Ef__switchU24map21_4(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map21_4 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map21_4), value); } inline static int32_t get_offset_of_U3CU3Ef__switchU24map22_5() { return static_cast<int32_t>(offsetof(MethodDictionary_t207894204_StaticFields, ___U3CU3Ef__switchU24map22_5)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map22_5() const { return ___U3CU3Ef__switchU24map22_5; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map22_5() { return &___U3CU3Ef__switchU24map22_5; } inline void set_U3CU3Ef__switchU24map22_5(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map22_5 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map22_5), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // METHODDICTIONARY_T207894204_H #ifndef DICTIONARYENUMERATOR_T2516729552_H #define DICTIONARYENUMERATOR_T2516729552_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.MethodDictionary/DictionaryEnumerator struct DictionaryEnumerator_t2516729552 : public RuntimeObject { public: // System.Runtime.Remoting.Messaging.MethodDictionary System.Runtime.Remoting.Messaging.MethodDictionary/DictionaryEnumerator::_methodDictionary MethodDictionary_t207894204 * ____methodDictionary_0; // System.Collections.IDictionaryEnumerator System.Runtime.Remoting.Messaging.MethodDictionary/DictionaryEnumerator::_hashtableEnum RuntimeObject* ____hashtableEnum_1; // System.Int32 System.Runtime.Remoting.Messaging.MethodDictionary/DictionaryEnumerator::_posMethod int32_t ____posMethod_2; public: inline static int32_t get_offset_of__methodDictionary_0() { return static_cast<int32_t>(offsetof(DictionaryEnumerator_t2516729552, ____methodDictionary_0)); } inline MethodDictionary_t207894204 * get__methodDictionary_0() const { return ____methodDictionary_0; } inline MethodDictionary_t207894204 ** get_address_of__methodDictionary_0() { return &____methodDictionary_0; } inline void set__methodDictionary_0(MethodDictionary_t207894204 * value) { ____methodDictionary_0 = value; Il2CppCodeGenWriteBarrier((&____methodDictionary_0), value); } inline static int32_t get_offset_of__hashtableEnum_1() { return static_cast<int32_t>(offsetof(DictionaryEnumerator_t2516729552, ____hashtableEnum_1)); } inline RuntimeObject* get__hashtableEnum_1() const { return ____hashtableEnum_1; } inline RuntimeObject** get_address_of__hashtableEnum_1() { return &____hashtableEnum_1; } inline void set__hashtableEnum_1(RuntimeObject* value) { ____hashtableEnum_1 = value; Il2CppCodeGenWriteBarrier((&____hashtableEnum_1), value); } inline static int32_t get_offset_of__posMethod_2() { return static_cast<int32_t>(offsetof(DictionaryEnumerator_t2516729552, ____posMethod_2)); } inline int32_t get__posMethod_2() const { return ____posMethod_2; } inline int32_t* get_address_of__posMethod_2() { return &____posMethod_2; } inline void set__posMethod_2(int32_t value) { ____posMethod_2 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // DICTIONARYENUMERATOR_T2516729552_H #ifndef MONOMETHODMESSAGE_T2807636944_H #define MONOMETHODMESSAGE_T2807636944_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.MonoMethodMessage struct MonoMethodMessage_t2807636944 : public RuntimeObject { public: // System.Reflection.MonoMethod System.Runtime.Remoting.Messaging.MonoMethodMessage::method MonoMethod_t * ___method_0; // System.Object[] System.Runtime.Remoting.Messaging.MonoMethodMessage::args ObjectU5BU5D_t2843939325* ___args_1; // System.Byte[] System.Runtime.Remoting.Messaging.MonoMethodMessage::arg_types ByteU5BU5D_t4116647657* ___arg_types_2; // System.Runtime.Remoting.Messaging.LogicalCallContext System.Runtime.Remoting.Messaging.MonoMethodMessage::ctx LogicalCallContext_t3342013719 * ___ctx_3; // System.Object System.Runtime.Remoting.Messaging.MonoMethodMessage::rval RuntimeObject * ___rval_4; // System.Exception System.Runtime.Remoting.Messaging.MonoMethodMessage::exc Exception_t1436737249 * ___exc_5; // System.String System.Runtime.Remoting.Messaging.MonoMethodMessage::uri String_t* ___uri_6; // System.Type[] System.Runtime.Remoting.Messaging.MonoMethodMessage::methodSignature TypeU5BU5D_t3940880105* ___methodSignature_7; public: inline static int32_t get_offset_of_method_0() { return static_cast<int32_t>(offsetof(MonoMethodMessage_t2807636944, ___method_0)); } inline MonoMethod_t * get_method_0() const { return ___method_0; } inline MonoMethod_t ** get_address_of_method_0() { return &___method_0; } inline void set_method_0(MonoMethod_t * value) { ___method_0 = value; Il2CppCodeGenWriteBarrier((&___method_0), value); } inline static int32_t get_offset_of_args_1() { return static_cast<int32_t>(offsetof(MonoMethodMessage_t2807636944, ___args_1)); } inline ObjectU5BU5D_t2843939325* get_args_1() const { return ___args_1; } inline ObjectU5BU5D_t2843939325** get_address_of_args_1() { return &___args_1; } inline void set_args_1(ObjectU5BU5D_t2843939325* value) { ___args_1 = value; Il2CppCodeGenWriteBarrier((&___args_1), value); } inline static int32_t get_offset_of_arg_types_2() { return static_cast<int32_t>(offsetof(MonoMethodMessage_t2807636944, ___arg_types_2)); } inline ByteU5BU5D_t4116647657* get_arg_types_2() const { return ___arg_types_2; } inline ByteU5BU5D_t4116647657** get_address_of_arg_types_2() { return &___arg_types_2; } inline void set_arg_types_2(ByteU5BU5D_t4116647657* value) { ___arg_types_2 = value; Il2CppCodeGenWriteBarrier((&___arg_types_2), value); } inline static int32_t get_offset_of_ctx_3() { return static_cast<int32_t>(offsetof(MonoMethodMessage_t2807636944, ___ctx_3)); } inline LogicalCallContext_t3342013719 * get_ctx_3() const { return ___ctx_3; } inline LogicalCallContext_t3342013719 ** get_address_of_ctx_3() { return &___ctx_3; } inline void set_ctx_3(LogicalCallContext_t3342013719 * value) { ___ctx_3 = value; Il2CppCodeGenWriteBarrier((&___ctx_3), value); } inline static int32_t get_offset_of_rval_4() { return static_cast<int32_t>(offsetof(MonoMethodMessage_t2807636944, ___rval_4)); } inline RuntimeObject * get_rval_4() const { return ___rval_4; } inline RuntimeObject ** get_address_of_rval_4() { return &___rval_4; } inline void set_rval_4(RuntimeObject * value) { ___rval_4 = value; Il2CppCodeGenWriteBarrier((&___rval_4), value); } inline static int32_t get_offset_of_exc_5() { return static_cast<int32_t>(offsetof(MonoMethodMessage_t2807636944, ___exc_5)); } inline Exception_t1436737249 * get_exc_5() const { return ___exc_5; } inline Exception_t1436737249 ** get_address_of_exc_5() { return &___exc_5; } inline void set_exc_5(Exception_t1436737249 * value) { ___exc_5 = value; Il2CppCodeGenWriteBarrier((&___exc_5), value); } inline static int32_t get_offset_of_uri_6() { return static_cast<int32_t>(offsetof(MonoMethodMessage_t2807636944, ___uri_6)); } inline String_t* get_uri_6() const { return ___uri_6; } inline String_t** get_address_of_uri_6() { return &___uri_6; } inline void set_uri_6(String_t* value) { ___uri_6 = value; Il2CppCodeGenWriteBarrier((&___uri_6), value); } inline static int32_t get_offset_of_methodSignature_7() { return static_cast<int32_t>(offsetof(MonoMethodMessage_t2807636944, ___methodSignature_7)); } inline TypeU5BU5D_t3940880105* get_methodSignature_7() const { return ___methodSignature_7; } inline TypeU5BU5D_t3940880105** get_address_of_methodSignature_7() { return &___methodSignature_7; } inline void set_methodSignature_7(TypeU5BU5D_t3940880105* value) { ___methodSignature_7 = value; Il2CppCodeGenWriteBarrier((&___methodSignature_7), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // MONOMETHODMESSAGE_T2807636944_H #ifndef REMOTINGSURROGATE_T2834579653_H #define REMOTINGSURROGATE_T2834579653_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.RemotingSurrogate struct RemotingSurrogate_t2834579653 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // REMOTINGSURROGATE_T2834579653_H #ifndef OBJREFSURROGATE_T3860276170_H #define OBJREFSURROGATE_T3860276170_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.ObjRefSurrogate struct ObjRefSurrogate_t3860276170 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // OBJREFSURROGATE_T3860276170_H #ifndef REMOTINGSURROGATESELECTOR_T2472351973_H #define REMOTINGSURROGATESELECTOR_T2472351973_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.RemotingSurrogateSelector struct RemotingSurrogateSelector_t2472351973 : public RuntimeObject { public: // System.Runtime.Serialization.ISurrogateSelector System.Runtime.Remoting.Messaging.RemotingSurrogateSelector::_next RuntimeObject* ____next_3; public: inline static int32_t get_offset_of__next_3() { return static_cast<int32_t>(offsetof(RemotingSurrogateSelector_t2472351973, ____next_3)); } inline RuntimeObject* get__next_3() const { return ____next_3; } inline RuntimeObject** get_address_of__next_3() { return &____next_3; } inline void set__next_3(RuntimeObject* value) { ____next_3 = value; Il2CppCodeGenWriteBarrier((&____next_3), value); } }; struct RemotingSurrogateSelector_t2472351973_StaticFields { public: // System.Type System.Runtime.Remoting.Messaging.RemotingSurrogateSelector::s_cachedTypeObjRef Type_t * ___s_cachedTypeObjRef_0; // System.Runtime.Remoting.Messaging.ObjRefSurrogate System.Runtime.Remoting.Messaging.RemotingSurrogateSelector::_objRefSurrogate ObjRefSurrogate_t3860276170 * ____objRefSurrogate_1; // System.Runtime.Remoting.Messaging.RemotingSurrogate System.Runtime.Remoting.Messaging.RemotingSurrogateSelector::_objRemotingSurrogate RemotingSurrogate_t2834579653 * ____objRemotingSurrogate_2; public: inline static int32_t get_offset_of_s_cachedTypeObjRef_0() { return static_cast<int32_t>(offsetof(RemotingSurrogateSelector_t2472351973_StaticFields, ___s_cachedTypeObjRef_0)); } inline Type_t * get_s_cachedTypeObjRef_0() const { return ___s_cachedTypeObjRef_0; } inline Type_t ** get_address_of_s_cachedTypeObjRef_0() { return &___s_cachedTypeObjRef_0; } inline void set_s_cachedTypeObjRef_0(Type_t * value) { ___s_cachedTypeObjRef_0 = value; Il2CppCodeGenWriteBarrier((&___s_cachedTypeObjRef_0), value); } inline static int32_t get_offset_of__objRefSurrogate_1() { return static_cast<int32_t>(offsetof(RemotingSurrogateSelector_t2472351973_StaticFields, ____objRefSurrogate_1)); } inline ObjRefSurrogate_t3860276170 * get__objRefSurrogate_1() const { return ____objRefSurrogate_1; } inline ObjRefSurrogate_t3860276170 ** get_address_of__objRefSurrogate_1() { return &____objRefSurrogate_1; } inline void set__objRefSurrogate_1(ObjRefSurrogate_t3860276170 * value) { ____objRefSurrogate_1 = value; Il2CppCodeGenWriteBarrier((&____objRefSurrogate_1), value); } inline static int32_t get_offset_of__objRemotingSurrogate_2() { return static_cast<int32_t>(offsetof(RemotingSurrogateSelector_t2472351973_StaticFields, ____objRemotingSurrogate_2)); } inline RemotingSurrogate_t2834579653 * get__objRemotingSurrogate_2() const { return ____objRemotingSurrogate_2; } inline RemotingSurrogate_t2834579653 ** get_address_of__objRemotingSurrogate_2() { return &____objRemotingSurrogate_2; } inline void set__objRemotingSurrogate_2(RemotingSurrogate_t2834579653 * value) { ____objRemotingSurrogate_2 = value; Il2CppCodeGenWriteBarrier((&____objRemotingSurrogate_2), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // REMOTINGSURROGATESELECTOR_T2472351973_H #ifndef DYNAMICPROPERTYREG_T4086779412_H #define DYNAMICPROPERTYREG_T4086779412_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.DynamicPropertyCollection/DynamicPropertyReg struct DynamicPropertyReg_t4086779412 : public RuntimeObject { public: // System.Runtime.Remoting.Contexts.IDynamicProperty System.Runtime.Remoting.Contexts.DynamicPropertyCollection/DynamicPropertyReg::Property RuntimeObject* ___Property_0; // System.Runtime.Remoting.Contexts.IDynamicMessageSink System.Runtime.Remoting.Contexts.DynamicPropertyCollection/DynamicPropertyReg::Sink RuntimeObject* ___Sink_1; public: inline static int32_t get_offset_of_Property_0() { return static_cast<int32_t>(offsetof(DynamicPropertyReg_t4086779412, ___Property_0)); } inline RuntimeObject* get_Property_0() const { return ___Property_0; } inline RuntimeObject** get_address_of_Property_0() { return &___Property_0; } inline void set_Property_0(RuntimeObject* value) { ___Property_0 = value; Il2CppCodeGenWriteBarrier((&___Property_0), value); } inline static int32_t get_offset_of_Sink_1() { return static_cast<int32_t>(offsetof(DynamicPropertyReg_t4086779412, ___Sink_1)); } inline RuntimeObject* get_Sink_1() const { return ___Sink_1; } inline RuntimeObject** get_address_of_Sink_1() { return &___Sink_1; } inline void set_Sink_1(RuntimeObject* value) { ___Sink_1 = value; Il2CppCodeGenWriteBarrier((&___Sink_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // DYNAMICPROPERTYREG_T4086779412_H #ifndef CROSSCONTEXTCHANNEL_T4063984580_H #define CROSSCONTEXTCHANNEL_T4063984580_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.CrossContextChannel struct CrossContextChannel_t4063984580 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CROSSCONTEXTCHANNEL_T4063984580_H #ifndef ATTRIBUTE_T861562559_H #define ATTRIBUTE_T861562559_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Attribute struct Attribute_t861562559 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // ATTRIBUTE_T861562559_H #ifndef MARSHAL_T1757017490_H #define MARSHAL_T1757017490_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.Marshal struct Marshal_t1757017490 : public RuntimeObject { public: public: }; struct Marshal_t1757017490_StaticFields { public: // System.Int32 System.Runtime.InteropServices.Marshal::SystemMaxDBCSCharSize int32_t ___SystemMaxDBCSCharSize_0; // System.Int32 System.Runtime.InteropServices.Marshal::SystemDefaultCharSize int32_t ___SystemDefaultCharSize_1; public: inline static int32_t get_offset_of_SystemMaxDBCSCharSize_0() { return static_cast<int32_t>(offsetof(Marshal_t1757017490_StaticFields, ___SystemMaxDBCSCharSize_0)); } inline int32_t get_SystemMaxDBCSCharSize_0() const { return ___SystemMaxDBCSCharSize_0; } inline int32_t* get_address_of_SystemMaxDBCSCharSize_0() { return &___SystemMaxDBCSCharSize_0; } inline void set_SystemMaxDBCSCharSize_0(int32_t value) { ___SystemMaxDBCSCharSize_0 = value; } inline static int32_t get_offset_of_SystemDefaultCharSize_1() { return static_cast<int32_t>(offsetof(Marshal_t1757017490_StaticFields, ___SystemDefaultCharSize_1)); } inline int32_t get_SystemDefaultCharSize_1() const { return ___SystemDefaultCharSize_1; } inline int32_t* get_address_of_SystemDefaultCharSize_1() { return &___SystemDefaultCharSize_1; } inline void set_SystemDefaultCharSize_1(int32_t value) { ___SystemDefaultCharSize_1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // MARSHAL_T1757017490_H #ifndef ACTIVATIONSERVICES_T4161385317_H #define ACTIVATIONSERVICES_T4161385317_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Activation.ActivationServices struct ActivationServices_t4161385317 : public RuntimeObject { public: public: }; struct ActivationServices_t4161385317_StaticFields { public: // System.Runtime.Remoting.Activation.IActivator System.Runtime.Remoting.Activation.ActivationServices::_constructionActivator RuntimeObject* ____constructionActivator_0; public: inline static int32_t get_offset_of__constructionActivator_0() { return static_cast<int32_t>(offsetof(ActivationServices_t4161385317_StaticFields, ____constructionActivator_0)); } inline RuntimeObject* get__constructionActivator_0() const { return ____constructionActivator_0; } inline RuntimeObject** get_address_of__constructionActivator_0() { return &____constructionActivator_0; } inline void set__constructionActivator_0(RuntimeObject* value) { ____constructionActivator_0 = value; Il2CppCodeGenWriteBarrier((&____constructionActivator_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // ACTIVATIONSERVICES_T4161385317_H #ifndef SINKPROVIDERDATA_T4151372974_H #define SINKPROVIDERDATA_T4151372974_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Channels.SinkProviderData struct SinkProviderData_t4151372974 : public RuntimeObject { public: // System.String System.Runtime.Remoting.Channels.SinkProviderData::sinkName String_t* ___sinkName_0; // System.Collections.ArrayList System.Runtime.Remoting.Channels.SinkProviderData::children ArrayList_t2718874744 * ___children_1; // System.Collections.Hashtable System.Runtime.Remoting.Channels.SinkProviderData::properties Hashtable_t1853889766 * ___properties_2; public: inline static int32_t get_offset_of_sinkName_0() { return static_cast<int32_t>(offsetof(SinkProviderData_t4151372974, ___sinkName_0)); } inline String_t* get_sinkName_0() const { return ___sinkName_0; } inline String_t** get_address_of_sinkName_0() { return &___sinkName_0; } inline void set_sinkName_0(String_t* value) { ___sinkName_0 = value; Il2CppCodeGenWriteBarrier((&___sinkName_0), value); } inline static int32_t get_offset_of_children_1() { return static_cast<int32_t>(offsetof(SinkProviderData_t4151372974, ___children_1)); } inline ArrayList_t2718874744 * get_children_1() const { return ___children_1; } inline ArrayList_t2718874744 ** get_address_of_children_1() { return &___children_1; } inline void set_children_1(ArrayList_t2718874744 * value) { ___children_1 = value; Il2CppCodeGenWriteBarrier((&___children_1), value); } inline static int32_t get_offset_of_properties_2() { return static_cast<int32_t>(offsetof(SinkProviderData_t4151372974, ___properties_2)); } inline Hashtable_t1853889766 * get_properties_2() const { return ___properties_2; } inline Hashtable_t1853889766 ** get_address_of_properties_2() { return &___properties_2; } inline void set_properties_2(Hashtable_t1853889766 * value) { ___properties_2 = value; Il2CppCodeGenWriteBarrier((&___properties_2), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // SINKPROVIDERDATA_T4151372974_H #ifndef CROSSAPPDOMAINSINK_T2177102621_H #define CROSSAPPDOMAINSINK_T2177102621_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Channels.CrossAppDomainSink struct CrossAppDomainSink_t2177102621 : public RuntimeObject { public: // System.Int32 System.Runtime.Remoting.Channels.CrossAppDomainSink::_domainID int32_t ____domainID_2; public: inline static int32_t get_offset_of__domainID_2() { return static_cast<int32_t>(offsetof(CrossAppDomainSink_t2177102621, ____domainID_2)); } inline int32_t get__domainID_2() const { return ____domainID_2; } inline int32_t* get_address_of__domainID_2() { return &____domainID_2; } inline void set__domainID_2(int32_t value) { ____domainID_2 = value; } }; struct CrossAppDomainSink_t2177102621_StaticFields { public: // System.Collections.Hashtable System.Runtime.Remoting.Channels.CrossAppDomainSink::s_sinks Hashtable_t1853889766 * ___s_sinks_0; // System.Reflection.MethodInfo System.Runtime.Remoting.Channels.CrossAppDomainSink::processMessageMethod MethodInfo_t * ___processMessageMethod_1; public: inline static int32_t get_offset_of_s_sinks_0() { return static_cast<int32_t>(offsetof(CrossAppDomainSink_t2177102621_StaticFields, ___s_sinks_0)); } inline Hashtable_t1853889766 * get_s_sinks_0() const { return ___s_sinks_0; } inline Hashtable_t1853889766 ** get_address_of_s_sinks_0() { return &___s_sinks_0; } inline void set_s_sinks_0(Hashtable_t1853889766 * value) { ___s_sinks_0 = value; Il2CppCodeGenWriteBarrier((&___s_sinks_0), value); } inline static int32_t get_offset_of_processMessageMethod_1() { return static_cast<int32_t>(offsetof(CrossAppDomainSink_t2177102621_StaticFields, ___processMessageMethod_1)); } inline MethodInfo_t * get_processMessageMethod_1() const { return ___processMessageMethod_1; } inline MethodInfo_t ** get_address_of_processMessageMethod_1() { return &___processMessageMethod_1; } inline void set_processMessageMethod_1(MethodInfo_t * value) { ___processMessageMethod_1 = value; Il2CppCodeGenWriteBarrier((&___processMessageMethod_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CROSSAPPDOMAINSINK_T2177102621_H #ifndef CROSSAPPDOMAINCHANNEL_T1606809047_H #define CROSSAPPDOMAINCHANNEL_T1606809047_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Channels.CrossAppDomainChannel struct CrossAppDomainChannel_t1606809047 : public RuntimeObject { public: public: }; struct CrossAppDomainChannel_t1606809047_StaticFields { public: // System.Object System.Runtime.Remoting.Channels.CrossAppDomainChannel::s_lock RuntimeObject * ___s_lock_0; public: inline static int32_t get_offset_of_s_lock_0() { return static_cast<int32_t>(offsetof(CrossAppDomainChannel_t1606809047_StaticFields, ___s_lock_0)); } inline RuntimeObject * get_s_lock_0() const { return ___s_lock_0; } inline RuntimeObject ** get_address_of_s_lock_0() { return &___s_lock_0; } inline void set_s_lock_0(RuntimeObject * value) { ___s_lock_0 = value; Il2CppCodeGenWriteBarrier((&___s_lock_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CROSSAPPDOMAINCHANNEL_T1606809047_H #ifndef CROSSAPPDOMAINDATA_T2130208023_H #define CROSSAPPDOMAINDATA_T2130208023_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Channels.CrossAppDomainData struct CrossAppDomainData_t2130208023 : public RuntimeObject { public: // System.Object System.Runtime.Remoting.Channels.CrossAppDomainData::_ContextID RuntimeObject * ____ContextID_0; // System.Int32 System.Runtime.Remoting.Channels.CrossAppDomainData::_DomainID int32_t ____DomainID_1; // System.String System.Runtime.Remoting.Channels.CrossAppDomainData::_processGuid String_t* ____processGuid_2; public: inline static int32_t get_offset_of__ContextID_0() { return static_cast<int32_t>(offsetof(CrossAppDomainData_t2130208023, ____ContextID_0)); } inline RuntimeObject * get__ContextID_0() const { return ____ContextID_0; } inline RuntimeObject ** get_address_of__ContextID_0() { return &____ContextID_0; } inline void set__ContextID_0(RuntimeObject * value) { ____ContextID_0 = value; Il2CppCodeGenWriteBarrier((&____ContextID_0), value); } inline static int32_t get_offset_of__DomainID_1() { return static_cast<int32_t>(offsetof(CrossAppDomainData_t2130208023, ____DomainID_1)); } inline int32_t get__DomainID_1() const { return ____DomainID_1; } inline int32_t* get_address_of__DomainID_1() { return &____DomainID_1; } inline void set__DomainID_1(int32_t value) { ____DomainID_1 = value; } inline static int32_t get_offset_of__processGuid_2() { return static_cast<int32_t>(offsetof(CrossAppDomainData_t2130208023, ____processGuid_2)); } inline String_t* get__processGuid_2() const { return ____processGuid_2; } inline String_t** get_address_of__processGuid_2() { return &____processGuid_2; } inline void set__processGuid_2(String_t* value) { ____processGuid_2 = value; Il2CppCodeGenWriteBarrier((&____processGuid_2), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CROSSAPPDOMAINDATA_T2130208023_H #ifndef CHANNELSERVICES_T3942013484_H #define CHANNELSERVICES_T3942013484_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Channels.ChannelServices struct ChannelServices_t3942013484 : public RuntimeObject { public: public: }; struct ChannelServices_t3942013484_StaticFields { public: // System.Collections.ArrayList System.Runtime.Remoting.Channels.ChannelServices::registeredChannels ArrayList_t2718874744 * ___registeredChannels_0; // System.Collections.ArrayList System.Runtime.Remoting.Channels.ChannelServices::delayedClientChannels ArrayList_t2718874744 * ___delayedClientChannels_1; // System.Runtime.Remoting.Contexts.CrossContextChannel System.Runtime.Remoting.Channels.ChannelServices::_crossContextSink CrossContextChannel_t4063984580 * ____crossContextSink_2; // System.String System.Runtime.Remoting.Channels.ChannelServices::CrossContextUrl String_t* ___CrossContextUrl_3; // System.Collections.IList System.Runtime.Remoting.Channels.ChannelServices::oldStartModeTypes RuntimeObject* ___oldStartModeTypes_4; public: inline static int32_t get_offset_of_registeredChannels_0() { return static_cast<int32_t>(offsetof(ChannelServices_t3942013484_StaticFields, ___registeredChannels_0)); } inline ArrayList_t2718874744 * get_registeredChannels_0() const { return ___registeredChannels_0; } inline ArrayList_t2718874744 ** get_address_of_registeredChannels_0() { return &___registeredChannels_0; } inline void set_registeredChannels_0(ArrayList_t2718874744 * value) { ___registeredChannels_0 = value; Il2CppCodeGenWriteBarrier((&___registeredChannels_0), value); } inline static int32_t get_offset_of_delayedClientChannels_1() { return static_cast<int32_t>(offsetof(ChannelServices_t3942013484_StaticFields, ___delayedClientChannels_1)); } inline ArrayList_t2718874744 * get_delayedClientChannels_1() const { return ___delayedClientChannels_1; } inline ArrayList_t2718874744 ** get_address_of_delayedClientChannels_1() { return &___delayedClientChannels_1; } inline void set_delayedClientChannels_1(ArrayList_t2718874744 * value) { ___delayedClientChannels_1 = value; Il2CppCodeGenWriteBarrier((&___delayedClientChannels_1), value); } inline static int32_t get_offset_of__crossContextSink_2() { return static_cast<int32_t>(offsetof(ChannelServices_t3942013484_StaticFields, ____crossContextSink_2)); } inline CrossContextChannel_t4063984580 * get__crossContextSink_2() const { return ____crossContextSink_2; } inline CrossContextChannel_t4063984580 ** get_address_of__crossContextSink_2() { return &____crossContextSink_2; } inline void set__crossContextSink_2(CrossContextChannel_t4063984580 * value) { ____crossContextSink_2 = value; Il2CppCodeGenWriteBarrier((&____crossContextSink_2), value); } inline static int32_t get_offset_of_CrossContextUrl_3() { return static_cast<int32_t>(offsetof(ChannelServices_t3942013484_StaticFields, ___CrossContextUrl_3)); } inline String_t* get_CrossContextUrl_3() const { return ___CrossContextUrl_3; } inline String_t** get_address_of_CrossContextUrl_3() { return &___CrossContextUrl_3; } inline void set_CrossContextUrl_3(String_t* value) { ___CrossContextUrl_3 = value; Il2CppCodeGenWriteBarrier((&___CrossContextUrl_3), value); } inline static int32_t get_offset_of_oldStartModeTypes_4() { return static_cast<int32_t>(offsetof(ChannelServices_t3942013484_StaticFields, ___oldStartModeTypes_4)); } inline RuntimeObject* get_oldStartModeTypes_4() const { return ___oldStartModeTypes_4; } inline RuntimeObject** get_address_of_oldStartModeTypes_4() { return &___oldStartModeTypes_4; } inline void set_oldStartModeTypes_4(RuntimeObject* value) { ___oldStartModeTypes_4 = value; Il2CppCodeGenWriteBarrier((&___oldStartModeTypes_4), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CHANNELSERVICES_T3942013484_H #ifndef CHANNELINFO_T2064577689_H #define CHANNELINFO_T2064577689_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.ChannelInfo struct ChannelInfo_t2064577689 : public RuntimeObject { public: // System.Object[] System.Runtime.Remoting.ChannelInfo::channelData ObjectU5BU5D_t2843939325* ___channelData_0; public: inline static int32_t get_offset_of_channelData_0() { return static_cast<int32_t>(offsetof(ChannelInfo_t2064577689, ___channelData_0)); } inline ObjectU5BU5D_t2843939325* get_channelData_0() const { return ___channelData_0; } inline ObjectU5BU5D_t2843939325** get_address_of_channelData_0() { return &___channelData_0; } inline void set_channelData_0(ObjectU5BU5D_t2843939325* value) { ___channelData_0 = value; Il2CppCodeGenWriteBarrier((&___channelData_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CHANNELINFO_T2064577689_H #ifndef MARSHALBYREFOBJECT_T2760389100_H #define MARSHALBYREFOBJECT_T2760389100_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.MarshalByRefObject struct MarshalByRefObject_t2760389100 : public RuntimeObject { public: // System.Runtime.Remoting.ServerIdentity System.MarshalByRefObject::_identity ServerIdentity_t2342208608 * ____identity_0; public: inline static int32_t get_offset_of__identity_0() { return static_cast<int32_t>(offsetof(MarshalByRefObject_t2760389100, ____identity_0)); } inline ServerIdentity_t2342208608 * get__identity_0() const { return ____identity_0; } inline ServerIdentity_t2342208608 ** get_address_of__identity_0() { return &____identity_0; } inline void set__identity_0(ServerIdentity_t2342208608 * value) { ____identity_0 = value; Il2CppCodeGenWriteBarrier((&____identity_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // MARSHALBYREFOBJECT_T2760389100_H #ifndef APPDOMAINLEVELACTIVATOR_T643114572_H #define APPDOMAINLEVELACTIVATOR_T643114572_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Activation.AppDomainLevelActivator struct AppDomainLevelActivator_t643114572 : public RuntimeObject { public: // System.String System.Runtime.Remoting.Activation.AppDomainLevelActivator::_activationUrl String_t* ____activationUrl_0; // System.Runtime.Remoting.Activation.IActivator System.Runtime.Remoting.Activation.AppDomainLevelActivator::_next RuntimeObject* ____next_1; public: inline static int32_t get_offset_of__activationUrl_0() { return static_cast<int32_t>(offsetof(AppDomainLevelActivator_t643114572, ____activationUrl_0)); } inline String_t* get__activationUrl_0() const { return ____activationUrl_0; } inline String_t** get_address_of__activationUrl_0() { return &____activationUrl_0; } inline void set__activationUrl_0(String_t* value) { ____activationUrl_0 = value; Il2CppCodeGenWriteBarrier((&____activationUrl_0), value); } inline static int32_t get_offset_of__next_1() { return static_cast<int32_t>(offsetof(AppDomainLevelActivator_t643114572, ____next_1)); } inline RuntimeObject* get__next_1() const { return ____next_1; } inline RuntimeObject** get_address_of__next_1() { return &____next_1; } inline void set__next_1(RuntimeObject* value) { ____next_1 = value; Il2CppCodeGenWriteBarrier((&____next_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // APPDOMAINLEVELACTIVATOR_T643114572_H #ifndef CONTEXTLEVELACTIVATOR_T975223365_H #define CONTEXTLEVELACTIVATOR_T975223365_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Activation.ContextLevelActivator struct ContextLevelActivator_t975223365 : public RuntimeObject { public: // System.Runtime.Remoting.Activation.IActivator System.Runtime.Remoting.Activation.ContextLevelActivator::m_NextActivator RuntimeObject* ___m_NextActivator_0; public: inline static int32_t get_offset_of_m_NextActivator_0() { return static_cast<int32_t>(offsetof(ContextLevelActivator_t975223365, ___m_NextActivator_0)); } inline RuntimeObject* get_m_NextActivator_0() const { return ___m_NextActivator_0; } inline RuntimeObject** get_address_of_m_NextActivator_0() { return &___m_NextActivator_0; } inline void set_m_NextActivator_0(RuntimeObject* value) { ___m_NextActivator_0 = value; Il2CppCodeGenWriteBarrier((&___m_NextActivator_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONTEXTLEVELACTIVATOR_T975223365_H #ifndef CONSTRUCTIONLEVELACTIVATOR_T842337821_H #define CONSTRUCTIONLEVELACTIVATOR_T842337821_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Activation.ConstructionLevelActivator struct ConstructionLevelActivator_t842337821 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONSTRUCTIONLEVELACTIVATOR_T842337821_H #ifndef DYNAMICPROPERTYCOLLECTION_T652373272_H #define DYNAMICPROPERTYCOLLECTION_T652373272_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.DynamicPropertyCollection struct DynamicPropertyCollection_t652373272 : public RuntimeObject { public: // System.Collections.ArrayList System.Runtime.Remoting.Contexts.DynamicPropertyCollection::_properties ArrayList_t2718874744 * ____properties_0; public: inline static int32_t get_offset_of__properties_0() { return static_cast<int32_t>(offsetof(DynamicPropertyCollection_t652373272, ____properties_0)); } inline ArrayList_t2718874744 * get__properties_0() const { return ____properties_0; } inline ArrayList_t2718874744 ** get_address_of__properties_0() { return &____properties_0; } inline void set__properties_0(ArrayList_t2718874744 * value) { ____properties_0 = value; Il2CppCodeGenWriteBarrier((&____properties_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // DYNAMICPROPERTYCOLLECTION_T652373272_H #ifndef TYPELIBIMPORTCLASSATTRIBUTE_T3680361199_H #define TYPELIBIMPORTCLASSATTRIBUTE_T3680361199_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.TypeLibImportClassAttribute struct TypeLibImportClassAttribute_t3680361199 : public Attribute_t861562559 { public: // System.String System.Runtime.InteropServices.TypeLibImportClassAttribute::_importClass String_t* ____importClass_0; public: inline static int32_t get_offset_of__importClass_0() { return static_cast<int32_t>(offsetof(TypeLibImportClassAttribute_t3680361199, ____importClass_0)); } inline String_t* get__importClass_0() const { return ____importClass_0; } inline String_t** get_address_of__importClass_0() { return &____importClass_0; } inline void set__importClass_0(String_t* value) { ____importClass_0 = value; Il2CppCodeGenWriteBarrier((&____importClass_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // TYPELIBIMPORTCLASSATTRIBUTE_T3680361199_H #ifndef PRESERVESIGATTRIBUTE_T979468563_H #define PRESERVESIGATTRIBUTE_T979468563_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.PreserveSigAttribute struct PreserveSigAttribute_t979468563 : public Attribute_t861562559 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // PRESERVESIGATTRIBUTE_T979468563_H #ifndef METHODRETURNDICTIONARY_T2551046119_H #define METHODRETURNDICTIONARY_T2551046119_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.MethodReturnDictionary struct MethodReturnDictionary_t2551046119 : public MethodDictionary_t207894204 { public: public: }; struct MethodReturnDictionary_t2551046119_StaticFields { public: // System.String[] System.Runtime.Remoting.Messaging.MethodReturnDictionary::InternalReturnKeys StringU5BU5D_t1281789340* ___InternalReturnKeys_6; // System.String[] System.Runtime.Remoting.Messaging.MethodReturnDictionary::InternalExceptionKeys StringU5BU5D_t1281789340* ___InternalExceptionKeys_7; public: inline static int32_t get_offset_of_InternalReturnKeys_6() { return static_cast<int32_t>(offsetof(MethodReturnDictionary_t2551046119_StaticFields, ___InternalReturnKeys_6)); } inline StringU5BU5D_t1281789340* get_InternalReturnKeys_6() const { return ___InternalReturnKeys_6; } inline StringU5BU5D_t1281789340** get_address_of_InternalReturnKeys_6() { return &___InternalReturnKeys_6; } inline void set_InternalReturnKeys_6(StringU5BU5D_t1281789340* value) { ___InternalReturnKeys_6 = value; Il2CppCodeGenWriteBarrier((&___InternalReturnKeys_6), value); } inline static int32_t get_offset_of_InternalExceptionKeys_7() { return static_cast<int32_t>(offsetof(MethodReturnDictionary_t2551046119_StaticFields, ___InternalExceptionKeys_7)); } inline StringU5BU5D_t1281789340* get_InternalExceptionKeys_7() const { return ___InternalExceptionKeys_7; } inline StringU5BU5D_t1281789340** get_address_of_InternalExceptionKeys_7() { return &___InternalExceptionKeys_7; } inline void set_InternalExceptionKeys_7(StringU5BU5D_t1281789340* value) { ___InternalExceptionKeys_7 = value; Il2CppCodeGenWriteBarrier((&___InternalExceptionKeys_7), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // METHODRETURNDICTIONARY_T2551046119_H #ifndef TIMESPAN_T881159249_H #define TIMESPAN_T881159249_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.TimeSpan struct TimeSpan_t881159249 { public: // System.Int64 System.TimeSpan::_ticks int64_t ____ticks_3; public: inline static int32_t get_offset_of__ticks_3() { return static_cast<int32_t>(offsetof(TimeSpan_t881159249, ____ticks_3)); } inline int64_t get__ticks_3() const { return ____ticks_3; } inline int64_t* get_address_of__ticks_3() { return &____ticks_3; } inline void set__ticks_3(int64_t value) { ____ticks_3 = value; } }; struct TimeSpan_t881159249_StaticFields { public: // System.TimeSpan System.TimeSpan::MaxValue TimeSpan_t881159249 ___MaxValue_0; // System.TimeSpan System.TimeSpan::MinValue TimeSpan_t881159249 ___MinValue_1; // System.TimeSpan System.TimeSpan::Zero TimeSpan_t881159249 ___Zero_2; public: inline static int32_t get_offset_of_MaxValue_0() { return static_cast<int32_t>(offsetof(TimeSpan_t881159249_StaticFields, ___MaxValue_0)); } inline TimeSpan_t881159249 get_MaxValue_0() const { return ___MaxValue_0; } inline TimeSpan_t881159249 * get_address_of_MaxValue_0() { return &___MaxValue_0; } inline void set_MaxValue_0(TimeSpan_t881159249 value) { ___MaxValue_0 = value; } inline static int32_t get_offset_of_MinValue_1() { return static_cast<int32_t>(offsetof(TimeSpan_t881159249_StaticFields, ___MinValue_1)); } inline TimeSpan_t881159249 get_MinValue_1() const { return ___MinValue_1; } inline TimeSpan_t881159249 * get_address_of_MinValue_1() { return &___MinValue_1; } inline void set_MinValue_1(TimeSpan_t881159249 value) { ___MinValue_1 = value; } inline static int32_t get_offset_of_Zero_2() { return static_cast<int32_t>(offsetof(TimeSpan_t881159249_StaticFields, ___Zero_2)); } inline TimeSpan_t881159249 get_Zero_2() const { return ___Zero_2; } inline TimeSpan_t881159249 * get_address_of_Zero_2() { return &___Zero_2; } inline void set_Zero_2(TimeSpan_t881159249 value) { ___Zero_2 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // TIMESPAN_T881159249_H #ifndef CONTEXTBOUNDOBJECT_T1394786030_H #define CONTEXTBOUNDOBJECT_T1394786030_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.ContextBoundObject struct ContextBoundObject_t1394786030 : public MarshalByRefObject_t2760389100 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONTEXTBOUNDOBJECT_T1394786030_H #ifndef METHODCALLDICTIONARY_T605791082_H #define METHODCALLDICTIONARY_T605791082_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.MethodCallDictionary struct MethodCallDictionary_t605791082 : public MethodDictionary_t207894204 { public: public: }; struct MethodCallDictionary_t605791082_StaticFields { public: // System.String[] System.Runtime.Remoting.Messaging.MethodCallDictionary::InternalKeys StringU5BU5D_t1281789340* ___InternalKeys_6; public: inline static int32_t get_offset_of_InternalKeys_6() { return static_cast<int32_t>(offsetof(MethodCallDictionary_t605791082_StaticFields, ___InternalKeys_6)); } inline StringU5BU5D_t1281789340* get_InternalKeys_6() const { return ___InternalKeys_6; } inline StringU5BU5D_t1281789340** get_address_of_InternalKeys_6() { return &___InternalKeys_6; } inline void set_InternalKeys_6(StringU5BU5D_t1281789340* value) { ___InternalKeys_6 = value; Il2CppCodeGenWriteBarrier((&___InternalKeys_6), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // METHODCALLDICTIONARY_T605791082_H #ifndef CONSTRUCTIONCALL_T4011594745_H #define CONSTRUCTIONCALL_T4011594745_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.ConstructionCall struct ConstructionCall_t4011594745 : public MethodCall_t861078140 { public: // System.Runtime.Remoting.Activation.IActivator System.Runtime.Remoting.Messaging.ConstructionCall::_activator RuntimeObject* ____activator_11; // System.Object[] System.Runtime.Remoting.Messaging.ConstructionCall::_activationAttributes ObjectU5BU5D_t2843939325* ____activationAttributes_12; // System.Collections.IList System.Runtime.Remoting.Messaging.ConstructionCall::_contextProperties RuntimeObject* ____contextProperties_13; // System.Type System.Runtime.Remoting.Messaging.ConstructionCall::_activationType Type_t * ____activationType_14; // System.String System.Runtime.Remoting.Messaging.ConstructionCall::_activationTypeName String_t* ____activationTypeName_15; // System.Boolean System.Runtime.Remoting.Messaging.ConstructionCall::_isContextOk bool ____isContextOk_16; public: inline static int32_t get_offset_of__activator_11() { return static_cast<int32_t>(offsetof(ConstructionCall_t4011594745, ____activator_11)); } inline RuntimeObject* get__activator_11() const { return ____activator_11; } inline RuntimeObject** get_address_of__activator_11() { return &____activator_11; } inline void set__activator_11(RuntimeObject* value) { ____activator_11 = value; Il2CppCodeGenWriteBarrier((&____activator_11), value); } inline static int32_t get_offset_of__activationAttributes_12() { return static_cast<int32_t>(offsetof(ConstructionCall_t4011594745, ____activationAttributes_12)); } inline ObjectU5BU5D_t2843939325* get__activationAttributes_12() const { return ____activationAttributes_12; } inline ObjectU5BU5D_t2843939325** get_address_of__activationAttributes_12() { return &____activationAttributes_12; } inline void set__activationAttributes_12(ObjectU5BU5D_t2843939325* value) { ____activationAttributes_12 = value; Il2CppCodeGenWriteBarrier((&____activationAttributes_12), value); } inline static int32_t get_offset_of__contextProperties_13() { return static_cast<int32_t>(offsetof(ConstructionCall_t4011594745, ____contextProperties_13)); } inline RuntimeObject* get__contextProperties_13() const { return ____contextProperties_13; } inline RuntimeObject** get_address_of__contextProperties_13() { return &____contextProperties_13; } inline void set__contextProperties_13(RuntimeObject* value) { ____contextProperties_13 = value; Il2CppCodeGenWriteBarrier((&____contextProperties_13), value); } inline static int32_t get_offset_of__activationType_14() { return static_cast<int32_t>(offsetof(ConstructionCall_t4011594745, ____activationType_14)); } inline Type_t * get__activationType_14() const { return ____activationType_14; } inline Type_t ** get_address_of__activationType_14() { return &____activationType_14; } inline void set__activationType_14(Type_t * value) { ____activationType_14 = value; Il2CppCodeGenWriteBarrier((&____activationType_14), value); } inline static int32_t get_offset_of__activationTypeName_15() { return static_cast<int32_t>(offsetof(ConstructionCall_t4011594745, ____activationTypeName_15)); } inline String_t* get__activationTypeName_15() const { return ____activationTypeName_15; } inline String_t** get_address_of__activationTypeName_15() { return &____activationTypeName_15; } inline void set__activationTypeName_15(String_t* value) { ____activationTypeName_15 = value; Il2CppCodeGenWriteBarrier((&____activationTypeName_15), value); } inline static int32_t get_offset_of__isContextOk_16() { return static_cast<int32_t>(offsetof(ConstructionCall_t4011594745, ____isContextOk_16)); } inline bool get__isContextOk_16() const { return ____isContextOk_16; } inline bool* get_address_of__isContextOk_16() { return &____isContextOk_16; } inline void set__isContextOk_16(bool value) { ____isContextOk_16 = value; } }; struct ConstructionCall_t4011594745_StaticFields { public: // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Runtime.Remoting.Messaging.ConstructionCall::<>f__switch$map20 Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map20_17; public: inline static int32_t get_offset_of_U3CU3Ef__switchU24map20_17() { return static_cast<int32_t>(offsetof(ConstructionCall_t4011594745_StaticFields, ___U3CU3Ef__switchU24map20_17)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map20_17() const { return ___U3CU3Ef__switchU24map20_17; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map20_17() { return &___U3CU3Ef__switchU24map20_17; } inline void set_U3CU3Ef__switchU24map20_17(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map20_17 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map20_17), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONSTRUCTIONCALL_T4011594745_H #ifndef UINTPTR_T_H #define UINTPTR_T_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.UIntPtr struct UIntPtr_t { public: // System.Void* System.UIntPtr::_pointer void* ____pointer_1; public: inline static int32_t get_offset_of__pointer_1() { return static_cast<int32_t>(offsetof(UIntPtr_t, ____pointer_1)); } inline void* get__pointer_1() const { return ____pointer_1; } inline void** get_address_of__pointer_1() { return &____pointer_1; } inline void set__pointer_1(void* value) { ____pointer_1 = value; } }; struct UIntPtr_t_StaticFields { public: // System.UIntPtr System.UIntPtr::Zero UIntPtr_t ___Zero_0; public: inline static int32_t get_offset_of_Zero_0() { return static_cast<int32_t>(offsetof(UIntPtr_t_StaticFields, ___Zero_0)); } inline UIntPtr_t get_Zero_0() const { return ___Zero_0; } inline UIntPtr_t * get_address_of_Zero_0() { return &___Zero_0; } inline void set_Zero_0(UIntPtr_t value) { ___Zero_0 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // UINTPTR_T_H #ifndef CONSTRUCTIONCALLDICTIONARY_T686578562_H #define CONSTRUCTIONCALLDICTIONARY_T686578562_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.ConstructionCallDictionary struct ConstructionCallDictionary_t686578562 : public MethodDictionary_t207894204 { public: public: }; struct ConstructionCallDictionary_t686578562_StaticFields { public: // System.String[] System.Runtime.Remoting.Messaging.ConstructionCallDictionary::InternalKeys StringU5BU5D_t1281789340* ___InternalKeys_6; // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Runtime.Remoting.Messaging.ConstructionCallDictionary::<>f__switch$map23 Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map23_7; // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Runtime.Remoting.Messaging.ConstructionCallDictionary::<>f__switch$map24 Dictionary_2_t2736202052 * ___U3CU3Ef__switchU24map24_8; public: inline static int32_t get_offset_of_InternalKeys_6() { return static_cast<int32_t>(offsetof(ConstructionCallDictionary_t686578562_StaticFields, ___InternalKeys_6)); } inline StringU5BU5D_t1281789340* get_InternalKeys_6() const { return ___InternalKeys_6; } inline StringU5BU5D_t1281789340** get_address_of_InternalKeys_6() { return &___InternalKeys_6; } inline void set_InternalKeys_6(StringU5BU5D_t1281789340* value) { ___InternalKeys_6 = value; Il2CppCodeGenWriteBarrier((&___InternalKeys_6), value); } inline static int32_t get_offset_of_U3CU3Ef__switchU24map23_7() { return static_cast<int32_t>(offsetof(ConstructionCallDictionary_t686578562_StaticFields, ___U3CU3Ef__switchU24map23_7)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map23_7() const { return ___U3CU3Ef__switchU24map23_7; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map23_7() { return &___U3CU3Ef__switchU24map23_7; } inline void set_U3CU3Ef__switchU24map23_7(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map23_7 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map23_7), value); } inline static int32_t get_offset_of_U3CU3Ef__switchU24map24_8() { return static_cast<int32_t>(offsetof(ConstructionCallDictionary_t686578562_StaticFields, ___U3CU3Ef__switchU24map24_8)); } inline Dictionary_2_t2736202052 * get_U3CU3Ef__switchU24map24_8() const { return ___U3CU3Ef__switchU24map24_8; } inline Dictionary_2_t2736202052 ** get_address_of_U3CU3Ef__switchU24map24_8() { return &___U3CU3Ef__switchU24map24_8; } inline void set_U3CU3Ef__switchU24map24_8(Dictionary_2_t2736202052 * value) { ___U3CU3Ef__switchU24map24_8 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map24_8), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONSTRUCTIONCALLDICTIONARY_T686578562_H #ifndef REMOTEACTIVATOR_T2150046731_H #define REMOTEACTIVATOR_T2150046731_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Activation.RemoteActivator struct RemoteActivator_t2150046731 : public MarshalByRefObject_t2760389100 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // REMOTEACTIVATOR_T2150046731_H #ifndef SYSTEMEXCEPTION_T176217640_H #define SYSTEMEXCEPTION_T176217640_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.SystemException struct SystemException_t176217640 : public Exception_t1436737249 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // SYSTEMEXCEPTION_T176217640_H #ifndef ENUM_T4135868527_H #define ENUM_T4135868527_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Enum struct Enum_t4135868527 : public ValueType_t3640485471 { public: public: }; struct Enum_t4135868527_StaticFields { public: // System.Char[] System.Enum::split_char CharU5BU5D_t3528271667* ___split_char_0; public: inline static int32_t get_offset_of_split_char_0() { return static_cast<int32_t>(offsetof(Enum_t4135868527_StaticFields, ___split_char_0)); } inline CharU5BU5D_t3528271667* get_split_char_0() const { return ___split_char_0; } inline CharU5BU5D_t3528271667** get_address_of_split_char_0() { return &___split_char_0; } inline void set_split_char_0(CharU5BU5D_t3528271667* value) { ___split_char_0 = value; Il2CppCodeGenWriteBarrier((&___split_char_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif // Native definition for P/Invoke marshalling of System.Enum struct Enum_t4135868527_marshaled_pinvoke { }; // Native definition for COM marshalling of System.Enum struct Enum_t4135868527_marshaled_com { }; #endif // ENUM_T4135868527_H #ifndef CONTEXTATTRIBUTE_T1328788465_H #define CONTEXTATTRIBUTE_T1328788465_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.ContextAttribute struct ContextAttribute_t1328788465 : public Attribute_t861562559 { public: // System.String System.Runtime.Remoting.Contexts.ContextAttribute::AttributeName String_t* ___AttributeName_0; public: inline static int32_t get_offset_of_AttributeName_0() { return static_cast<int32_t>(offsetof(ContextAttribute_t1328788465, ___AttributeName_0)); } inline String_t* get_AttributeName_0() const { return ___AttributeName_0; } inline String_t** get_address_of_AttributeName_0() { return &___AttributeName_0; } inline void set_AttributeName_0(String_t* value) { ___AttributeName_0 = value; Il2CppCodeGenWriteBarrier((&___AttributeName_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONTEXTATTRIBUTE_T1328788465_H #ifndef INTPTR_T_H #define INTPTR_T_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.IntPtr struct IntPtr_t { public: // System.Void* System.IntPtr::m_value void* ___m_value_0; public: inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(IntPtr_t, ___m_value_0)); } inline void* get_m_value_0() const { return ___m_value_0; } inline void** get_address_of_m_value_0() { return &___m_value_0; } inline void set_m_value_0(void* value) { ___m_value_0 = value; } }; struct IntPtr_t_StaticFields { public: // System.IntPtr System.IntPtr::Zero IntPtr_t ___Zero_1; public: inline static int32_t get_offset_of_Zero_1() { return static_cast<int32_t>(offsetof(IntPtr_t_StaticFields, ___Zero_1)); } inline IntPtr_t get_Zero_1() const { return ___Zero_1; } inline IntPtr_t* get_address_of_Zero_1() { return &___Zero_1; } inline void set_Zero_1(IntPtr_t value) { ___Zero_1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // INTPTR_T_H #ifndef TYPELIBVERSIONATTRIBUTE_T570454682_H #define TYPELIBVERSIONATTRIBUTE_T570454682_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.TypeLibVersionAttribute struct TypeLibVersionAttribute_t570454682 : public Attribute_t861562559 { public: // System.Int32 System.Runtime.InteropServices.TypeLibVersionAttribute::major int32_t ___major_0; // System.Int32 System.Runtime.InteropServices.TypeLibVersionAttribute::minor int32_t ___minor_1; public: inline static int32_t get_offset_of_major_0() { return static_cast<int32_t>(offsetof(TypeLibVersionAttribute_t570454682, ___major_0)); } inline int32_t get_major_0() const { return ___major_0; } inline int32_t* get_address_of_major_0() { return &___major_0; } inline void set_major_0(int32_t value) { ___major_0 = value; } inline static int32_t get_offset_of_minor_1() { return static_cast<int32_t>(offsetof(TypeLibVersionAttribute_t570454682, ___minor_1)); } inline int32_t get_minor_1() const { return ___minor_1; } inline int32_t* get_address_of_minor_1() { return &___minor_1; } inline void set_minor_1(int32_t value) { ___minor_1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // TYPELIBVERSIONATTRIBUTE_T570454682_H #ifndef CALLINGCONVENTION_T1027624783_H #define CALLINGCONVENTION_T1027624783_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.CallingConvention struct CallingConvention_t1027624783 { public: // System.Int32 System.Runtime.InteropServices.CallingConvention::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(CallingConvention_t1027624783, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CALLINGCONVENTION_T1027624783_H #ifndef LIFETIMESERVICES_T3061370510_H #define LIFETIMESERVICES_T3061370510_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Lifetime.LifetimeServices struct LifetimeServices_t3061370510 : public RuntimeObject { public: public: }; struct LifetimeServices_t3061370510_StaticFields { public: // System.TimeSpan System.Runtime.Remoting.Lifetime.LifetimeServices::_leaseManagerPollTime TimeSpan_t881159249 ____leaseManagerPollTime_0; // System.TimeSpan System.Runtime.Remoting.Lifetime.LifetimeServices::_leaseTime TimeSpan_t881159249 ____leaseTime_1; // System.TimeSpan System.Runtime.Remoting.Lifetime.LifetimeServices::_renewOnCallTime TimeSpan_t881159249 ____renewOnCallTime_2; // System.TimeSpan System.Runtime.Remoting.Lifetime.LifetimeServices::_sponsorshipTimeout TimeSpan_t881159249 ____sponsorshipTimeout_3; // System.Runtime.Remoting.Lifetime.LeaseManager System.Runtime.Remoting.Lifetime.LifetimeServices::_leaseManager LeaseManager_t3648745595 * ____leaseManager_4; public: inline static int32_t get_offset_of__leaseManagerPollTime_0() { return static_cast<int32_t>(offsetof(LifetimeServices_t3061370510_StaticFields, ____leaseManagerPollTime_0)); } inline TimeSpan_t881159249 get__leaseManagerPollTime_0() const { return ____leaseManagerPollTime_0; } inline TimeSpan_t881159249 * get_address_of__leaseManagerPollTime_0() { return &____leaseManagerPollTime_0; } inline void set__leaseManagerPollTime_0(TimeSpan_t881159249 value) { ____leaseManagerPollTime_0 = value; } inline static int32_t get_offset_of__leaseTime_1() { return static_cast<int32_t>(offsetof(LifetimeServices_t3061370510_StaticFields, ____leaseTime_1)); } inline TimeSpan_t881159249 get__leaseTime_1() const { return ____leaseTime_1; } inline TimeSpan_t881159249 * get_address_of__leaseTime_1() { return &____leaseTime_1; } inline void set__leaseTime_1(TimeSpan_t881159249 value) { ____leaseTime_1 = value; } inline static int32_t get_offset_of__renewOnCallTime_2() { return static_cast<int32_t>(offsetof(LifetimeServices_t3061370510_StaticFields, ____renewOnCallTime_2)); } inline TimeSpan_t881159249 get__renewOnCallTime_2() const { return ____renewOnCallTime_2; } inline TimeSpan_t881159249 * get_address_of__renewOnCallTime_2() { return &____renewOnCallTime_2; } inline void set__renewOnCallTime_2(TimeSpan_t881159249 value) { ____renewOnCallTime_2 = value; } inline static int32_t get_offset_of__sponsorshipTimeout_3() { return static_cast<int32_t>(offsetof(LifetimeServices_t3061370510_StaticFields, ____sponsorshipTimeout_3)); } inline TimeSpan_t881159249 get__sponsorshipTimeout_3() const { return ____sponsorshipTimeout_3; } inline TimeSpan_t881159249 * get_address_of__sponsorshipTimeout_3() { return &____sponsorshipTimeout_3; } inline void set__sponsorshipTimeout_3(TimeSpan_t881159249 value) { ____sponsorshipTimeout_3 = value; } inline static int32_t get_offset_of__leaseManager_4() { return static_cast<int32_t>(offsetof(LifetimeServices_t3061370510_StaticFields, ____leaseManager_4)); } inline LeaseManager_t3648745595 * get__leaseManager_4() const { return ____leaseManager_4; } inline LeaseManager_t3648745595 ** get_address_of__leaseManager_4() { return &____leaseManager_4; } inline void set__leaseManager_4(LeaseManager_t3648745595 * value) { ____leaseManager_4 = value; Il2CppCodeGenWriteBarrier((&____leaseManager_4), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // LIFETIMESERVICES_T3061370510_H #ifndef ASYNCRESULT_T4194309572_H #define ASYNCRESULT_T4194309572_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.AsyncResult struct AsyncResult_t4194309572 : public RuntimeObject { public: // System.Object System.Runtime.Remoting.Messaging.AsyncResult::async_state RuntimeObject * ___async_state_0; // System.Threading.WaitHandle System.Runtime.Remoting.Messaging.AsyncResult::handle WaitHandle_t1743403487 * ___handle_1; // System.Object System.Runtime.Remoting.Messaging.AsyncResult::async_delegate RuntimeObject * ___async_delegate_2; // System.IntPtr System.Runtime.Remoting.Messaging.AsyncResult::data IntPtr_t ___data_3; // System.Object System.Runtime.Remoting.Messaging.AsyncResult::object_data RuntimeObject * ___object_data_4; // System.Boolean System.Runtime.Remoting.Messaging.AsyncResult::sync_completed bool ___sync_completed_5; // System.Boolean System.Runtime.Remoting.Messaging.AsyncResult::completed bool ___completed_6; // System.Boolean System.Runtime.Remoting.Messaging.AsyncResult::endinvoke_called bool ___endinvoke_called_7; // System.Object System.Runtime.Remoting.Messaging.AsyncResult::async_callback RuntimeObject * ___async_callback_8; // System.Threading.ExecutionContext System.Runtime.Remoting.Messaging.AsyncResult::current ExecutionContext_t1748372627 * ___current_9; // System.Threading.ExecutionContext System.Runtime.Remoting.Messaging.AsyncResult::original ExecutionContext_t1748372627 * ___original_10; // System.Int32 System.Runtime.Remoting.Messaging.AsyncResult::gchandle int32_t ___gchandle_11; // System.Runtime.Remoting.Messaging.MonoMethodMessage System.Runtime.Remoting.Messaging.AsyncResult::call_message MonoMethodMessage_t2807636944 * ___call_message_12; // System.Runtime.Remoting.Messaging.IMessageCtrl System.Runtime.Remoting.Messaging.AsyncResult::message_ctrl RuntimeObject* ___message_ctrl_13; // System.Runtime.Remoting.Messaging.IMessage System.Runtime.Remoting.Messaging.AsyncResult::reply_message RuntimeObject* ___reply_message_14; public: inline static int32_t get_offset_of_async_state_0() { return static_cast<int32_t>(offsetof(AsyncResult_t4194309572, ___async_state_0)); } inline RuntimeObject * get_async_state_0() const { return ___async_state_0; } inline RuntimeObject ** get_address_of_async_state_0() { return &___async_state_0; } inline void set_async_state_0(RuntimeObject * value) { ___async_state_0 = value; Il2CppCodeGenWriteBarrier((&___async_state_0), value); } inline static int32_t get_offset_of_handle_1() { return static_cast<int32_t>(offsetof(AsyncResult_t4194309572, ___handle_1)); } inline WaitHandle_t1743403487 * get_handle_1() const { return ___handle_1; } inline WaitHandle_t1743403487 ** get_address_of_handle_1() { return &___handle_1; } inline void set_handle_1(WaitHandle_t1743403487 * value) { ___handle_1 = value; Il2CppCodeGenWriteBarrier((&___handle_1), value); } inline static int32_t get_offset_of_async_delegate_2() { return static_cast<int32_t>(offsetof(AsyncResult_t4194309572, ___async_delegate_2)); } inline RuntimeObject * get_async_delegate_2() const { return ___async_delegate_2; } inline RuntimeObject ** get_address_of_async_delegate_2() { return &___async_delegate_2; } inline void set_async_delegate_2(RuntimeObject * value) { ___async_delegate_2 = value; Il2CppCodeGenWriteBarrier((&___async_delegate_2), value); } inline static int32_t get_offset_of_data_3() { return static_cast<int32_t>(offsetof(AsyncResult_t4194309572, ___data_3)); } inline IntPtr_t get_data_3() const { return ___data_3; } inline IntPtr_t* get_address_of_data_3() { return &___data_3; } inline void set_data_3(IntPtr_t value) { ___data_3 = value; } inline static int32_t get_offset_of_object_data_4() { return static_cast<int32_t>(offsetof(AsyncResult_t4194309572, ___object_data_4)); } inline RuntimeObject * get_object_data_4() const { return ___object_data_4; } inline RuntimeObject ** get_address_of_object_data_4() { return &___object_data_4; } inline void set_object_data_4(RuntimeObject * value) { ___object_data_4 = value; Il2CppCodeGenWriteBarrier((&___object_data_4), value); } inline static int32_t get_offset_of_sync_completed_5() { return static_cast<int32_t>(offsetof(AsyncResult_t4194309572, ___sync_completed_5)); } inline bool get_sync_completed_5() const { return ___sync_completed_5; } inline bool* get_address_of_sync_completed_5() { return &___sync_completed_5; } inline void set_sync_completed_5(bool value) { ___sync_completed_5 = value; } inline static int32_t get_offset_of_completed_6() { return static_cast<int32_t>(offsetof(AsyncResult_t4194309572, ___completed_6)); } inline bool get_completed_6() const { return ___completed_6; } inline bool* get_address_of_completed_6() { return &___completed_6; } inline void set_completed_6(bool value) { ___completed_6 = value; } inline static int32_t get_offset_of_endinvoke_called_7() { return static_cast<int32_t>(offsetof(AsyncResult_t4194309572, ___endinvoke_called_7)); } inline bool get_endinvoke_called_7() const { return ___endinvoke_called_7; } inline bool* get_address_of_endinvoke_called_7() { return &___endinvoke_called_7; } inline void set_endinvoke_called_7(bool value) { ___endinvoke_called_7 = value; } inline static int32_t get_offset_of_async_callback_8() { return static_cast<int32_t>(offsetof(AsyncResult_t4194309572, ___async_callback_8)); } inline RuntimeObject * get_async_callback_8() const { return ___async_callback_8; } inline RuntimeObject ** get_address_of_async_callback_8() { return &___async_callback_8; } inline void set_async_callback_8(RuntimeObject * value) { ___async_callback_8 = value; Il2CppCodeGenWriteBarrier((&___async_callback_8), value); } inline static int32_t get_offset_of_current_9() { return static_cast<int32_t>(offsetof(AsyncResult_t4194309572, ___current_9)); } inline ExecutionContext_t1748372627 * get_current_9() const { return ___current_9; } inline ExecutionContext_t1748372627 ** get_address_of_current_9() { return &___current_9; } inline void set_current_9(ExecutionContext_t1748372627 * value) { ___current_9 = value; Il2CppCodeGenWriteBarrier((&___current_9), value); } inline static int32_t get_offset_of_original_10() { return static_cast<int32_t>(offsetof(AsyncResult_t4194309572, ___original_10)); } inline ExecutionContext_t1748372627 * get_original_10() const { return ___original_10; } inline ExecutionContext_t1748372627 ** get_address_of_original_10() { return &___original_10; } inline void set_original_10(ExecutionContext_t1748372627 * value) { ___original_10 = value; Il2CppCodeGenWriteBarrier((&___original_10), value); } inline static int32_t get_offset_of_gchandle_11() { return static_cast<int32_t>(offsetof(AsyncResult_t4194309572, ___gchandle_11)); } inline int32_t get_gchandle_11() const { return ___gchandle_11; } inline int32_t* get_address_of_gchandle_11() { return &___gchandle_11; } inline void set_gchandle_11(int32_t value) { ___gchandle_11 = value; } inline static int32_t get_offset_of_call_message_12() { return static_cast<int32_t>(offsetof(AsyncResult_t4194309572, ___call_message_12)); } inline MonoMethodMessage_t2807636944 * get_call_message_12() const { return ___call_message_12; } inline MonoMethodMessage_t2807636944 ** get_address_of_call_message_12() { return &___call_message_12; } inline void set_call_message_12(MonoMethodMessage_t2807636944 * value) { ___call_message_12 = value; Il2CppCodeGenWriteBarrier((&___call_message_12), value); } inline static int32_t get_offset_of_message_ctrl_13() { return static_cast<int32_t>(offsetof(AsyncResult_t4194309572, ___message_ctrl_13)); } inline RuntimeObject* get_message_ctrl_13() const { return ___message_ctrl_13; } inline RuntimeObject** get_address_of_message_ctrl_13() { return &___message_ctrl_13; } inline void set_message_ctrl_13(RuntimeObject* value) { ___message_ctrl_13 = value; Il2CppCodeGenWriteBarrier((&___message_ctrl_13), value); } inline static int32_t get_offset_of_reply_message_14() { return static_cast<int32_t>(offsetof(AsyncResult_t4194309572, ___reply_message_14)); } inline RuntimeObject* get_reply_message_14() const { return ___reply_message_14; } inline RuntimeObject** get_address_of_reply_message_14() { return &___reply_message_14; } inline void set_reply_message_14(RuntimeObject* value) { ___reply_message_14 = value; Il2CppCodeGenWriteBarrier((&___reply_message_14), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // ASYNCRESULT_T4194309572_H #ifndef ARGINFOTYPE_T1035054221_H #define ARGINFOTYPE_T1035054221_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.ArgInfoType struct ArgInfoType_t1035054221 { public: // System.Byte System.Runtime.Remoting.Messaging.ArgInfoType::value__ uint8_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(ArgInfoType_t1035054221, ___value___1)); } inline uint8_t get_value___1() const { return ___value___1; } inline uint8_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(uint8_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // ARGINFOTYPE_T1035054221_H #ifndef SYNCHRONIZATIONATTRIBUTE_T3946661254_H #define SYNCHRONIZATIONATTRIBUTE_T3946661254_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.SynchronizationAttribute struct SynchronizationAttribute_t3946661254 : public ContextAttribute_t1328788465 { public: // System.Boolean System.Runtime.Remoting.Contexts.SynchronizationAttribute::_bReEntrant bool ____bReEntrant_1; // System.Int32 System.Runtime.Remoting.Contexts.SynchronizationAttribute::_flavor int32_t ____flavor_2; // System.Int32 System.Runtime.Remoting.Contexts.SynchronizationAttribute::_lockCount int32_t ____lockCount_3; // System.Threading.Mutex System.Runtime.Remoting.Contexts.SynchronizationAttribute::_mutex Mutex_t3066672582 * ____mutex_4; // System.Threading.Thread System.Runtime.Remoting.Contexts.SynchronizationAttribute::_ownerThread Thread_t2300836069 * ____ownerThread_5; public: inline static int32_t get_offset_of__bReEntrant_1() { return static_cast<int32_t>(offsetof(SynchronizationAttribute_t3946661254, ____bReEntrant_1)); } inline bool get__bReEntrant_1() const { return ____bReEntrant_1; } inline bool* get_address_of__bReEntrant_1() { return &____bReEntrant_1; } inline void set__bReEntrant_1(bool value) { ____bReEntrant_1 = value; } inline static int32_t get_offset_of__flavor_2() { return static_cast<int32_t>(offsetof(SynchronizationAttribute_t3946661254, ____flavor_2)); } inline int32_t get__flavor_2() const { return ____flavor_2; } inline int32_t* get_address_of__flavor_2() { return &____flavor_2; } inline void set__flavor_2(int32_t value) { ____flavor_2 = value; } inline static int32_t get_offset_of__lockCount_3() { return static_cast<int32_t>(offsetof(SynchronizationAttribute_t3946661254, ____lockCount_3)); } inline int32_t get__lockCount_3() const { return ____lockCount_3; } inline int32_t* get_address_of__lockCount_3() { return &____lockCount_3; } inline void set__lockCount_3(int32_t value) { ____lockCount_3 = value; } inline static int32_t get_offset_of__mutex_4() { return static_cast<int32_t>(offsetof(SynchronizationAttribute_t3946661254, ____mutex_4)); } inline Mutex_t3066672582 * get__mutex_4() const { return ____mutex_4; } inline Mutex_t3066672582 ** get_address_of__mutex_4() { return &____mutex_4; } inline void set__mutex_4(Mutex_t3066672582 * value) { ____mutex_4 = value; Il2CppCodeGenWriteBarrier((&____mutex_4), value); } inline static int32_t get_offset_of__ownerThread_5() { return static_cast<int32_t>(offsetof(SynchronizationAttribute_t3946661254, ____ownerThread_5)); } inline Thread_t2300836069 * get__ownerThread_5() const { return ____ownerThread_5; } inline Thread_t2300836069 ** get_address_of__ownerThread_5() { return &____ownerThread_5; } inline void set__ownerThread_5(Thread_t2300836069 * value) { ____ownerThread_5 = value; Il2CppCodeGenWriteBarrier((&____ownerThread_5), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // SYNCHRONIZATIONATTRIBUTE_T3946661254_H #ifndef CONTEXTCALLBACKOBJECT_T2292721408_H #define CONTEXTCALLBACKOBJECT_T2292721408_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.ContextCallbackObject struct ContextCallbackObject_t2292721408 : public ContextBoundObject_t1394786030 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONTEXTCALLBACKOBJECT_T2292721408_H #ifndef CONTEXT_T3285446944_H #define CONTEXT_T3285446944_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.Context struct Context_t3285446944 : public RuntimeObject { public: // System.Int32 System.Runtime.Remoting.Contexts.Context::domain_id int32_t ___domain_id_0; // System.Int32 System.Runtime.Remoting.Contexts.Context::context_id int32_t ___context_id_1; // System.UIntPtr System.Runtime.Remoting.Contexts.Context::static_data UIntPtr_t ___static_data_2; // System.Runtime.Remoting.Messaging.IMessageSink System.Runtime.Remoting.Contexts.Context::server_context_sink_chain RuntimeObject* ___server_context_sink_chain_4; // System.Runtime.Remoting.Messaging.IMessageSink System.Runtime.Remoting.Contexts.Context::client_context_sink_chain RuntimeObject* ___client_context_sink_chain_5; // System.Object[] System.Runtime.Remoting.Contexts.Context::datastore ObjectU5BU5D_t2843939325* ___datastore_6; // System.Collections.ArrayList System.Runtime.Remoting.Contexts.Context::context_properties ArrayList_t2718874744 * ___context_properties_7; // System.Boolean System.Runtime.Remoting.Contexts.Context::frozen bool ___frozen_8; // System.Runtime.Remoting.Contexts.DynamicPropertyCollection System.Runtime.Remoting.Contexts.Context::context_dynamic_properties DynamicPropertyCollection_t652373272 * ___context_dynamic_properties_12; // System.Runtime.Remoting.Contexts.ContextCallbackObject System.Runtime.Remoting.Contexts.Context::callback_object ContextCallbackObject_t2292721408 * ___callback_object_13; public: inline static int32_t get_offset_of_domain_id_0() { return static_cast<int32_t>(offsetof(Context_t3285446944, ___domain_id_0)); } inline int32_t get_domain_id_0() const { return ___domain_id_0; } inline int32_t* get_address_of_domain_id_0() { return &___domain_id_0; } inline void set_domain_id_0(int32_t value) { ___domain_id_0 = value; } inline static int32_t get_offset_of_context_id_1() { return static_cast<int32_t>(offsetof(Context_t3285446944, ___context_id_1)); } inline int32_t get_context_id_1() const { return ___context_id_1; } inline int32_t* get_address_of_context_id_1() { return &___context_id_1; } inline void set_context_id_1(int32_t value) { ___context_id_1 = value; } inline static int32_t get_offset_of_static_data_2() { return static_cast<int32_t>(offsetof(Context_t3285446944, ___static_data_2)); } inline UIntPtr_t get_static_data_2() const { return ___static_data_2; } inline UIntPtr_t * get_address_of_static_data_2() { return &___static_data_2; } inline void set_static_data_2(UIntPtr_t value) { ___static_data_2 = value; } inline static int32_t get_offset_of_server_context_sink_chain_4() { return static_cast<int32_t>(offsetof(Context_t3285446944, ___server_context_sink_chain_4)); } inline RuntimeObject* get_server_context_sink_chain_4() const { return ___server_context_sink_chain_4; } inline RuntimeObject** get_address_of_server_context_sink_chain_4() { return &___server_context_sink_chain_4; } inline void set_server_context_sink_chain_4(RuntimeObject* value) { ___server_context_sink_chain_4 = value; Il2CppCodeGenWriteBarrier((&___server_context_sink_chain_4), value); } inline static int32_t get_offset_of_client_context_sink_chain_5() { return static_cast<int32_t>(offsetof(Context_t3285446944, ___client_context_sink_chain_5)); } inline RuntimeObject* get_client_context_sink_chain_5() const { return ___client_context_sink_chain_5; } inline RuntimeObject** get_address_of_client_context_sink_chain_5() { return &___client_context_sink_chain_5; } inline void set_client_context_sink_chain_5(RuntimeObject* value) { ___client_context_sink_chain_5 = value; Il2CppCodeGenWriteBarrier((&___client_context_sink_chain_5), value); } inline static int32_t get_offset_of_datastore_6() { return static_cast<int32_t>(offsetof(Context_t3285446944, ___datastore_6)); } inline ObjectU5BU5D_t2843939325* get_datastore_6() const { return ___datastore_6; } inline ObjectU5BU5D_t2843939325** get_address_of_datastore_6() { return &___datastore_6; } inline void set_datastore_6(ObjectU5BU5D_t2843939325* value) { ___datastore_6 = value; Il2CppCodeGenWriteBarrier((&___datastore_6), value); } inline static int32_t get_offset_of_context_properties_7() { return static_cast<int32_t>(offsetof(Context_t3285446944, ___context_properties_7)); } inline ArrayList_t2718874744 * get_context_properties_7() const { return ___context_properties_7; } inline ArrayList_t2718874744 ** get_address_of_context_properties_7() { return &___context_properties_7; } inline void set_context_properties_7(ArrayList_t2718874744 * value) { ___context_properties_7 = value; Il2CppCodeGenWriteBarrier((&___context_properties_7), value); } inline static int32_t get_offset_of_frozen_8() { return static_cast<int32_t>(offsetof(Context_t3285446944, ___frozen_8)); } inline bool get_frozen_8() const { return ___frozen_8; } inline bool* get_address_of_frozen_8() { return &___frozen_8; } inline void set_frozen_8(bool value) { ___frozen_8 = value; } inline static int32_t get_offset_of_context_dynamic_properties_12() { return static_cast<int32_t>(offsetof(Context_t3285446944, ___context_dynamic_properties_12)); } inline DynamicPropertyCollection_t652373272 * get_context_dynamic_properties_12() const { return ___context_dynamic_properties_12; } inline DynamicPropertyCollection_t652373272 ** get_address_of_context_dynamic_properties_12() { return &___context_dynamic_properties_12; } inline void set_context_dynamic_properties_12(DynamicPropertyCollection_t652373272 * value) { ___context_dynamic_properties_12 = value; Il2CppCodeGenWriteBarrier((&___context_dynamic_properties_12), value); } inline static int32_t get_offset_of_callback_object_13() { return static_cast<int32_t>(offsetof(Context_t3285446944, ___callback_object_13)); } inline ContextCallbackObject_t2292721408 * get_callback_object_13() const { return ___callback_object_13; } inline ContextCallbackObject_t2292721408 ** get_address_of_callback_object_13() { return &___callback_object_13; } inline void set_callback_object_13(ContextCallbackObject_t2292721408 * value) { ___callback_object_13 = value; Il2CppCodeGenWriteBarrier((&___callback_object_13), value); } }; struct Context_t3285446944_StaticFields { public: // System.Runtime.Remoting.Messaging.IMessageSink System.Runtime.Remoting.Contexts.Context::default_server_context_sink RuntimeObject* ___default_server_context_sink_3; // System.Int32 System.Runtime.Remoting.Contexts.Context::global_count int32_t ___global_count_9; // System.Collections.Hashtable System.Runtime.Remoting.Contexts.Context::namedSlots Hashtable_t1853889766 * ___namedSlots_10; // System.Runtime.Remoting.Contexts.DynamicPropertyCollection System.Runtime.Remoting.Contexts.Context::global_dynamic_properties DynamicPropertyCollection_t652373272 * ___global_dynamic_properties_11; public: inline static int32_t get_offset_of_default_server_context_sink_3() { return static_cast<int32_t>(offsetof(Context_t3285446944_StaticFields, ___default_server_context_sink_3)); } inline RuntimeObject* get_default_server_context_sink_3() const { return ___default_server_context_sink_3; } inline RuntimeObject** get_address_of_default_server_context_sink_3() { return &___default_server_context_sink_3; } inline void set_default_server_context_sink_3(RuntimeObject* value) { ___default_server_context_sink_3 = value; Il2CppCodeGenWriteBarrier((&___default_server_context_sink_3), value); } inline static int32_t get_offset_of_global_count_9() { return static_cast<int32_t>(offsetof(Context_t3285446944_StaticFields, ___global_count_9)); } inline int32_t get_global_count_9() const { return ___global_count_9; } inline int32_t* get_address_of_global_count_9() { return &___global_count_9; } inline void set_global_count_9(int32_t value) { ___global_count_9 = value; } inline static int32_t get_offset_of_namedSlots_10() { return static_cast<int32_t>(offsetof(Context_t3285446944_StaticFields, ___namedSlots_10)); } inline Hashtable_t1853889766 * get_namedSlots_10() const { return ___namedSlots_10; } inline Hashtable_t1853889766 ** get_address_of_namedSlots_10() { return &___namedSlots_10; } inline void set_namedSlots_10(Hashtable_t1853889766 * value) { ___namedSlots_10 = value; Il2CppCodeGenWriteBarrier((&___namedSlots_10), value); } inline static int32_t get_offset_of_global_dynamic_properties_11() { return static_cast<int32_t>(offsetof(Context_t3285446944_StaticFields, ___global_dynamic_properties_11)); } inline DynamicPropertyCollection_t652373272 * get_global_dynamic_properties_11() const { return ___global_dynamic_properties_11; } inline DynamicPropertyCollection_t652373272 ** get_address_of_global_dynamic_properties_11() { return &___global_dynamic_properties_11; } inline void set_global_dynamic_properties_11(DynamicPropertyCollection_t652373272 * value) { ___global_dynamic_properties_11 = value; Il2CppCodeGenWriteBarrier((&___global_dynamic_properties_11), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONTEXT_T3285446944_H #ifndef URLATTRIBUTE_T221584584_H #define URLATTRIBUTE_T221584584_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Activation.UrlAttribute struct UrlAttribute_t221584584 : public ContextAttribute_t1328788465 { public: // System.String System.Runtime.Remoting.Activation.UrlAttribute::url String_t* ___url_1; public: inline static int32_t get_offset_of_url_1() { return static_cast<int32_t>(offsetof(UrlAttribute_t221584584, ___url_1)); } inline String_t* get_url_1() const { return ___url_1; } inline String_t** get_address_of_url_1() { return &___url_1; } inline void set_url_1(String_t* value) { ___url_1 = value; Il2CppCodeGenWriteBarrier((&___url_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // URLATTRIBUTE_T221584584_H #ifndef UNMANAGEDTYPE_T523127242_H #define UNMANAGEDTYPE_T523127242_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.UnmanagedType struct UnmanagedType_t523127242 { public: // System.Int32 System.Runtime.InteropServices.UnmanagedType::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(UnmanagedType_t523127242, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // UNMANAGEDTYPE_T523127242_H #ifndef SAFEHANDLE_T3273388951_H #define SAFEHANDLE_T3273388951_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.SafeHandle struct SafeHandle_t3273388951 : public CriticalFinalizerObject_t701527852 { public: // System.IntPtr System.Runtime.InteropServices.SafeHandle::handle IntPtr_t ___handle_0; // System.IntPtr System.Runtime.InteropServices.SafeHandle::invalid_handle_value IntPtr_t ___invalid_handle_value_1; // System.Int32 System.Runtime.InteropServices.SafeHandle::refcount int32_t ___refcount_2; // System.Boolean System.Runtime.InteropServices.SafeHandle::owns_handle bool ___owns_handle_3; public: inline static int32_t get_offset_of_handle_0() { return static_cast<int32_t>(offsetof(SafeHandle_t3273388951, ___handle_0)); } inline IntPtr_t get_handle_0() const { return ___handle_0; } inline IntPtr_t* get_address_of_handle_0() { return &___handle_0; } inline void set_handle_0(IntPtr_t value) { ___handle_0 = value; } inline static int32_t get_offset_of_invalid_handle_value_1() { return static_cast<int32_t>(offsetof(SafeHandle_t3273388951, ___invalid_handle_value_1)); } inline IntPtr_t get_invalid_handle_value_1() const { return ___invalid_handle_value_1; } inline IntPtr_t* get_address_of_invalid_handle_value_1() { return &___invalid_handle_value_1; } inline void set_invalid_handle_value_1(IntPtr_t value) { ___invalid_handle_value_1 = value; } inline static int32_t get_offset_of_refcount_2() { return static_cast<int32_t>(offsetof(SafeHandle_t3273388951, ___refcount_2)); } inline int32_t get_refcount_2() const { return ___refcount_2; } inline int32_t* get_address_of_refcount_2() { return &___refcount_2; } inline void set_refcount_2(int32_t value) { ___refcount_2 = value; } inline static int32_t get_offset_of_owns_handle_3() { return static_cast<int32_t>(offsetof(SafeHandle_t3273388951, ___owns_handle_3)); } inline bool get_owns_handle_3() const { return ___owns_handle_3; } inline bool* get_address_of_owns_handle_3() { return &___owns_handle_3; } inline void set_owns_handle_3(bool value) { ___owns_handle_3 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // SAFEHANDLE_T3273388951_H #ifndef MARSHALDIRECTIVEEXCEPTION_T2580336406_H #define MARSHALDIRECTIVEEXCEPTION_T2580336406_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.MarshalDirectiveException struct MarshalDirectiveException_t2580336406 : public SystemException_t176217640 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // MARSHALDIRECTIVEEXCEPTION_T2580336406_H #ifndef COMINTERFACETYPE_T2732813453_H #define COMINTERFACETYPE_T2732813453_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.ComInterfaceType struct ComInterfaceType_t2732813453 { public: // System.Int32 System.Runtime.InteropServices.ComInterfaceType::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(ComInterfaceType_t2732813453, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // COMINTERFACETYPE_T2732813453_H #ifndef UNMANAGEDFUNCTIONPOINTERATTRIBUTE_T1554680451_H #define UNMANAGEDFUNCTIONPOINTERATTRIBUTE_T1554680451_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute struct UnmanagedFunctionPointerAttribute_t1554680451 : public Attribute_t861562559 { public: // System.Runtime.InteropServices.CallingConvention System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute::call_conv int32_t ___call_conv_0; public: inline static int32_t get_offset_of_call_conv_0() { return static_cast<int32_t>(offsetof(UnmanagedFunctionPointerAttribute_t1554680451, ___call_conv_0)); } inline int32_t get_call_conv_0() const { return ___call_conv_0; } inline int32_t* get_address_of_call_conv_0() { return &___call_conv_0; } inline void set_call_conv_0(int32_t value) { ___call_conv_0 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // UNMANAGEDFUNCTIONPOINTERATTRIBUTE_T1554680451_H #ifndef INTERFACETYPEATTRIBUTE_T633123336_H #define INTERFACETYPEATTRIBUTE_T633123336_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.InterfaceTypeAttribute struct InterfaceTypeAttribute_t633123336 : public Attribute_t861562559 { public: // System.Runtime.InteropServices.ComInterfaceType System.Runtime.InteropServices.InterfaceTypeAttribute::intType int32_t ___intType_0; public: inline static int32_t get_offset_of_intType_0() { return static_cast<int32_t>(offsetof(InterfaceTypeAttribute_t633123336, ___intType_0)); } inline int32_t get_intType_0() const { return ___intType_0; } inline int32_t* get_address_of_intType_0() { return &___intType_0; } inline void set_intType_0(int32_t value) { ___intType_0 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // INTERFACETYPEATTRIBUTE_T633123336_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize400 = { sizeof (InterfaceTypeAttribute_t633123336), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable400[1] = { InterfaceTypeAttribute_t633123336::get_offset_of_intType_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize401 = { sizeof (Marshal_t1757017490), -1, sizeof(Marshal_t1757017490_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable401[2] = { Marshal_t1757017490_StaticFields::get_offset_of_SystemMaxDBCSCharSize_0(), Marshal_t1757017490_StaticFields::get_offset_of_SystemDefaultCharSize_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize402 = { sizeof (MarshalDirectiveException_t2580336406), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable402[1] = { 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize403 = { sizeof (PreserveSigAttribute_t979468563), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize404 = { sizeof (SafeHandle_t3273388951), sizeof(void*), 0, 0 }; extern const int32_t g_FieldOffsetTable404[4] = { SafeHandle_t3273388951::get_offset_of_handle_0(), SafeHandle_t3273388951::get_offset_of_invalid_handle_value_1(), SafeHandle_t3273388951::get_offset_of_refcount_2(), SafeHandle_t3273388951::get_offset_of_owns_handle_3(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize405 = { sizeof (TypeLibImportClassAttribute_t3680361199), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable405[1] = { TypeLibImportClassAttribute_t3680361199::get_offset_of__importClass_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize406 = { sizeof (TypeLibVersionAttribute_t570454682), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable406[2] = { TypeLibVersionAttribute_t570454682::get_offset_of_major_0(), TypeLibVersionAttribute_t570454682::get_offset_of_minor_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize407 = { sizeof (UnmanagedFunctionPointerAttribute_t1554680451), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable407[1] = { UnmanagedFunctionPointerAttribute_t1554680451::get_offset_of_call_conv_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize408 = { sizeof (UnmanagedType_t523127242)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable408[36] = { UnmanagedType_t523127242::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize409 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize410 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize411 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize412 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize413 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize414 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize415 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize416 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize417 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize418 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize419 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize420 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize421 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize422 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize423 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize424 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize425 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize426 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize427 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize428 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize429 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize430 = { sizeof (ActivationServices_t4161385317), -1, sizeof(ActivationServices_t4161385317_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable430[1] = { ActivationServices_t4161385317_StaticFields::get_offset_of__constructionActivator_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize431 = { sizeof (AppDomainLevelActivator_t643114572), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable431[2] = { AppDomainLevelActivator_t643114572::get_offset_of__activationUrl_0(), AppDomainLevelActivator_t643114572::get_offset_of__next_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize432 = { sizeof (ConstructionLevelActivator_t842337821), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize433 = { sizeof (ContextLevelActivator_t975223365), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable433[1] = { ContextLevelActivator_t975223365::get_offset_of_m_NextActivator_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize434 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize435 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize436 = { sizeof (RemoteActivator_t2150046731), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize437 = { sizeof (UrlAttribute_t221584584), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable437[1] = { UrlAttribute_t221584584::get_offset_of_url_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize438 = { sizeof (ChannelInfo_t2064577689), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable438[1] = { ChannelInfo_t2064577689::get_offset_of_channelData_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize439 = { sizeof (ChannelServices_t3942013484), -1, sizeof(ChannelServices_t3942013484_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable439[5] = { ChannelServices_t3942013484_StaticFields::get_offset_of_registeredChannels_0(), ChannelServices_t3942013484_StaticFields::get_offset_of_delayedClientChannels_1(), ChannelServices_t3942013484_StaticFields::get_offset_of__crossContextSink_2(), ChannelServices_t3942013484_StaticFields::get_offset_of_CrossContextUrl_3(), ChannelServices_t3942013484_StaticFields::get_offset_of_oldStartModeTypes_4(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize440 = { sizeof (CrossAppDomainData_t2130208023), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable440[3] = { CrossAppDomainData_t2130208023::get_offset_of__ContextID_0(), CrossAppDomainData_t2130208023::get_offset_of__DomainID_1(), CrossAppDomainData_t2130208023::get_offset_of__processGuid_2(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize441 = { sizeof (CrossAppDomainChannel_t1606809047), -1, sizeof(CrossAppDomainChannel_t1606809047_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable441[1] = { CrossAppDomainChannel_t1606809047_StaticFields::get_offset_of_s_lock_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize442 = { sizeof (CrossAppDomainSink_t2177102621), -1, sizeof(CrossAppDomainSink_t2177102621_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable442[3] = { CrossAppDomainSink_t2177102621_StaticFields::get_offset_of_s_sinks_0(), CrossAppDomainSink_t2177102621_StaticFields::get_offset_of_processMessageMethod_1(), CrossAppDomainSink_t2177102621::get_offset_of__domainID_2(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize443 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize444 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize445 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize446 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize447 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize448 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize449 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize450 = { sizeof (SinkProviderData_t4151372974), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable450[3] = { SinkProviderData_t4151372974::get_offset_of_sinkName_0(), SinkProviderData_t4151372974::get_offset_of_children_1(), SinkProviderData_t4151372974::get_offset_of_properties_2(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize451 = { sizeof (Context_t3285446944), -1, sizeof(Context_t3285446944_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable451[14] = { Context_t3285446944::get_offset_of_domain_id_0(), Context_t3285446944::get_offset_of_context_id_1(), Context_t3285446944::get_offset_of_static_data_2(), Context_t3285446944_StaticFields::get_offset_of_default_server_context_sink_3(), Context_t3285446944::get_offset_of_server_context_sink_chain_4(), Context_t3285446944::get_offset_of_client_context_sink_chain_5(), Context_t3285446944::get_offset_of_datastore_6(), Context_t3285446944::get_offset_of_context_properties_7(), Context_t3285446944::get_offset_of_frozen_8(), Context_t3285446944_StaticFields::get_offset_of_global_count_9(), Context_t3285446944_StaticFields::get_offset_of_namedSlots_10(), Context_t3285446944_StaticFields::get_offset_of_global_dynamic_properties_11(), Context_t3285446944::get_offset_of_context_dynamic_properties_12(), Context_t3285446944::get_offset_of_callback_object_13(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize452 = { sizeof (DynamicPropertyCollection_t652373272), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable452[1] = { DynamicPropertyCollection_t652373272::get_offset_of__properties_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize453 = { sizeof (DynamicPropertyReg_t4086779412), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable453[2] = { DynamicPropertyReg_t4086779412::get_offset_of_Property_0(), DynamicPropertyReg_t4086779412::get_offset_of_Sink_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize454 = { sizeof (ContextCallbackObject_t2292721408), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize455 = { sizeof (ContextAttribute_t1328788465), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable455[1] = { ContextAttribute_t1328788465::get_offset_of_AttributeName_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize456 = { sizeof (CrossContextChannel_t4063984580), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize457 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize458 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize459 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize460 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize461 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize462 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize463 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize464 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize465 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize466 = { sizeof (SynchronizationAttribute_t3946661254), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable466[5] = { SynchronizationAttribute_t3946661254::get_offset_of__bReEntrant_1(), SynchronizationAttribute_t3946661254::get_offset_of__flavor_2(), SynchronizationAttribute_t3946661254::get_offset_of__lockCount_3(), SynchronizationAttribute_t3946661254::get_offset_of__mutex_4(), SynchronizationAttribute_t3946661254::get_offset_of__ownerThread_5(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize467 = { sizeof (SynchronizedClientContextSink_t1886771601), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable467[2] = { SynchronizedClientContextSink_t1886771601::get_offset_of__next_0(), SynchronizedClientContextSink_t1886771601::get_offset_of__att_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize468 = { sizeof (SynchronizedServerContextSink_t2776015682), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable468[2] = { SynchronizedServerContextSink_t2776015682::get_offset_of__next_0(), SynchronizedServerContextSink_t2776015682::get_offset_of__att_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize469 = { sizeof (LeaseManager_t3648745595), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable469[2] = { LeaseManager_t3648745595::get_offset_of__objects_0(), LeaseManager_t3648745595::get_offset_of__timer_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize470 = { sizeof (LeaseSink_t3666380219), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable470[1] = { LeaseSink_t3666380219::get_offset_of__nextSink_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize471 = { sizeof (LifetimeServices_t3061370510), -1, sizeof(LifetimeServices_t3061370510_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable471[5] = { LifetimeServices_t3061370510_StaticFields::get_offset_of__leaseManagerPollTime_0(), LifetimeServices_t3061370510_StaticFields::get_offset_of__leaseTime_1(), LifetimeServices_t3061370510_StaticFields::get_offset_of__renewOnCallTime_2(), LifetimeServices_t3061370510_StaticFields::get_offset_of__sponsorshipTimeout_3(), LifetimeServices_t3061370510_StaticFields::get_offset_of__leaseManager_4(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize472 = { sizeof (ArgInfoType_t1035054221)+ sizeof (RuntimeObject), sizeof(uint8_t), 0, 0 }; extern const int32_t g_FieldOffsetTable472[3] = { ArgInfoType_t1035054221::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize473 = { sizeof (ArgInfo_t3261134217), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable473[3] = { ArgInfo_t3261134217::get_offset_of__paramMap_0(), ArgInfo_t3261134217::get_offset_of__inoutArgCount_1(), ArgInfo_t3261134217::get_offset_of__method_2(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize474 = { sizeof (AsyncResult_t4194309572), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable474[15] = { AsyncResult_t4194309572::get_offset_of_async_state_0(), AsyncResult_t4194309572::get_offset_of_handle_1(), AsyncResult_t4194309572::get_offset_of_async_delegate_2(), AsyncResult_t4194309572::get_offset_of_data_3(), AsyncResult_t4194309572::get_offset_of_object_data_4(), AsyncResult_t4194309572::get_offset_of_sync_completed_5(), AsyncResult_t4194309572::get_offset_of_completed_6(), AsyncResult_t4194309572::get_offset_of_endinvoke_called_7(), AsyncResult_t4194309572::get_offset_of_async_callback_8(), AsyncResult_t4194309572::get_offset_of_current_9(), AsyncResult_t4194309572::get_offset_of_original_10(), AsyncResult_t4194309572::get_offset_of_gchandle_11(), AsyncResult_t4194309572::get_offset_of_call_message_12(), AsyncResult_t4194309572::get_offset_of_message_ctrl_13(), AsyncResult_t4194309572::get_offset_of_reply_message_14(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize475 = { sizeof (ClientContextTerminatorSink_t4064115021), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable475[1] = { ClientContextTerminatorSink_t4064115021::get_offset_of__context_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize476 = { sizeof (ConstructionCall_t4011594745), -1, sizeof(ConstructionCall_t4011594745_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable476[7] = { ConstructionCall_t4011594745::get_offset_of__activator_11(), ConstructionCall_t4011594745::get_offset_of__activationAttributes_12(), ConstructionCall_t4011594745::get_offset_of__contextProperties_13(), ConstructionCall_t4011594745::get_offset_of__activationType_14(), ConstructionCall_t4011594745::get_offset_of__activationTypeName_15(), ConstructionCall_t4011594745::get_offset_of__isContextOk_16(), ConstructionCall_t4011594745_StaticFields::get_offset_of_U3CU3Ef__switchU24map20_17(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize477 = { sizeof (ConstructionCallDictionary_t686578562), -1, sizeof(ConstructionCallDictionary_t686578562_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable477[3] = { ConstructionCallDictionary_t686578562_StaticFields::get_offset_of_InternalKeys_6(), ConstructionCallDictionary_t686578562_StaticFields::get_offset_of_U3CU3Ef__switchU24map23_7(), ConstructionCallDictionary_t686578562_StaticFields::get_offset_of_U3CU3Ef__switchU24map24_8(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize478 = { sizeof (EnvoyTerminatorSink_t3654193516), -1, sizeof(EnvoyTerminatorSink_t3654193516_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable478[1] = { EnvoyTerminatorSink_t3654193516_StaticFields::get_offset_of_Instance_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize479 = { sizeof (Header_t549724581), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable479[4] = { Header_t549724581::get_offset_of_HeaderNamespace_0(), Header_t549724581::get_offset_of_MustUnderstand_1(), Header_t549724581::get_offset_of_Name_2(), Header_t549724581::get_offset_of_Value_3(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize480 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize481 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize482 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize483 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize484 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize485 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize486 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize487 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize488 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize489 = { sizeof (LogicalCallContext_t3342013719), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable489[2] = { LogicalCallContext_t3342013719::get_offset_of__data_0(), LogicalCallContext_t3342013719::get_offset_of__remotingData_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize490 = { sizeof (CallContextRemotingData_t2260963392), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable490[1] = { CallContextRemotingData_t2260963392::get_offset_of__logicalCallID_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize491 = { sizeof (MethodCall_t861078140), -1, sizeof(MethodCall_t861078140_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable491[11] = { MethodCall_t861078140::get_offset_of__uri_0(), MethodCall_t861078140::get_offset_of__typeName_1(), MethodCall_t861078140::get_offset_of__methodName_2(), MethodCall_t861078140::get_offset_of__args_3(), MethodCall_t861078140::get_offset_of__methodSignature_4(), MethodCall_t861078140::get_offset_of__methodBase_5(), MethodCall_t861078140::get_offset_of__callContext_6(), MethodCall_t861078140::get_offset_of__genericArguments_7(), MethodCall_t861078140::get_offset_of_ExternalProperties_8(), MethodCall_t861078140::get_offset_of_InternalProperties_9(), MethodCall_t861078140_StaticFields::get_offset_of_U3CU3Ef__switchU24map1F_10(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize492 = { sizeof (MethodCallDictionary_t605791082), -1, sizeof(MethodCallDictionary_t605791082_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable492[1] = { MethodCallDictionary_t605791082_StaticFields::get_offset_of_InternalKeys_6(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize493 = { sizeof (MethodDictionary_t207894204), -1, sizeof(MethodDictionary_t207894204_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable493[6] = { MethodDictionary_t207894204::get_offset_of__internalProperties_0(), MethodDictionary_t207894204::get_offset_of__message_1(), MethodDictionary_t207894204::get_offset_of__methodKeys_2(), MethodDictionary_t207894204::get_offset_of__ownProperties_3(), MethodDictionary_t207894204_StaticFields::get_offset_of_U3CU3Ef__switchU24map21_4(), MethodDictionary_t207894204_StaticFields::get_offset_of_U3CU3Ef__switchU24map22_5(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize494 = { sizeof (DictionaryEnumerator_t2516729552), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable494[3] = { DictionaryEnumerator_t2516729552::get_offset_of__methodDictionary_0(), DictionaryEnumerator_t2516729552::get_offset_of__hashtableEnum_1(), DictionaryEnumerator_t2516729552::get_offset_of__posMethod_2(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize495 = { sizeof (MethodReturnDictionary_t2551046119), -1, sizeof(MethodReturnDictionary_t2551046119_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable495[2] = { MethodReturnDictionary_t2551046119_StaticFields::get_offset_of_InternalReturnKeys_6(), MethodReturnDictionary_t2551046119_StaticFields::get_offset_of_InternalExceptionKeys_7(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize496 = { sizeof (MonoMethodMessage_t2807636944), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable496[8] = { MonoMethodMessage_t2807636944::get_offset_of_method_0(), MonoMethodMessage_t2807636944::get_offset_of_args_1(), MonoMethodMessage_t2807636944::get_offset_of_arg_types_2(), MonoMethodMessage_t2807636944::get_offset_of_ctx_3(), MonoMethodMessage_t2807636944::get_offset_of_rval_4(), MonoMethodMessage_t2807636944::get_offset_of_exc_5(), MonoMethodMessage_t2807636944::get_offset_of_uri_6(), MonoMethodMessage_t2807636944::get_offset_of_methodSignature_7(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize497 = { sizeof (RemotingSurrogate_t2834579653), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize498 = { sizeof (ObjRefSurrogate_t3860276170), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize499 = { sizeof (RemotingSurrogateSelector_t2472351973), -1, sizeof(RemotingSurrogateSelector_t2472351973_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable499[4] = { RemotingSurrogateSelector_t2472351973_StaticFields::get_offset_of_s_cachedTypeObjRef_0(), RemotingSurrogateSelector_t2472351973_StaticFields::get_offset_of__objRefSurrogate_1(), RemotingSurrogateSelector_t2472351973_StaticFields::get_offset_of__objRemotingSurrogate_2(), RemotingSurrogateSelector_t2472351973::get_offset_of__next_3(), }; #ifdef __clang__ #pragma clang diagnostic pop #endif
[ "gotchman0217@gmail.com" ]
gotchman0217@gmail.com
4c937ac0b893ee380be3b190adb8cdace3105320
915f197bd8c5ee7fb35821de1cd5dda6dff9ae2c
/1 Buzzer/Fur_Elise/Fur_Elise.ino
2bf9212c8065839a0466aed08c81c9e6a504bd97
[]
no_license
HuyGiaHoang/Hobbies
409b5a5105a517c03efb557ea06d39e2b3427950
1f592e8f2d127272ab7a0886e50f8daf153b4e2f
refs/heads/master
2023-04-02T06:12:52.438381
2021-04-04T19:46:45
2021-04-04T19:46:45
350,014,883
0
0
null
null
null
null
UTF-8
C++
false
false
4,120
ino
// Define frequency for each note #define C3 131 #define Cs3 139 #define D3 147 #define Ds3 156 #define E3 165 #define F3 175 #define Fs3 185 #define G3 196 #define Gs3 208 #define A3 220 #define As3 233 #define B3 247 #define C4 262 #define Cs4 277 #define D4 294 #define Ds4 311 #define E4 330 #define F4 349 #define Fs4 370 #define G4 392 #define Gs4 415 #define A4 440 #define As4 466 #define B4 494 #define C5 523 #define Cs5 554 #define D5 587 #define Ds5 622 #define E5 660 #define F5 698 #define Fs5 740 #define G5 784 #define Gs5 831 #define A5 880 #define As5 932 #define B5 988 #define C6 1047 #define Cs6 1109 #define D6 1175 #define Ds6 1245 #define E6 1319 #define F6 1397 #define Fs6 1480 #define G6 1568 #define Gs6 1661 #define A6 1760 #define As6 1865 #define B6 1976 // Define tempo for the music #define SIXTEENTH 222 #define EIGHTH 2*SIXTEENTH #define DOTTED_EIGHTH 3*SIXTEENTH #define QUARTER 4*SIXTEENTH #define DOTTED_QUARTER 6*SIXTEENTH #define HALF 8*SIXTEENTH #define WHOLE 16*SIXTEENTH #define BUZZER 9 #define button 13 void setup() { pinMode(BUZZER ,OUTPUT); pinMode(button, INPUT_PULLUP); } void loop() { if(digitalRead(button) == 0) // check if Arduino input pin (13) is at LOW level { while(digitalRead(button) == 0); // holding the button.... // PART A /////////////////////////////////////////////////////////////////////////// commonPart1(); note(BUZZER, A4, EIGHTH); delay(EIGHTH); commonPart1(); note(BUZZER, A4, EIGHTH); delay(SIXTEENTH); note(BUZZER, B4, SIXTEENTH); note(BUZZER, C5, SIXTEENTH); note(BUZZER, D5, SIXTEENTH); commonPart2(); commonPart1(); note(BUZZER, A4, EIGHTH); delay(SIXTEENTH); note(BUZZER, B4, SIXTEENTH); note(BUZZER, C5, SIXTEENTH); note(BUZZER, D5, SIXTEENTH); commonPart2(); commonPart1(); note(BUZZER, A4, EIGHTH); delay(SIXTEENTH); } } void note(unsigned int pin, unsigned int note, unsigned int duration) { tone(pin, note); delay(duration); noTone(pin); } void commonPart1() { note(BUZZER, E5, SIXTEENTH); note(BUZZER, Ds5, SIXTEENTH); note(BUZZER, E5, SIXTEENTH); note(BUZZER, Ds5, SIXTEENTH); note(BUZZER, E5, SIXTEENTH); note(BUZZER, B4, SIXTEENTH); note(BUZZER, D5, SIXTEENTH); note(BUZZER, C5, SIXTEENTH); note(BUZZER, A4, EIGHTH); delay(SIXTEENTH); note(BUZZER, C4, SIXTEENTH); note(BUZZER, E4, SIXTEENTH); note(BUZZER, A4, SIXTEENTH); note(BUZZER, B4, EIGHTH); delay(SIXTEENTH); note(BUZZER, E4, SIXTEENTH); note(BUZZER, Gs4, SIXTEENTH); note(BUZZER, B4, SIXTEENTH); note(BUZZER, C5, EIGHTH); delay(SIXTEENTH); note(BUZZER, E4, SIXTEENTH); note(BUZZER, E5, SIXTEENTH); note(BUZZER, Ds5, SIXTEENTH); note(BUZZER, E5, SIXTEENTH); note(BUZZER, Ds5, SIXTEENTH); note(BUZZER, E5, SIXTEENTH); note(BUZZER, B4, SIXTEENTH); note(BUZZER, D5, SIXTEENTH); note(BUZZER, C5, SIXTEENTH); note(BUZZER, A4, EIGHTH); delay(SIXTEENTH); note(BUZZER, C4, SIXTEENTH); note(BUZZER, E4, SIXTEENTH); note(BUZZER, A4, SIXTEENTH); note(BUZZER, B4, EIGHTH); delay(SIXTEENTH); note(BUZZER, D4, SIXTEENTH); note(BUZZER, C5, SIXTEENTH); note(BUZZER, B4, SIXTEENTH); } void commonPart2() { note(BUZZER, E5, DOTTED_EIGHTH); note(BUZZER, G4, SIXTEENTH); note(BUZZER, F5, SIXTEENTH); note(BUZZER, E5, SIXTEENTH); note(BUZZER, D5, DOTTED_EIGHTH); note(BUZZER, F4, SIXTEENTH); note(BUZZER, E5, SIXTEENTH); note(BUZZER, D5, SIXTEENTH); note(BUZZER, C5, DOTTED_EIGHTH); note(BUZZER, E4, SIXTEENTH); note(BUZZER, D5, SIXTEENTH); note(BUZZER, C5, SIXTEENTH); note(BUZZER, B4, EIGHTH); delay(SIXTEENTH); note(BUZZER, E4, SIXTEENTH); note(BUZZER, E5, SIXTEENTH); delay(SIXTEENTH); delay(SIXTEENTH); note(BUZZER, E5, SIXTEENTH); note(BUZZER, E6, SIXTEENTH); delay(SIXTEENTH); delay(SIXTEENTH); note(BUZZER, Ds5, SIXTEENTH); note(BUZZER, E5, SIXTEENTH); delay(SIXTEENTH); delay(SIXTEENTH); note(BUZZER, Ds5, SIXTEENTH); }
[ "hgiahuy281000@gmail.com" ]
hgiahuy281000@gmail.com
194c672bd5945aeae2077f4fb7440508d7c7fd74
775702906fe4f001327e242c101dc8a48c290603
/B - Sea and Islands.cpp
94cc24f0ef76efdfcd7d8892c1d94b7d2440f6de
[]
no_license
fkshohag/Codeforces
6f4f4d488399e12de0247c79927e89ef0ac0a6be
50efa70cbaf17fac40fc84bad57545b218d85780
refs/heads/master
2021-05-31T06:22:37.359578
2015-05-31T12:09:59
2015-05-31T12:09:59
30,644,239
0
1
null
null
null
null
UTF-8
C++
false
false
568
cpp
# include <iostream> # include <cstdio> # include <cstring> using namespace std; # define si(x) scanf("%d",&(x)); string s[100]; int main() { //freopen("in","r",stdin); //freopen("out","w",stdout); int n,k; si(n);si(k); for(int i=0;i<n;i++) { string st=""; for(int j=0;j<n;j++) { st+='S'; } s[i]=st; } for(int i=0;i<n;i++) { for(int j=0;j<n && k>0;j++) { if((i+j)%2!=0)continue; s[i][j]='L'; k--; } } if(k>0) { cout<<"NO"<<endl; return 0; } cout<<"YES"<<endl; for(int i=0;i<n;i++) { cout<<s[i]<<endl; } return 0; }
[ "fazlulkabir94@users.noreply.github.com" ]
fazlulkabir94@users.noreply.github.com
38a7301b2beb27316a98b1cb55b79ea5df6f7f8e
8ac3fcdd9647b8898d1f7cf941465e906853b299
/src_old/src_py/bspline.cpp
9173b5a31889573d6953a8a2d6cafac0fdb6ed94
[]
no_license
ReiMatsuzaki/rescol
a8589eb624782d081fa8f3d884d8ddee2993ed80
46c205a3228423f5be97eeaa68bcb7a4b0f31888
refs/heads/master
2021-05-04T10:36:11.090876
2016-11-01T11:12:04
2016-11-01T11:12:04
43,137,468
0
0
null
null
null
null
UTF-8
C++
false
false
2,088
cpp
#include <cmath> #include <vector> #include <stdexcept> #include "bspline.hpp" namespace { using std::abs; } double CalcBSpline(int order, double* ts, int i, double x) { if(order < 1) { std::domain_error err("bspline.cpp, CalcBSpline, order must be positive."); throw err; } if(i < 0) { std::domain_error err("bspline.cpp, CalcBSpline, index must be positive"); throw err; } if(x < ts[i] || ts[i+order] < x) return 0.0; if(order == 1) { if(ts[i] <= x && x < ts[i+1]) return 1.0; else return 0.0; } else { double ti = ts[i]; double ti1 = ts[i+1]; double tidm1 = ts[i+order-1]; double tid = ts[i+order]; double bs0 = CalcBSpline(order-1, ts, i, x); double bs1 = CalcBSpline(order-1, ts, i+1, x); double acc(0.0); if(std::abs(bs0) > 0.000000001) acc += (x - ti) / (tidm1 - ti) * bs0; if(abs(bs1) > 0.000000001) acc += (tid - x) / (tid - ti1) * bs1; return acc; } } double CalcDerivBSpline(int order, double* ts, int i, double x) { if(order < 1) { std::domain_error err("bspline.cpp, CalcDerivBSpline, order must be positive."); throw err; } if(i < 0) { std::domain_error err("bspline.cpp, CalcDerivBSpline, index must be positive"); throw err; } if(order == 1) return 0.0; else { int k(order); double bs0 = CalcBSpline(k-1, ts, i, x); double bs1 = CalcBSpline(k-1, ts, i+1, x); double eps = 0.000000001; double acc(0.0); if(std::abs(bs0) > eps) acc += (k-1)/(ts[i+k-1]-ts[i]) * bs0; if(std::abs(bs1) > eps) acc -= (k-1)/(ts[i+k]-ts[i+1]) * bs1; return acc; } } double ERI_ele(double* vs, int num_basis, int num_quad, int i0, int i1, int j0, int j1, int a, int b, int c, int d, double* ws, double* rij) { double res(0.0); for(int i = i0; i < i1; i++) for(int j = j0; j < j1; j++) { res += ws[i]*ws[j]*rij[i*num_quad+j]* vs[a*num_quad+i]*vs[c*num_quad+i]* vs[b*num_quad+j]*vs[d*num_quad+j]; } return res; }
[ "matsuzaki.rei@gmail.com" ]
matsuzaki.rei@gmail.com
ae4edbc851e09c5d28357d3949c7832aac1d5263
4fda16bc63942f0186713aad30b71fae050dcfe5
/UnfoldedShowcase/Resources/Frameworks/deck.gl.framework/Headers/core/src/arrow/row.h
f4fe45d60e77ec1a7331354a0351e0ca70c97eaa
[]
no_license
UnfoldedInc/ios-showcase
57f1681260c978bee1fff6ce27467b0e49b667eb
038bc92cd781985a87938c70d8eb4463b3062b50
refs/heads/master
2022-09-28T00:06:27.102499
2020-06-08T06:33:09
2020-06-08T06:33:09
265,884,403
1
0
null
null
null
null
UTF-8
C++
false
false
11,094
h
// Copyright (c) 2020 Unfolded, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #ifndef DECKGL_CORE_ARROW_ROW_H #define DECKGL_CORE_ARROW_ROW_H #include <arrow/array.h> #include <arrow/table.h> #include <memory> #include <optional> #include <string> #include <tuple> #include <vector> #include "math.gl/core.h" #include "probe.gl/core.h" namespace deckgl { struct ListArrayMetadata { public: ListArrayMetadata(int32_t offset, int32_t length, const std::shared_ptr<arrow::Array>& values) : offset{offset}, length{length}, values{values} {} int32_t offset; int32_t length; std::shared_ptr<arrow::Array> values; }; class Row { public: Row(const std::shared_ptr<arrow::Table>& table, int64_t rowIndex); auto getInt(const std::string& columnName, int defaultValue = 0) const -> int; auto getFloat(const std::string& columnName, float defaultValue = 0.0) const -> float; auto getDouble(const std::string& columnName, double defaultValue = 0.0) const -> double; auto getBool(const std::string& columnName, bool defaultValue = false) const -> bool; auto getString(const std::string& columnName, const std::string& defaultValue = "") const -> std::string; template <typename T> auto getVector2(const std::string& columnName, const mathgl::Vector2<T>& defaultValue = {}) const -> mathgl::Vector2<T> { auto data = this->getListData<T>(columnName, {defaultValue.x, defaultValue.y}); return mathgl::Vector2<T>{data.size() > 0 ? data.at(0) : 0, data.size() > 1 ? data.at(1) : 0}; } template <typename T> auto getVector3(const std::string& columnName, const mathgl::Vector3<T>& defaultValue = {}) const -> mathgl::Vector3<T> { auto data = this->getListData<T>(columnName, {defaultValue.x, defaultValue.y, defaultValue.z}); return mathgl::Vector3<T>{data.size() > 0 ? data.at(0) : 0, data.size() > 1 ? data.at(1) : 0, data.size() > 2 ? data.at(2) : 0}; } template <typename T> auto getVector4(const std::string& columnName, const mathgl::Vector4<T>& defaultValue = {}) const -> mathgl::Vector4<T> { auto data = this->getListData<T>(columnName, {defaultValue.x, defaultValue.y, defaultValue.z, defaultValue.w}); return mathgl::Vector4<T>{data.size() > 0 ? data.at(0) : 0, data.size() > 1 ? data.at(1) : 0, data.size() > 2 ? data.at(2) : 0, data.size() > 3 ? data.at(3) : 0}; } template <typename T> auto getVector2List(const std::string& columnName, const std::vector<mathgl::Vector2<T>>& defaultValue = {}) const -> std::vector<mathgl::Vector2<T>> { auto listData = this->getNestedListData<T>(columnName, {}); std::vector<mathgl::Vector2<T>> vectorData; vectorData.reserve(listData.size()); for (const auto& data : listData) { vectorData.push_back(mathgl::Vector2<T>{data.size() > 0 ? data[0] : 0, data.size() > 1 ? data[1] : 0}); } return vectorData; } template <typename T> auto getVector3List(const std::string& columnName, const std::vector<mathgl::Vector3<T>>& defaultValue = {}) const -> std::vector<mathgl::Vector3<T>> { auto listData = this->getNestedListData<T>(columnName, {}); std::vector<mathgl::Vector3<T>> vectorData; vectorData.reserve(listData.size()); for (const auto& data : listData) { vectorData.push_back(mathgl::Vector3<T>{data.size() > 0 ? data[0] : 0, data.size() > 1 ? data[1] : 0, data.size() > 2 ? data[2] : 0}); } return vectorData; } template <typename T> auto getVector4List(const std::string& columnName, const std::vector<mathgl::Vector4<T>>& defaultValue = {}) const -> std::vector<mathgl::Vector4<T>> { auto listData = this->getNestedListData<T>(columnName, {}); std::vector<mathgl::Vector4<T>> vectorData; vectorData.reserve(listData.size()); for (const auto& data : listData) { vectorData.push_back(mathgl::Vector4<T>{data.size() > 0 ? data[0] : 0, data.size() > 1 ? data[1] : 0, data.size() > 2 ? data[2] : 0, data.size() > 3 ? data[3] : 0}); } return vectorData; } template <typename T> auto getListData(const std::string& columnName, const std::vector<T>& defaultValue = {}) const -> std::vector<T> { if (!this->isValid(columnName)) { probegl::WarningLog() << "Requested column data not valid, returning default value"; return defaultValue; } auto optionalMetadata = this->_getListArrayMetadata(this->_getChunk(columnName), this->_chunkRowIndex); if (!optionalMetadata) { probegl::WarningLog() << "Requested list type not supported, returning default value"; return defaultValue; } return this->_getListData(optionalMetadata.value(), defaultValue); } template <typename T> auto getNestedListData(const std::string& columnName, const std::vector<std::vector<T>>& defaultValue = {}) const -> std::vector<std::vector<T>> { if (!this->isValid(columnName)) { probegl::WarningLog() << "Requested column data not valid, returning default value"; return defaultValue; } auto optionalMetadata = this->_getListArrayMetadata(this->_getChunk(columnName), this->_chunkRowIndex); if (!optionalMetadata) { probegl::WarningLog() << "Requested list type not supported, returning default value"; return defaultValue; } return this->_getNestedListData(optionalMetadata.value(), defaultValue); } /// \brief Checks whether value at this row, for columnName is valid and not null. /// \param columnName Name of the column who's value to check. /// \return true if the value for columnName is valid and not null, false otherwise. auto isValid(const std::string& columnName) const -> bool; /// \brief Increments current row index. void incrementRowIndex(uint64_t increment = 1); private: /// \brief Retrieves a chunk for a given columName. /// \param columnName Name of the column to do the lookup for. /// \return Returns a chunk within column named columnName, that this row belongs to. /// \throw Throws an exception if columnName does not exist in the table, or if the chunk couldn't be found. auto _getChunk(const std::string& columnName) const -> std::shared_ptr<arrow::Array>; /// \brief Calculates a relative index of a row within the appropriate chunk. /// \param table Table to do chunk lookup in. /// \param rowIndex Index of the row to do lookup for. /// \return Tuple containing index of the chunk this row belongs to, and a row index within the chunk. /// \throw Throws an exception if rowIndex exceeds table bounds, or if the chunk couldn't be found. auto _getRowChunkData(const std::shared_ptr<arrow::Table>& table, int64_t rowIndex) const -> std::tuple<int, int64_t>; auto _getDouble(const std::shared_ptr<arrow::Array>& chunk) const -> std::optional<double>; auto _getListArrayMetadata(const std::shared_ptr<arrow::Array>& array, int64_t index) const -> std::optional<ListArrayMetadata>; template <typename T> auto _getListData(const ListArrayMetadata& metadata, const std::vector<T>& defaultValue = {}) const -> std::vector<T> { std::vector<T> data; switch (metadata.values->type_id()) { case arrow::Type::type::DOUBLE: { auto doubleArray = std::static_pointer_cast<arrow::DoubleArray>(metadata.values); for (int32_t i = 0; i < metadata.length; i++) { data.push_back(static_cast<T>(doubleArray->Value(metadata.offset + i))); } break; } case arrow::Type::type::FLOAT: { auto floatArray = std::static_pointer_cast<arrow::FloatArray>(metadata.values); for (int32_t i = 0; i < metadata.length; i++) { data.push_back(static_cast<T>(floatArray->Value(metadata.offset + i))); } break; } case arrow::Type::type::INT64: { auto int64Array = std::static_pointer_cast<arrow::Int64Array>(metadata.values); for (int32_t i = 0; i < metadata.length; i++) { data.push_back(static_cast<T>(int64Array->Value(metadata.offset + i))); } break; } case arrow::Type::type::INT32: { auto int32Array = std::static_pointer_cast<arrow::Int32Array>(metadata.values); for (int32_t i = 0; i < metadata.length; i++) { data.push_back(static_cast<T>(int32Array->Value(metadata.offset + i))); } break; } default: probegl::WarningLog() << "Unsupported list value type, returning default value"; return defaultValue; } return data; } template <typename T> auto _getNestedListData(const ListArrayMetadata& metadata, const std::vector<std::vector<T>>& defaultValue = {}) const -> std::vector<std::vector<T>> { std::vector<std::vector<T>> data; switch (metadata.values->type_id()) { case arrow::Type::type::LIST: case arrow::Type::type::FIXED_SIZE_LIST: { for (int32_t i = 0; i < metadata.length; i++) { auto optionalMetadata = this->_getListArrayMetadata(metadata.values, metadata.offset + i); if (!optionalMetadata) { probegl::WarningLog() << "List type for nested array not supported, returning default value"; return defaultValue; } data.push_back(this->_getListData(optionalMetadata.value(), std::vector<T>{})); } break; } default: probegl::WarningLog() << "Unsupported list value type, returning default value"; return defaultValue; } return data; } /// \brief Table that this row belongs to. std::shared_ptr<arrow::Table> _table; /// \brief Index of the row within table. int64_t _rowIndex; /// \brief Index of the chunk that this row belongs to. int _chunkIndex; /// \brief Relative row index in respect to the chunk. int64_t _chunkRowIndex; // std::unordered_map<std::string, std::shared_ptr<arrow::Array>> _cache; }; } // namespace deckgl #endif // DECKGL_CORE_ARROW_ROW_H
[ "ipuaca@gmail.com" ]
ipuaca@gmail.com
ce4dc5ae767b899fa9fef059d1a1c2d2dd95fd04
4c23be1a0ca76f68e7146f7d098e26c2bbfb2650
/h2/3.5/rho
99959f3a4614ef2a956faf621f940dd7c9cc4169
[]
no_license
labsandy/OpenFOAM_workspace
a74b473903ddbd34b31dc93917e3719bc051e379
6e0193ad9dabd613acf40d6b3ec4c0536c90aed4
refs/heads/master
2022-02-25T02:36:04.164324
2019-08-23T02:27:16
2019-08-23T02:27:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
831
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 6 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "3.5"; object rho; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -3 0 0 0 0 0]; internalField uniform 0.220061; boundaryField { boundary { type empty; } } // ************************************************************************* //
[ "jfeatherstone123@gmail.com" ]
jfeatherstone123@gmail.com
3b35129653f1028741825890e110001a141c350f
6b40e9dccf2edc767c44df3acd9b626fcd586b4d
/NT/ds/adsi/ldap/cpropmgr.hxx
f6b868223fc47cf8d84c9d7fc42272d1e7c59977
[]
no_license
jjzhang166/WinNT5_src_20201004
712894fcf94fb82c49e5cd09d719da00740e0436
b2db264153b80fbb91ef5fc9f57b387e223dbfc2
refs/heads/Win2K3
2023-08-12T01:31:59.670176
2021-10-14T15:14:37
2021-10-14T15:14:37
586,134,273
1
0
null
2023-01-07T03:47:45
2023-01-07T03:47:44
null
UTF-8
C++
false
false
9,657
hxx
//+--------------------------------------------------------------------------- // // Microsoft Windows // Copyright (C) Microsoft Corporation, 1992 - 2000. // // File: cpropmgr.hxx // // Contents: Header for property manager - object that implements/helps // implement IUMIPropList functions. // The property manager needs to be initialized in one of 2 modes // 1) PropertyCache mode in which case it uses the objects existing // property cache to provide IUMIPropList support and // 2) Interface property mode in which case a list of the properties, // this object should support is passed in (refer to constructor // for complete details). // // History: 02-07-00 AjayR Created. // //---------------------------------------------------------------------------- #ifndef __CPROPMGR_H__ #define __CPROPMGR_H__ // // Global fucntions that are used to free the umi properties/values arrays // HRESULT FreeOneUmiProperty(UMI_PROPERTY *pUmiProperty); HRESULT FreeUmiPropertyValues(UMI_PROPERTY_VALUES *pUmiProps); HRESULT ConvertUmiPropCodeToLdapCode(ULONG uUmiFlags, DWORD &dwLdapOpCode); HRESULT ConvertLdapCodeToUmiPropCode(DWORD dwLdapCode, ULONG &uUmiFlags); HRESULT ConvertLdapSyntaxIdToUmiType(DWORD dwLdapSyntax, ULONG &uUmiType); // // Default number of properties in prop mgr mode. // #define MAX_PROPMGR_PROP_COUNT 15 typedef ULONG UMIPROPS; typedef LONG UMIPROP; typedef struct _intfproperty{ LPWSTR pszPropertyName; // Property name. DWORD dwNumElements; DWORD dwFlags; // Status of the value. DWORD dwSyntaxId; // Syntax Id of the stored value. PUMI_PROPERTY pUmiProperty; // Umi property with values. }INTF_PROPERTY, *PINTF_PROPERTY; const DWORD OPERATION_CODE_READABLE = 1; const DWORD OPERATION_CODE_WRITEABLE = 2; const DWORD OPERATION_CODE_READWRITE = 3; // // These are the codes used by the property cache. // #define PROPERTY_INIT 0 #define PROPERTY_UPDATE 1 #define PROPERTY_ADD 2 #define PROPERTY_DELETE 3 #define PROPERTY_DELETE_VALUE 4 class CPropertyManager : INHERIT_TRACKING, public IUmiPropList { public: // // IUknown support. // STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) ; // // We cannot use standard refCounting cause the release method is // different. This should be similar to the DECLARE_STD_REFCOUNTING // except that in release we release a ref to the pIADs also. // STDMETHOD_(ULONG, AddRef)() { if (!_fPropCacheMode && _pUnk) { // // This is to make sure we are not left with a // dangling IADs ref. // _pUnk->AddRef(); } # if DBG == 1 return StdAddRef(); #else // // We need to use the stuff directly from the definition as // the fn is not defined for fre builds. // InterlockedIncrement((long*)&_ulRefs); return _ulRefs; #endif }; STDMETHOD_(ULONG, Release)() { #if DBG == 1 // // Delete is handled by the owning IADs Object. // ULONG ul = StdRelease(); // // Need to releas the ref only if we are in intf prop mode. // In the propCache mode, this object does not need to be ref // counted cause it's lifetime is similar to that of the // owning object (one implementing IADs). // if (!_fPropCacheMode && _pUnk) { _pUnk->Release(); } return ul; #else InterlockedDecrement((long*)&_ulRefs); if (!_fPropCacheMode && _pUnk) { _pUnk->Release(); } return _ulRefs; #endif }; // // IUmiPropList methods. // STDMETHOD(Put)( IN LPCWSTR pszName, IN ULONG uFlags, OUT UMI_PROPERTY_VALUES *pProp ); STDMETHOD(Get)( IN LPCWSTR pszName, IN ULONG uFlags, OUT UMI_PROPERTY_VALUES **pProp ); STDMETHOD(GetAt)( IN LPCWSTR pszName, IN ULONG uFlags, IN ULONG uBufferLength, OUT LPVOID pExistingMem ); STDMETHOD(GetAs)( IN LPCWSTR pszName, IN ULONG uFlags, IN ULONG uCoercionType, OUT UMI_PROPERTY_VALUES **pProp ); STDMETHOD (Delete)( IN LPCWSTR pszUrl, IN OPTIONAL ULONG uFlags ); STDMETHOD(FreeMemory)( ULONG uReserved, LPVOID pMem ); STDMETHOD(GetProps)( IN LPCWSTR *pszNames, IN ULONG uNameCount, IN ULONG uFlags, OUT UMI_PROPERTY_VALUES **pProps ); STDMETHOD(PutProps)( IN LPCWSTR *pszNames, IN ULONG uNameCount, IN ULONG uFlags, IN UMI_PROPERTY_VALUES *pProps ); STDMETHOD(PutFrom)( IN LPCWSTR pszName, IN ULONG uFlags, IN ULONG uBufferLength, IN LPVOID pExistingMem ); // // Other public methods. // CPropertyManager:: CPropertyManager(); CPropertyManager:: ~CPropertyManager(); // // Use this to initialize with property cache object. // static HRESULT CPropertyManager:: CreatePropertyManager( IADs *pADsObj, IUnknown *pUnk, CPropertyCache *pPropCache, CCredentials *pCreds, LPWSTR pszServerName, CPropertyManager FAR * FAR * ppPropertyManager = NULL ); static HRESULT CPropertyManager:: CreatePropertyManager( IUnknown *pUnk, IUnknown *pADs, CCredentials *pCredentials, INTF_PROP_DATA intfPropTable[], CPropertyManager FAR * FAR * ppPropertyManager ); // // Helper functions that are not part of the interfaces supported. // HRESULT CPropertyManager::GetStringProperty( LPCWSTR pszPropName, LPWSTR *pszRetStrVal ); HRESULT CPropertyManager::GetLongProperty( LPCWSTR pszPropName, LONG *plVal ); HRESULT CPropertyManager::GetBoolProperty( LPCWSTR pszPropName, BOOL *pfFlag ); HRESULT CPropertyManager::GetLastStatus( ULONG uFlags, ULONG *puSpecificStatus, REFIID riid, LPVOID *pStatusObj ); // // Helper to delete SD on commit calls if needed. // HRESULT CPropertyManager::DeleteSDIfPresent(); protected: // // These are internal methods. // HRESULT CPropertyManager:: AddProperty( LPCWSTR szPropertyName, UMI_PROPERTY umiProperty ); HRESULT CPropertyManager:: UpdateProperty( DWORD dwIndex, UMI_PROPERTY umiProperty ); HRESULT CPropertyManager:: FindProperty( LPCWSTR szPropertyName, PDWORD pdwIndex ); HRESULT CPropertyManager:: DeleteProperty( DWORD dwIndex ); VOID CPropertyManager:: flushpropertycache(); HRESULT CPropertyManager:: ClearAllPropertyFlags(VOID); // // Way to get a list of the names of the properties. // HRESULT CPropertyManager:: GetPropertyNames(PUMI_PROPERTY_VALUES *pUmiProps); // // Way to get a list of the names and types for schema objects. // HRESULT CPropertyManager:: GetPropertyNamesSchema(PUMI_PROPERTY_VALUES *pUmiProps); // // Add Property to table and return index of entry. // HRESULT CPropertyManager:: AddToTable( LPCWSTR pszPropertyName, PDWORD pdwIndex ); // // Check if this is a valid interfaceProperty. // BOOL CPropertyManager:: VerifyIfValidProperty( LPCWSTR pszPropertyName, UMI_PROPERTY umiProperty ); // // More helper routines. // HRESULT CPropertyManager::GetIndexInStaticTable( LPCWSTR pszName, DWORD &dwIndex ); void CPropertyManager::SetLastStatus(ULONG ulStatus){ _ulStatus = ulStatus; } // // Does all the hard work for interface properties. // HRESULT CPropertyManager::GetInterfaceProperty( LPCWSTR pszName, ULONG uFlags, UMI_PROPERTY_VALUES **ppProp, DWORD dwTableIndex ); protected: // // Not all are used in all cases. If in propCache mode, a lot of // these are not used, the _pPropCache already has the info we // need. // Likewise if we are in intfProperties mode, the _pPropCache is // not valid, the other member variables have useful information // though. // DWORD _dwMaxProperties; CPropertyCache * _pPropCache; PINTF_PROPERTY _pIntfProperties; DWORD _dwMaxLimit; BOOL _fPropCacheMode; INTF_PROP_DATA * _pStaticPropData; ULONG _ulStatus; IADs* _pIADs; IUnknown* _pUnk; // // All these are part of the owning object, do not free. // CCredentials* _pCreds; LPWSTR _pszServerName; }; #endif // __CPROPMGR_H__
[ "seta7D5@protonmail.com" ]
seta7D5@protonmail.com
b11a5e62eff4b7fddea3db96eda3c3a765a45844
57fbe3892aed2cf8733c1acc6c17d9ff85e44ff7
/deps/sscc/struct_tree.h
4a602684a68d430c196a7ea50c510c3852880550
[]
no_license
hanguangming/Blitz
a4093eda2b057255730454b43bb5ee4381565206
e3229221ea27e0a9e1f163bb1e60e6268ce5aca4
refs/heads/master
2021-01-01T05:21:08.988192
2016-04-11T19:08:44
2016-04-11T19:08:44
55,997,308
1
1
null
null
null
null
UTF-8
C++
false
false
1,205
h
#ifndef __STRUCT_TREE_H__ #define __STRUCT_TREE_H__ #include <list> #include "tree.h" #include "parser.h" class MessageTree; class StructTree : public Tree { public: StructTree() : Tree(TREE_STRUCT), message() { } StructTree(ptr<Token> name) : Tree(TREE_STRUCT), _name(name), message() { } void parse(Parser *parser) override; ptr<Token> name() const { return _name; } void name(ptr<Token> value) { _name = value; } ptr<StructTree> inherited() const { return _inherited.cast<StructTree>(); } void parseInherited(Parser *parser, ptr<StructTree> inherited); void parseBody(Parser *parser); void parseItems(Parser *parser); ptr<Tree> getItem(const char *name, bool find_union); typedef std::list<ptr<Tree>>::iterator iterator; iterator begin() { return _symbols.begin(); } iterator end() { return _symbols.end(); } size_t size() const { return _symbols.size(); } protected: void parseUnion(Parser *parser); void parseUnionPtr(Parser *parser); protected: ptr<Token> _name; ptr<Tree> _inherited; std::list<ptr<Tree>> _symbols; public: MessageTree *message; }; #endif
[ "1653331981@qq.com" ]
1653331981@qq.com
90a853a0ab24c459e47ce0a82eca464be3aa4dca
5456502f97627278cbd6e16d002d50f1de3da7bb
/chrome/browser/ui/global_error/global_error_service.cc
a6cf302b5202ac7517e249fc1e8dc99f67f2961d
[ "BSD-3-Clause" ]
permissive
TrellixVulnTeam/Chromium_7C66
72d108a413909eb3bd36c73a6c2f98de1573b6e5
c8649ab2a0f5a747369ed50351209a42f59672ee
refs/heads/master
2023-03-16T12:51:40.231959
2017-12-20T10:38:26
2017-12-20T10:38:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,376
cc
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ui/global_error/global_error_service.h" #include <stddef.h> #include <algorithm> #include "base/stl_util.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/global_error/global_error.h" #include "chrome/browser/ui/global_error/global_error_bubble_view_base.h" #include "content/public/browser/notification_service.h" GlobalErrorService::GlobalErrorService(Profile* profile) : profile_(profile) { } GlobalErrorService::~GlobalErrorService() { base::STLDeleteElements(&errors_); } void GlobalErrorService::AddGlobalError(GlobalError* error) { DCHECK(error); errors_.push_back(error); NotifyErrorsChanged(error); } void GlobalErrorService::RemoveGlobalError(GlobalError* error) { errors_.erase(std::find(errors_.begin(), errors_.end(), error)); GlobalErrorBubbleViewBase* bubble = error->GetBubbleView(); if (bubble) bubble->CloseBubbleView(); NotifyErrorsChanged(error); } GlobalError* GlobalErrorService::GetGlobalErrorByMenuItemCommandID( int command_id) const { for (GlobalErrorList::const_iterator it = errors_.begin(); it != errors_.end(); ++it) { GlobalError* error = *it; if (error->HasMenuItem() && command_id == error->MenuItemCommandID()) return error; } return NULL; } GlobalError* GlobalErrorService::GetHighestSeverityGlobalErrorWithAppMenuItem() const { GlobalError::Severity highest_severity = GlobalError::SEVERITY_LOW; GlobalError* highest_severity_error = NULL; for (GlobalErrorList::const_iterator it = errors_.begin(); it != errors_.end(); ++it) { GlobalError* error = *it; if (error->HasMenuItem()) { if (!highest_severity_error || error->GetSeverity() > highest_severity) { highest_severity = error->GetSeverity(); highest_severity_error = error; } } } return highest_severity_error; } GlobalError* GlobalErrorService::GetFirstGlobalErrorWithBubbleView() const { for (GlobalErrorList::const_iterator it = errors_.begin(); it != errors_.end(); ++it) { GlobalError* error = *it; if (error->HasBubbleView() && !error->HasShownBubbleView()) return error; } return NULL; } void GlobalErrorService::NotifyErrorsChanged(GlobalError* error) { // GlobalErrorService is bound only to original profile so we need to send // notifications to both it and its off-the-record profile to update // incognito windows as well. std::vector<Profile*> profiles_to_notify; if (profile_ != NULL) { profiles_to_notify.push_back(profile_); if (profile_->IsOffTheRecord()) profiles_to_notify.push_back(profile_->GetOriginalProfile()); else if (profile_->HasOffTheRecordProfile()) profiles_to_notify.push_back(profile_->GetOffTheRecordProfile()); for (size_t i = 0; i < profiles_to_notify.size(); ++i) { content::NotificationService::current()->Notify( chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, content::Source<Profile>(profiles_to_notify[i]), content::Details<GlobalError>(error)); } } }
[ "lixiaodonglove7@aliyun.com" ]
lixiaodonglove7@aliyun.com
5acbbf94e7f207335c4c95d776fc455549ddcca9
f753bbcf728966f71c4b84848a21372b1dfcae28
/library/TextureAtlas.cc
f49f4f3724d8a10bb5521efc70adeef02c45ba5a
[ "Zlib", "BSL-1.0" ]
permissive
sherjilozair/gf
9e0fbbb0ef659fa19baf8cb3504c1ead90656998
c2176a05e25434ddc2ef5fabe54f9b593aabe0e3
refs/heads/master
2020-03-18T18:26:37.858387
2018-04-14T20:27:19
2018-04-14T20:27:19
132,169,221
0
0
null
null
null
null
UTF-8
C++
false
false
3,699
cc
/* * Gamedev Framework (gf) * Copyright (C) 2016-2018 Julien Bernard * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. */ #include <gf/TextureAtlas.h> #include <cassert> #include <cstring> #include <gf/Log.h> #include <gf/ResourceManager.h> #include <gf/Texture.h> #include "vendor/tinyxml2/tinyxml2.h" namespace gf { #ifndef DOXYGEN_SHOULD_SKIP_THIS inline namespace v1 { #endif bool TextureAtlas::loadFromFile(const Path& filename) { tinyxml2::XMLDocument doc; int err = doc.LoadFile(filename.string().c_str()); if (doc.Error() || err != tinyxml2::XML_SUCCESS) { Log::error("Could not load atlas texture: '%s'\n", filename.string().c_str()); return false; } assert(err == tinyxml2::XML_SUCCESS); const tinyxml2::XMLElement *root = doc.RootElement(); if (std::strcmp(root->Name(), "TextureAtlas") != 0) { return false; } Path texturePath = root->Attribute("imagePath"); if (texturePath.empty()) { return false; } setTexturePath(texturePath); const tinyxml2::XMLElement *child = root->FirstChildElement(); while (child != nullptr) { if (std::strcmp(child->Name(), "SubTexture") != 0) { m_rects.clear(); return false; } std::string name = child->Attribute("name"); assert(!name.empty()); RectU rect; err = child->QueryUnsignedAttribute("x", &rect.left); assert(err == tinyxml2::XML_SUCCESS); err = child->QueryUnsignedAttribute("y", &rect.top); assert(err == tinyxml2::XML_SUCCESS); err = child->QueryUnsignedAttribute("width", &rect.width); assert(err == tinyxml2::XML_SUCCESS); err = child->QueryUnsignedAttribute("height", &rect.height); assert(err == tinyxml2::XML_SUCCESS); addSubTexture(name, rect); child = child->NextSiblingElement(); } return true; } bool TextureAtlas::loadFromFile(const Path& filename, ResourceManager& resources) { gf::Path absolute = resources.getAbsolutePath(filename); bool loaded = loadFromFile(absolute); if (!loaded) { return false; } Path parent = absolute.parent_path(); Texture& texture = resources.getTexture(parent / getTexturePath()); setTexture(texture); return true; } void TextureAtlas::addSubTexture(std::string name, const RectU& rect) { m_rects.emplace(std::move(name), rect); } RectU TextureAtlas::getSubTexture(const std::string& name) const { auto it = m_rects.find(name); if (it == m_rects.end()) { return RectU(0, 0, 1, 1); } return it->second; } RectF TextureAtlas::getTextureRect(const std::string& name) const { if (m_texture == nullptr) { return RectF(0, 0, 1, 1); } RectU rect = getSubTexture(name); return m_texture->computeTextureCoords(rect); } #ifndef DOXYGEN_SHOULD_SKIP_THIS } #endif }
[ "julien.bernard@univ-fcomte.fr" ]
julien.bernard@univ-fcomte.fr
2fe89d1a333cce4baf7d8f3322c944b29ab88ed3
e858709d8de220a54718912acdac3ce0e17a7fc7
/Sketches/BigServoTest/Sweep/Sweep.ino
4187c91047c62c914a23a129774e0bb35e87f91c
[]
no_license
Jwho303/Arduino
1384bd2dcbbfa9b7aec5b5c07fb899f0d583fb24
b91c9a50a1f52ded72bc5a6408a88f40a6cdcdbf
refs/heads/master
2020-04-07T17:44:47.282919
2018-11-21T17:14:53
2018-11-21T17:14:53
158,582,219
0
0
null
null
null
null
UTF-8
C++
false
false
636
ino
/* Sweep by BARRAGAN <http://barraganstudio.com> This example code is in the public domain. modified 8 Nov 2013 by Scott Fitzgerald http://www.arduino.cc/en/Tutorial/Sweep */ #include <Servo.h> Servo myservo; // create servo object to control a servo // twelve servo objects can be created on most boards int pos = 0; // variable to store the servo position void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object myservo.write(0); Serial.begin(9600); Serial.println("!!!!!!!!!!!!!!!!!Start!!!!!!!!!!!!!!!!!!"); } void loop() { Serial.println(myservo.read()); delay(15); }
[ "jwho303@gmail.com" ]
jwho303@gmail.com
b21b6ebb9c450f305b05c31dad661d7c3426a21f
a6dad7feebf42fb7ebe4fef852cd6001fd5fe214
/my-stl-list/cpp-files/hpp-files/listAM.hpp
ad3401282337e4fe6c9e92e71080b93841e8833e
[]
no_license
codetrixter/DataStructure-Problems
5b1d50f4b6bd76b9e7909e6039f8e234ab26a132
2cb942b5b55b822f4aae7b2dbbde1386d4d12228
refs/heads/master
2023-01-13T16:57:07.959847
2023-01-04T08:45:24
2023-01-04T08:45:24
196,786,551
0
0
null
null
null
null
UTF-8
C++
false
false
417
hpp
/** * @file listAM.cpp * @author Abhishek * @brief header of my version of stl lists, this is the first iteration, * it will be updated as the understanding grows better. * @version 0.1 * @date 2022-05-09 * * @copyright Copyright (c) 2022 * */ #include <iostream> class listAM { public: listAM(int *data); private: struct Node { int data; Node *next; } };
[ "Abhishek20893@gmail.com" ]
Abhishek20893@gmail.com
562553631a151ec20845234ae8d94cd62c20b740
9ba3bf556d5c34f6e1eafa8ca8f107fffdb07ba3
/friend/friend.cpp
d482b888c12ce9281dc78773f4883f0921fd663e
[]
no_license
YCHEN-NYU/PlayWithLeeCode
1c839f67701a7eda9ca7389b5f9bcce933901abb
9527878ec75c5c279e861b7248f3a588758dd9a9
refs/heads/master
2021-01-12T14:18:21.905139
2018-02-02T16:13:07
2018-02-02T16:13:07
68,966,957
0
0
null
null
null
null
UTF-8
C++
false
false
176
cpp
#include "Complex.h" #include <iostream> #include <iomanip> using namespace std; int main() { Complex<int> V1, V2(1, 2); V2.print(); //cin >> V1; return 0; }
[ "yc1224@nyu.edu" ]
yc1224@nyu.edu
4278df640b25e59470b1b391de2e0c68f7fc34d0
2133dd71f3bd896acdfe2236a8b95a2774379bda
/all/1002.查找常用字符.cpp
fe77c02b061c00402de7c874a38e8c0babf832f8
[]
no_license
SuperCodeFarmers/MyLeetCode
4df011817c19b6d3d4f7d0f16ee022d8d2041768
a7677da42340b85faee9e2d5d755db38089795b8
refs/heads/master
2023-08-24T22:20:25.832819
2021-09-30T07:12:32
2021-09-30T07:12:32
275,822,699
0
0
null
null
null
null
UTF-8
C++
false
false
1,665
cpp
#include <iostream> #include <vector> #include <map> #include <string> #include <string.h> using namespace std; /* * 给定仅有小写字母组成的字符串数组 A,返回列表中的每个字符串中都显示的全部字符(包括重复字符)组成的列表。 * 例如,如果一个字符在每个字符串中出现 3 次,但不是 4 次,则需要在最终答案中包含该字符 3 次。 * * 你可以按任意顺序返回答案。 * *   * * 示例 1: * * 输入:["bella","label","roller"] * 输出:["e","l","l"] * 示例 2: * * 输入:["cool","lock","cook"] * 输出:["c","o"] *   * * 提示: * * 1 <= A.length <= 100 * 1 <= A[i].length <= 100 * A[i][j] 是小写字母 * * 来源:力扣(LeetCode) * 链接:https://leetcode-cn.com/problems/find-common-characters * 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 */ vector<string> commonChars(vector<string>& A) { if (A.empty()) { return {}; } int cnt[26] = {}; memset(cnt, 0x3f, sizeof cnt); for(string s : A) { int cur_cnt[26] = {}; for (int i = 0; i < s.size(); ++i) { cur_cnt[s[i] - 'a']++; } for (int i = 0; i < 26; ++i) { cnt[i] = min(cur_cnt[i], cnt[i]); } } vector<string> ret; for (int i = 0; i < 26; ++i) { for (int j = 0; j < cnt[i]; ++j) { string s(1, i+'a'); ret.push_back(s); } } return ret; } int main() { int cnt[26] = {}; memset(cnt, 0x3f, sizeof cnt); std::cout << cnt << std::endl; return 0; }
[ "1041893269@qq.com" ]
1041893269@qq.com
7b508b322f61b287b95445df9777fb73fb747900
f0ad29ebac79b47a00ab2ae197ba78c9226fd4c4
/AnnonsAdminMeny/Ad.cpp
feb6d9732228a11801755a9a05f0c0d43cc5a883
[]
no_license
circuital/Programmering_Cpp_AnnonsAdminMeny
577c238033cf589c7f80fe0ff2301afd95715b7b
6e154f0b1236eb24a725c4cee425fa3acf8d76c8
refs/heads/master
2022-10-24T03:01:43.044204
2019-11-14T20:51:59
2019-11-14T20:51:59
221,189,476
0
0
null
null
null
null
UTF-8
C++
false
false
596
cpp
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <string> #include <time.h> #include "Ad.h" #include "AdTypeEnum.h" void Ad::CreateAd(string name, string adText, AdType adType, int idIndex) { this->name = name; this->id = idIndex; this->adType = adType; this->adText = adText; } void Ad::UpdateAd(string name, string adText, AdType adType) { this->name = name; this->adType = adType; this->adText = adText; } string Ad::GetAdName() { return this->name; } string Ad::GetAdText() { return this->adText; } AdType Ad::GetAdType() { return this->adType; }
[ "elvira.granqvist@gmail.com" ]
elvira.granqvist@gmail.com
7ff3bba3afd8a828e50585132fd7675bf96282ff
b07a2ae34f9a21f7d9f7ff00b33ae8689ad8473c
/experiment9/Comms.cpp
e6e46f78bac5eebca286cef9ec18456157a9042c
[]
no_license
yanhua-tj/Cpp_Opp
3c357bfea041803942318e24223ec2cd1d44ede7
c0b1b30a162699d73557330475403bf8ed401ba9
refs/heads/master
2021-04-02T08:13:34.027553
2020-05-29T12:29:23
2020-05-29T12:29:23
248,252,623
0
0
null
null
null
null
GB18030
C++
false
false
3,523
cpp
#include "Comms.h" //初始化构造函数 Comms::Comms(unsigned maxCount) : m_count(0) { //初始化最大通讯录数 m_maxCount = maxCount; mp_Ce = new CommEntry[m_maxCount]; } //析构释放内存 Comms::~Comms() { delete[] mp_Ce; } //输入通讯录 void Comms::input() { cout << "请输入添加条目个数: "; unsigned num = 0; cin >> num; while (m_count + num > m_maxCount) { cout << "剩余通讯录条目数量不足, 剩余" << m_maxCount - m_count << endl; cout << "请输入添加条目个数: "; cin >> num; } cin.ignore(16, '\n'); //清空缓冲区 for (int i = 0; i < (int)num; i++) { cout << "添加第" << i + 1 << "条通讯录" << endl; cin >> mp_Ce[i + m_count]; } m_count += num; } //输出通讯录 void Comms::outputAll() { CommEntry::outputInfo(); cout << endl; for (unsigned i = 0; i < m_count; i++) { cout << mp_Ce[i]; } cout << "当前通讯录一共有: " << m_count; cout << "\t通讯录最大容量: " << m_maxCount << endl; } //输入姓名查找下标 int Comms::findname(string name) { for (unsigned i = 0; i < m_count; i++) { if (mp_Ce[i].getName() == name) { return (int)i; } } return -1; } //输入电话查找下标 int Comms::findtel(string tel) { for (unsigned i = 0; i < m_count; i++) { if (mp_Ce[i].getTel() == tel) { return (int)i; } } return -1; } //输入姓名修改其电话 void Comms::modifytel(string name, string tel) { mp_Ce[findname(name)].setTel(tel); cout << name << "电话修改为: " << tel << endl; } //输入电话修改其姓名 void Comms::modifyname(string tel, string name) { mp_Ce[findtel(tel)].setName(name); cout << tel << "的联系人修改为: " << name << endl; } //输入电话模糊查找 void Comms::fuzzysearchtel(string tel) { int count = 0; cout << "模糊查找结果: " << endl; for (unsigned i = 0; i < m_count; i++) { string s1 = mp_Ce[i].getTel(); if (s1.find(tel) != string::npos) { cout << s1 << endl; count ++; } } if (count == 0) { cout << "模糊查找没有结果" << endl; } else { cout << "模糊查找到" << count << "条信息" << endl; } } //输入姓名模糊查找 void Comms::fuzzysearchname(string name) { int count = 0; cout << "模糊查找结果: " << endl; for (unsigned i = 0; i < m_count; i++) { string s1 = mp_Ce[i].getName(); if (s1.find(name) != string::npos) { cout << s1 << endl; count++; } } if (count == 0) { cout << "模糊查找没有结果" << endl; } else { cout << "模糊查找到" << count << "条信息" << endl; } } //从文件中读数据 void Comms::inputFromFile(ifstream& in) { in >> m_maxCount; in.get(); in >> m_count; in.get(); delete[] mp_Ce; mp_Ce = new CommEntry[m_maxCount]; for (int i = 0; i < m_count; i++) { in >> mp_Ce[i]; } cout << "文件中的数据已读取" << endl; } //保存数据到文件中 void Comms::outputToFile(ofstream& out) { out << m_maxCount << endl; out << m_count << endl; for (int i = 0; i < m_count; i++) { out << mp_Ce[i]; } cout << "数据已保存在文件中" << endl; }
[ "2297009607@qq.com" ]
2297009607@qq.com
89aed41303abaf1da7d217bce850555bc1fd889c
9d3b71f6d4457d22fb95fc87e207451878616b6b
/linear.h
2d6e798b3c012e40697413b4528ccbf260f3b53e
[]
no_license
casseveritt/quad
1ef59c600a26371a098cd82f0c86b990775a9edf
74369ab3e74c3eb9eb1e2417c7bb4dc28b2ccc76
refs/heads/master
2022-10-23T04:43:38.730249
2020-05-31T18:08:56
2020-05-31T18:08:56
268,163,670
1
0
null
null
null
null
UTF-8
C++
false
false
47,689
h
/* linear Copyright (c) 2019 Cass Everitt from glh - Copyright (c) 2000-2009 Cass Everitt Copyright (c) 2000 NVIDIA Corporation All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of contributors to this software may not 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 REGENTS 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. Cass Everitt */ // Author: Cass W. Everitt #pragma once //#include <memory.h> #include <assert.h> #include <math.h> #include <algorithm> #define R3_RAD_TO_DEG 57.2957795130823208767981548141052 #define R3_DEG_TO_RAD 0.0174532925199432957692369076848861 #define R3_ZERO 0.0 #define R3_ONE 1.0 #define R3_TWO 2.0 #define R3_EPSILON 1e-9 #define R3_PI 3.1415926535897932384626433832795 namespace r3 { template <typename T> inline T Equivalent(T a, T b) { return (a < (b + T(R3_EPSILON))) && (a > (b - T(R3_EPSILON))); } template <typename T> inline T GreaterThan(T a, T b) { return a > (b - T(R3_EPSILON)); } template <typename T> inline T LessThan(T a, T b) { return a < (b + T(R3_EPSILON)); } template <typename T> inline T ToDegrees(T radians) { return radians * T(R3_RAD_TO_DEG); } template <typename T> inline T ToRadians(T degrees) { return degrees * T(R3_DEG_TO_RAD); } template <typename T, typename S> inline T Lerp(const T& a, const T& b, S factor) { return (S(1) - factor) * a + factor * b; } template <typename T> class Line; template <typename T> class Plane; template <typename T> class Matrix3; template <typename T> class Matrix4; template <typename T> class Quaternion; template <class T> struct Vec2 { typedef T ElementType; static const int N = 2; Vec2() : x(0), y(0) {} Vec2(const T* tp) : x(tp[0]), y(tp[1]) {} Vec2(T x_, T y_) : x(x_), y(y_) {} union { struct { T x, y; }; T v[N]; }; // generic part T Dot(const Vec2& rhs) const { T r = 0; for (int i = 0; i < N; i++) { r += v[i] * rhs.v[i]; } return r; } T Length() const { T r = 0; for (int i = 0; i < N; i++) { r += v[i] * v[i]; } return T(sqrt(r)); } T LengthSquared() const { T r = 0; for (int i = 0; i < N; i++) { r += v[i] * v[i]; } return r; } void Negate() { for (int i = 0; i < N; i++) { v[i] = -v[i]; } } T Normalize() { T len = Length(); if (len > R3_EPSILON) { for (int i = 0; i < N; i++) v[i] /= len; } return len; } Vec2 Normalized() const { Vec2 n(*this); n.Normalize(); return n; } T& operator[](int i) { return v[i]; } const T& operator[](int i) const { return v[i]; } Vec2& operator*=(T d) { for (int i = 0; i < N; i++) v[i] *= d; return *this; } Vec2& operator*=(const Vec2& u) { for (int i = 0; i < N; i++) v[i] *= u[i]; return *this; } Vec2& operator/=(T d) { return *this *= (T(1) / d); } Vec2& operator+=(const Vec2& u) { for (int i = 0; i < N; i++) v[i] += u.v[i]; return *this; } Vec2& operator-=(const Vec2& u) { for (int i = 0; i < N; i++) v[i] -= u.v[i]; return *this; } Vec2 operator-() const { Vec2 rv(*this); rv.Negate(); return rv; } Vec2 operator+(const Vec2& rhs) const { Vec2 rt(*this); return rt += rhs; } Vec2 operator-(const Vec2& rhs) const { Vec2 rt(*this); return rt -= rhs; } }; // vector friend operators template <class T> inline Vec2<T> operator*(const Vec2<T>& b, T d) { Vec2<T> rt(b); return rt *= d; } template <class T> inline Vec2<T> operator*(T d, const Vec2<T>& b) { return b * d; } template <class T> inline Vec2<T> operator*(const Vec2<T>& b, const Vec2<T>& d) { Vec2<T> rt(b); return rt *= d; } template <class T> inline Vec2<T> operator/(const Vec2<T>& b, T d) { Vec2<T> rt(b); return rt /= d; } template <class T> inline Vec2<T> operator+(const Vec2<T>& v1, const Vec2<T>& v2) { Vec2<T> rt(v1); return rt += v2; } template <class T> inline Vec2<T> operator-(const Vec2<T>& v1, const Vec2<T>& v2) { Vec2<T> rt(v1); return rt -= v2; } template <class T> inline bool operator==(const Vec2<T>& v1, const Vec2<T>& v2) { for (int i = 0; i < 2; i++) if (v1.v[i] != v2.v[i]) return false; return true; } template <class T> inline bool operator!=(const Vec2<T>& v1, const Vec2<T>& v2) { return !(v1 == v2); } template <typename T> inline Vec2<T> Min(const Vec2<T>& v1, const Vec2<T>& v2) { Vec2<T> r; r.x = std::min(v1.x, v2.x); r.y = std::min(v1.y, v2.y); return r; } template <typename T> inline Vec2<T> Max(const Vec2<T>& v1, const Vec2<T>& v2) { Vec2<T> r; r.x = std::max(v1.x, v2.x); r.y = std::max(v1.y, v2.y); return r; } template <typename T> class Vec3 { public: typedef T ElementType; static const int N = 3; Vec3() { x = y = z = 0.f; } Vec3(const T* tp) { x = tp[0]; y = tp[1]; z = tp[2]; } Vec3(T x_, T y_, T z_) { v[0] = x_; v[1] = y_; v[2] = z_; } void GetValue(T& x_, T& y_, T& z_) const { x_ = v[0]; y_ = v[1]; z_ = v[2]; } Vec3 Cross(const Vec3& rhs) const { Vec3 rt; rt.x = v[1] * rhs.z - v[2] * rhs.y; rt.y = v[2] * rhs.x - v[0] * rhs.z; rt.z = v[0] * rhs.y - v[1] * rhs.x; return rt; } Vec3& SetValue(const T& x_, const T& y_, const T& z_) { v[0] = x_; v[1] = y_; v[2] = z_; return *this; } union { struct { T x, y, z; }; T v[N]; }; // generic part int Size() const { return N; } const T* GetValue() const { return v; } T Dot(const Vec3& rhs) const { T r = 0; for (int i = 0; i < N; i++) { r += v[i] * rhs.v[i]; } return r; } T Length() const { T r = 0; for (int i = 0; i < N; i++) { r += v[i] * v[i]; } return T(sqrt(r)); } T LengthSquared() const { T r = 0; for (int i = 0; i < N; i++) { r += v[i] * v[i]; } return r; } void Negate() { for (int i = 0; i < N; i++) { v[i] = -v[i]; } } T Normalize() { T len = Length(); if (len > R3_EPSILON) { for (int i = 0; i < N; i++) { v[i] /= len; } } return len; } Vec3 Normalized() const { Vec3 n(*this); n.Normalize(); return n; } void Orthonormalize(const Vec3& to) { T d = Dot(to); (*this) -= d * to; Normalize(); } Vec3 Orthonormalized(const Vec3& to) const { Vec3 o(*this); o.Orthonormalize(to); return o; } Vec3& SetValue(const T* rhs) { for (int i = 0; i < N; i++) { v[i] = rhs[i]; } return *this; } T& operator[](int i) { return v[i]; } const T& operator[](int i) const { return v[i]; } Vec3& operator*=(T d) { for (int i = 0; i < N; i++) { v[i] *= d; } return *this; } Vec3& operator*=(const Vec3& u) { for (int i = 0; i < N; i++) { v[i] *= u[i]; } return *this; } Vec3& operator/=(T d) { return *this *= (T(1) / d); } Vec3& operator+=(T d) { for (int i = 0; i < N; i++) { v[i] += d; } return *this; } Vec3& operator+=(const Vec3& u) { for (int i = 0; i < N; i++) { v[i] += u.v[i]; } return *this; } Vec3& operator-=(T d) { for (int i = 0; i < N; i++) { v[i] -= d; } return *this; } Vec3& operator-=(const Vec3& u) { for (int i = 0; i < N; i++) { v[i] -= u.v[i]; } return *this; } Vec3 operator-() const { Vec3 rv(*this); rv.Negate(); return rv; } Vec3 operator+(const Vec3& rhs) const { Vec3 rt(*this); return rt += rhs; } Vec3 operator-(const Vec3& rhs) const { Vec3 rt(*this); return rt -= rhs; } }; // vector friend operators template <class T> inline Vec3<T> operator*(const Vec3<T>& b, const Vec3<T>& d) { Vec3<T> rt(b); return rt *= d; } template <class T> inline Vec3<T> operator+(const Vec3<T>& v1, const Vec3<T>& v2) { Vec3<T> rt(v1); return rt += v2; } template <class T> inline Vec3<T> operator-(const Vec3<T>& v1, const Vec3<T>& v2) { Vec3<T> rt(v1); return rt -= v2; } template <class T> inline bool operator==(const Vec3<T>& v1, const Vec3<T>& v2) { for (int i = 0; i < 3; i++) { if (v1.v[i] != v2.v[i]) { return false; } } return true; } template <class T> inline bool operator!=(const Vec3<T>& v1, const Vec3<T>& v2) { return !(v1 == v2); } template <typename T> inline Vec3<T> Min(const Vec3<T>& v1, const Vec3<T>& v2) { Vec3<T> r; r.x = std::min(v1.x, v2.x); r.y = std::min(v1.y, v2.y); r.z = std::min(v1.z, v2.z); return r; } template <typename T> inline Vec3<T> Max(const Vec3<T>& v1, const Vec3<T>& v2) { Vec3<T> r; r.x = std::max(v1.x, v2.x); r.y = std::max(v1.y, v2.y); r.z = std::max(v1.z, v2.z); return r; } template <typename T> class Vec4 { public: typedef T ElementType; static const int N = 4; Vec4() { x = y = z = 0.f; w = 1.f; } Vec4(const T* tp) { x = tp[0]; y = tp[1]; z = tp[2]; w = tp[3]; } Vec4(const Vec3<T>& t, T fourth) { v[0] = t.x; v[1] = t.y; v[2] = t.z; v[3] = fourth; } Vec4(T x_, T y_, T z_ = 0, T w_ = 1) { v[0] = x_; v[1] = y_; v[2] = z_; v[3] = w_; } void GetValue(T& x_, T& y_, T& z_, T& w_) const { x_ = v[0]; y_ = v[1]; z_ = v[2]; w_ = v[3]; } Vec4& SetValue(const T& x_, const T& y_, const T& z_, const T& w_) { v[0] = x_; v[1] = y_; v[2] = z_; v[3] = w_; return *this; } union { struct { T x, y, z, w; }; T v[N]; }; // generic part int Size() const { return N; } const T* GetValue() const { return v; } T Dot(const Vec4& rhs) const { T r = 0; for (int i = 0; i < N; i++) { r += v[i] * rhs.v[i]; } return r; } T Length() const { T r = 0; for (int i = 0; i < N; i++) { r += v[i] * v[i]; } return T(sqrt(r)); } T LengthSquared() const { T r = 0; for (int i = 0; i < N; i++) { r += v[i] * v[i]; } return r; } void Negate() { for (int i = 0; i < N; i++) { v[i] = -v[i]; } } T Normalize() { T len = Length(); if (len > R3_EPSILON) { for (int i = 0; i < N; i++) { v[i] /= len; } } return len; } Vec4 Normalized() const { Vec4 n(*this); n.Normalize(); return n; } Vec4& SetValue(const T* rhs) { for (int i = 0; i < N; i++) { v[i] = rhs[i]; } return *this; } T& operator[](int i) { return v[i]; } const T& operator[](int i) const { return v[i]; } Vec4& operator*=(T d) { for (int i = 0; i < N; i++) { v[i] *= d; } return *this; } Vec4& operator*=(const Vec4& u) { for (int i = 0; i < N; i++) { v[i] *= u[i]; } return *this; } Vec4& operator/=(T d) { return *this *= (T(1) / d); } Vec4& operator+=(const Vec4& u) { for (int i = 0; i < N; i++) { v[i] += u.v[i]; } return *this; } Vec4& operator-=(const Vec4& u) { for (int i = 0; i < N; i++) { v[i] -= u.v[i]; } return *this; } Vec4 operator-() const { Vec4 rv(*this); rv.negate(); return rv; } Vec4 operator+(const Vec4& rhs) const { Vec4 rt(*this); return rt += rhs; } Vec4 operator-(const Vec4& rhs) const { Vec4 rt(*this); return rt -= rhs; } }; template <typename T> inline Vec3<T> Homogenize(const Vec4<T>& v) { Vec3<T> rt; assert(v[3] != R3_ZERO); rt[0] = v[0] / v[3]; rt[1] = v[1] / v[3]; rt[2] = v[2] / v[3]; return rt; } // vector friend operators template <class T> inline Vec4<T> operator*(const Vec4<T>& b, const Vec4<T>& d) { Vec4<T> rt(b); return rt *= d; } template <class T> inline Vec4<T> operator+(const Vec4<T>& v1, const Vec4<T>& v2) { Vec4<T> rt(v1); return rt += v2; } template <class T> inline Vec4<T> operator-(const Vec4<T>& v1, const Vec4<T>& v2) { Vec4<T> rt(v1); return rt -= v2; } template <class T> inline bool operator==(const Vec4<T>& v1, const Vec4<T>& v2) { for (int i = 0; i < 4; i++) { if (v1.v[i] != v2.v[i]) { return false; } } return true; } template <class T> inline bool operator!=(const Vec4<T>& v1, const Vec4<T>& v2) { return !(v1 == v2); } template <typename T> inline Vec4<T> Min(const Vec4<T>& v1, const Vec4<T>& v2) { Vec4<T> r; r.x = std::min(v1.x, v2.x); r.y = std::min(v1.y, v2.y); r.z = std::min(v1.z, v2.z); r.w = std::min(v1.w, v2.w); return r; } template <typename T> inline Vec4<T> Max(const Vec4<T>& v1, const Vec4<T>& v2) { Vec4<T> r; r.x = std::max(v1.x, v2.x); r.y = std::max(v1.y, v2.y); r.z = std::max(v1.z, v2.z); r.w = std::max(v1.w, v2.w); return r; } template <typename T> inline T operator+(T v, const typename T::ElementType s) { return v += s; } template <typename T> inline T operator+(const typename T::ElementType s, T v) { return v += s; } template <typename T> inline T operator-(const typename T::ElementType s, T v) { return v -= s; } template <typename T> inline T operator-(T v, const typename T::ElementType s) { return v -= s; } template <typename T> inline T operator*(T v, const typename T::ElementType s) { return v *= s; } template <typename T> inline T operator*(const typename T::ElementType s, T v) { return v *= s; } template <typename T> inline T operator/(T v, const typename T::ElementType s) { return v /= s; } template <typename T> inline typename T::ElementType Dot(const T& v1, const T& v2) { return v1.Dot(v2); } template <typename T> class Line { public: typedef T ElementType; Line() { SetValue(Vec3<T>(0, 0, 0), Vec3<T>(0, 0, 1)); } Line(const Vec3<T>& p0, const Vec3<T>& p1) { SetValue(p0, p1); } void SetValue(const Vec3<T>& p0, const Vec3<T>& p1) { position = p0; direction = p1 - p0; direction.normalize(); } bool GetClosestPoints(const Line& line2, Vec3<T>& pointOnThis, Vec3<T>& pointOnThat) { // quick check to see if parallel -- if so, quit. if (fabs(direction.Dot(line2.direction)) == 1.0) return 0; Line l2 = line2; // Algorithm: Brian Jean // T u; T v; Vec3<T> Vr = direction; Vec3<T> Vs = l2.direction; T Vr_Dot_Vs = Vr.Dot(Vs); T detA = T(1.0 - (Vr_Dot_Vs * Vr_Dot_Vs)); Vec3<T> C = l2.position - position; T C_Dot_Vr = C.Dot(Vr); T C_Dot_Vs = C.Dot(Vs); u = (C_Dot_Vr - Vr_Dot_Vs * C_Dot_Vs) / detA; v = (C_Dot_Vr * Vr_Dot_Vs - C_Dot_Vs) / detA; pointOnThis = position; pointOnThis += direction * u; pointOnThat = l2.position; pointOnThat += l2.direction * v; return 1; } Vec3<T> GetClosestPoint(const Vec3<T>& point) { Vec3<T> np = point - position; Vec3<T> rp = direction * direction.Dot(np) + position; return rp; } const Vec3<T>& GetPosition() const { return position; } const Vec3<T>& GetDirection() const { return direction; } // protected: Vec3<T> position; Vec3<T> direction; }; template <typename T> struct LineSegment2 { Vec2<T> a, b; LineSegment2() {} LineSegment2(const Vec2<T>& ptA, const Vec2<T>& ptB) : a(ptA), b(ptB) {} Vec3<T> GetPlane() const { // not normalized Vec3<T> p; p.x = a.y - b.y; p.y = b.x - a.x; p.z = -(p.x * a.x + p.y * a.y); return p; } }; template <typename T> inline bool Intersect(const LineSegment2<T>& s0, const LineSegment2<T>& s1) { Vec3<T> p = s0.GetPlane(); if (p.Dot(Vec3<T>(s1.a.x, s1.a.y, 1)) * p.Dot(Vec3<T>(s1.b.x, s1.b.y, 1)) > 0) { return false; } p = s1.GetPlane(); if (p.Dot(Vec3<T>(s0.a.x, s0.a.y, 1)) * p.Dot(Vec3<T>(s0.b.x, s0.b.y, 1)) > 0) { return false; } return true; } // Matrix3 template <typename T> class Matrix3 { public: typedef T ElementType; T m[3][3]; Matrix3() { MakeIdentity(); } template <typename TIN> Matrix3(const TIN* in) { m[0][0] = in[0]; m[0][1] = in[1]; m[0][2] = in[2]; m[1][0] = in[3]; m[1][1] = in[4]; m[1][2] = in[5]; m[2][0] = in[6]; m[2][1] = in[7]; m[2][2] = in[8]; } void MakeIdentity() { m[0][0] = 1; m[0][1] = 0; m[0][2] = 0; m[1][0] = 0; m[1][1] = 1; m[1][2] = 0; m[2][0] = 0; m[2][1] = 0; m[2][2] = 1; } Matrix3 Adjugate() const { Matrix3 m3; int L[3] = {1, 0, 0}; int G[3] = {2, 2, 1}; for (int row = 0; row < 3; row++) { for (int col = 0; col < 3; col++) { T t = m[L[row]][L[col]] * m[G[row]][G[col]] - m[G[row]][L[col]] * m[L[row]][G[col]]; m3.m[row][col] = ((row + col) & 0x1) ? -t : t; } } return m3.Transposed(); } Matrix3 Transposed() const { Matrix3 m3; m3.m[0][0] = m[0][0]; m3.m[1][0] = m[0][1]; m3.m[2][0] = m[0][2]; m3.m[0][1] = m[1][0]; m3.m[1][1] = m[1][1]; m3.m[2][1] = m[1][2]; m3.m[0][2] = m[2][0]; m3.m[1][2] = m[2][1]; m3.m[2][2] = m[2][2]; return m3; } T Determinant() const { T result = m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0] + m[0][2] * m[1][0] * m[2][1] - m[2][0] * m[1][1] * m[0][2] - m[2][1] * m[1][2] * m[0][0] - m[2][2] * m[1][0] * m[0][1]; return result; } void Div(T t) { Mul(T(1.0) / t); } void Mul(T t) { for (int row = 0; row < 3; row++) { for (int col = 0; col < 3; col++) { m[row][col] *= t; } } } // Cramer's Rule Matrix3 Inverted() const { Matrix3 m3 = Adjugate(); m3.Div(Determinant()); return m3; } Vec3<T> GetRow(int i) const { return Vec3<T>(m[i][0], m[i][1], m[i][2]); } void SetRow(int i, const Vec3<T>& v) { m[i][0] = v.x; m[i][1] = v.y; m[i][2] = v.z; } Vec3<T> GetColumn(int i) const { return Vec3<T>(m[0][i], m[1][i], m[2][i]); } void SetColumn(int i, const Vec3<T>& v) { m[0][i] = v.x; m[1][i] = v.y; m[2][i] = v.z; } T& operator()(int row, int col) { return m[row][col]; } const T& operator()(int row, int col) const { return m[row][col]; } }; template <typename T> inline Vec3<T> operator*(const Matrix3<T>& m, const Vec3<T>& v) { return Vec3<T>(m(0, 0) * v.x + m(0, 1) * v.y + m(0, 2) * v.z, m(1, 0) * v.x + m(1, 1) * v.y + m(1, 2) * v.z, m(2, 0) * v.x + m(2, 1) * v.y + m(2, 2) * v.z); } // Matrix4 template <typename T> class Matrix4 { public: typedef T ElementType; Matrix4() { MakeIdentity(); } Matrix4(T* m_) { SetValue(m_); } Matrix4(T a00, T a01, T a02, T a03, T a10, T a11, T a12, T a13, T a20, T a21, T a22, T a23, T a30, T a31, T a32, T a33) { el(0, 0) = a00; el(0, 1) = a01; el(0, 2) = a02; el(0, 3) = a03; el(1, 0) = a10; el(1, 1) = a11; el(1, 2) = a12; el(1, 3) = a13; el(2, 0) = a20; el(2, 1) = a21; el(2, 2) = a22; el(2, 3) = a23; el(3, 0) = a30; el(3, 1) = a31; el(3, 2) = a32; el(3, 3) = a33; } void GetValue(T* mp) const { int c = 0; for (int j = 0; j < 4; j++) { for (int i = 0; i < 4; i++) { mp[c++] = el(i, j); } } } const T* GetValue() const { return m; } void SetValue(T* mp) { int c = 0; for (int j = 0; j < 4; j++) { for (int i = 0; i < 4; i++) { el(i, j) = mp[c++]; } } } void SetValue(T r) { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { el(i, j) = r; } } } void MakeIdentity() { el(0, 0) = 1.0; el(0, 1) = 0.0; el(0, 2) = 0.0; el(0, 3) = 0.0; el(1, 0) = 0.0; el(1, 1) = 1.0; el(1, 2) = 0.0; el(1, 3) = 0.0; el(2, 0) = 0.0; el(2, 1) = 0.0; el(2, 2) = 1.0; el(2, 3) = 0.0; el(3, 0) = 0.0; el(3, 1) = 0.0; el(3, 2) = 0.0; el(3, 3) = 1.0; } static Matrix4 Identity() { static const Matrix4 mident(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0); return mident; } static Matrix4 Scale(T s) { Matrix4 mat; mat.SetScale(s); return mat; } static Matrix4 Scale(Vec3<T> s) { Matrix4 mat; mat.SetScale(s); return mat; } static Matrix4 Translate(Vec3<T> t) { Matrix4 mat; mat.SetTranslate(t); return mat; } void SetScale(T s) { el(0, 0) = s; el(1, 1) = s; el(2, 2) = s; } void SetScale(const Vec3<T>& s) { el(0, 0) = s.x; el(1, 1) = s.y; el(2, 2) = s.z; } void SetTranslate(const Vec3<T>& t) { el(0, 3) = t.x; el(1, 3) = t.y; el(2, 3) = t.z; } void SetRow(int r, const Vec4<T>& t) { el(r, 0) = t.x; el(r, 1) = t.y; el(r, 2) = t.z; el(r, 3) = t.w; } void SetColumn(int c, const Vec4<T>& t) { el(0, c) = t.x; el(1, c) = t.y; el(2, c) = t.z; el(3, c) = t.w; } void GetRow(int r, Vec4<T>& t) const { t.x = el(r, 0); t.y = el(r, 1); t.z = el(r, 2); t.w = el(r, 3); } Vec4<T> GetRow(int r) const { Vec4<T> v; GetRow(r, v); return v; } void GetColumn(int c, Vec4<T>& t) const { t.x = el(0, c); t.y = el(1, c); t.z = el(2, c); t.w = el(3, c); } Vec4<T> GetColumn(int c) const { Vec4<T> v; GetColumn(c, v); return v; } Matrix4 Inverted() const { Matrix4 minv; T r1[8], r2[8], r3[8], r4[8]; T *s[4], *tmprow; s[0] = &r1[0]; s[1] = &r2[0]; s[2] = &r3[0]; s[3] = &r4[0]; int i, j, p, jj; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { s[i][j] = el(i, j); if (i == j) s[i][j + 4] = 1.0; else s[i][j + 4] = 0.0; } } T scp[4]; for (i = 0; i < 4; i++) { scp[i] = T(fabs(s[i][0])); for (j = 1; j < 4; j++) { if (T(fabs(s[i][j])) > scp[i]) { scp[i] = T(fabs(s[i][j])); } } if (scp[i] == 0.0) { return minv; // singular matrix! } } int pivot_to; T scp_max; for (i = 0; i < 4; i++) { // select pivot row pivot_to = i; scp_max = T(fabs(s[i][i] / scp[i])); // find out which row should be on top for (p = i + 1; p < 4; p++) { if (T(fabs(s[p][i] / scp[p])) > scp_max) { scp_max = T(fabs(s[p][i] / scp[p])); pivot_to = p; } } // Pivot if necessary if (pivot_to != i) { tmprow = s[i]; s[i] = s[pivot_to]; s[pivot_to] = tmprow; T tmpscp; tmpscp = scp[i]; scp[i] = scp[pivot_to]; scp[pivot_to] = tmpscp; } T mji; // perform gaussian elimination for (j = i + 1; j < 4; j++) { mji = s[j][i] / s[i][i]; s[j][i] = 0.0; for (jj = i + 1; jj < 8; jj++) { s[j][jj] -= mji * s[i][jj]; } } } if (s[3][3] == 0.0) return minv; // singular matrix! // // Now we have an upper triangular matrix. // // x x x x | y y y y // 0 x x x | y y y y // 0 0 x x | y y y y // 0 0 0 x | y y y y // // we'll back substitute to get the inverse // // 1 0 0 0 | z z z z // 0 1 0 0 | z z z z // 0 0 1 0 | z z z z // 0 0 0 1 | z z z z // T mij; for (i = 3; i > 0; i--) { for (j = i - 1; j > -1; j--) { mij = s[j][i] / s[i][i]; for (jj = j + 1; jj < 8; jj++) { s[j][jj] -= mij * s[i][jj]; } } } for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { minv(i, j) = s[i][j + 4] / s[i][i]; } } return minv; } Matrix4 Transposed() const { Matrix4 mtrans; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { mtrans(i, j) = el(j, i); } } return mtrans; } Matrix4& MultRight(const Matrix4& b) { Matrix4 mt(*this); SetValue(T(0)); for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { for (int c = 0; c < 4; c++) { el(i, j) += mt(i, c) * b(c, j); } } } return *this; } Matrix4& MultLeft(const Matrix4& b) { Matrix4 mt(*this); SetValue(T(0)); for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { for (int c = 0; c < 4; c++) { el(i, j) += b(i, c) * mt(c, j); } } } return *this; } // dst = M * src void MultMatrixVec(const Vec3<T>& src, Vec3<T>& dst) const { T w = (src.x * el(3, 0) + src.y * el(3, 1) + src.z * el(3, 2) + el(3, 3)); assert(w != R3_ZERO); dst.x = (src.x * el(0, 0) + src.y * el(0, 1) + src.z * el(0, 2) + el(0, 3)) / w; dst.y = (src.x * el(1, 0) + src.y * el(1, 1) + src.z * el(1, 2) + el(1, 3)) / w; dst.z = (src.x * el(2, 0) + src.y * el(2, 1) + src.z * el(2, 2) + el(2, 3)) / w; } void MultMatrixVec(Vec3<T>& src_and_dst) const { MultMatrixVec(Vec3<T>(src_and_dst), src_and_dst); } // dst = src * M void MultVecMatrix(const Vec3<T>& src, Vec3<T>& dst) const { T w = (src.x * el(0, 3) + src.y * el(1, 3) + src.z * el(2, 3) + el(3, 3)); assert(w != R3_ZERO); dst.x = (src.x * el(0, 0) + src.y * el(1, 0) + src.z * el(2, 0) + el(3, 0)) / w; dst.y = (src.x * el(0, 1) + src.y * el(1, 1) + src.z * el(2, 1) + el(3, 1)) / w; dst.z = (src.x * el(0, 2) + src.y * el(1, 2) + src.z * el(2, 2) + el(3, 2)) / w; } void MultVecMatrix(Vec3<T>& src_and_dst) const { MultVecMatrix(Vec3<T>(src_and_dst), src_and_dst); } // dst = M * src void MultMatrixVec(const Vec4<T>& src, Vec4<T>& dst) const { dst.x = (src.x * el(0, 0) + src.y * el(0, 1) + src.z * el(0, 2) + src.w * el(0, 3)); dst.y = (src.x * el(1, 0) + src.y * el(1, 1) + src.z * el(1, 2) + src.w * el(1, 3)); dst.z = (src.x * el(2, 0) + src.y * el(2, 1) + src.z * el(2, 2) + src.w * el(2, 3)); dst.w = (src.x * el(3, 0) + src.y * el(3, 1) + src.z * el(3, 2) + src.w * el(3, 3)); } void MultMatrixVec(Vec4<T>& src_and_dst) const { MultMatrixVec(Vec4<T>(src_and_dst), src_and_dst); } // dst = src * M void MultVecMatrix(const Vec4<T>& src, Vec4<T>& dst) const { dst.x = (src.x * el(0, 0) + src.y * el(1, 0) + src.z * el(2, 0) + src.w * el(3, 0)); dst.y = (src.x * el(0, 1) + src.y * el(1, 1) + src.z * el(2, 1) + src.w * el(3, 1)); dst.z = (src.x * el(0, 2) + src.y * el(1, 2) + src.z * el(2, 2) + src.w * el(3, 2)); dst.w = (src.x * el(0, 3) + src.y * el(1, 3) + src.z * el(2, 3) + src.w * el(3, 3)); } void MultVecMatrix(Vec4<T>& src_and_dst) const { MultVecMatrix(Vec4<T>(src_and_dst), src_and_dst); } // dst = M * src void MultMatrixDir(const Vec3<T>& src, Vec3<T>& dst) const { dst.x = (src.x * el(0, 0) + src.y * el(0, 1) + src.z * el(0, 2)); dst.y = (src.x * el(1, 0) + src.y * el(1, 1) + src.z * el(1, 2)); dst.z = (src.x * el(2, 0) + src.y * el(2, 1) + src.z * el(2, 2)); } void MultMatrixDir(Vec3<T>& src_and_dst) const { MultMatrixDir(Vec3<T>(src_and_dst), src_and_dst); } // dst = src * M void MultDirMatrix(const Vec3<T>& src, Vec3<T>& dst) const { dst.x = (src.x * el(0, 0) + src.y * el(1, 0) + src.z * el(2, 0)); dst.y = (src.x * el(0, 1) + src.y * el(1, 1) + src.z * el(2, 1)); dst.z = (src.x * el(0, 2) + src.y * el(1, 2) + src.z * el(2, 2)); } void MultDirMatrix(Vec3<T>& src_and_dst) const { MultDirMatrix(Vec3<T>(src_and_dst), src_and_dst); } T& operator()(int row, int col) { return el(row, col); } const T& operator()(int row, int col) const { return el(row, col); } T& el(int row, int col) { return m[row | (col << 2)]; } const T& el(int row, int col) const { return m[row | (col << 2)]; } Matrix4& operator*=(const Matrix4& mat) { MultRight(mat); return *this; } Matrix4& operator*=(const T& r) { for (int i = 0; i < 4; ++i) { el(0, i) *= r; el(1, i) *= r; el(2, i) *= r; el(3, i) *= r; } return *this; } Matrix4& operator+=(const Matrix4& mat) { for (int i = 0; i < 4; ++i) { el(0, i) += mat.el(0, i); el(1, i) += mat.el(1, i); el(2, i) += mat.el(2, i); el(3, i) += mat.el(3, i); } return *this; } T m[16]; }; template <typename T> inline Matrix4<T> operator*(const Matrix4<T>& m1, const Matrix4<T>& m2) { static Matrix4<T> product; product = m1; product.MultRight(m2); return product; } template <typename T> inline bool operator==(const Matrix4<T>& m1, const Matrix4<T>& m2) { return (m1(0, 0) == m2(0, 0) && m1(0, 1) == m2(0, 1) && m1(0, 2) == m2(0, 2) && m1(0, 3) == m2(0, 3) && m1(1, 0) == m2(1, 0) && m1(1, 1) == m2(1, 1) && m1(1, 2) == m2(1, 2) && m1(1, 3) == m2(1, 3) && m1(2, 0) == m2(2, 0) && m1(2, 1) == m2(2, 1) && m1(2, 2) == m2(2, 2) && m1(2, 3) == m2(2, 3) && m1(3, 0) == m2(3, 0) && m1(3, 1) == m2(3, 1) && m1(3, 2) == m2(3, 2) && m1(3, 3) == m2(3, 3)); } template <typename T> inline bool operator!=(const Matrix4<T>& m1, const Matrix4<T>& m2) { return !(m1 == m2); } template <typename T> inline Vec3<T> operator*(const Matrix4<T>& m, const Vec3<T>& v) { Vec3<T> r; m.MultMatrixVec(v, r); return r; } template <typename T> inline Vec4<T> operator*(const Matrix4<T>& m, const Vec4<T>& v) { Vec4<T> r; m.MultMatrixVec(v, r); return r; } template <typename T> inline Vec3<T> operator*(const Vec3<T>& v, const Matrix4<T>& m) { Vec3<T> r; m.MultVecMatrix(v, r); return r; } template <typename T> inline Vec4<T> operator*(const Vec4<T>& v, const Matrix4<T>& m) { Vec4<T> r; m.MultVecMatrix(v, r); return r; } template <typename T> inline Matrix4<T> ToMatrix4(const Matrix3<T>& m3) { Matrix4<T> m4; m4(0, 0) = m3(0, 0); m4(0, 1) = m3(0, 1); m4(0, 2) = m3(0, 2); m4(0, 3) = 0.0f; m4(1, 0) = m3(1, 0); m4(1, 1) = m3(1, 1); m4(1, 2) = m3(1, 2); m4(1, 3) = 0.0f; m4(2, 0) = m3(2, 0); m4(2, 1) = m3(2, 1); m4(2, 2) = m3(2, 2); m4(2, 3) = 0.0f; m4(3, 0) = 0.0f; m4(3, 1) = 0.0f; m4(3, 2) = 0.0f; m4(3, 3) = 1.0f; return m4; } template <typename T> inline Matrix3<T> ToMatrix3(const Matrix4<T>& m4) { Matrix3<T> m3; m3(0, 0) = m4(0, 0); m3(0, 1) = m4(0, 1); m3(0, 2) = m4(0, 2); m3(1, 0) = m4(1, 0); m3(1, 1) = m4(1, 1); m3(1, 2) = m4(1, 2); m3(2, 0) = m4(2, 0); m3(2, 1) = m4(2, 1); m3(2, 2) = m4(2, 2); return m3; } template <typename T> class Quaternion { public: typedef T ElementType; Quaternion() { q[0] = q[1] = q[2] = 0.0; q[3] = R3_ONE; } Quaternion(const T v[4]) { SetValue(v); } Quaternion(T q0, T q1, T q2, T q3) { SetValue(q0, q1, q2, q3); } Quaternion(const Matrix4<T>& m) { SetValue(m); } Quaternion(const Vec3<T>& axis, T radians) { SetValue(axis, radians); } Quaternion(const Vec3<T>& rotateFrom, const Vec3<T>& rotateTo) { SetValue(rotateFrom, rotateTo); } Quaternion(const Vec3<T>& fromLook, const Vec3<T>& fromUp, const Vec3<T>& toLook, const Vec3<T>& toUp) { SetValue(fromLook, fromUp, toLook, toUp); } const T* GetValue() const { return &q[0]; } void GetValue(T& q0, T& q1, T& q2, T& q3) const { q0 = q[0]; q1 = q[1]; q2 = q[2]; q3 = q[3]; } Quaternion& SetValue(T q0, T q1, T q2, T q3) { q[0] = q0; q[1] = q1; q[2] = q2; q[3] = q3; return *this; } void GetValue(Vec3<T>& axis, T& radians) const { radians = T(acos(q[3]) * R3_TWO); if (radians == R3_ZERO) axis = Vec3<T>(0.0, 0.0, 1.0); else { axis.x = q[0]; axis.y = q[1]; axis.z = q[2]; axis.Normalize(); } } void GetValue(Matrix3<T>& m) const { T s, xs, ys, zs, wx, wy, wz, xx, xy, xz, yy, yz, zz; T norm = q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3]; s = (Equivalent(norm, T(R3_ZERO))) ? R3_ZERO : (R3_TWO / norm); xs = q[0] * s; ys = q[1] * s; zs = q[2] * s; wx = q[3] * xs; wy = q[3] * ys; wz = q[3] * zs; xx = q[0] * xs; xy = q[0] * ys; xz = q[0] * zs; yy = q[1] * ys; yz = q[1] * zs; zz = q[2] * zs; m(0, 0) = T(R3_ONE - (yy + zz)); m(1, 0) = T(xy + wz); m(2, 0) = T(xz - wy); m(0, 1) = T(xy - wz); m(1, 1) = T(R3_ONE - (xx + zz)); m(2, 1) = T(yz + wx); m(0, 2) = T(xz + wy); m(1, 2) = T(yz - wx); m(2, 2) = T(R3_ONE - (xx + yy)); } void GetValue(Matrix4<T>& m) const { Matrix3<T> m3; GetValue(m3); m = ToMatrix4(m3); } Matrix3<T> GetMatrix3() const { Matrix3<T> m; GetValue(m); return m; } Matrix4<T> GetMatrix4() const { Matrix4<T> m; GetValue(m); return m; } Quaternion& SetValue(const T* qp) { memcpy(q, qp, sizeof(T) * 4); return *this; } Quaternion& SetValue(const Matrix4<T>& m) { T tr, s; int i, j, k; const int nxt[3] = {1, 2, 0}; tr = m(0, 0) + m(1, 1) + m(2, 2); if (tr > R3_ZERO) { s = T(sqrt(tr + m(3, 3))); q[3] = T(s * 0.5); s = T(0.5) / s; q[0] = T((m(1, 2) - m(2, 1)) * s); q[1] = T((m(2, 0) - m(0, 2)) * s); q[2] = T((m(0, 1) - m(1, 0)) * s); } else { i = 0; if (m(1, 1) > m(0, 0)) i = 1; if (m(2, 2) > m(i, i)) i = 2; j = nxt[i]; k = nxt[j]; s = T(sqrt((m(i, j) - (m(j, j) + m(k, k))) + R3_ONE)); q[i] = T(s * 0.5); s = T(0.5 / s); q[3] = T((m(j, k) - m(k, j)) * s); q[j] = T((m(i, j) + m(j, i)) * s); q[k] = T((m(i, k) + m(k, i)) * s); } return *this; } Quaternion& SetValue(const Vec3<T>& axis, T theta) { T lensquared = axis.LengthSquared(); if (lensquared <= T(R3_EPSILON)) { // axis too small. x = y = z = 0.0; w = R3_ONE; } else { theta *= T(0.5); T sin_theta = T(sin(theta)); if (!Equivalent(lensquared, T(R3_ONE))) { sin_theta /= T(sqrt(lensquared)); } x = sin_theta * axis.x; y = sin_theta * axis.y; z = sin_theta * axis.z; w = T(cos(theta)); } return *this; } Quaternion& SetValue(const Vec3<T>& rotateFrom, const Vec3<T>& rotateTo) { Vec3<T> p1, p2; T alpha; p1 = rotateFrom; p1.Normalize(); p2 = rotateTo; p2.Normalize(); alpha = p1.Dot(p2); if (GreaterThan(alpha, T(R3_ONE))) { *this = Identity(); return *this; } // ensures that the anti-parallel case leads to a positive dot if (LessThan(alpha, T(-R3_ONE))) { Vec3<T> v; if (p1.x != p1.y) { v = Vec3<T>(p1.y, p1.x, p1.z); } else { v = Vec3<T>(p1.z, p1.y, p1.x); } v -= p1 * p1.Dot(v); v.Normalize(); SetValue(v, R3_PI); return *this; } p1 = p1.Cross(p2); p1.Normalize(); SetValue(p1, T(acos(alpha))); return *this; } Quaternion& SetValue(const Vec3<T>& fromLook, const Vec3<T>& fromUp, const Vec3<T>& toLook, const Vec3<T>& toUp) { Vec3<T> fL = fromLook.Normalized(); Vec3<T> fU = fromUp.Normalized(); Vec3<T> tL = toLook.Normalized(); Vec3<T> tU = toUp.Normalized(); Quaternion r = Quaternion(fL, tL); Vec3<T> rfU = r * fU; // Vec3<T> rfL = r * fL; Vec3<T> tUo = tU.Orthonormalized(tL); float d = std::max(-1.0f, std::min(1.0f, rfU.Dot(tUo))); float twist = acosf(d); Vec3<T> ux = rfU.Cross(tUo); if (ux.Dot(tL) < 0) { twist = -twist; } Quaternion rTwist = Quaternion(tL, twist); *this = rTwist * r; return *this; } Quaternion& operator*=(const Quaternion& qr) { Quaternion ql(*this); w = ql.w * qr.w - ql.x * qr.x - ql.y * qr.y - ql.z * qr.z; x = ql.w * qr.x + ql.x * qr.w + ql.y * qr.z - ql.z * qr.y; y = ql.w * qr.y + ql.y * qr.w + ql.z * qr.x - ql.x * qr.z; z = ql.w * qr.z + ql.z * qr.w + ql.x * qr.y - ql.y * qr.x; return *this; } void Normalize() { T rnorm = R3_ONE / T(sqrt(w * w + x * x + y * y + z * z)); if (Equivalent(rnorm, R3_ZERO)) { return; } x *= rnorm; y *= rnorm; z *= rnorm; w *= rnorm; } Quaternion Normalized() const { Quaternion quat(*this); quat.Normalize(); return quat; } bool Equals(const Quaternion& r, T tolerance) const { T t; t = ((q[0] - r.q[0]) * (q[0] - r.q[0]) + (q[1] - r.q[1]) * (q[1] - r.q[1]) + (q[2] - r.q[2]) * (q[2] - r.q[2]) + (q[3] - r.q[3]) * (q[3] - r.q[3])); if (t > R3_EPSILON) { return false; } return 1; } Quaternion& Conjugate() { q[0] *= -R3_ONE; q[1] *= -R3_ONE; q[2] *= -R3_ONE; return *this; } Quaternion& Invert() { return Conjugate(); } Quaternion Inverted() const { Quaternion r = *this; return r.Invert(); } // // Quaternion multiplication with cartesian vector // v' = q*v*q(star) // void MultVec(const Vec3<T>& src, Vec3<T>& dst) const { T v_coef = w * w - x * x - y * y - z * z; T u_coef = R3_TWO * (src.x * x + src.y * y + src.z * z); T c_coef = R3_TWO * w; dst.x = v_coef * src.x + u_coef * x + c_coef * (y * src.z - z * src.y); dst.y = v_coef * src.y + u_coef * y + c_coef * (z * src.x - x * src.z); dst.z = v_coef * src.z + u_coef * z + c_coef * (x * src.y - y * src.x); } void MultVec(Vec3<T>& src_and_dst) const { MultVec(Vec3<T>(src_and_dst), src_and_dst); } Vec3<T> Rotate(const Vec3<T>& v) const { Vec3<T> ret; (*this).MultVec(v, ret); return ret; } void ScaleAngle(T scaleFactor) { Vec3<T> axis; T radians; GetValue(axis, radians); radians *= scaleFactor; SetValue(axis, radians); } static Quaternion Slerp(const Quaternion& p, const Quaternion& q, T alpha) { Quaternion r; T cos_omega = p.x * q.x + p.y * q.y + p.z * q.z + p.w * q.w; // if B is on opposite hemisphere from A, use -B instead int bflip; if ((bflip = (cos_omega < R3_ZERO))) { cos_omega = -cos_omega; } // complementary interpolation parameter T beta = R3_ONE - alpha; if (cos_omega <= R3_ONE - R3_EPSILON) { return p; } T omega = T(acos(cos_omega)); T one_over_sin_omega = R3_ONE / T(sin(omega)); beta = T(sin(omega * beta) * one_over_sin_omega); alpha = T(sin(omega * alpha) * one_over_sin_omega); if (bflip) { alpha = -alpha; } r.x = beta * p.q[0] + alpha * q.q[0]; r.y = beta * p.q[1] + alpha * q.q[1]; r.z = beta * p.q[2] + alpha * q.q[2]; r.w = beta * p.q[3] + alpha * q.q[3]; return r; } static Quaternion Identity() { static const Quaternion ident(Vec3<T>(0.0, 0.0, 0.0), R3_ONE); return ident; } T& operator[](int i) { assert(i < 4); return q[i]; } const T& operator[](int i) const { assert(i < 4); return q[i]; } union { struct { T x, y, z, w; }; T q[4]; }; }; template <typename T> inline bool operator==(const Quaternion<T>& q1, const Quaternion<T>& q2) { return (Equivalent(q1.x, q2.x) && Equivalent(q1.y, q2.y) && Equivalent(q1.z, q2.z) && Equivalent(q1.w, q2.w)); } template <typename T> inline bool operator!=(const Quaternion<T>& q1, const Quaternion<T>& q2) { return !(q1 == q2); } template <typename T> inline Quaternion<T> operator*(const Quaternion<T>& q1, const Quaternion<T>& q2) { Quaternion<T> r(q1); r *= q2; return r; } template <typename T> inline Vec3<T> operator*(const Quaternion<T>& q, const Vec3<T>& v) { Vec3<T> r(v); q.MultVec(r); return r; } template <typename T> class Plane { public: typedef T ElementType; Plane() { planedistance = 0.0; planenormal.SetValue(0.0, 0.0, 1.0); } Plane(const Vec3<T>& p0, const Vec3<T>& p1, const Vec3<T>& p2) { Vec3<T> v0 = p1 - p0; Vec3<T> v1 = p2 - p0; planenormal = v0.Cross(v1); planenormal.Normalize(); planedistance = p0.Dot(planenormal); } Plane(const Vec3<T>& normal, T distance) { planedistance = distance; planenormal = normal; planenormal.Normalize(); } Plane(const Vec3<T>& normal, const Vec3<T>& point) { planenormal = normal; planenormal.Normalize(); planedistance = point.Dot(planenormal); } void Offset(T d) { planedistance += d; } bool Intersect(const Line<T>& l, Vec3<T>& intersection) const { Vec3<T> pos, dir; Vec3<T> pn = planenormal; T pd = planedistance; pos = l.GetPosition(); dir = l.GetDirection(); if (dir.Dot(pn) == 0.0) return 0; pos -= pn * pd; // now we're talking about a Plane passing through the origin if (pos.Dot(pn) < 0.0) pn.Negate(); if (dir.Dot(pn) > 0.0) dir.Negate(); Vec3<T> ppos = pn * pos.Dot(pn); pos = (ppos.Length() / dir.Dot(-pn)) * dir; intersection = l.GetPosition(); intersection += pos; return 1; } void Transform(const Matrix4<T>& matrix) { Matrix4<T> invtr = matrix.Inverted(); invtr = invtr.Transposed(); Vec3<T> pntOnPlane = planenormal * planedistance; Vec3<T> newPntOnPlane; Vec3<T> newnormal; invtr.MultDirMatrix(planenormal, newnormal); matrix.MultVecMatrix(pntOnPlane, newPntOnPlane); newnormal.Normalize(); planenormal = newnormal; planedistance = newPntOnPlane.Dot(planenormal); } bool IsInHalfSpace(const Vec3<T>& point) const { if ((point.Dot(planenormal) - planedistance) < 0.0) return 0; return 1; } T Distance(const Vec3<T>& point) const { return planenormal.Dot(point - planenormal * planedistance); } const Vec3<T>& GetNormal() const { return planenormal; } T GetDistanceFromOrigin() const { return planedistance; } // protected: Vec3<T> planenormal; T planedistance; }; template <typename T> inline bool operator==(const Plane<T>& p1, const Plane<T>& p2) { return (p1.planedistance == p2.planedistance && p1.planenormal == p2.planenormal); } template <typename T> inline bool operator!=(const Plane<T>& p1, const Plane<T>& p2) { return !(p1 == p2); } // some useful constructors / functions // inverse of camera_lookat template <typename T> inline Matrix4<T> GeomLookAt(const Vec3<T>& from, const Vec3<T>& to, const Vec3<T>& Up) { Vec3<T> look = to - from; look.Normalize(); Vec3<T> up(Up); up -= look * look.Dot(up); up.Normalize(); Quaternion<T> r(Vec3<T>(0, 0, -1), Vec3<T>(0, 1, 0), look, up); Matrix4<T> m; r.GetValue(m); m.SetTranslate(from); return m; } // inverse of object_lookat template <typename T> inline Matrix4<T> CameraLookAt(const Vec3<T>& eye, const Vec3<T>& lookpoint, const Vec3<T>& Up) { Vec3<T> look = lookpoint - eye; look.Normalize(); Vec3<T> up(Up); up -= look * look.Dot(up); up.Normalize(); Matrix4<T> t; t.SetTranslate(-eye); Quaternion<T> r(Vec3<T>(0, 0, -1), Vec3<T>(0, 1, 0), look, up); r.Invert(); Matrix4<T> rm; r.GetValue(rm); return rm * t; } template <typename T> inline Matrix4<T> Frustum(T left, T right, T bottom, T top, T zNear, T zFar) { Matrix4<T> m; m(0, 0) = (2 * zNear) / (right - left); m(0, 2) = (right + left) / (right - left); m(1, 1) = (2 * zNear) / (top - bottom); m(1, 2) = (top + bottom) / (top - bottom); m(2, 2) = -(zFar + zNear) / (zFar - zNear); m(2, 3) = -2 * zFar * zNear / (zFar - zNear); m(3, 2) = -1; m(3, 3) = 0; return m; } template <typename T> inline Matrix4<T> FrustumInverted(T left, T right, T bottom, T top, T zNear, T zFar) { Matrix4<T> m; m(0, 0) = (right - left) / (2 * zNear); m(0, 3) = (right + left) / (2 * zNear); m(1, 1) = (top - bottom) / (2 * zNear); m(1, 3) = (top + bottom) / (2 * zNear); m(2, 2) = 0; m(2, 3) = -1; m(3, 2) = -(zFar - zNear) / (2 * zFar * zNear); m(3, 3) = (zFar + zNear) / (2 * zFar * zNear); return m; } template <typename T> inline Matrix4<T> Perspective(T fovy, T aspect, T zNear, T zFar) { T tangent = T(tan(ToRadians(fovy / T(2.0)))); T y = tangent * zNear; T x = aspect * y; return Frustum(-x, x, -y, y, zNear, zFar); } template <typename T> inline Matrix4<T> PerspectiveInverted(T fovy, T aspect, T zNear, T zFar) { T tangent = T(tan(ToRadians(fovy / T(2.0)))); T y = tangent * zNear; T x = aspect * y; return FrustumInverted(-x, x, -y, y, zNear, zFar); } template <typename T> inline Matrix4<T> Ortho(T left, T right, T bottom, T top, T zNear, T zFar) { Matrix4<T> m; Vec3<T> s(1 / (right - left), 1 / (top - bottom), 1 / (zFar - zNear)); m.SetScale(s * T(2)); m.SetTranslate(s * Vec3<T>(-(right + left), -(top + bottom), zFar + zNear)); return m; } template <typename T> inline Matrix4<T> OrthoInverted(T left, T right, T bottom, T top, T zNear, T zFar) { // could be done with a formula, but I'm being lazy Matrix4<T> m = Ortho(left, right, bottom, top, zNear, zFar); return m.Inverted(); } template <typename T> struct Pose { typedef T ElementType; typedef Quaternion<T> Q; typedef Vec3<T> V; Q r; V t; Pose() {} Pose(const Pose& p) : r(p.r), t(p.t) {} Pose(const Q& rotation, const V& translation) { SetValue(rotation, translation); } void SetValue(const Q& rotation, const V& translation) { r = rotation; t = translation; } void SetValue(const V& from, const V& to, const V& up) { t = from; V look = (to - from).Normalized(); V u = (up - look * Dot(look, up)).Normalized(); // -Z is the canonical fwd vector, and +Y is the canonical up vector r.SetValue(V(0, 0, -1), V(0, 1, 0), look, u); } V Transform(const V& pos) const { return t + r.Rotate(pos); } Pose Inverted() const { Q ir = r.Inverted(); return Pose(ir, ir.Rotate(-t)); } Matrix4<T> GetMatrix4() const { return Matrix4<T>::Translate(t) * r.GetMatrix4(); } }; // make common typedefs... typedef Vec2<int> Vec2i; typedef Vec2<float> Vec2f; typedef Vec2<double> Vec2d; typedef Vec3<int> Vec3i; typedef Vec3<float> Vec3f; typedef Vec3<double> Vec3d; typedef Vec4<float> Vec4f; typedef Vec4<double> Vec4d; typedef Vec4<int> Vec4i; typedef Vec4<unsigned char> Vec4ub; typedef Quaternion<float> Quaternionf; typedef Quaternion<double> Quaterniond; typedef Quaternion<float> Rotationf; typedef Quaternion<double> Rotationd; typedef Line<float> Linef; typedef Line<double> Lined; typedef LineSegment2<float> LineSegment2f; typedef LineSegment2<double> LineSegment2d; typedef Plane<float> Planef; typedef Plane<double> Planed; typedef Matrix3<float> Matrix3f; typedef Matrix3<double> Matrix3d; typedef Matrix3<int> Matrix3i; typedef Matrix4<float> Matrix4f; typedef Matrix4<double> Matrix4d; typedef Pose<float> Posef; typedef Pose<double> Posed; } // namespace r3
[ "cass.everitt@oculus.com" ]
cass.everitt@oculus.com
52a4ee959de92da43c82208c4ec0d5c145f2a1a4
b611beffab6205d9bd3f003036465edfc0bfe5b8
/C/interros/cours/annees_precedentes/interro-2015-12-07/code1.cpp
d2bc12ab9e9ce4a1498f5e624a96b743e14840c2
[]
no_license
AmerBouayad/OldProjects
5366551abe6f9b00120c53fdbfd0772557f8e886
b2632a284f5785970879d984e3e7ff7eeb45c7a7
refs/heads/master
2022-12-08T22:32:33.353108
2020-09-06T22:41:48
2020-09-06T22:41:48
293,326,487
0
0
null
null
null
null
UTF-8
C++
false
false
241
cpp
#include <iostream> int f(const char tab[]) { return sizeof(tab) / sizeof(*tab); } int main() { char bat[] = {1, 2, 3, 4, 5, 6, 7}; std::cout << (sizeof(bat) / sizeof(*bat)) << std::endl; std::cout << f (bat) << std::endl; }
[ "42392@etu.he2b.be" ]
42392@etu.he2b.be
5f847d3c879dd8e2e844bda4506b384630ded887
3dc008f3d6facdc3b1bcd93cc77267256497c2ed
/C++Training/MemoryManagement/11HeapObjectProhibition.cpp
aa47750f45a2fd9c128a67cf06a1aa2d4695c7f9
[]
no_license
sunny972538/c-_materials
5f5348466bb8b76fdb5f34236ac1d3ffb288226d
919a397b5a51e7a0f9d0c5caf6f6f1c61d76029b
refs/heads/master
2020-05-18T16:32:27.675570
2019-05-02T06:04:36
2019-05-02T06:04:36
184,529,152
0
0
null
null
null
null
UTF-8
C++
false
false
430
cpp
#include<iostream> #include<new> using namespace std; namespace Ex19 { struct SA //<-- prevent instantiation on heap { private: static void* operator new(size_t size) { return malloc(size); } }; }; using namespace Ex19; void main19() { SA stackObject; // stackObject::SA::SA(); //SA *heapObject = new SA(); <-- error /* SA *p = SA::operator new(sizeof(SA)); <--error not accessible p->SA::SA(); */ }
[ "sunny972538@gmail.com" ]
sunny972538@gmail.com
09ff1037ae5885ff29eb2d493f769301d4c4de79
c7ad1dd84604e275ebfc5a7e354b23ceb598fca5
/include/algo/blast/api/windowmask_filter.hpp
390b8934834c4d1ae93fbc1dfdacf196254ecc50
[]
no_license
svn2github/ncbi_tk
fc8cfcb75dfd79840e420162a8ae867826a3d922
c9580988f9e5f7c770316163adbec8b7a40f89ca
refs/heads/master
2023-09-03T12:30:52.531638
2017-05-15T14:17:27
2017-05-15T14:17:27
60,197,012
1
1
null
null
null
null
UTF-8
C++
false
false
3,366
hpp
/* $Id$ * =========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software/database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software/database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * */ /** @file windowmask_filter.hpp * Interface to retrieve list of available windowmasker filtering */ #ifndef ALGO_BLAST_API___WINDOWMASK_FILTER_HPP #define ALGO_BLAST_API___WINDOWMASK_FILTER_HPP #include <algo/blast/core/blast_export.h> /** @addtogroup AlgoBlast * * @{ */ BEGIN_NCBI_SCOPE BEGIN_SCOPE(blast) /// This function returns a list of NCBI taxonomy IDs for which there exists /// windowmasker masking data to support organism specific filtering. NCBI_XBLAST_EXPORT void GetTaxIdWithWindowMaskerSupport(set<int>& supported_taxids); /// Get the windowmasker file path for a given taxid /// @param taxid NCBI taxonomy ID to get windowmasker files for [in] /// @return empty string if not found NCBI_XBLAST_EXPORT string WindowMaskerTaxidToDb(int taxid); /// Get the windowmasker file path for a given taxid and base path /// @param taxid NCBI taxonomy ID to get windowmasker files for [in] /// @return empty string if not found /// @note Needed for GBench to ensure MT-safety, it this is not a concern, use /// the other overloaded version of WindowMaskerTaxidToDb NCBI_XBLAST_EXPORT string WindowMaskerTaxidToDb(const string& window_masker_path, int taxid); /// Initialize the path to the windowmasker data files /// @param window_masker_path path to window masker data files [in] /// @return 0 in case of success, 1 if the path does not exist or is a file NCBI_XBLAST_EXPORT int WindowMaskerPathInit(const string& window_masker_path); /// Resets the path to the windowmasker data files NCBI_XBLAST_EXPORT void WindowMaskerPathReset(); /// Retrieves the path to the windowmasker data files NCBI_XBLAST_EXPORT string WindowMaskerPathGet(); END_SCOPE(BLAST) END_NCBI_SCOPE /* @} */ #endif /* ALGO_BLAST_API___WINDOWMASK_FILTER_HPP */
[ "camacho@112efe8e-fc92-43c6-89b6-d25c299ce97b" ]
camacho@112efe8e-fc92-43c6-89b6-d25c299ce97b
4dd1cf10972596b1eee3f2bab3006beb8ff4c3bc
cc95b782330ed397090c4c45521faf9bc24350a4
/lab4-main.cpp
6f0efdcaf7164f3ebc6c2772a407f4bdf57a2b86
[]
no_license
ehh2h/HashTableLab
76320e493a0122d625e1ff0a445646fa5059f7ac
d98d342072a2b7749e1247c4c39521f90f47c825
refs/heads/master
2021-03-12T19:25:15.607558
2015-02-27T13:39:40
2015-02-27T13:39:40
31,420,495
0
0
null
null
null
null
UTF-8
C++
false
false
509
cpp
// File: lab4-main.cpp // Programmer: Eric Howard // Description: Main Client File #include <iostream> using namespace std; #include "recordsOffice.h" int main(){ //int argc, char* argv[]){ //string commandsFileName( "lab4-commands-short.tab"); //string commandsFileName( "lab4-commands.tab"); string commandsFileName( "lab4-commands-test.tab"); recordsOffice records; cout << "Importing " << commandsFileName << endl; records.importRecords(commandsFileName); return 0; }
[ "ehh2h@Mtmail.mtsu.edu" ]
ehh2h@Mtmail.mtsu.edu
cc0e4f6995e5b5cdd8922153f3c771007cc4c8bb
6cc69d2446fb12f8660df7863d8866d29d52ce08
/src/Practice/Websites/GeeksForGeeks/Trees/Page 4/DeleteATree.h
c795334dcea4d1ab4d404f9a84fcace7e9dcd6e8
[]
no_license
kodakandlaavinash/DoOrDie
977e253b048668561fb56ec5c6d3c40d9b57a440
f961e068e435a5cedb66d0fba5c21b63afe37390
refs/heads/master
2021-01-23T02:30:10.606394
2013-09-12T08:06:45
2013-09-12T08:06:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,063
h
/* * DeleteATree.h * * Created on: Jul 17, 2013 * Author: Avinash */ // // Testing Status // #include <string> #include <vector> #include <cstdlib> #include <cstdio> #include <cmath> #include <algorithm> #include <ctime> #include <list> #include <map> #include <set> #include <bitset> #include <functional> #include <utility> #include <iostream> #include <fstream> #include <sstream> #include <string.h> #include <hash_map> #include <stack> #include <queue> #include <limits.h> using namespace std; using namespace __gnu_cxx; #define null NULL #define PRINT_NEW_LINE printf("\n") //int main(){ // return -1; //} #ifndef DELETEATREE_H_ #define DELETEATREE_H_ void DeleteEntireTree(tNode *ptr){ if(ptr == NULL){ return; } if(ptr->left == NULL || ptr->right == NULL){ return; } tNode *nodeToBeDeleted; DeleteEntireTree(ptr->left); nodeToBeDeleted = ptr->left; ptr->left = NULL; free(nodeToBeDeleted); DeleteEntireTree(ptr->right); nodeToBeDeleted = ptr->right; ptr->right = NULL; free(nodeToBeDeleted); } #endif /* DELETEATREE_H_ */
[ "kodakandlaavinash@gmail.com" ]
kodakandlaavinash@gmail.com
fe76c29751319172f44976f9551e219be04fddf4
4cbc4fe975925f1f242fb1f807219eb9c1b250fc
/external/include/webrtc/base/network.h
52d7d35a2c924e5dcfa6fcf808128dcfaa42e7ff
[ "MIT" ]
permissive
vahid-dan/Tincan
1b1b8d3e0b94a023160ad4f81c0ca35f01f00668
747040d5b12457b69011ce64ada9319800e5dd22
refs/heads/master
2020-04-22T19:46:13.668607
2019-02-14T03:11:18
2019-02-14T03:11:18
170,618,742
0
1
MIT
2019-02-14T03:10:18
2019-02-14T03:10:17
null
UTF-8
C++
false
false
15,520
h
/* * 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. */ #ifndef WEBRTC_BASE_NETWORK_H_ #define WEBRTC_BASE_NETWORK_H_ #include <stdint.h> #include <deque> #include <map> #include <memory> #include <string> #include <vector> #include "webrtc/base/ipaddress.h" #include "webrtc/base/networkmonitor.h" #include "webrtc/base/messagehandler.h" #include "webrtc/base/sigslot.h" #if defined(WEBRTC_POSIX) struct ifaddrs; #endif // defined(WEBRTC_POSIX) namespace rtc { extern const char kPublicIPv4Host[]; extern const char kPublicIPv6Host[]; class IfAddrsConverter; class Network; class NetworkMonitorInterface; class Thread; static const uint16_t kNetworkCostMax = 999; static const uint16_t kNetworkCostHigh = 900; static const uint16_t kNetworkCostUnknown = 50; static const uint16_t kNetworkCostLow = 10; static const uint16_t kNetworkCostMin = 0; // By default, ignore loopback interfaces on the host. const int kDefaultNetworkIgnoreMask = ADAPTER_TYPE_LOOPBACK; // Makes a string key for this network. Used in the network manager's maps. // Network objects are keyed on interface name, network prefix and the // length of that prefix. std::string MakeNetworkKey(const std::string& name, const IPAddress& prefix, int prefix_length); class DefaultLocalAddressProvider { public: virtual ~DefaultLocalAddressProvider() = default; // The default local address is the local address used in multi-homed endpoint // when the any address (0.0.0.0 or ::) is used as the local address. It's // important to check the return value as a IP family may not be enabled. virtual bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const = 0; }; // Generic network manager interface. It provides list of local // networks. // // Every method of NetworkManager (including the destructor) must be called on // the same thread, except for the constructor which may be called on any // thread. // // This allows constructing a NetworkManager subclass on one thread and // passing it into an object that uses it on a different thread. class NetworkManager : public DefaultLocalAddressProvider { public: typedef std::vector<Network*> NetworkList; // This enum indicates whether adapter enumeration is allowed. enum EnumerationPermission { ENUMERATION_ALLOWED, // Adapter enumeration is allowed. Getting 0 network // from GetNetworks means that there is no network // available. ENUMERATION_BLOCKED, // Adapter enumeration is disabled. // GetAnyAddressNetworks() should be used instead. }; NetworkManager(); ~NetworkManager() override; // Called when network list is updated. sigslot::signal0<> SignalNetworksChanged; // Indicates a failure when getting list of network interfaces. sigslot::signal0<> SignalError; // This should be called on the NetworkManager's thread before the // NetworkManager is used. Subclasses may override this if necessary. virtual void Initialize() {} // Start/Stop monitoring of network interfaces // list. SignalNetworksChanged or SignalError is emitted immediately // after StartUpdating() is called. After that SignalNetworksChanged // is emitted whenever list of networks changes. virtual void StartUpdating() = 0; virtual void StopUpdating() = 0; // Returns the current list of networks available on this machine. // StartUpdating() must be called before this method is called. // It makes sure that repeated calls return the same object for a // given network, so that quality is tracked appropriately. Does not // include ignored networks. virtual void GetNetworks(NetworkList* networks) const = 0; // return the current permission state of GetNetworks() virtual EnumerationPermission enumeration_permission() const; // "AnyAddressNetwork" is a network which only contains single "any address" // IP address. (i.e. INADDR_ANY for IPv4 or in6addr_any for IPv6). This is // useful as binding to such interfaces allow default routing behavior like // http traffic. // TODO(guoweis): remove this body when chromium implements this. virtual void GetAnyAddressNetworks(NetworkList* networks) {} // Dumps the current list of networks in the network manager. virtual void DumpNetworks() {} bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const override; struct Stats { int ipv4_network_count; int ipv6_network_count; Stats() { ipv4_network_count = 0; ipv6_network_count = 0; } }; }; // Base class for NetworkManager implementations. class NetworkManagerBase : public NetworkManager { public: NetworkManagerBase(); ~NetworkManagerBase() override; void GetNetworks(NetworkList* networks) const override; void GetAnyAddressNetworks(NetworkList* networks) override; // Defaults to true. bool ipv6_enabled() const { return ipv6_enabled_; } void set_ipv6_enabled(bool enabled) { ipv6_enabled_ = enabled; } void set_max_ipv6_networks(int networks) { max_ipv6_networks_ = networks; } int max_ipv6_networks() { return max_ipv6_networks_; } EnumerationPermission enumeration_permission() const override; bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const override; protected: typedef std::map<std::string, Network*> NetworkMap; // Updates |networks_| with the networks listed in |list|. If // |network_map_| already has a Network object for a network listed // in the |list| then it is reused. Accept ownership of the Network // objects in the |list|. |changed| will be set to true if there is // any change in the network list. void MergeNetworkList(const NetworkList& list, bool* changed); // |stats| will be populated even if |*changed| is false. void MergeNetworkList(const NetworkList& list, bool* changed, NetworkManager::Stats* stats); void set_enumeration_permission(EnumerationPermission state) { enumeration_permission_ = state; } void set_default_local_addresses(const IPAddress& ipv4, const IPAddress& ipv6); private: friend class NetworkTest; Network* GetNetworkFromAddress(const rtc::IPAddress& ip) const; EnumerationPermission enumeration_permission_; NetworkList networks_; int max_ipv6_networks_; NetworkMap networks_map_; bool ipv6_enabled_; std::unique_ptr<rtc::Network> ipv4_any_address_network_; std::unique_ptr<rtc::Network> ipv6_any_address_network_; IPAddress default_local_ipv4_address_; IPAddress default_local_ipv6_address_; // We use 16 bits to save the bandwidth consumption when sending the network // id over the Internet. It is OK that the 16-bit integer overflows to get a // network id 0 because we only compare the network ids in the old and the new // best connections in the transport channel. uint16_t next_available_network_id_ = 1; }; // Basic implementation of the NetworkManager interface that gets list // of networks using OS APIs. class BasicNetworkManager : public NetworkManagerBase, public MessageHandler, public sigslot::has_slots<> { public: BasicNetworkManager(); ~BasicNetworkManager() override; void StartUpdating() override; void StopUpdating() override; void DumpNetworks() override; // MessageHandler interface. void OnMessage(Message* msg) override; bool started() { return start_count_ > 0; } // Sets the network ignore list, which is empty by default. Any network on the // ignore list will be filtered from network enumeration results. void set_network_ignore_list(const std::vector<std::string>& list) { network_ignore_list_ = list; } #if defined(WEBRTC_LINUX) // Sets the flag for ignoring non-default routes. void set_ignore_non_default_routes(bool value) { ignore_non_default_routes_ = true; } #endif protected: #if defined(WEBRTC_POSIX) // Separated from CreateNetworks for tests. void ConvertIfAddrs(ifaddrs* interfaces, IfAddrsConverter* converter, bool include_ignored, NetworkList* networks) const; #endif // defined(WEBRTC_POSIX) // Creates a network object for each network available on the machine. bool CreateNetworks(bool include_ignored, NetworkList* networks) const; // Determines if a network should be ignored. This should only be determined // based on the network's property instead of any individual IP. bool IsIgnoredNetwork(const Network& network) const; // This function connects a UDP socket to a public address and returns the // local address associated it. Since it binds to the "any" address // internally, it returns the default local address on a multi-homed endpoint. IPAddress QueryDefaultLocalAddress(int family) const; private: friend class NetworkTest; // Creates a network monitor and listens for network updates. void StartNetworkMonitor(); // Stops and removes the network monitor. void StopNetworkMonitor(); // Called when it receives updates from the network monitor. void OnNetworksChanged(); // Updates the networks and reschedules the next update. void UpdateNetworksContinually(); // Only updates the networks; does not reschedule the next update. void UpdateNetworksOnce(); AdapterType GetAdapterTypeFromName(const char* network_name) const; Thread* thread_; bool sent_first_update_; int start_count_; std::vector<std::string> network_ignore_list_; bool ignore_non_default_routes_; std::unique_ptr<NetworkMonitorInterface> network_monitor_; }; // Represents a Unix-type network interface, with a name and single address. class Network { public: Network(const std::string& name, const std::string& description, const IPAddress& prefix, int prefix_length); Network(const std::string& name, const std::string& description, const IPAddress& prefix, int prefix_length, AdapterType type); ~Network(); sigslot::signal1<const Network*> SignalTypeChanged; const DefaultLocalAddressProvider* default_local_address_provider() { return default_local_address_provider_; } void set_default_local_address_provider( const DefaultLocalAddressProvider* provider) { default_local_address_provider_ = provider; } // Returns the name of the interface this network is associated wtih. const std::string& name() const { return name_; } // Returns the OS-assigned name for this network. This is useful for // debugging but should not be sent over the wire (for privacy reasons). const std::string& description() const { return description_; } // Returns the prefix for this network. const IPAddress& prefix() const { return prefix_; } // Returns the length, in bits, of this network's prefix. int prefix_length() const { return prefix_length_; } // |key_| has unique value per network interface. Used in sorting network // interfaces. Key is derived from interface name and it's prefix. std::string key() const { return key_; } // Returns the Network's current idea of the 'best' IP it has. // Or return an unset IP if this network has no active addresses. // Here is the rule on how we mark the IPv6 address as ignorable for WebRTC. // 1) return all global temporary dynamic and non-deprecrated ones. // 2) if #1 not available, return global ones. // 3) if #2 not available, use ULA ipv6 as last resort. (ULA stands // for unique local address, which is not route-able in open // internet but might be useful for a close WebRTC deployment. // TODO(guoweis): rule #3 actually won't happen at current // implementation. The reason being that ULA address starting with // 0xfc 0r 0xfd will be grouped into its own Network. The result of // that is WebRTC will have one extra Network to generate candidates // but the lack of rule #3 shouldn't prevent turning on IPv6 since // ULA should only be tried in a close deployment anyway. // Note that when not specifying any flag, it's treated as case global // IPv6 address IPAddress GetBestIP() const; // Keep the original function here for now. // TODO(guoweis): Remove this when all callers are migrated to GetBestIP(). IPAddress ip() const { return GetBestIP(); } // Adds an active IP address to this network. Does not check for duplicates. void AddIP(const InterfaceAddress& ip) { ips_.push_back(ip); } // Sets the network's IP address list. Returns true if new IP addresses were // detected. Passing true to already_changed skips this check. bool SetIPs(const std::vector<InterfaceAddress>& ips, bool already_changed); // Get the list of IP Addresses associated with this network. const std::vector<InterfaceAddress>& GetIPs() const { return ips_;} // Clear the network's list of addresses. void ClearIPs() { ips_.clear(); } // Returns the scope-id of the network's address. // Should only be relevant for link-local IPv6 addresses. int scope_id() const { return scope_id_; } void set_scope_id(int id) { scope_id_ = id; } // Indicates whether this network should be ignored, perhaps because // the IP is 0, or the interface is one we know is invalid. bool ignored() const { return ignored_; } void set_ignored(bool ignored) { ignored_ = ignored; } AdapterType type() const { return type_; } void set_type(AdapterType type) { if (type_ == type) { return; } type_ = type; SignalTypeChanged(this); } uint16_t GetCost() const { switch (type_) { case rtc::ADAPTER_TYPE_ETHERNET: case rtc::ADAPTER_TYPE_LOOPBACK: return kNetworkCostMin; case rtc::ADAPTER_TYPE_WIFI: case rtc::ADAPTER_TYPE_VPN: return kNetworkCostLow; case rtc::ADAPTER_TYPE_CELLULAR: return kNetworkCostHigh; default: return kNetworkCostUnknown; } } // A unique id assigned by the network manager, which may be signaled // to the remote side in the candidate. uint16_t id() const { return id_; } void set_id(uint16_t id) { id_ = id; } int preference() const { return preference_; } void set_preference(int preference) { preference_ = preference; } // When we enumerate networks and find a previously-seen network is missing, // we do not remove it (because it may be used elsewhere). Instead, we mark // it inactive, so that we can detect network changes properly. bool active() const { return active_; } void set_active(bool active) { if (active_ != active) { active_ = active; } } // Debugging description of this network std::string ToString() const; private: const DefaultLocalAddressProvider* default_local_address_provider_ = nullptr; std::string name_; std::string description_; IPAddress prefix_; int prefix_length_; std::string key_; std::vector<InterfaceAddress> ips_; int scope_id_; bool ignored_; AdapterType type_; int preference_; bool active_ = true; uint16_t id_ = 0; friend class NetworkManager; }; } // namespace rtc #endif // WEBRTC_BASE_NETWORK_H_
[ "kcratie@users.noreply.github.com" ]
kcratie@users.noreply.github.com
ecbfff8e41db0ce3e9ec1f026b84ba527d7fdb17
ab132fec05b446c134f8fd4aa5d0625c7adb66f3
/processor/Session.h
dcd570332854396ad9e0a9997da54c303a643113
[]
no_license
asdlei99/talkingtime
4651b43a9be1bd7c8ff2ae82a3f83e2c39f8a913
783ff1441ce24bce5a7061d5f734dafc094ea628
refs/heads/master
2022-04-17T20:38:19.241877
2020-02-25T09:38:43
2020-02-25T09:38:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,176
h
#ifndef __SESSION_H__ #define __SESSION_H__ #include <cstdio> #include "Common.h" #include <string> #include "Connection.h" #include "Message.h" #include "MessageBuilder.h" #include "ikcp.h" class Session { private: uv_loop_t *__loop; uv_udp_t * serv; SockAddrIn *__addr; std::string __host; uint32_t __port; Conv __down_conv; Timer __timer; private: uv_alloc_cb alloc_cb; uv_udp_recv_cb recv_cb; kcp_send_cb on_send_cb; uv_udp_send_cb send_cb; uv_timer_cb __timer_cb; private: std::map<Conv, Connection*> __conv_2_conn; TinyMesgQueue<MesgWrapper *> __msg_que; std::map<std::string, std::set<std::string> * > __room_info; std::map<std::string, Conv> __uid_2_conv; std::map<std::string, std::string> *__config_map; SockAddrIn *__down_addr; Connection *__down_conn; uint64_t __down_t_interval; std::string __key; ServType __serv_type; public: Session(uv_loop_t *, uv_udp_t *); virtual ~Session(); private: bool __initConfig(); bool __initServer(); bool __initPeerNode(); public: bool initSess(); bool startSess(); void setCallback(uv_alloc_cb, uv_udp_recv_cb, kcp_send_cb, uv_udp_send_cb); inline void setTimerCallback(uv_timer_cb cb) { __timer_cb = cb; } inline void setConfigMap(std::map<std::string, std::string> *config_map_) { __config_map = config_map_; } void allocBuff(uv_handle_t *handle, size_t size, uv_buf_t *buff); void onRecvPacket(ssize_t, const uv_buf_t *, const SockAddr *, unsigned); void onSendPacket(const char *, int, Conv, ikcpcb*); void onTimer(Timer *); public: void updateLiveInfo(std::string, std::string); int8_t getLiveInfo(std::string&, std::string &); void updateUid2Conv(std::string, Conv); int8_t getConvByUid(std::string &, Conv &); int8_t getConnByConv(Conv &, Connection **conn); void releaseConn(Conv &, Connection **conn); void deleteUserOrRoom(std::string &, std::string &); int8_t cloneMembersById(std::string &, std::set<std::string> &); private: void __procInnerHeartbeat(); }; #endif
[ "liangyunge@liangyungedeMacBook-Pro.local" ]
liangyunge@liangyungedeMacBook-Pro.local
55c9096a1c324e81998f29512dc5a5044f30db3c
48e9625fcc35e6bf790aa5d881151906280a3554
/Sources/Elastos/LibCore/inc/org/apache/http/impl/auth/AuthSchemeBase.h
9d30724a46c5435f01c49e1e36113d582a9aa45d
[ "Apache-2.0" ]
permissive
suchto/ElastosRT
f3d7e163d61fe25517846add777690891aa5da2f
8a542a1d70aebee3dbc31341b7e36d8526258849
refs/heads/master
2021-01-22T20:07:56.627811
2017-03-17T02:37:51
2017-03-17T02:37:51
85,281,630
4
2
null
2017-03-17T07:08:49
2017-03-17T07:08:49
null
UTF-8
C++
false
false
2,465
h
//========================================================================= // Copyright (C) 2012 The Elastos Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. //========================================================================= #ifndef __ORG_APACHE_HTTP_IMPL_AUTH_AUTHSCHEMEBASE_H__ #define __ORG_APACHE_HTTP_IMPL_AUTH_AUTHSCHEMEBASE_H__ #include "Elastos.CoreLibrary.Apache.h" #include "elastos/core/Object.h" using Org::Apache::Http::IHeader; using Org::Apache::Http::Auth::IAuthScheme; using Org::Apache::Http::Utility::ICharArrayBuffer; namespace Org { namespace Apache { namespace Http { namespace Impl { namespace Auth { /** * Abstract authentication scheme class that serves as a basis * for all authentication schemes supported by HttpClient. This class * defines the generic way of parsing an authentication challenge. It * does not make any assumptions regarding the format of the challenge * nor does it impose any specific way of responding to that challenge. * * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a> */ class AuthSchemeBase : public Object , public IAuthScheme { public: AuthSchemeBase(); CAR_INTERFACE_DECL() CARAPI ProcessChallenge( /* [in] */ IHeader* header); /** * Returns <code>true</code> if authenticating against a proxy, <code>false</code> * otherwise. * * @return <code>true</code> if authenticating against a proxy, <code>false</code> * otherwise */ CARAPI_(Boolean) IsProxy(); protected: virtual CARAPI ParseChallenge( /* [in] */ ICharArrayBuffer* buffer, /* [in] */ Int32 pos, /* [in] */ Int32 len) = 0; private: /** * Flag whether authenticating against a proxy. */ Boolean mProxy; }; } // namespace Auth } // namespace Impl } // namespace Http } // namespace Apache } // namespace Org #endif // __ORG_APACHE_HTTP_IMPL_AUTH_AUTHSCHEMEBASE_H__
[ "cao.jing@kortide.com" ]
cao.jing@kortide.com
f5bfb5415db3ad622cafadbdafd400be5f6a58e7
ace28e29eaa4ff031fdf7aa4d29bb5d85b46eaa3
/Visual Mercutio/zModel/PSS_OutputSearchView.h
c2193caf27969272f4ebe43613b7f26b917f960b
[ "MIT" ]
permissive
emtee40/Visual-Mercutio
675ff3d130783247b97d4b0c8760f931fbba68b3
f079730005b6ce93d5e184bb7c0893ccced3e3ab
refs/heads/master
2023-07-16T20:30:29.954088
2021-08-16T19:19:57
2021-08-16T19:19:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,652
h
/**************************************************************************** * ==> PSS_OutputSearchView ------------------------------------------------* **************************************************************************** * Description : Provides an output search view * * Developer : Processsoft * ****************************************************************************/ #ifndef PSS_OutputSearchViewH #define PSS_OutputSearchViewH #if _MSC_VER > 1000 #pragma once #endif // change the definition of AFX_EXT... to make it import #undef AFX_EXT_CLASS #undef AFX_EXT_API #undef AFX_EXT_DATA #define AFX_EXT_CLASS AFX_CLASS_IMPORT #define AFX_EXT_API AFX_API_IMPORT #define AFX_EXT_DATA AFX_DATA_IMPORT // processsoft #include "zBaseLib\PSS_OutputView.h" #ifdef _ZMODELEXPORT // put the values back to make AFX_EXT_CLASS export again #undef AFX_EXT_CLASS #undef AFX_EXT_API #undef AFX_EXT_DATA #define AFX_EXT_CLASS AFX_CLASS_EXPORT #define AFX_EXT_API AFX_API_EXPORT #define AFX_EXT_DATA AFX_DATA_EXPORT #endif /** * Output search view *@author Dominique Aigroz, Jean-Milost Reymond */ class AFX_EXT_CLASS PSS_OutputSearchView : public PSS_OutputView { DECLARE_DYNAMIC(PSS_OutputSearchView) public: PSS_OutputSearchView(); virtual ~PSS_OutputSearchView(); protected: /// Generated message map functions //{{AFX_MSG(PSS_OutputSearchView) virtual void OnSelChanged(); virtual void OnDoubleClick(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; #endif
[ "jean_milost@hotmail.com" ]
jean_milost@hotmail.com
6100751c0abf225c97c6441522e2ca5a2a62cfa4
213d3876d690b296238a396c56cccce7f19505bb
/cse20212/prelab/main.cpp
3446c7918693c240b4fd60ce74de3eeca816d833
[]
no_license
marivaldojunior/school_code
5b3d8451421b167eab65a8c8c0700920a2064769
33a01436ff83b18e1818aa8b58210bb49b5ec041
refs/heads/master
2020-05-01T19:03:42.051109
2018-01-26T18:49:29
2018-01-26T18:49:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
714
cpp
/* Main.cpp Program will be used to calculate personal mortgages. Coded by Iheanyi Ekechukwu*/ #include <iostream> #include <iomanip> #include "mortgage.h" using namespace std; int main() { //Construct a mortgage with an invalid interest rate Mortgage bad(100000, -0.05, 5000); // Construct a valid mortgage Mortgage good(10000.00, 0.05, 500.00); // Third mortgage to exemplify credit Mortgage third; cout << setiosflags(ios::fixed); third.credit(10000); //Credit the mortgage cout << "Current balance after crediting second mortgage 10K: " << third.getPrincipal() << endl; cout << setprecision(2); cout << "Amortization schedule for good mortgage:" << endl; cout << setprecision(2); good.amortize(); }
[ "iekechukwu@gmail.com" ]
iekechukwu@gmail.com
f04a2663e97d2a098b0735cd8ab24e70d44a608f
14582f8c74c28d346399f877b9957d0332ba1c3c
/branches/pstade_1_03_5_head/pstade_subversive/pstade/apple/atl/core.hpp
46e88153079a251c0c94d68a1efdf7653234f7f9
[]
no_license
svn2github/p-stade
c7b421be9eeb8327ddd04d3cb36822ba1331a43e
909b46567aa203d960fe76055adafc3fdc48e8a5
refs/heads/master
2016-09-05T22:14:09.460711
2014-08-22T08:16:11
2014-08-22T08:16:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
421
hpp
#ifndef PSTADE_APPLE_ATL_CORE_HPP #define PSTADE_APPLE_ATL_CORE_HPP // PStade.Apple // // Copyright Shunsuke Sogame 2005-2006. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include "./config.hpp" // ATL_VER #if (PSTADE_APPLE_ATL_VER >= 0x0700) #include <atlcore.h> #endif #endif
[ "mb2sync@350e9bb6-6311-0410-90c3-be67731b76ec" ]
mb2sync@350e9bb6-6311-0410-90c3-be67731b76ec
447745f7f2958e3e9193fb7de49865149d50a67e
f6706091127440d4051d9c49bf9c5957c68f0116
/wdd-vscode/VsCodeDebugEngine.h
8c8eb0b06838ea77b6f90788c595355b0c546b4b
[ "Apache-2.0" ]
permissive
ylqhust/wdd
d31d1b9d0fb66ee5008fce749554a66dcf52e5cf
461c1f0c48af7c442fd574656397b9042028727c
refs/heads/master
2022-04-08T10:03:14.863623
2017-04-01T03:04:12
2017-04-01T03:04:12
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,951
h
#pragma once #include "../wddlib/ReplaySession.h" #include "../wddlib/Symbols.h" struct Frame { uint32_t id; uint32_t threadId; CComPtr<IDiaSymbol> func; CComPtr<IDiaStackFrame> frame; std::map<uint64_t, int> lines; uint64_t retAddr; uint64_t base; void SetFunction(CComPtr<IDiaSymbol> f, SymbolTable& st); }; struct VarSet { std::string name; std::unordered_set<uint32_t> dataKinds; uint32_t frameId; }; class VsCodeDebugEngine : public ReplaySession { public: VsCodeDebugEngine(); ~VsCodeDebugEngine(); void Run(); void OnFirstBreakpoint(ProcessID processId); void OnCreateProcess(ProcessID processId, ThreadID threadId, CREATE_PROCESS_DEBUG_INFO& info); void OnCreateThread(ProcessID processId, ThreadID threadId, CREATE_THREAD_DEBUG_INFO& info); void OnExitThread(ProcessID processId, ThreadID threadId, EXIT_THREAD_DEBUG_INFO& info); void OnExitProcess(ProcessID processId, ThreadID threadId, EXIT_PROCESS_DEBUG_INFO& info); private: void Loop(); nlohmann::json StackWalk(DWORD processId, DWORD threadId, int startFrame, int level); void SetUserBreakpoint(uint64_t va, const std::string& reason, bool invisible = false); void ClearInvisibleBreakPoints(uint64_t except_va = 0); void ClearUserBreakpoints(); void ClearStackCache(DWORD threadId); std::string clientId_; std::string adapterId_; struct Config { bool lineStartAt1; bool columnsStartAt1; std::string pathFormat; bool supportsVariableType; bool supportsVariablePaging; bool supportsRunInTerminalRequest; } config_; std::unique_ptr<SymbolTable> st_; bool first_process_created_{ false }; bool stopOnEntry_{ false }; std::unordered_map<uint32_t, Frame> frames_; std::unordered_map<uint32_t, std::vector<Frame*>> framesPerThread_; std::unordered_map<uint32_t, VarSet> vars_; uint32_t frameIdGen_{ 1 }; uint32_t varsIdGen_{ 1 }; std::vector<uint64_t> invisibleBreakpointPositions_; uint32_t invisibleBreakpointProcessId_; };
[ "ipknhama@gmail.com" ]
ipknhama@gmail.com
2cc14670723135cea5271c52bfe26ed4f94a0e14
f545b849fa162f7e437eb9fd9e3958f6b81d3ddb
/BOJ/q16390.cpp
e6da8ca1d5144ce3f7cad7370706b7134b3d3d10
[]
no_license
lkw1120/problem-solving
216fb135f1b314a10faf5e5c06d1ca03d638e935
9887ed81ce0958a9a9b7d80d754d14217e4df25a
refs/heads/master
2023-08-20T15:32:35.739832
2023-08-19T17:04:23
2023-08-19T17:04:23
172,870,054
0
0
null
null
null
null
UTF-8
C++
false
false
894
cpp
#include<bits/stdc++.h> using namespace std; vector<string> v; int dX[8] = {0,1,1,1,0,-1,-1,-1}; int dY[8] = {1,1,0,-1,-1,-1,0,1}; int M,N,ans; void bfs(int x, int y) { queue<pair<int,int>> q; q.push({x,y}); while(!q.empty()) { x = q.front().first; y = q.front().second; q.pop(); for(int i=0;i<8;i++) { int dx = x+dX[i]; int dy = y+dY[i]; if(0 <= dx && dx < M && 0 <= dy && dy < N && v[dx][dy] == '#') { v[dx][dy] = '.'; q.push({dx,dy}); } } } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>M>>N; v.resize(M); for(int i=0;i<M;i++) { cin>>v[i]; } ans = 0; for(int i=0;i<M;i++) { for(int j=0;j<N;j++) { if(v[i][j] == '#') { v[i][j] = '.'; bfs(i,j); ans++; } } } cout<<ans<<"\n"; return 0; }
[ "lkwkang@gmail.com" ]
lkwkang@gmail.com
4e5279478cbc2c770c89ec9a158ef0aad4fd4edb
0149a18329517d09305285f16ab41a251835269f
/Contest Volumes/Volume 104 (10400-10499)/UVa_10405_Longest_Common_Subsequence.cpp
6ed4bc860cacb31312a5df07a4730b4941259ac9
[]
no_license
keisuke-kanao/my-UVa-solutions
138d4bf70323a50defb3a659f11992490f280887
f5d31d4760406378fdd206dcafd0f984f4f80889
refs/heads/master
2021-05-14T13:35:56.317618
2019-04-16T10:13:45
2019-04-16T10:13:45
116,445,001
3
1
null
null
null
null
UTF-8
C++
false
false
1,364
cpp
/* UVa 10405 - Longest Common Subsequence To build using Visual Studio 2008: cl -EHsc -O2 UVa_10405_Longest_Common_Subsequence.cpp */ #include <algorithm> #include <cstdio> #include <cstring> using namespace std; /* function LCSLength(X[1..m], Y[1..n]) C = array(0..m, 0..n) for i := 0..m C[i,0] = 0 for j := 0..n C[0,j] = 0 for i := 1..m for j := 1..n if X[i] = Y[j] C[i,j] := C[i-1,j-1] + 1 else: C[i,j] := max(C[i,j-1], C[i-1,j]) return C[m,n] */ const int nr_chars_max = 1024; char first_s[nr_chars_max], second_s[nr_chars_max]; int lcs_c[2][nr_chars_max]; int lcs(int first_s_length, int second_s_length) { memset(lcs_c[0], 0, sizeof(int) * (second_s_length + 1)); memset(lcs_c[1], 0, sizeof(int) * (second_s_length + 1)); for (int i = 1; i <= first_s_length; i++) { int ci = i % 2, pi = (i - 1) % 2; for (int j = 1; j <= second_s_length; j++) { if (first_s[i - 1] == second_s[j - 1]) lcs_c[ci][j] = lcs_c[pi][j - 1] + 1; else lcs_c[ci][j] = max(lcs_c[ci][j - 1], lcs_c[pi][j]); } } return lcs_c[first_s_length % 2][second_s_length]; } int main() { while (gets(first_s)) { gets(second_s); printf("%d\n", lcs(strlen(first_s), strlen(second_s))); } return 0; }
[ "keisuke.kanao.154@gmail.com" ]
keisuke.kanao.154@gmail.com
9c3b4a9ce1e54d7aa9af0ab795151b5c61c9ae32
2e8e733584c070b246550c7817cd04f9505fdfe5
/Code/CryEngine/CryCommon/IParticles.h
3bffe3c1f6747d7f8644b3f4afb2118e0ea79096
[]
no_license
blockspacer/Infected
5dd1ea143cb55be57684f22deebad93f3d44b93c
6f64151eb9c5b8b285f522826d10bfe23a315d20
refs/heads/master
2021-05-27T09:54:36.729273
2015-01-25T01:27:45
2015-01-25T01:27:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
25,666
h
//////////////////////////////////////////////////////////////////////////// // // Crytek Engine Source File. // Copyright (C), Crytek Studios, 2002. // ------------------------------------------------------------------------- // File name: IParticles.h // Version: v1.00 // Created: 2008-02-26 by Scott Peter // Compilers: Visual Studio.NET // Description: Interfaces to particle types // ------------------------------------------------------------------------- // History: // //////////////////////////////////////////////////////////////////////////// #include DEVIRTUALIZE_HEADER_FIX(IParticles.h) #ifndef IPARTICLES_H #define IPARTICLES_H #include <IMemory.h> #include <IEntityRenderState.h> #include <TimeValue.h> #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 enum EParticleEmitterFlags { ePEF_Independent = BIT(0), // Not controlled by entity. ePEF_Nowhere = BIT(1), // Not in scene (e.g. rendered in editor window) ePEF_TemporaryEffect = BIT(2), // Has temporary programmatically created IParticleEffect. ePEF_Custom = BIT(16), // Any bits above and including this one can be used for game specific purposes }; // Summary: // Reference to one geometry type // Description: // Reference to one of several types of geometry, for particle attachment. struct GeomRef { IStatObj* m_pStatObj; ICharacterInstance* m_pChar; IPhysicalEntity* m_pPhysEnt; GeomRef(): m_pStatObj(0), m_pChar(0), m_pPhysEnt(0) {} GeomRef(IStatObj* pObj) : m_pStatObj(pObj), m_pChar(0), m_pPhysEnt(0) {} GeomRef(ICharacterInstance* pChar) : m_pChar(pChar), m_pStatObj(0), m_pPhysEnt(0) {} GeomRef(IPhysicalEntity* pPhys) : m_pChar(0), m_pStatObj(0), m_pPhysEnt(pPhys) {} operator bool() const { return m_pStatObj || m_pChar || m_pPhysEnt; } }; //Summary: // Real-time params to control particle emitters. // Description: // Real-time params to control particle emitters. Some parameters override emitter params. struct SpawnParams { EGeomType eAttachType; // What type of object particles emitted from. EGeomForm eAttachForm; // What aspect of shape emitted from. bool bCountPerUnit; // Multiply particle count also by geometry extent (length/area/volume). bool bEnableSound; // Controls whether to play sound events or not. bool bRegisterByBBox; // Use the Bounding Box instead of Position to Register in VisArea float fCountScale; // Multiple for particle count (on top of bCountPerUnit if set). float fSizeScale; // Multiple for all effect sizes. float fSpeedScale; // Multiple for particle emission speed. float fTimeScale; // Multiple for emitter time evolution. float fPulsePeriod; // How often to restart emitter. float fStrength; // Controls parameter strength curves. inline SpawnParams( EGeomType eType = GeomType_None, EGeomForm eForm = GeomForm_Surface ) { eAttachType = eType; eAttachForm = eForm; bCountPerUnit = false; bRegisterByBBox = false; fCountScale = 1; fSizeScale = 1; fSpeedScale = 1; fTimeScale = 1; fPulsePeriod = 0; fStrength = -1; bEnableSound = true; } }; struct ParticleTarget { Vec3 vTarget; // Target location for particles. Vec3 vVelocity; // Velocity of moving target. float fRadius; // Size of target, for orbiting. // Options. bool bTarget; // Target is enabled. bool bPriority; // This target takes priority over others (attractor entities). ParticleTarget() { memset(this, 0, sizeof(*this)); } }; struct EmitParticleData { IStatObj* pStatObj; // The displayable geometry object for the entity. If NULL, uses emitter settings for sprite or geometry. IPhysicalEntity* pPhysEnt; // A physical entity which controls the particle. If NULL, uses emitter settings to physicalise or move particle. QuatTS Location; // Specified location for particle. Velocity3 Velocity; // Specified linear and rotational velocity for particle. bool bHasLocation; // Location is specified. bool bHasVel; // Velocities are specified. EmitParticleData() : pStatObj(0), pPhysEnt(0), Location(IDENTITY), Velocity(ZERO), bHasLocation(false), bHasVel(false) { } }; struct ParticleParams; // Summary: // Interface to control a particle effect. // Description: // This interface is used by I3DEngine::CreateParticleEffect to control a particle effect. // It is created by CreateParticleEffect method of 3d engine. UNIQUE_IFACE struct IParticleEffect : public _i_reference_target_t { static QuatTS ParticleLoc(const Vec3& pos, const Vec3& dir = Vec3(0,0,1), float scale = 1.f) { QuatTS qts(IDENTITY, pos, scale); if (!dir.IsZero()) { // Rotate in 2 stages to avoid roll. Vec3 dirxy = Vec3(dir.x, dir.y, 0.f); if (!dirxy.IsZero(1e-10f)) { dirxy.Normalize(); qts.q = Quat::CreateRotationV0V1(dirxy, dir.GetNormalized()) * Quat::CreateRotationV0V1(Vec3(0,1,0), dirxy); } else qts.q = Quat::CreateRotationV0V1(Vec3(0,1,0), dir.GetNormalized()); } return qts; } // <interfuscator:shuffle> virtual void GetMemoryUsage( ICrySizer *pSizer ) const = 0; ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // Summary: // Spawns this effect. // Arguments: // qLoc - World location to place emitter. // uEmitterFlags - EParticleEmitterFlags // Return Value: // The spawned emitter, or 0 if unable. virtual struct IParticleEmitter* Spawn( const QuatTS& loc, uint uEmitterFlags = 0, const SpawnParams* pSpawnParams = NULL ) = 0; // Summary: // Sets a new name to this particle effect. // Arguments: // sFullName - The full name of this effect, including library and group qualifiers. virtual void SetName( cstr sFullName ) = 0; // Summary: // Gets the name of this particle effect. // Return Value: // A C string which holds the minimally qualified name of this effect. // For top level effects, includes library.group qualifier. // For child effects, includes only the base name. virtual cstr GetName() const = 0; // Summary: // Gets the name of this particle effect. // Return Value: // A std::string which holds the fully qualified name of this effect, with all parents and library. virtual string GetFullName() const = 0; // Summary: // Enables or disables the effect. // Arguments: // bEnabled - set to true to enable the effect or to false to disable it virtual void SetEnabled( bool bEnabled ) = 0; // Summary: // Determines if the effect is already enabled. // Return Value: // A boolean value which indicate the status of the effect; true if // enabled or false if disabled. virtual bool IsEnabled() const = 0; // Summary: // Sets the particle parameters. // Return Value: // An object of the type ParticleParams which contains several parameters. virtual void SetParticleParams( const ParticleParams &params ) = 0; //! Return ParticleParams. // Summary: // Gets the particle parameters. // Return Value: // An object of the type ParticleParams which contains several parameters. virtual const ParticleParams& GetParticleParams() const = 0; ////////////////////////////////////////////////////////////////////////// // Child particle systems. ////////////////////////////////////////////////////////////////////////// // Summary: // Gets the number of sub particles childs. // Return Value: // An integer representing the amount of sub particles childs virtual int GetChildCount() const = 0; //! Get sub Particles child by index. // Summary: // Gets a specified particles child. // Arguments: // index - The index of a particle child // Return Value: // A pointer to a IParticleEffect derived object. virtual IParticleEffect* GetChild( int index ) const = 0; // Summary: // Removes all child particles. virtual void ClearChilds() = 0; // Summary: // Inserts a child particle effect at a precise slot. // Arguments: // slot - An integer value which specify the desired slot // pEffect - A pointer to the particle effect to insert virtual void InsertChild( int slot,IParticleEffect *pEffect ) = 0; // Summary: // Finds in which slot a child particle effect is stored. // Arguments: // pEffect - A pointer to the child particle effect // Return Value: // An integer representing the slot number or -1 if the slot is not found. virtual int FindChild( IParticleEffect *pEffect ) const = 0; // Summary: // Remove effect from current parent, and set new parent // Arguments: // pParent: New parent, may be 0 virtual void SetParent( IParticleEffect* pParent ) = 0; // Summary: // Gets the particles effect parent, if any. // Return Value: // A pointer representing the particles effect parent. virtual IParticleEffect* GetParent() const = 0; // Summary: // Loads all resources needed for a particle effects. // Returns: // True if any resources loaded. virtual bool LoadResources() = 0; // Summary: // Unloads all resources previously loaded. virtual void UnloadResources() = 0; // Summary: // Serializes particle effect to/from XML. // Arguments: // bLoading - true when loading,false for saving. // bChilds - When true also recursively serializes effect childs. virtual void Serialize( XmlNodeRef node,bool bLoading,bool bChilds ) = 0; // </interfuscator:shuffle> // Compatibility versions. IParticleEmitter* Spawn( const Matrix34& mLoc, uint uEmitterFlags = 0 ) { return Spawn(QuatTS(mLoc), uEmitterFlags); } IParticleEmitter* Spawn( bool bIndependent, const QuatTS& qLoc ) { return Spawn(qLoc, ePEF_Independent * uint32(bIndependent)); } IParticleEmitter* Spawn( bool bIndependent, const Matrix34& mLoc ) { return Spawn(QuatTS(mLoc), ePEF_Independent * uint32(bIndependent)); } }; // Description: // An IParticleEmitter should usually be created by // I3DEngine::CreateParticleEmitter. Deleting the emitter should be done // using I3DEngine::DeleteParticleEmitter. // Summary: // Interface to a particle effect emitter. UNIQUE_IFACE struct IParticleEmitter : public IRenderNode, public CMultiThreadRefCount { // <interfuscator:shuffle> // Summary: // Returns whether emitter still alive in engine. virtual bool IsAlive() const = 0; // Summary: // Returns whether emitter requires no further attachment. virtual bool IsInstant() const = 0; // Summary: // Sets emitter state to active or inactive. Emitters are initially active. // if bActive = true: // Emitter updates and emits as normal, and deletes itself if limited lifetime. // if bActive = false: // Stops all emitter updating and particle emission. // Existing particles continue to update and render. // Emitter is not deleted. virtual void Activate( bool bActive ) = 0; // Summary: // Removes emitter and all particles instantly. virtual void Kill() = 0; // Summary: // Advances the emitter to its equilibrium state. virtual void Prime() = 0; // Summary: // Restarts the emitter from scratch (if active). // Any existing particles are re-used oldest first. virtual void Restart() = 0; // Description: // Will define the effect used to spawn the particles from the emitter. // Notes: // Never call this function if you already used SetParams. // See Also: // SetParams // Arguments: // pEffect - A pointer to an IParticleEffect object // Summary: // Set the effects used by the particle emitter. virtual void SetEffect( const IParticleEffect* pEffect ) = 0; // Description: // Returns particle effect assigned on this emitter. virtual const IParticleEffect* GetEffect() const = 0; // Summary: // Specifies how particles are emitted from source. virtual void SetSpawnParams( const SpawnParams& spawnParams, GeomRef geom = GeomRef()) = 0; // Summary: // Retrieves current SpawnParams. virtual void GetSpawnParams( SpawnParams& spawnParams ) const = 0; // Summary: // Associates emitter with entity, for dynamic updating of positions etc. // Notes: // Must be done when entity created or serialized, entity association is not serialized. virtual void SetEntity( IEntity* pEntity, int nSlot ) = 0; // Summary: // Sets location with quat-based orientation. // Notes: // IRenderNode.SetMatrix() is equivalent, but performs conversion. virtual void SetLocation( const QuatTS& loc ) = 0; // Attractors. virtual void SetTarget( const ParticleTarget& target ) = 0; // Summary: // Updates emitter's state to current time. virtual void Update() = 0; // Summary: // Programmatically adds particle to emitter for rendering. // With no arguments, spawns particles according to emitter settings. // Specific objects can be passed for programmatic control. // Arguments: // pData - Specific data for particle, or NULL for defaults. virtual void EmitParticle( const EmitParticleData* pData = NULL ) = 0; void EmitParticle( IStatObj* pStatObj, IPhysicalEntity* pPhysEnt = NULL, QuatTS* pLocation = NULL, Velocity3* pVel = NULL ) { EmitParticleData data; data.pStatObj = pStatObj; data.pPhysEnt = pPhysEnt; if (pLocation) { data.Location = *pLocation; data.bHasLocation = true; } if (pVel) { data.Velocity = *pVel; data.bHasVel = true; } EmitParticle(&data); } virtual bool UpdateStreamableComponents( float fImportance, Matrix34A& objMatrix, IRenderNode* pRenderNode, float fEntDistance, bool bFullUpdate, int nLod ) = 0; // Summary: // Get the Entity ID that this particle emitter is attached to virtual unsigned int GetAttachedEntityId() = 0; // Summary: // Get the Entity Slot that this particle emitter is attached to virtual int GetAttachedEntitySlot() = 0; // Summary: // Get the flags associated with this particle emitter virtual uint32 GetEmitterFlags() const = 0; // Summary: // Set the flags associated with this particle emitter virtual void SetEmitterFlags(uint32 flags) = 0; // Summary: // Checks if particle emitter uses diffuse cubemap for lighting // and the cubemap ID needs to be updated. // Arguments: // nCacheId - Gets cached cubemap texture ID from last update. virtual bool NeedsNearestCubemapUpdate(uint16 & nCachedId, const SRenderingPassInfo &passInfo) const = 0; // Summary: // Caches a new cubemap texture ID. virtual void CacheNearestCubemap(uint16 nCMTexId, const SRenderingPassInfo &passInfo) = 0; // </interfuscator:shuffle> }; ////////////////////////////////////////////////////////////////////////// // Description: // A callback interface for a class that wants to be aware when particle emitters are being created/deleted. struct IParticleEffectListener { // <interfuscator:shuffle> virtual ~IParticleEffectListener(){} // Description: // This callback is called when a new particle emitter is created. // Arguments: // pEmitter - The emitter created // bIndependent - // mLoc - The location of the emitter // pEffect - The particle effect virtual void OnCreateEmitter(IParticleEmitter* pEmitter, const QuatTS& qLoc, const IParticleEffect* pEffect, uint32 uEmitterFlags ) = 0; // Description: // This callback is called when a particle emitter is deleted. // Arguments: // pEmitter - The emitter being deleted virtual void OnDeleteEmitter(IParticleEmitter* pEmitter) = 0; // </interfuscator:shuffle> }; ////////////////////////////////////////////////////////////////////////// struct SContainerCounts { float EmittersRendered, ParticlesRendered; float PixelsProcessed, PixelsRendered; float ParticlesReiterate, ParticlesReject, ParticlesClip; float ParticlesCollideTest, ParticlesCollideHit; SContainerCounts() { memset(this, 0, sizeof(*this)); } }; struct SParticleCounts: SContainerCounts { float EmittersAlloc; float EmittersActive; float ParticlesAlloc; float ParticlesActive; float SubEmittersActive; int nCollidingEmitters; int nCollidingParticles; float StaticBoundsVolume; float DynamicBoundsVolume; float ErrorBoundsVolume; SParticleCounts() { memset(this, 0, sizeof(*this)); } }; struct SSumParticleCounts: SParticleCounts { float SumParticlesAlloc, SumEmittersAlloc; SSumParticleCounts() : SumParticlesAlloc(0.f), SumEmittersAlloc(0.f) {} void GetMemoryUsage( ICrySizer *pSizer ) const { pSizer->AddObject(this, sizeof(*this)); } }; struct SEffectCounts { int nLoaded, nUsed, nEnabled, nActive; SEffectCounts() { memset(this, 0, sizeof(*this)); } }; template<class T> Array<float> FloatArray( T& obj ) { return Array<float>( (float*)&obj, (float*)(&obj+1) ); } inline void AddArray( Array<float> dst, Array<const float> src ) { for (int i = min(dst.size(), src.size())-1; i >= 0; --i) dst[i] += src[i]; } inline void BlendArray( Array<float> dst, float fDst, Array<const float> src, float fSrc ) { for (int i = min(dst.size(), src.size())-1; i >= 0; --i) dst[i] = dst[i] * fDst + src[i] * fSrc; } ////////////////////////////////////////////////////////////////////////// struct IParticleEffectIterator { virtual ~IParticleEffectIterator() {} virtual void AddRef() = 0; virtual void Release() = 0; virtual IParticleEffect* Next() = 0; virtual int GetCount() const = 0; }; TYPEDEF_AUTOPTR(IParticleEffectIterator); typedef IParticleEffectIterator_AutoPtr IParticleEffectIteratorPtr; ////////////////////////////////////////////////////////////////////////// struct IParticleManager { // <interfuscator:shuffle> virtual ~IParticleManager(){} ////////////////////////////////////////////////////////////////////////// // ParticleEffects ////////////////////////////////////////////////////////////////////////// // Summary: // Creates a new empty particle effect. // Return Value: // A pointer to a object derived from IParticleEffect. virtual IParticleEffect* CreateEffect() = 0; // Summary: // Deletes a specified particle effect. // Arguments: // pEffect - A pointer to the particle effect object to delete virtual void DeleteEffect( IParticleEffect* pEffect ) = 0; // Summary: // Searches by name for a particle effect. // Arguments: // sEffectName - The fully qualified name (with library prefix) of the particle effect to search. // bLoad - Whether to load the effect's assets if found. // sSource - Optional client context, for diagnostics. // Return Value: // A pointer to a particle effect matching the specified name, or NULL if not found. virtual IParticleEffect* FindEffect( cstr sEffectName, cstr sSource = "", bool bLoadResources = true ) = 0; // Summary: // Creates a particle effect from an XML node. Overwrites any existing effect of the same name. // Arguments: // sEffectName: the name of the particle effect to be created. // effectNode: Xml structure describing the particle effect properties. // bLoadResources: indicates if the resources for this effect should be loaded. // Return value: // Returns a pointer to the particle effect. virtual IParticleEffect* LoadEffect( cstr sEffectName, XmlNodeRef& effectNode, bool bLoadResources, const cstr sSource = NULL ) = 0; // Summary: // Loads a library of effects from an XML description. // Arguments: // Return value: virtual bool LoadLibrary( cstr sParticlesLibrary, XmlNodeRef& libNode, bool bLoadResources ) = 0; virtual bool LoadLibrary( cstr sParticlesLibrary, cstr sParticlesLibraryFile = NULL, bool bLoadResources = false ) = 0; // Summary: // Returns particle iterator. // Arguments: // Return value: virtual IParticleEffectIteratorPtr GetEffectIterator() = 0; ////////////////////////////////////////////////////////////////////////// // ParticleEmitters ////////////////////////////////////////////////////////////////////////// // Summary: // Creates a new particle emitter, with custom particle params instead of a library effect. // Arguments: // bIndependent - // mLoc - World location of emitter. // Params - Programmatic particle params. // Return Value: // A pointer to an object derived from IParticleEmitter virtual IParticleEmitter* CreateEmitter( const QuatTS& loc, const ParticleParams& Params, uint uEmitterFlags = 0, const SpawnParams* pSpawnParams = NULL ) = 0; IParticleEmitter* CreateEmitter( const Matrix34& mLoc, const ParticleParams& Params, uint uEmitterFlags = 0, const SpawnParams* pSpawnParams = NULL ) { return CreateEmitter( QuatTS(mLoc), Params, uEmitterFlags, pSpawnParams ); } // Summary: // Deletes a specified particle emitter. // Arguments: // pPartEmitter - Specify the emitter to delete virtual void DeleteEmitter( IParticleEmitter * pPartEmitter ) = 0; // Summary: // Deletes all particle emitters which have any of the flags in mask set // Arguments: // mask - Flags used to filter which emitters to delete virtual void DeleteEmitters( uint32 mask ) = 0; // Summary: // Reads or writes emitter state -- creates emitter if reading // Arguments: // ser - Serialization context // pEmitter - Emitter to save if writing, NULL if reading. // Return Value: // pEmitter if writing, newly created emitter if reading virtual IParticleEmitter* SerializeEmitter( TSerialize ser, IParticleEmitter* pEmitter = NULL ) = 0; // Processing. virtual void Update() = 0; virtual void RenderDebugInfo() = 0; virtual void Reset( bool bIndependentOnly ) = 0; virtual void ClearRenderResources( bool bForceClear ) = 0; virtual void ClearDeferredReleaseResources() = 0; virtual void OnStartRuntime() = 0; virtual void OnFrameStart() = 0; virtual void Serialize( TSerialize ser ) = 0; virtual void PostSerialize( bool bReading ) = 0; // Summary: // Set the timer used to update the particle system // Arguments: // pTimer - Specify the timer virtual void SetTimer(ITimer* pTimer) = 0; // Stats virtual void GetMemoryUsage( ICrySizer* pSizer ) const = 0; virtual void GetCounts( SParticleCounts& counts ) = 0; //PerfHUD virtual void CreatePerfHUDWidget() = 0; // Summary: // Registers new particle events listener. virtual void AddEventListener(IParticleEffectListener *pListener) = 0; virtual void RemoveEventListener(IParticleEffectListener *pListener) = 0; // Prepare all date for SPU Particle*::Render Tasks virtual void PrepareForRender(const SRenderingPassInfo &passInfo) = 0; // Finish up all Particle*::Render Tasks virtual void FinishParticleRenderTasks(const SRenderingPassInfo &passInfo) = 0; // Add nTicks to the number of Ticks spend this frame in particle functions virtual void AddFrameTicks( uint64 nTicks ) = 0; // Reset Ticks Counter virtual void ResetFrameTicks() = 0; // Get number of Ticks accumulated over this frame virtual uint64 NumFrameTicks() const =0; // Get The number of emitters manged by ParticleManager virtual uint32 NumEmitter() const = 0; // Add nTicks to the number of Ticks spend this frame in particle functions virtual void AddFrameSyncTicks( uint64 nTicks ) = 0; // Get number of Ticks accumulated over this frame virtual uint64 NumFrameSyncTicks() const =0; // add a container to collect which take the most memory in the vertex/index pools virtual void AddVertexIndexPoolUsageEntry( uint32 nVertexMemory, uint32 nIndexMemory, const char *pContainerName ) = 0; virtual void MarkAsOutOfMemory() = 0; // </interfuscator:shuffle> }; #if defined(ENABLE_LW_PROFILERS) && !defined(__SPU__) class CParticleLightProfileSection { public: CParticleLightProfileSection() : m_nTicks( JobManager::Fiber::GetNonFiberTicks() ) { } ~CParticleLightProfileSection() { IParticleManager *pPartMan = gEnv->p3DEngine->GetParticleManager(); IF( pPartMan != NULL, 1) { pPartMan->AddFrameTicks(JobManager::Fiber::GetNonFiberTicks() - m_nTicks); } } private: uint64 m_nTicks; }; class CParticleLightProfileSectionSyncTime { public: CParticleLightProfileSectionSyncTime() : m_nTicks( JobManager::Fiber::GetNonFiberTicks() ) {} ~CParticleLightProfileSectionSyncTime() { IParticleManager *pPartMan = gEnv->p3DEngine->GetParticleManager(); IF( pPartMan != NULL, 1) { pPartMan->AddFrameSyncTicks(JobManager::Fiber::GetNonFiberTicks() - m_nTicks); } } private: uint64 m_nTicks; }; #define PARTICLE_LIGHT_PROFILER() CParticleLightProfileSection _particleLightProfileSection; #define PARTICLE_LIGHT_SYNC_PROFILER() CParticleLightProfileSectionSyncTime _particleLightSyncProfileSection; #else #define PARTICLE_LIGHT_PROFILER() #define PARTICLE_LIGHT_SYNC_PROFILER() #endif enum EPerfHUD_ParticleDisplayMode { PARTICLE_DISP_MODE_NONE=0, PARTICLE_DISP_MODE_PARTICLE, PARTICLE_DISP_MODE_EMITTER, PARTICLE_DISP_MODE_FILL, PARTICLE_DISP_MODE_NUM, }; #endif //IPARTICLES_H
[ "jasonh78@gmail.com" ]
jasonh78@gmail.com
9498ae1acb224299d9a51d264f96f619a77abdbf
a5a7c59b04a1a64fe34653c7970c3cf173f9c1df
/externals/numeric_bindings/boost/numeric/bindings/lapack/driver/gegv.hpp
3ae73a19c16bdcf2021e9fa24c28a1c9346e481e
[ "BSL-1.0", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
siconos/siconos
a7afdba41a2bc1192ad8dcd93ac7266fa281f4cf
82a8d1338bfc1be0d36b5e8a9f40c1ad5384a641
refs/heads/master
2023-08-21T22:22:55.625941
2023-07-17T13:07:32
2023-07-17T13:07:32
37,709,357
166
33
Apache-2.0
2023-07-17T12:31:16
2015-06-19T07:55:53
C
UTF-8
C++
false
false
23,896
hpp
// // Copyright (c) 2002--2010 // Toon Knapen, Karl Meerbergen, Kresimir Fresl, // Thomas Klimpel and Rutger ter Borg // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // THIS FILE IS AUTOMATICALLY GENERATED // PLEASE DO NOT EDIT! // #ifndef BOOST_NUMERIC_BINDINGS_LAPACK_DRIVER_GEGV_HPP #define BOOST_NUMERIC_BINDINGS_LAPACK_DRIVER_GEGV_HPP #include <boost/assert.hpp> #include <boost/numeric/bindings/begin.hpp> #include <boost/numeric/bindings/detail/array.hpp> #include <boost/numeric/bindings/is_column_major.hpp> #include <boost/numeric/bindings/is_complex.hpp> #include <boost/numeric/bindings/is_mutable.hpp> #include <boost/numeric/bindings/is_real.hpp> #include <boost/numeric/bindings/lapack/workspace.hpp> #include <boost/numeric/bindings/remove_imaginary.hpp> #include <boost/numeric/bindings/size.hpp> #include <boost/numeric/bindings/stride.hpp> #include <boost/numeric/bindings/traits/detail/utils.hpp> #include <boost/numeric/bindings/value_type.hpp> #include <boost/static_assert.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/type_traits/remove_const.hpp> #include <boost/utility/enable_if.hpp> // // The LAPACK-backend for gegv is the netlib-compatible backend. // #include <boost/numeric/bindings/lapack/detail/lapack.h> #include <boost/numeric/bindings/lapack/detail/lapack_option.hpp> namespace boost { namespace numeric { namespace bindings { namespace lapack { // // The detail namespace contains value-type-overloaded functions that // dispatch to the appropriate back-end LAPACK-routine. // namespace detail { // // Overloaded function for dispatching to // * netlib-compatible LAPACK backend (the default), and // * float value-type. // inline std::ptrdiff_t gegv( const char jobvl, const char jobvr, const fortran_int_t n, float* a, const fortran_int_t lda, float* b, const fortran_int_t ldb, float* alphar, float* alphai, float* beta, float* vl, const fortran_int_t ldvl, float* vr, const fortran_int_t ldvr, float* work, const fortran_int_t lwork ) { fortran_int_t info(0); LAPACK_SGEGV( &jobvl, &jobvr, &n, a, &lda, b, &ldb, alphar, alphai, beta, vl, &ldvl, vr, &ldvr, work, &lwork, &info ); return info; } // // Overloaded function for dispatching to // * netlib-compatible LAPACK backend (the default), and // * double value-type. // inline std::ptrdiff_t gegv( const char jobvl, const char jobvr, const fortran_int_t n, double* a, const fortran_int_t lda, double* b, const fortran_int_t ldb, double* alphar, double* alphai, double* beta, double* vl, const fortran_int_t ldvl, double* vr, const fortran_int_t ldvr, double* work, const fortran_int_t lwork ) { fortran_int_t info(0); LAPACK_DGEGV( &jobvl, &jobvr, &n, a, &lda, b, &ldb, alphar, alphai, beta, vl, &ldvl, vr, &ldvr, work, &lwork, &info ); return info; } // // Overloaded function for dispatching to // * netlib-compatible LAPACK backend (the default), and // * complex<float> value-type. // inline std::ptrdiff_t gegv( const char jobvl, const char jobvr, const fortran_int_t n, std::complex<float>* a, const fortran_int_t lda, std::complex<float>* b, const fortran_int_t ldb, std::complex<float>* alpha, std::complex<float>* beta, std::complex<float>* vl, const fortran_int_t ldvl, std::complex<float>* vr, const fortran_int_t ldvr, std::complex<float>* work, const fortran_int_t lwork, float* rwork ) { fortran_int_t info(0); LAPACK_CGEGV( &jobvl, &jobvr, &n, a, &lda, b, &ldb, alpha, beta, vl, &ldvl, vr, &ldvr, work, &lwork, rwork, &info ); return info; } // // Overloaded function for dispatching to // * netlib-compatible LAPACK backend (the default), and // * complex<double> value-type. // inline std::ptrdiff_t gegv( const char jobvl, const char jobvr, const fortran_int_t n, std::complex<double>* a, const fortran_int_t lda, std::complex<double>* b, const fortran_int_t ldb, std::complex<double>* alpha, std::complex<double>* beta, std::complex<double>* vl, const fortran_int_t ldvl, std::complex<double>* vr, const fortran_int_t ldvr, std::complex<double>* work, const fortran_int_t lwork, double* rwork ) { fortran_int_t info(0); LAPACK_ZGEGV( &jobvl, &jobvr, &n, a, &lda, b, &ldb, alpha, beta, vl, &ldvl, vr, &ldvr, work, &lwork, rwork, &info ); return info; } } // namespace detail // // Value-type based template class. Use this class if you need a type // for dispatching to gegv. // template< typename Value, typename Enable = void > struct gegv_impl {}; // // This implementation is enabled if Value is a real type. // template< typename Value > struct gegv_impl< Value, typename boost::enable_if< is_real< Value > >::type > { typedef Value value_type; typedef typename remove_imaginary< Value >::type real_type; // // Static member function for user-defined workspaces, that // * Deduces the required arguments for dispatching to LAPACK, and // * Asserts that most arguments make sense. // template< typename MatrixA, typename MatrixB, typename VectorALPHAR, typename VectorALPHAI, typename VectorBETA, typename MatrixVL, typename MatrixVR, typename WORK > static std::ptrdiff_t invoke( const char jobvl, const char jobvr, MatrixA& a, MatrixB& b, VectorALPHAR& alphar, VectorALPHAI& alphai, VectorBETA& beta, MatrixVL& vl, MatrixVR& vr, detail::workspace1< WORK > work ) { namespace bindings = ::boost::numeric::bindings; BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) ); BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) ); BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixVL >::value) ); BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixVR >::value) ); BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const< typename bindings::value_type< MatrixA >::type >::type, typename remove_const< typename bindings::value_type< MatrixB >::type >::type >::value) ); BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const< typename bindings::value_type< MatrixA >::type >::type, typename remove_const< typename bindings::value_type< VectorALPHAR >::type >::type >::value) ); BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const< typename bindings::value_type< MatrixA >::type >::type, typename remove_const< typename bindings::value_type< VectorALPHAI >::type >::type >::value) ); BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const< typename bindings::value_type< MatrixA >::type >::type, typename remove_const< typename bindings::value_type< VectorBETA >::type >::type >::value) ); BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const< typename bindings::value_type< MatrixA >::type >::type, typename remove_const< typename bindings::value_type< MatrixVL >::type >::type >::value) ); BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const< typename bindings::value_type< MatrixA >::type >::type, typename remove_const< typename bindings::value_type< MatrixVR >::type >::type >::value) ); BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) ); BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) ); BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorALPHAR >::value) ); BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorALPHAI >::value) ); BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBETA >::value) ); BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixVL >::value) ); BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixVR >::value) ); BOOST_ASSERT( bindings::size(alphar) >= bindings::size_column(a) ); BOOST_ASSERT( bindings::size(beta) >= bindings::size_column(a) ); BOOST_ASSERT( bindings::size(work.select(real_type())) >= min_size_work( bindings::size_column(a) )); BOOST_ASSERT( bindings::size_column(a) >= 0 ); BOOST_ASSERT( bindings::size_minor(a) == 1 || bindings::stride_minor(a) == 1 ); BOOST_ASSERT( bindings::size_minor(b) == 1 || bindings::stride_minor(b) == 1 ); BOOST_ASSERT( bindings::size_minor(vl) == 1 || bindings::stride_minor(vl) == 1 ); BOOST_ASSERT( bindings::size_minor(vr) == 1 || bindings::stride_minor(vr) == 1 ); BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1, bindings::size_column(a)) ); BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1, bindings::size_column(a)) ); BOOST_ASSERT( jobvl == 'N' || jobvl == 'V' ); BOOST_ASSERT( jobvr == 'N' || jobvr == 'V' ); return detail::gegv( jobvl, jobvr, bindings::size_column(a), bindings::begin_value(a), bindings::stride_major(a), bindings::begin_value(b), bindings::stride_major(b), bindings::begin_value(alphar), bindings::begin_value(alphai), bindings::begin_value(beta), bindings::begin_value(vl), bindings::stride_major(vl), bindings::begin_value(vr), bindings::stride_major(vr), bindings::begin_value(work.select(real_type())), bindings::size(work.select(real_type())) ); } // // Static member function that // * Figures out the minimal workspace requirements, and passes // the results to the user-defined workspace overload of the // invoke static member function // * Enables the unblocked algorithm (BLAS level 2) // template< typename MatrixA, typename MatrixB, typename VectorALPHAR, typename VectorALPHAI, typename VectorBETA, typename MatrixVL, typename MatrixVR > static std::ptrdiff_t invoke( const char jobvl, const char jobvr, MatrixA& a, MatrixB& b, VectorALPHAR& alphar, VectorALPHAI& alphai, VectorBETA& beta, MatrixVL& vl, MatrixVR& vr, minimal_workspace ) { namespace bindings = ::boost::numeric::bindings; bindings::detail::array< real_type > tmp_work( min_size_work( bindings::size_column(a) ) ); return invoke( jobvl, jobvr, a, b, alphar, alphai, beta, vl, vr, workspace( tmp_work ) ); } // // Static member function that // * Figures out the optimal workspace requirements, and passes // the results to the user-defined workspace overload of the // invoke static member // * Enables the blocked algorithm (BLAS level 3) // template< typename MatrixA, typename MatrixB, typename VectorALPHAR, typename VectorALPHAI, typename VectorBETA, typename MatrixVL, typename MatrixVR > static std::ptrdiff_t invoke( const char jobvl, const char jobvr, MatrixA& a, MatrixB& b, VectorALPHAR& alphar, VectorALPHAI& alphai, VectorBETA& beta, MatrixVL& vl, MatrixVR& vr, optimal_workspace ) { namespace bindings = ::boost::numeric::bindings; real_type opt_size_work; detail::gegv( jobvl, jobvr, bindings::size_column(a), bindings::begin_value(a), bindings::stride_major(a), bindings::begin_value(b), bindings::stride_major(b), bindings::begin_value(alphar), bindings::begin_value(alphai), bindings::begin_value(beta), bindings::begin_value(vl), bindings::stride_major(vl), bindings::begin_value(vr), bindings::stride_major(vr), &opt_size_work, -1 ); bindings::detail::array< real_type > tmp_work( traits::detail::to_int( opt_size_work ) ); return invoke( jobvl, jobvr, a, b, alphar, alphai, beta, vl, vr, workspace( tmp_work ) ); } // // Static member function that returns the minimum size of // workspace-array work. // static std::ptrdiff_t min_size_work( const std::ptrdiff_t n ) { return std::max< std::ptrdiff_t >(1,8*n); } }; // // This implementation is enabled if Value is a complex type. // template< typename Value > struct gegv_impl< Value, typename boost::enable_if< is_complex< Value > >::type > { typedef Value value_type; typedef typename remove_imaginary< Value >::type real_type; // // Static member function for user-defined workspaces, that // * Deduces the required arguments for dispatching to LAPACK, and // * Asserts that most arguments make sense. // template< typename MatrixA, typename MatrixB, typename VectorALPHA, typename VectorBETA, typename MatrixVL, typename MatrixVR, typename WORK, typename RWORK > static std::ptrdiff_t invoke( const char jobvl, const char jobvr, MatrixA& a, MatrixB& b, VectorALPHA& alpha, VectorBETA& beta, MatrixVL& vl, MatrixVR& vr, detail::workspace2< WORK, RWORK > work ) { namespace bindings = ::boost::numeric::bindings; BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixA >::value) ); BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixB >::value) ); BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixVL >::value) ); BOOST_STATIC_ASSERT( (bindings::is_column_major< MatrixVR >::value) ); BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const< typename bindings::value_type< MatrixA >::type >::type, typename remove_const< typename bindings::value_type< MatrixB >::type >::type >::value) ); BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const< typename bindings::value_type< MatrixA >::type >::type, typename remove_const< typename bindings::value_type< VectorALPHA >::type >::type >::value) ); BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const< typename bindings::value_type< MatrixA >::type >::type, typename remove_const< typename bindings::value_type< VectorBETA >::type >::type >::value) ); BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const< typename bindings::value_type< MatrixA >::type >::type, typename remove_const< typename bindings::value_type< MatrixVL >::type >::type >::value) ); BOOST_STATIC_ASSERT( (boost::is_same< typename remove_const< typename bindings::value_type< MatrixA >::type >::type, typename remove_const< typename bindings::value_type< MatrixVR >::type >::type >::value) ); BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) ); BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) ); BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorALPHA >::value) ); BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorBETA >::value) ); BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixVL >::value) ); BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixVR >::value) ); BOOST_ASSERT( bindings::size(alpha) >= bindings::size_column(a) ); BOOST_ASSERT( bindings::size(beta) >= bindings::size_column(a) ); BOOST_ASSERT( bindings::size(work.select(real_type())) >= min_size_rwork( bindings::size_column(a) )); BOOST_ASSERT( bindings::size(work.select(value_type())) >= min_size_work( bindings::size_column(a) )); BOOST_ASSERT( bindings::size_column(a) >= 0 ); BOOST_ASSERT( bindings::size_minor(a) == 1 || bindings::stride_minor(a) == 1 ); BOOST_ASSERT( bindings::size_minor(b) == 1 || bindings::stride_minor(b) == 1 ); BOOST_ASSERT( bindings::size_minor(vl) == 1 || bindings::stride_minor(vl) == 1 ); BOOST_ASSERT( bindings::size_minor(vr) == 1 || bindings::stride_minor(vr) == 1 ); BOOST_ASSERT( bindings::stride_major(a) >= std::max< std::ptrdiff_t >(1, bindings::size_column(a)) ); BOOST_ASSERT( bindings::stride_major(b) >= std::max< std::ptrdiff_t >(1, bindings::size_column(a)) ); BOOST_ASSERT( jobvl == 'N' || jobvl == 'V' ); BOOST_ASSERT( jobvr == 'N' || jobvr == 'V' ); return detail::gegv( jobvl, jobvr, bindings::size_column(a), bindings::begin_value(a), bindings::stride_major(a), bindings::begin_value(b), bindings::stride_major(b), bindings::begin_value(alpha), bindings::begin_value(beta), bindings::begin_value(vl), bindings::stride_major(vl), bindings::begin_value(vr), bindings::stride_major(vr), bindings::begin_value(work.select(value_type())), bindings::size(work.select(value_type())), bindings::begin_value(work.select(real_type())) ); } // // Static member function that // * Figures out the minimal workspace requirements, and passes // the results to the user-defined workspace overload of the // invoke static member function // * Enables the unblocked algorithm (BLAS level 2) // template< typename MatrixA, typename MatrixB, typename VectorALPHA, typename VectorBETA, typename MatrixVL, typename MatrixVR > static std::ptrdiff_t invoke( const char jobvl, const char jobvr, MatrixA& a, MatrixB& b, VectorALPHA& alpha, VectorBETA& beta, MatrixVL& vl, MatrixVR& vr, minimal_workspace ) { namespace bindings = ::boost::numeric::bindings; bindings::detail::array< value_type > tmp_work( min_size_work( bindings::size_column(a) ) ); bindings::detail::array< real_type > tmp_rwork( min_size_rwork( bindings::size_column(a) ) ); return invoke( jobvl, jobvr, a, b, alpha, beta, vl, vr, workspace( tmp_work, tmp_rwork ) ); } // // Static member function that // * Figures out the optimal workspace requirements, and passes // the results to the user-defined workspace overload of the // invoke static member // * Enables the blocked algorithm (BLAS level 3) // template< typename MatrixA, typename MatrixB, typename VectorALPHA, typename VectorBETA, typename MatrixVL, typename MatrixVR > static std::ptrdiff_t invoke( const char jobvl, const char jobvr, MatrixA& a, MatrixB& b, VectorALPHA& alpha, VectorBETA& beta, MatrixVL& vl, MatrixVR& vr, optimal_workspace ) { namespace bindings = ::boost::numeric::bindings; value_type opt_size_work; bindings::detail::array< real_type > tmp_rwork( min_size_rwork( bindings::size_column(a) ) ); detail::gegv( jobvl, jobvr, bindings::size_column(a), bindings::begin_value(a), bindings::stride_major(a), bindings::begin_value(b), bindings::stride_major(b), bindings::begin_value(alpha), bindings::begin_value(beta), bindings::begin_value(vl), bindings::stride_major(vl), bindings::begin_value(vr), bindings::stride_major(vr), &opt_size_work, -1, bindings::begin_value(tmp_rwork) ); bindings::detail::array< value_type > tmp_work( traits::detail::to_int( opt_size_work ) ); return invoke( jobvl, jobvr, a, b, alpha, beta, vl, vr, workspace( tmp_work, tmp_rwork ) ); } // // Static member function that returns the minimum size of // workspace-array work. // static std::ptrdiff_t min_size_work( const std::ptrdiff_t n ) { return std::max< std::ptrdiff_t >(1,2*n); } // // Static member function that returns the minimum size of // workspace-array rwork. // static std::ptrdiff_t min_size_rwork( const std::ptrdiff_t n ) { return 8*n; } }; // // Functions for direct use. These functions are overloaded for temporaries, // so that wrapped types can still be passed and used for write-access. In // addition, if applicable, they are overloaded for user-defined workspaces. // Calls to these functions are passed to the gegv_impl classes. In the // documentation, most overloads are collapsed to avoid a large number of // prototypes which are very similar. // // // Overloaded function for gegv. Its overload differs for // * User-defined workspace // template< typename MatrixA, typename MatrixB, typename VectorALPHAR, typename VectorALPHAI, typename VectorBETA, typename MatrixVL, typename MatrixVR, typename Workspace > inline typename boost::enable_if< detail::is_workspace< Workspace >, std::ptrdiff_t >::type gegv( const char jobvl, const char jobvr, MatrixA& a, MatrixB& b, VectorALPHAR& alphar, VectorALPHAI& alphai, VectorBETA& beta, MatrixVL& vl, MatrixVR& vr, Workspace work ) { return gegv_impl< typename bindings::value_type< MatrixA >::type >::invoke( jobvl, jobvr, a, b, alphar, alphai, beta, vl, vr, work ); } // // Overloaded function for gegv. Its overload differs for // * Default workspace-type (optimal) // template< typename MatrixA, typename MatrixB, typename VectorALPHAR, typename VectorALPHAI, typename VectorBETA, typename MatrixVL, typename MatrixVR > inline typename boost::disable_if< detail::is_workspace< MatrixVR >, std::ptrdiff_t >::type gegv( const char jobvl, const char jobvr, MatrixA& a, MatrixB& b, VectorALPHAR& alphar, VectorALPHAI& alphai, VectorBETA& beta, MatrixVL& vl, MatrixVR& vr ) { return gegv_impl< typename bindings::value_type< MatrixA >::type >::invoke( jobvl, jobvr, a, b, alphar, alphai, beta, vl, vr, optimal_workspace() ); } // // Overloaded function for gegv. Its overload differs for // * User-defined workspace // template< typename MatrixA, typename MatrixB, typename VectorALPHA, typename VectorBETA, typename MatrixVL, typename MatrixVR, typename Workspace > inline typename boost::enable_if< detail::is_workspace< Workspace >, std::ptrdiff_t >::type gegv( const char jobvl, const char jobvr, MatrixA& a, MatrixB& b, VectorALPHA& alpha, VectorBETA& beta, MatrixVL& vl, MatrixVR& vr, Workspace work ) { return gegv_impl< typename bindings::value_type< MatrixA >::type >::invoke( jobvl, jobvr, a, b, alpha, beta, vl, vr, work ); } // // Overloaded function for gegv. Its overload differs for // * Default workspace-type (optimal) // template< typename MatrixA, typename MatrixB, typename VectorALPHA, typename VectorBETA, typename MatrixVL, typename MatrixVR > inline typename boost::disable_if< detail::is_workspace< MatrixVR >, std::ptrdiff_t >::type gegv( const char jobvl, const char jobvr, MatrixA& a, MatrixB& b, VectorALPHA& alpha, VectorBETA& beta, MatrixVL& vl, MatrixVR& vr ) { return gegv_impl< typename bindings::value_type< MatrixA >::type >::invoke( jobvl, jobvr, a, b, alpha, beta, vl, vr, optimal_workspace() ); } } // namespace lapack } // namespace bindings } // namespace numeric } // namespace boost #endif
[ "franck.perignon@imag.fr" ]
franck.perignon@imag.fr