blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
201
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
7
100
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
260 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
11.4k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
80 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
8
9.86M
extension
stringclasses
52 values
content
stringlengths
8
9.86M
authors
listlengths
1
1
author
stringlengths
0
119
dc0fc47d5b83251439d5220969a7de1b05f41500
0ac89ef66f99c323003eaf5fc05d9562e8fa6d69
/NQueenII.cc
0481ad4db039bd340ef0aa59f837184715e1a24d
[]
no_license
YuxiKou/leetcode
22ce9324e4afef1a864454f477a2f369a5617ac3
283faadbe85ebcdd8bdd34ebabf601b7d6db4612
refs/heads/master
2021-01-18T19:18:51.040690
2014-10-22T02:23:33
2014-10-22T02:23:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
557
cc
/* Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. */ class Solution { public: int cnt,upper; int totalNQueens(int n) { cnt = 0; upper = (1<<n)-1 ; Queen(0,0,0); return cnt; } void Queen(int row,int ld,int rd) { int pos,p; if(row!=upper) { pos = upper & (~(row | ld |rd)); while(pos!=0) { p = pos & (-pos); pos = pos - p; Queen(row+p,(ld+p)<<1,(rd+p)>>1); } } else ++cnt; } };
[ "koukou1213@gmail.com" ]
koukou1213@gmail.com
0d2c0eb8f88756616a04cee01f03e001b1bfef17
fb0b4ff48221365f8546b86c4a45ea10c55210ca
/ArenaShooter UE4/Source/ArenaShooter/Public/Character/BaseCharacter.h
351842c32568e6aa8bfc48a5a2da68e257e00258
[]
no_license
dantheman94/ArenaShooter_UE4
2e445621529851fbf2455bd0d7be484e291ee284
512b740f72c3faee9ebda89a88612ed8604beb32
refs/heads/master
2023-02-11T02:57:29.215439
2021-01-12T11:11:15
2021-01-12T11:11:15
241,025,353
6
5
null
null
null
null
UTF-8
C++
false
false
73,776
h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "Curves/CurveVector.h" #include "GameFramework/Character.h" #include "Structures.h" #include "BaseCharacter.generated.h" // *** DEFINITIONS #define _MAX_FLESH_HEALTH 100.0f #define _MAX_SHIELD 100.0f // *** ENUMERATORS UENUM(BlueprintType) enum class E_AimDirection : uint8 { ePT_ZoomIn UMETA(DisplayName = "ZoomIn"), ePT_ZoomOut UMETA(DisplayName = "ZoomOut") }; UENUM(BlueprintType) enum class E_CharacterStates : uint8 { eCS_Idle UMETA(DisplayName = "Idle"), eCS_Walking UMETA(DisplayName = "Walking"), eCS_Jogging UMETA(DisplayName = "Joggin"), eCS_Sprinting UMETA(DisplayName = "Sprinting"), eCS_Crouching UMETA(DisplayName = "Crouching"), eCS_Sliding UMETA(DisplayName = "Sliding"), eCS_Jumping UMETA(DisplayName = "Jumping"), eCS_DoubleJumping UMETA(DisplayName = "DoubleJumping"), eCS_Dashing UMETA(DisplayName = "Dashing"), eCS_Hovering UMETA(DisplayName = "Hovering"), eCS_Montage UMETA(DisplayName = "Playing Montage"), eCS_Ragdoll UMETA(DisplayName = "Ragdolling") }; UENUM(BlueprintType) enum class E_CombatStates : uint8 { ePT_Aiming UMETA(DisplayName = "ZoomIn"), ePT_ZoomOut UMETA(DisplayName = "ZoomOut") }; // *** EVENT DISPATCHERS / DELEGATES DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FADSAnimDelegate, bool, AimingEnter); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnTakeDamage, float, DamageAmount); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSprintEnter, bool, IsSprinting); // *** CLASSES class UCameraShake; class AController; class AWeapon; class UCameraComponent; class USpringArmComponent; class UStamina; class UFireMode; class AInteractable; UCLASS() class ABaseCharacter : public ACharacter { GENERATED_BODY() #pragma region Public Variables public: // Character | FirstPerson **************************************************************************************************************** UPROPERTY(BlueprintReadWrite, VisibleAnywhere) UCameraComponent* _FirstPerson_Camera = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) USpringArmComponent* _FirstPerson_SpringArm = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) USkeletalMeshComponent* _FirstPerson_Arms = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) USkeletalMeshComponent* _FirstPerson_ArmsDuelLeft = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) USkeletalMeshComponent* _FirstPerson_ArmsDuelRight = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) USkeletalMeshComponent* _FirstPerson_PrimaryWeapon_SkeletalMesh = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) USkeletalMeshComponent* _FirstPerson_SecondaryWeapon_SkeletalMesh = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) UStaticMeshComponent* _FirstPerson_PrimaryWeapon_Sight_StaticMesh = NULL; // Character | ThirdPerson **************************************************************************************************************** UPROPERTY(BlueprintReadWrite, VisibleAnywhere) USkeletalMeshComponent* _ThirdPerson_PrimaryWeapon_SkeletalMesh = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) USkeletalMeshComponent* _ThirdPerson_SecondaryWeapon_SkeletalMesh = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) USkeletalMeshComponent* _ThirdPerson_ReserveWeapon_SkeletalMesh = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) UCapsuleComponent* _HitBox_Head = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) UCapsuleComponent* _HitBox_TorsoUpper = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) UCapsuleComponent* _HitBox_TorsoLower = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) UCapsuleComponent* _HitBox_RightShoulder = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) UCapsuleComponent* _HitBox_RightForearm = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) UCapsuleComponent* _HitBox_RightHand = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) UCapsuleComponent* _HitBox_LeftShoulder = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) UCapsuleComponent* _HitBox_LeftForearm = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) UCapsuleComponent* _HitBox_LeftHand = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) UCapsuleComponent* _HitBox_RightThigh = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) UCapsuleComponent* _HitBox_RightShin = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) UCapsuleComponent* _HitBox_LeftThigh = NULL; UPROPERTY(BlueprintReadWrite, VisibleAnywhere) UCapsuleComponent* _HitBox_LeftShin = NULL; #pragma endregion Public Variables #pragma region Protected Variables protected: /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Startup /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Default Settings") float _fDefaultCapsuleHalfHeight = 0.0f; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Default Settings") float _fCameraRotationLagSpeed = 0.0f; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Default Settings") float _fDefaultGravityScale = 0.0f; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Default Settings") float _fDefaultAirControl = 0.0f; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Default Settings") float _fDefaultGroundFriction = 0.0f; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Default Settings") float _fDefaultBrakingFrictionFactor = 0.0f; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Default Settings") float _fDefaultBrakingDecelerationWalking = 0.0f; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Current Frame /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// bool _bIsPerformingGroundChecks = false; float _fFallingVelocity = 0.0f; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Animation /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Animation") float _fGlobalTogglePlayRate = 2.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Animation") float _fGlobalReloadPlayRate = 1.0f; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Animation") UAnimMontage* _CurrentMontagePlaying = NULL; /* * */ UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Animation") bool _bCancelAnimation = false; /* * A timer handle used for referencing the primary (right arm) animation. */ UPROPERTY() FTimerHandle _fPrimaryFPAnimationHandle; /* * A timer handle used for referencing the secondary (left arm) animation. */ UPROPERTY() FTimerHandle _fSecondaryFPAnimationHandle; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Controller | Input /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * A scalar value (0 - 1 FLOAT) that represents the amount of input being driven into the forward/backward input (REPLICATED). * EG: Keyboard will either be -1.0, 0.0 or 1.0 explicitly, but a gamepad could be somewhere in between this range due to its axis controller). * This is primarily used for animation (Blending from idle -> walk -> jog animation state) */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Controller | Input", Replicated) float _fForwardInputScale = 0.0f; /* * A scalar value (0 - 1 FLOAT) that represents the amount of input being driven into the right/left input (REPLICATED). * EG: Keyboard will either be -1.0, 0.0 or 1.0 explicitly, but a gamepad could be somewhere in between this range due to its axis controller). * This is primarily used for animation (Blending from idle -> walk -> jog animation state) */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Controller | Input", Replicated) float _fRightInputScale = 0.0f; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Health | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * Returns whether the character has HEALTH greater than 0.0f (REPLICATED). */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Health", Replicated) bool _bIsAlive = false; /* * Returns whether the character is currently taking damage or not (REPLICATED). */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Health", Replicated) bool _bIsTakingDamage = false; /* * The amount of time (in seconds) that must past since the last frame that the character was inflicted with damage, * before the _bIsTakingDamage is reset back to FALSE. */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Health") float _fTakingDamageResetDelay = 0.2f; /* * A list of controllers that have inflicted damage to the character since they were at a maximum health & shield value. * This list is cleared only once the character has reached its maximum health values again. */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Health") TArray<AController*>_DamageInstigators; /* * */ UPROPERTY(BlueprintAssignable) FOnTakeDamage _fOnTakeDamage; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Health | Burn /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Health | Burn", Replicated) bool _bIsBurning = false; /* * A timer handle used for referencing the burn delay on this character. */ UPROPERTY() FTimerHandle _fBurnDelayHandle; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Health | Flesh /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * The current health value of the character (REPLICATED). */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Health | Flesh", Replicated) float _fFleshHealth = _MAX_FLESH_HEALTH; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Health | Shield /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * The minimum delay of time (in seconds) that must pass since the last frame that the character was inflicted with damage, * before the shields can begin recharging. */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Health | Shield") float _fShieldRechargeDelay = 3.0f; /* * The rate of recharge of the shield when it is below its maximum value. */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Health | Shield") float _fShieldRechargingRate = 40.0f; /* * The current shield value of the character (REPLICATED). */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Health | Shield", Replicated) float _fShield = _MAX_SHIELD; UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Health | Shield") bool _bRechargeShields = false; /* * A timer handle used for referencing the shield recharging delay. */ UPROPERTY() FTimerHandle _fShieldRechargeDelayHandle; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Interaction /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Interaction") TArray<UInteractionDataComponent*> _Interactables; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Interaction") UInteractionDataComponent* _FocusInteractable = NULL; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Interaction") float _fInteractionThresholdTime = 2.0f; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Interaction") bool _bIsTryingToInteractPrimary = false; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Interaction") bool _bIsTryingToInteractSecondary = false; /* * */ UPROPERTY() FTimerHandle _fInteractionHandle; /* * */ UPROPERTY() FTimerHandle _fSetWeaponHandle; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Starting /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * Returns whether the starting loadout of this character should use the loadout defined in the current gamemode. */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Inventory | Starting") bool _bUseStartingLoadoutFromGamemode = true; /* * The starting primary weapon of the character when created. * (Only valid if _UseStartingLoadoutFromGamemode is FALSE). */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Inventory | Starting") TSubclassOf<class AWeapon> _StartingPrimaryWeaponClass = NULL; /* * The starting secondary weapon of the character when created. * (Only valid if _UseStartingLoadoutFromGamemode is FALSE AND IF the _StartedPrimaryWeaponClass is a _bDuelWieldable AWeapon). */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Inventory | Starting") TSubclassOf<class AWeapon> _StartingSecondaryWeaponClass = NULL; /* * The starting reserve weapon of the character when created (Holstered weapon). * (Only valid if _UseStartingLoadoutFromGamemode is FALSE). */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Inventory | Starting") TSubclassOf<class AWeapon> _StartingReserveWeaponClass = NULL; /* * */ UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Inventory | Starting") bool _bStartingLoadout = true; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Weapon | Aiming /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Inventory | Weapon | Aiming") FName _AimSocketName = TEXT("AimingCameraPoint"); /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Inventory | Weapon | Aiming") float _fAimingSpringArmRotationLag = 40.0f; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Aiming") bool _bCanAim = true; /* * Returns whether the character is currently aiming (ADS) their weapon or not (REPLICATED). */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Aiming", Replicated) bool _bIsAiming = false; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Aiming") float _fAimTime = 0.0f; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Aiming") int _iCurrentFovStage = 0; UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Aiming") bool _bIsAimLerping = false; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Aiming") float _fFovStart = 90.0f; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Aiming") float _fFovTarget = 90.0f; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Aiming") FTransform _TargetOriginTransform = FTransform::Identity; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Aiming") FTransform _StartingOriginTransform = FTransform::Identity; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Aiming") FVector _FpsArmOffset = FVector::ZeroVector; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Aiming") E_AimDirection _eAimDirection = E_AimDirection::ePT_ZoomIn; /* * */ UPROPERTY(BlueprintAssignable, Category = "Inventory: Weapon | Aiming") FADSAnimDelegate _fAdsAnimationEvent; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Weapon | Toggle /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * A timer handle used for referencing the actual toggle. */ UPROPERTY() FTimerHandle _fToggleHandle; /* * A timer handle used for referencing the toggle exit. */ UPROPERTY() FTimerHandle _fExitToggleHandle; /* * Returns reference if the character is currently tabbing between its inventory weapons or not (REPLICATED). */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Tabbing", Replicated) bool _bIsTogglingWeapons = false; /* * Returns reference if the character is currently equipping a new inventory weapon or not (REPLICATED). */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Tabbing", Replicated) bool _bIsEquippingNewWeapon = false; /* * Returns reference to the previous primary weapon of the character (Used for toggling weapons) (REPLICATED). */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Tabbing", Replicated) AWeapon* _OldPrimaryWeapon = NULL; /* * Returns reference to the previous reserve weapon of the character (Used for toggling weapons) (REPLICATED). */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Tabbing", Replicated) AWeapon* _OldReserveWeapon = NULL; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Weapon | Primary /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * Returns reference to the current primary weapon of the character (REPLICATED). */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Primary", ReplicatedUsing = OnRep_PrimaryWeapon) AWeapon* _PrimaryWeapon = NULL; /* * Returns if whether the character is currently reloading their primary weapon or not (REPLICATED). */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Primary", Replicated) bool _bIsReloadingPrimaryWeapon = false; /* * Returns if the character has cancelled reloading their primary weapon or not. */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Primary") bool _bPrimaryReloadCancelled = false; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Primary") bool _bCanFirePrimary = true; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Primary") bool _bIsTryingToFirePrimary = false; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Primary") bool _bHasReleasedPrimaryTrigger = true; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Inventory | Weapon | Primary") bool _bDebugDrawPrimaryWeaponCameraTrace = false; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Inventory | Weapon | Primary", meta = (EditCondition = "_bDebugDrawPrimaryWeaponCameraTrace")) FColor _fPrimaryWeaponCameraTraceColour = FColor::Red; /* * A timer handle used for referencing the primary weapon reloading timer (NOT DUEL WIELDING) */ UPROPERTY() FTimerHandle _fPrimaryReloadHandle; /* * A timer handle used for referencing the primary weapon reloading timer */ UPROPERTY() FTimerHandle _fDuelPrimaryReloadHandle; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Weapon | Secondary /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * Returns reference to the current secondary weapon of the character (REPLICATED). */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Secondary", ReplicatedUsing = OnRep_DuelWielding) AWeapon* _SecondaryWeapon = NULL; /* * Returns whether the character is duel wielding a secondary weapon or not (REPLICATED). * This should be inline if whether _SecondaryWeapon isValid or not. */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Secondary", Replicated) bool _bIsDuelWielding = false; /* * Returns if whether the character is currently reloading their secondary weapon or not (REPLICATED). */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Secondary", Replicated) bool _bIsReloadingSecondaryWeapon = false; /* * Returns if the character has cancelled reloading their secondary weapon or not. */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Secondary") bool _bSecondaryReloadCancelled = false; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Secondary") bool _bCanFireSecondary = true; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Secondary") bool _bIsTryingToFireSecondary = false; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Secondary") bool _bHasReleasedSecondaryTrigger = true; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Inventory | Weapon | Secondary") bool _bDuelWieldingIsMirrored = false; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Inventory | Weapon | Secondary") bool _bDebugDrawSecondaryWeaponCameraTrace = false; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Inventory | Weapon | Secondary", meta = (EditCondition = "_bDebugDrawSecondaryWeaponCameraTrace")) FColor _fSecondaryWeaponCameraTraceColour = FColor::Red; /* * A timer handle used for referencing the secondary weapon reloading timer. */ UPROPERTY() FTimerHandle _fDuelSecondaryReloadHandle; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Weapon | Reserve /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * Returns reference to the current reserve weapon of the character (REPLICATED). */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Weapon | Reserve", ReplicatedUsing = OnRep_ReserveWeapon) AWeapon* _ReserveWeapon = NULL; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Grenade /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Inventory | Grenade", Replicated) int _iFragmentationGrenadeCount = 0; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Inventory | Grenade", Replicated) int _iEMPGrenadeCount = 0; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Inventory | Grenade", Replicated) int _iIncendiaryGrenadeCount = 0; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Inventory | Grenade") int _iMaximumGrenadeCount = 2; UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Inventory | Grenade") E_GrenadeType _eCurrentGrenadeType = E_GrenadeType::eWBT_Frag; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | Crouching /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Crouch") float _fCrouchLerpingDuration = 0.25f; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Crouch") float _fCrouchCameraLerpTime = 0.0f; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Crouch") float _fCrouchCapsuleLerpTime = 0.0f; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Crouch") bool _bLerpCrouchCamera = false; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Crouch") bool _bLerpCrouchCapsule = false; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Crouch") bool _bCrouchEnter = false; /* * Returns whether the character is currently in a crouching state or not (REPLICATED). */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Crouch", Replicated) bool _bIsCrouching = false; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Crouch") FTransform _tCrouchWeaponOrigin; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | Jog /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * A scalar multiplier of the camera shake used when jogging. Higher values means more "bobbing". */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Jog") float _fJogCameraBobScale = 0.4f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Jog") float _fJogGroundFriction = 8.0f; /* * Reference to the camera shake class to be used when the character is jogging. */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Jog") TSubclassOf<class UCameraShake> _CameraShakeJog = NULL; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | Jump /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Jump") bool _bCanJump = true; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Jump", Replicated) bool _bIsJumping = false; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Jump") bool _bOverwriteJumpMovementComponent = false; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Jump", meta = (EditCondition = "_bOverwriteJumpMovementComponent")) float _fOverwriteJumpForce = 740.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Jump") TSubclassOf<class UCameraShake> _CameraShakeJumpStart = NULL; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Jump") TSubclassOf<class UCameraShake> _CameraShakeJumpLand = NULL; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Jump") TSubclassOf<class UCurveVector> _CurveJumpLand = NULL; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Jump") float _fJumpGamepadRumbleIntensity = 1.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Jump") float _fJumpGamepadRumbleDuration = 0.15f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Jump") bool _fJumpGamepadRumbleAffectsLeftLarge = false; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Jump") bool _fJumpGamepadRumbleAffectsLeftSmall = true; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Jump") bool _fJumpGamepadRumbleAffectsRightLarge = false; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Jump") bool _fJumpGamepadRumbleAffectsRightSmall = true; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Jump") float _fFallingLandShakeMultiplier = 2.75f; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | Slide /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Slide") bool _bSlideEnabled = true; /* * */ UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "Movement | Slide") TSubclassOf<class UCameraShake> _SlideStartCameraShake; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Slide") UCameraShake* _SlideCameraShakeInstance = NULL; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Slide") bool _bIsTryingToSlide = false; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Slide", Replicated) bool _bIsSliding = false; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Slide") bool _bLerpSlideCamera = false; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Slide") bool _bSlideEnter = false; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Slide") FTransform _tSlideEnterOrigin; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Slide") float _fSlideForwardVelocityThreshold = 600.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Slide") float _fSlideUpVelocityThreshold = -500.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Slide") float _fSlideAirbourneGravityForce = 5.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Slide") FTransform _tSlideWeaponOrigin; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Slide") float _fSlideCameraLerpingDuration = 0.25f; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Slide") float _fSlideCameraLerpTime = 0.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Slide") float _fSlideForce = 300.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Slide") bool _fSlideLaunchXYOverride = false; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Slide") bool _fSlideLaunchZOverride = false; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Slide") float _fSlideBreakingFrictionFactor = 0.5f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Slide") float _fSlideBrakingDeceleration = 600.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Slide") bool _bOverrideSlideVelocityFromDash = true; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | Speed /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Speed") float _fMovementSpeedWalk = 575.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Speed") float _fMovementSpeedJog = 700.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Speed") float _fMovementSpeedSprint = 835.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Speed") float _fMovementSpeedCrouch = 385.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Speed") float _fMovementAccelerationRate = 100.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Speed") bool _bUsesStaminaToSprint = false; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Speed") TSubclassOf<UStamina> _SprintStaminaComponent; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | Sprint /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * Returns whether the character can use the sprint mechanic. */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Sprint") bool _bSprintEnabled = false; /* * Returns whether the character is trying to sprint (usually given by player input) */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Sprint") bool _bTryingToSprint = false; /* * Returns whether the character can sprint. */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Sprint") bool _bCanSprint = false; /* * Returns whether the character is currently in a sprinting state or not (REPLICATED). */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Sprint", Replicated) bool _bIsSprinting = false; /* * The amount of time the character has been sprinting for. */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Sprint") float _fSprintTime = 0.0f; /* * The multiplier used against the player's look input when the character is strafing. */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Sprint") float _fSprintStrafeInputScale = 0.35f; /* * The multiplier used against the player's look input when the character is sprinting. */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Sprint") float _fSprintLookInputScale = 0.7f; /* * A scalar multiplier of the camera shake used when sprinting. Higher values means more "bobbing". */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Sprint") float _fSprintCameraBobScale = 2.0f; /* * Reference to the camera shake class to be used when the character is sprinting. */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Sprint") TSubclassOf<class UCameraShake> _CameraShakeSprint = NULL; /* * */ UPROPERTY(BlueprintAssignable, Category = "Movement: Sprint") FOnSprintEnter _fOnSprintEnter; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Sprint") FTransform _tSprintWeaponOrigin; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | Stamina /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Inventory") TArray<UStamina*> _uStaminaComponents; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | Vault /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Vault") float _fLedgeForwardTraceRadius = 40.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Vault") float _fLedgeForwardTraceLength = 200.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Vault") float _fLedgeHeightTraceVerticalOffset= 200.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Vault") float _fLedgeHeightTraceForwardOffset = 100.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Vault") float _fLedgeHeightTraceLength = 300.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Vault") float _fVaultTime = 0.35; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Vault") FName _sPelvisSocket = TEXT("pelvisSocket"); /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Vault") float _fLedgeGrabThresholdMin = -75.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Vault") float _fLedgeGrabThresholdMax = 50.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Vault") float _fVaultHeightOffset = 100.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Vault") float _fVaultForwardOffset = 100.0f; /* * */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Movement | Vault") TEnumAsByte<ETraceTypeQuery> _eVaultTraceChannel = ETraceTypeQuery::TraceTypeQuery15; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Vault") bool _bCanVault = true; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Vault", Replicated) bool _bIsVaulting = false; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Vault") bool _bIsTryingToVault = false; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Vault") FVector _vWallImpactPoint = FVector::ZeroVector; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Vault") FVector _vWallNormal = FVector::ZeroVector; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Vault") FVector _vWallTraceStart = FVector::ZeroVector; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Vault") FVector _vWallTraceEnd = FVector::ZeroVector; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Vault") FVector _vWallHeightLocation = FVector::ZeroVector; /* * */ UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly, Category = "Movement | Vault") int32 _NextUUID = 0; #pragma endregion Protected Variables #pragma region Public Functions public: /** * @summary: Sets default values for this component's properties. * * @return: Constructor */ ABaseCharacter(); /** * @summary: Called when the game starts or when spawned. * * @return: virtual void */ virtual void BeginPlay() override; void GetLifetimeReplicatedProps(TArray<FLifetimeProperty> & OutLifetimeProps) const; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Character | FirstPerson /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION(BlueprintPure) USkeletalMeshComponent* GetFirstPersonArmsDuelLeftMesh() { return _FirstPerson_ArmsDuelLeft; } /* * */ UFUNCTION(BlueprintPure) USkeletalMeshComponent* GetFirstPersonArmsDuelRightMesh() { return _FirstPerson_ArmsDuelRight; } /* * */ UFUNCTION(BlueprintPure) USkeletalMeshComponent* GetFirstPersonArmsMesh() { return _FirstPerson_Arms; } /* * */ UFUNCTION(BlueprintPure) USkeletalMeshComponent* GetFirstPersonPrimaryWeaponMesh() { return _FirstPerson_PrimaryWeapon_SkeletalMesh; } /* * */ UFUNCTION(BlueprintPure) USkeletalMeshComponent* GetFirstPersonSecondaryWeaponMesh() { return _FirstPerson_SecondaryWeapon_SkeletalMesh; } /* * */ UFUNCTION(BlueprintPure) USkeletalMeshComponent* GetThirdPersonPrimaryWeaponMesh() { return _ThirdPerson_PrimaryWeapon_SkeletalMesh; } /* * */ UFUNCTION(BlueprintPure) USkeletalMeshComponent* GetThirdPersonSecondaryWeaponMesh() { return _ThirdPerson_SecondaryWeapon_SkeletalMesh; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Animation /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION() void FreezeAnimation(USkeletalMeshComponent* ArmsMesh, UAnimMontage* MontageToFreeze, float EndFrame, bool bHideMeshOnFreeze); /* * */ UFUNCTION(BlueprintPure) float GetGlobalReloadPlayRate() const { return _fGlobalReloadPlayRate; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Camera /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION(Client, Unreliable, WithValidation) void OwningClient_PlayCameraShake(TSubclassOf<class UCameraShake> ShakeClass, float Scale); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Controller | Gamepad /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION(Client, Unreliable, WithValidation) void OwningClient_GamepadRumble(float Intensity, float Duration, bool AffectsLeftLarge, bool AffectsLeftSmall, bool AffectsRightLarge, bool AffectsRightSmall); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Controller | Input /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * @summary: Sets the whether the character is using controller rotation yaw or not. * * @networking: Runs on server * * @param: bool useControllerRotationYaw * * @return: void */ UFUNCTION(Server, Reliable, WithValidation) void Server_SetUseControllerRotationYaw(bool useControllerRotationYaw); UFUNCTION() void SetForwardInputScale(float ForwardInputScale); /** * @summary: Sets the whether forward input scale of the character (used for animation) * * @networking: Runs on server * * @param: float forwardInputScale * * @return: void */ UFUNCTION(Server, Reliable, WithValidation) void Server_SetForwardInputScale(float ForwardInputScale); UFUNCTION() void SetRightInputScale(float RightInputScale); /** * @summary: Sets the whether right input scale of the character (used for animation) * * @networking: Runs on server * * @param: float rightInputScale * * @return: void */ UFUNCTION(Server, Unreliable, WithValidation) void Server_SetRightInputScale(float RightInputScale); /** * @summary: Returns the current forward input scale (used for animation walk blending) * * @return: float */ UFUNCTION(BlueprintPure, Category = "Controller | Input") float GetForwardInputScale() { return _fForwardInputScale; } /** * @summary: Returns the current right input scale (used for animation walk blending) * * @return: float */ UFUNCTION(BlueprintPure, Category = "Controller | Input") float GetRightInputScale() { return _fRightInputScale; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Health | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION() virtual void OnAnyDamage(AActor* Actor, float Damage, const UDamageType* DamageType, AController* InstigatedBy, AActor* DamageCauser); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_OnAnyDamage(AActor* Actor, float Damage, const UDamageType* DamageType, AController* InstigatedBy, AActor* DamageCauser); /* * */ UFUNCTION() virtual void OnPointDamage(float Damage); /* * */ UFUNCTION() virtual void OnRadialDamage(float Damage); /* * */ UFUNCTION() virtual void OnDeath(); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_OnDeath(); /* * */ UFUNCTION(BlueprintPure) bool IsAlive() { return /*_bIsAlive = */_fFleshHealth > 0.0f; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Health | Burn /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_BurnCharacter(int Steps, float Damage, float Delay); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Health | Flesh /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * @summary: Resets the flesh health of the character to the maximum amount. * * @networking: Runs on server * * @return: void */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_ResetFleshHealth(); /* * */ UFUNCTION(BlueprintPure) float GetCurrentFleshHealth() { return _fFleshHealth; } // Returns the value of _MAX_FLESH_HEALTH UFUNCTION(BlueprintPure) float GetMaxFleshHealth() { return (float)_MAX_FLESH_HEALTH; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Health | Shield /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * @summary: Resets the shield health of the character to the maximum amount. * * @networking: Runs on server * * @return: void */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_ResetShield(); /* * */ UFUNCTION() void ResetShieldRecharge(); /* * */ UFUNCTION() void StartRechargingShields(); /* * Returns if _fShield <= 0 */ UFUNCTION(BlueprintPure) bool IsShieldDepleted() { return _fShield <= 0.0f; } /* * Returns the value of _fShield */ UFUNCTION(BlueprintPure) float GetCurrentShield() { return _fShield; } /* * Returns the value of _MAX_SHIELD */ UFUNCTION(BlueprintPure) float GetMaxShield() { return (float)_MAX_SHIELD; } /* * Returns the value of _fShieldRechargeDelay */ UFUNCTION(BlueprintPure) float GetShieldRechargeDelayTime() { return _fShieldRechargeDelay; } /* * Returns the value of _fShieldRechargeDelayHandle */ UFUNCTION(BlueprintPure) FTimerHandle GetShieldRechargeDelayTimerHandle() { return _fShieldRechargeDelayHandle;} /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Interaction /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION(Category = "Interaction") UInteractionDataComponent* CalculatePrimaryFocusInteractable(); /* * */ UFUNCTION(Category = "Interaction") void AddToInteractablesArray(UInteractionDataComponent* Interactable); /* * */ UFUNCTION(Category = "Interaction") bool RemoveFromInteractablesArray(UInteractionDataComponent* Interactable); /* * */ UFUNCTION(Category = "Interaction") void InputInteractPrimary(); /* * */ UFUNCTION(Category = "Interaction") void InputInteractSecondary(); /* */ UFUNCTION(Category = "Interaction") void CancelInteraction(); /* */ UFUNCTION(Category = "Interaction") void Interact(bool IsSecondary); /* */ UFUNCTION() void FocusInteractableToHUD(); /* */ UFUNCTION() void SetIsTryingToInteractPrimary(bool Interacting) { _bIsTryingToInteractPrimary = Interacting; } /* */ UFUNCTION() void SetIsTryingToInteractSecondary(bool Interacting) { _bIsTryingToInteractSecondary = Interacting; } /* * */ UFUNCTION(BlueprintPure, Category = "Interaction") TArray<UInteractionDataComponent*> GetInteractablesArray() { return _Interactables; } /* * */ UFUNCTION(BlueprintPure, Category = "Interaction") FTimerHandle GetInteractionHandle() const { return _fInteractionHandle; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Starting /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * @summary: Spawns the starting loadout weapons and assigns them to the character. * * @networking: Runs on server * * @return: void */ UFUNCTION(Server, Reliable, WithValidation, Category = "Inventory | Starting") void Server_Reliable_CreateStartingLoadout(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Weapon | Aiming /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * @summary: Sets the whether the character is aiming or not * * @networking: Runs on server * * @param: bool aiming * * @return: void */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_SetIsAiming(bool aiming); /* * */ UFUNCTION() virtual void InputAimEnter(); /* * */ UFUNCTION() virtual void InputAimExit(); /* * */ UFUNCTION() void StopAiming(); /** * @summary: Returns whether the character is aiming or not. * * @return: bool */ UFUNCTION(BlueprintPure) bool IsAiming() { return _bIsAiming; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Weapon | Duel Wielding /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION() void OnDuelWielding_PrimaryReloadComplete(); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_SetIsDuelWielding(bool bDuelWielding); /* * */ UFUNCTION() void SetIsDuelWielding(bool bDuelWielding); /* * */ UFUNCTION() virtual void OnRep_DuelWielding(); /* * */ UFUNCTION(BlueprintPure) bool IsDuelWielding() const { return _bIsDuelWielding; } /* * */ UFUNCTION(BlueprintPure) bool IsDuelWieldingMirrored() const { return _bDuelWieldingIsMirrored; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Weapon | Firing /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION() void FireWeaponTraceFullAuto(AWeapon* Weapon); /* * */ UFUNCTION() void FireWeaponTraceSemiAuto(AWeapon* Weapon); /* * */ UFUNCTION() void FireWeaponTraceBurst(AWeapon* Weapon); /* * */ UFUNCTION() void FireWeaponTraceSpread(AWeapon* Weapon); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Weapon | Toggle /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION() void InputToggleWeapon(); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_SetupToggleWeapon(); /* * Setup toggle environment (old primary/reserve pointer refs) && notify state change */ UFUNCTION() void SetupToggleWeapon(); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_ToggleWeapon(); /* * */ UFUNCTION() void ToggleWeapon(); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_ExitToggleWeapon(); /* * */ UFUNCTION() void ExitToggleWeapon(); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_DropInteractableWeapon(AWeapon* WeaponInstance); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_SpawnAbstractWeapon(bool IsSecondary, TSubclassOf<AWeapon> WeaponClass, int MagazineSize, int ReserveSize, int BatterySize); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Weapon | Primary /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION() virtual void OnRep_PrimaryWeapon(); /** * @summary: Sets the character's primary weapon * * @networking: Runs on server * * @param: AWeapon* Weapon * @param: bool FirstPickup * * @return: void */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_SetPrimaryWeapon(AWeapon* Weapon, bool PlayAnimation, bool FirstPickup, bool DestroyOld = true); /** * @summary: Sets the character's first person mesh based on their primary weapon * * @networking: Runs on owning client * * @param: AWeapon* Weapon * * @return: void */ UFUNCTION(Client, Unreliable, WithValidation) void OwningClient_UpdateFirstPersonPrimaryWeaponMesh(AWeapon* Weapon, bool PlayAnimation, bool FirstPickup); /** * @summary: Sets the character's third person mesh based on their primary weapon * * @networking: Runs on all clients * * @param: AWeapon* Weapon * * @return: void */ UFUNCTION(NetMulticast, Unreliable, WithValidation) void Multicast_UpdateThirdPersonPrimaryWeaponMesh(AWeapon* Weapon); /* * */ UFUNCTION(BlueprintCosmetic, Category = "Inventory | Weapon | Primary") void UpdateFirstPersonPrimaryScopeAttachment(AWeapon* Weapon); /* * */ UFUNCTION(Client, Reliable, WithValidation) void OwningClient_PlayPrimaryWeaponFPAnimation(USkeletalMeshComponent* ArmsMesh, float PlayRate, bool FreezeMontageAtLastFrame, bool PlayHandAnimation, uint8 HandAnimation, float HandAnimationStartingFrame, bool PlayGunAnimation, uint8 GunAnimation, float GunAnimationStartingFrame); /* * */ UFUNCTION() void PlayPrimaryWeaponFPAnimation(USkeletalMeshComponent* ArmsMesh, float PlayRate, bool FreezeMontageAtLastFrame, bool PlayHandAnimation, uint8 HandAnimation, float HandAnimationStartingFrame, bool PlayGunAnimation, uint8 GunAnimation, float GunAnimationStartingFrame); /* * */ UFUNCTION(BlueprintPure) AWeapon* GetPointerPrimaryWeapon() const { return _PrimaryWeapon; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Weapon | Primary | Firing /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ virtual void InitFirePrimaryWeapon(); /* * */ UFUNCTION() void InputPrimaryFirePress(); /* * */ UFUNCTION() void InputPrimaryFireRelease(); /* * */ UFUNCTION(Client, Reliable, WithValidation) void OwningClient_Reliable_PrimarySetCanFireWeapon(bool bCanFire); /* * */ UFUNCTION(Client, Reliable, WithValidation) void OwningClient_Reliable_PrimaryWeaponCameraTrace(); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_PrimaryWeaponCameraTrace(FHitResult ClientHitResult); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Weapon | Primary | Reload /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * @summary: Checks and initiates a reload of the character's primary weapon. * * @return: virtual void */ UFUNCTION() virtual void InputReloadPrimaryWeapon(); /* * */ UFUNCTION() void OnReloadComplete(); /* * */ UFUNCTION() void SetIsReloadingPrimaryWeapon(bool IsReloading); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_SetIsReloadingPrimaryWeapon(bool ReloadingPrimary); /* * */ UFUNCTION(BlueprintGetter) bool IsPrimaryReloadCanceled() const { return _bPrimaryReloadCancelled; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Weapon | Secondary /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION() virtual void OnRep_SecondaryWeapon(); /** * @summary: Sets the character's secondary weapon * * @networking: Runs on server * * @param: AWeapon* Weapon * * @return: void */ UFUNCTION(Server, Reliable, WithValidation, Category = "Inventory | Weapon | Secondary") void Server_Reliable_SetSecondaryWeapon(AWeapon* Weapon); /** * @summary: Sets the character's first person mesh based on their secondary weapon * * @networking: Runs on owning client * * @param: AWeapon* Weapon * * @return: void */ UFUNCTION(Client, Unreliable, WithValidation, Category = "Inventory | Weapon | Secondary") void OwningClient_UpdateFirstPersonSecondaryWeaponMesh(AWeapon* Weapon); /** * @summary: Sets the character's third person mesh based on their secondary weapon * * @networking: Runs on all clients * * @param: AWeapon* Weapon * * @return: void */ UFUNCTION(NetMulticast, Unreliable, WithValidation, Category = "Inventory | Weapon | Secondary") void Multicast_UpdateThirdPersonSecondaryWeaponMesh(AWeapon* Weapon); /* * */ UFUNCTION(Client, Reliable, WithValidation) void OwningClient_PlaySecondaryWeaponFPAnimation(USkeletalMeshComponent* ArmsMesh, float PlayRate, bool FreezeMontageAtLastFrame, bool PlayHandAnimation, uint8 HandAnimation, float HandAnimationStartingFrame, bool PlayGunAnimation, uint8 GunAnimation, float GunAnimationStartingFrame); /* * */ UFUNCTION() void PlaySecondaryWeaponFPAnimation(USkeletalMeshComponent* ArmsMesh, float PlayRate, bool FreezeMontageAtLastFrame, bool PlayHandAnimation, uint8 HandAnimation, float HandAnimationStartingFrame, bool PlayGunAnimation, uint8 GunAnimation, float GunAnimationStartingFrame); /* * */ UFUNCTION(BlueprintPure) AWeapon* GetPointerSecondaryWeapon() const { return _SecondaryWeapon; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Weapon | Secondary | Firing /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION() void InitFireSecondaryWeapon(); /* * */ UFUNCTION() void InputSecondaryFirePress(); /* * */ UFUNCTION() void InputSecondaryFireRelease(); /* * */ UFUNCTION(Client, Reliable, WithValidation, Category = "Inventory | Weapon | Primary") void OwningClient_Reliable_SecondaryWeaponCameraTrace(); UFUNCTION(Server, Reliable, WithValidation, Category = "Inventory | Weapon | Primary") void Server_Reliable_SecondaryWeaponCameraTrace(FHitResult ClientHitResult); /* * */ UFUNCTION(Client, Reliable, WithValidation) void OwningClient_Reliable_SecondarySetCanFireWeapon(bool bCanFire); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Weapon | Secondary | Reload /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * @summary: Checks and initiates a reload of the character's secondary weapon. * * @return: virtual void */ UFUNCTION() virtual void InputReloadSecondaryWeapon(); /* * */ UFUNCTION() void OnDuelWielding_SecondaryReloadComplete(); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_SetIsReloadingSecondaryWeapon(bool ReloadingSecondary); /* * */ UFUNCTION() void SetIsReloadingSecondaryWeapon(bool IsReloading); /* * */ UFUNCTION(BlueprintGetter) bool IsSecondaryReloadCanceled() const { return _bSecondaryReloadCancelled; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Weapon | Reserve /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * @summary: Sets the character's reserve weapon * * @networking: Runs on server * * @param: AWeapon* Weapon * * @return: void */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_SetReserveWeapon(AWeapon* Weapon); /* * */ UFUNCTION() virtual void OnRep_ReserveWeapon(); /* * */ UFUNCTION(BlueprintPure) AWeapon* GetPointerReserveWeapon() const { return _ReserveWeapon; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Inventory | Grenade /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION(BlueprintPure) int GetFragmentationGrenadeCount() const { return _iFragmentationGrenadeCount; } /* * */ UFUNCTION(BlueprintPure) int GetEMPGrenadeCount() const { return _iEMPGrenadeCount; } /* * */ UFUNCTION(BlueprintPure) int GetIncendiaryGrenadeCount() const { return _iIncendiaryGrenadeCount; } /* * */ UFUNCTION(BlueprintPure) E_GrenadeType GetCurrentGrenadeType() const { return _eCurrentGrenadeType; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | Base /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION() virtual void MoveForward(float Value); /* * */ UFUNCTION() virtual void MoveRight(float Value); UFUNCTION(Server, Unreliable, WithValidation) void Server_SetMovementMode(EMovementMode MovementMode); UFUNCTION(NetMulticast, Unreliable, WithValidation) void Multicast_SetMovementMode(EMovementMode MovementMode); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | Properties | Gravity /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_SetGravityScale(float Scale); /* * */ UFUNCTION(NetMulticast, Reliable, WithValidation) void Multicast_Reliable_SetGravityScale(float Scale); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | Properties | Speed /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION(Server, Reliable, WithValidation, BlueprintCallable, Category = "Movement | Properties | Speed") void SetMovingSpeed(float Speed); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_SetMovingSpeed(float Speed); /* * */ UFUNCTION(NetMulticast, Reliable, WithValidation) void Multicast_Reliable_SetMovingSpeed(float Speed); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | Properties | Stamina /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * @summary: Returns reference to the list of stamina components attached to this character * * @return: TArray<UStamina*> */ UFUNCTION(BlueprintPure, Category = "Inventory") TArray<UStamina*> GetStaminaComponents() { return _uStaminaComponents; } /** * @summary: Returns reference to the of stamina component attached to this character, specified by the channel. * * @param: int Channel * * @return: TArray<UStamina*> */ UFUNCTION(BlueprintPure, Category = "Inventory") UStamina* GetStaminaComponentByChannel(int Channel); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | States | Crouch /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION() virtual void InputCrouchToggle(bool Crouch); /* * */ UFUNCTION() void InputCrouchEnter(); /* * */ UFUNCTION() void InputCrouchExit(); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_SetIsCrouching(bool IsCrouching); /** * @summary: Returns whether the character is crouching or not. * * @return: bool */ UFUNCTION(BlueprintPure, Category = "Movement | Crouch") bool IsCrouching() { return _bIsCrouching; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | States | Jump /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION() virtual void InputJump(); /** * @summary: Sets the whether the character is jumping or not. * * @networking: Runs on server * * @param: bool Jumping * * @return: void */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_SetJumping(bool Jumping); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | States | Slide /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION() virtual void InputSlideEnter(); /* * */ UFUNCTION() virtual void InputSlideExit(); /* * */ UFUNCTION() virtual void InputSlideToggle(bool Sliding); /* * */ UFUNCTION() virtual void Slide(bool WasDashing = false); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_SetIsSliding(bool Sliding); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_InitiateSlide(bool WasDashing); /* * */ UFUNCTION(NetMulticast, Reliable, WithValidation) void Multicast_Reliable_InitiateSlide(bool WasDashing); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_StopSlide(); /* * */ UFUNCTION(NetMulticast, Reliable, WithValidation) void Multicast_Reliable_StopSlide(); /* * */ UFUNCTION(BlueprintPure, Category = "Movement | Slide") bool IsSliding() const { return _bIsSliding; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | States | Sprint /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * @summary: Sets the whether the character is using sprinting or not. * * @networking: Runs on server * * @param: bool Sprinting * * @return: void */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_SetSprinting(bool Sprinting); /** * @summary: Returns whether the character is sprinting or not. * * @return: bool */ UFUNCTION(BlueprintPure, Category = "Movement | Sprint") bool IsSprinting() { return _bIsSprinting; } /** * @summary: Returns the look input scalar when the character is sprinting. * * @return: float */ UFUNCTION() float GetSprintLookInputScale() { return _fSprintLookInputScale; } /* * */ UFUNCTION() void InputSprintEnter(); /* * */ UFUNCTION() void InputSprintExit(); /* * */ UFUNCTION() void InputSprintToggle(bool Sprint); /* * */ UFUNCTION() void StopSprinting(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Movement | States | Vault /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* * */ UFUNCTION() void InputVault(); /* * */ UFUNCTION() FHitResult LedgeForwardTrace(); /* * */ UFUNCTION() FHitResult LedgeHeightTrace(); /* * */ UFUNCTION() bool GetHipToLedge(); /* * */ UFUNCTION() FVector GetMoveToLocation(float HeightOffset, float ForwardOffset); /* * */ UFUNCTION() void GrabLedge(FVector MoveLocation); UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_GrabLedge(FVector MoveLocation); UFUNCTION(NetMulticast, Reliable, WithValidation) void Multicast_Reliable_GrabLedge(FVector MoveLocation); /* * */ UFUNCTION() void ClimbLedge(); /* * */ UFUNCTION(Server, Reliable, WithValidation) void Server_Reliable_SetIsVaulting(bool Vaulting); /* * */ UFUNCTION() bool IsTryingToVault() { return _bIsTryingToVault; } /* * Doing ++ after the variable means add one to it but returns the value before the addition, * where as if we did it before it would return the value after the addition. */ UFUNCTION() int32 GetNextUUID() { return _NextUUID++; } // TEMPORARILY PLACED HERE FOR EASE OF USE -> TO BE MOVED INTO A SEPARATE CLASS LATER const FString EnumToString(const TCHAR* Enum, int32 EnumValue) { const UEnum* EnumPtr = FindObject<UEnum>(ANY_PACKAGE, Enum, true); if (!EnumPtr) return NSLOCTEXT("Invalid", "Invalid", "Invalid").ToString(); #if WITH_EDITOR return EnumPtr->GetDisplayNameTextByIndex(EnumValue).ToString(); #else return EnumPtr->GetEnumName(EnumValue); #endif } #pragma endregion Public Functions #pragma region Protected Functions /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Current Frame /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * @summary: Called every frame. * * @param: float DeltaTime * * @return: virtual void */ virtual void Tick(float DeltaTime) override; /* * */ virtual void OnGroundChecks(float DeltaTime); // Combat void TickAiming(float DeltaTime); void TickFiringPrimary(float DeltaTime); void TickFiringSecondary(float DeltaTime); void TickReloadingPrimary(float DeltaTime); void TickReloadingSecondary(float DeltaTime); // Movement void TickSprint(float DeltaTime); void TickCrouch(float DeltaTime); // Health void TickShields(float DeltaTime); // Properties void TickInteraction(float DeltaTime); #pragma endregion Protected Functions };
[ "dmarton94@gmail.com" ]
dmarton94@gmail.com
ecc8538a31907d5ab0d0dde461e15c53e49d4e2a
2483bfb32a5a2c0e94dd975a3acf14cfb0432d96
/game/Battlegrounds/ArenaTeam.cpp
c311a8ad5c2a3fd90d9c59228c96812ec304cdac
[]
no_license
gragonvlad/MStorm-Master
c78680b314433b07aeec588f7113fff4766a50a4
5e3ef21f16b34cd6c795456811c91e4eb85a4bc0
refs/heads/master
2021-01-01T20:31:23.256784
2017-06-18T00:03:21
2017-06-18T00:03:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
33,977
cpp
/* * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2009 MaNGOS <http://getmangos.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, see <http://www.gnu.org/licenses/>. */ #include "ObjectMgr.h" #include "Player.h" #include "WorldPacket.h" #include "ArenaTeam.h" #include "World.h" #include "Group.h" #include "ArenaTeamMgr.h" #include "WorldSession.h" #include "Opcodes.h" ArenaTeam::ArenaTeam() : TeamId(0), Type(0), TeamName(), CaptainGuid(), BackgroundColor(0), EmblemStyle(0), EmblemColor(0), BorderStyle(0), BorderColor(0) { Stats.WeekGames = 0; Stats.SeasonGames = 0; Stats.Rank = 0; Stats.Rating = sWorld->getIntConfig(CONFIG_ARENA_START_RATING); Stats.WeekWins = 0; Stats.SeasonWins = 0; } ArenaTeam::~ArenaTeam() { } bool ArenaTeam::Create(ObjectGuid captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor) { // Check if captain is present if (!ObjectAccessor::FindPlayer(captainGuid)) return false; // Check if arena team name is already taken if (sArenaTeamMgr->GetArenaTeamByName(teamName)) return false; // Generate new arena team id TeamId = sArenaTeamMgr->GenerateArenaTeamId(); // Assign member variables CaptainGuid = captainGuid; Type = type; TeamName = teamName; BackgroundColor = backgroundColor; EmblemStyle = emblemStyle; EmblemColor = emblemColor; BorderStyle = borderStyle; BorderColor = borderColor; uint32 captainLowGuid = captainGuid.GetCounter(); // Save arena team to db PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM); stmt->setUInt32(0, TeamId); stmt->setString(1, TeamName); stmt->setUInt32(2, captainLowGuid); stmt->setUInt8(3, Type); stmt->setUInt16(4, Stats.Rating); stmt->setUInt32(5, BackgroundColor); stmt->setUInt8(6, EmblemStyle); stmt->setUInt32(7, EmblemColor); stmt->setUInt8(8, BorderStyle); stmt->setUInt32(9, BorderColor); CharacterDatabase.Execute(stmt); // Add captain as member AddMember(CaptainGuid); TC_LOG_DEBUG("bg.arena", "New ArenaTeam created [Id: %u, Name: %s] [Type: %u] [Captain low GUID: %u]", GetId(), GetName().c_str(), GetType(), captainLowGuid); return true; } bool ArenaTeam::AddMember(ObjectGuid playerGuid) { std::string playerName; uint8 playerClass; // Check if arena team is full (Can't have more than type * 2 players) if (GetMembersSize() >= GetType() * 2) return false; // Get player name and class either from db or ObjectMgr Player* player = ObjectAccessor::FindPlayer(playerGuid); if (player) { playerClass = player->getClass(); playerName = player->GetName(); } else { // 0 1 // SELECT name, class FROM characters WHERE guid = ? PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_CLASS); stmt->setUInt32(0, playerGuid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) return false; playerName = (*result)[0].GetString(); playerClass = (*result)[1].GetUInt8(); } // Check if player is already in a similar arena team if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromDB(playerGuid, GetType()) != 0) { TC_LOG_DEBUG("bg.arena", "Arena: %s %s already has an arena team of type %u", playerGuid.ToString().c_str(), playerName.c_str(), GetType()); return false; } // Set player's personal rating uint32 personalRating = 0; if (sWorld->getIntConfig(CONFIG_ARENA_START_PERSONAL_RATING) > 0) personalRating = sWorld->getIntConfig(CONFIG_ARENA_START_PERSONAL_RATING); else if (GetRating() >= 1000) personalRating = 1000; // Try to get player's match maker rating from db and fall back to config setting if not found PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MATCH_MAKER_RATING); stmt->setUInt32(0, playerGuid.GetCounter()); stmt->setUInt8(1, GetSlot()); PreparedQueryResult result = CharacterDatabase.Query(stmt); uint32 matchMakerRating; if (result) matchMakerRating = (*result)[0].GetUInt16(); else matchMakerRating = sWorld->getIntConfig(CONFIG_ARENA_START_MATCHMAKER_RATING); // Remove all player signatures from other petitions // This will prevent player from joining too many arena teams and corrupt arena team data integrity Player::RemovePetitionsAndSigns(playerGuid, GetType()); // Feed data to the struct ArenaTeamMember newMember; newMember.Name = playerName; newMember.Guid = playerGuid; newMember.Class = playerClass; newMember.SeasonGames = 0; newMember.WeekGames = 0; newMember.SeasonWins = 0; newMember.WeekWins = 0; newMember.PersonalRating = personalRating; newMember.MatchMakerRating = matchMakerRating; Members.push_back(newMember); // Save player's arena team membership to db stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM_MEMBER); stmt->setUInt32(0, TeamId); stmt->setUInt32(1, playerGuid.GetCounter()); CharacterDatabase.Execute(stmt); // Inform player if online if (player) { player->SetInArenaTeam(TeamId, GetSlot(), GetType()); player->SetArenaTeamIdInvited(0); // Hide promote/remove buttons if (CaptainGuid != playerGuid) player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1); } TC_LOG_DEBUG("bg.arena", "Player: %s [%s] joined arena team type: %u [Id: %u, Name: %s].", playerName.c_str(), playerGuid.ToString().c_str(), GetType(), GetId(), GetName().c_str()); return true; } bool ArenaTeam::LoadArenaTeamFromDB(QueryResult result) { if (!result) return false; Field* fields = result->Fetch(); TeamId = fields[0].GetUInt32(); TeamName = fields[1].GetString(); CaptainGuid = ObjectGuid(HIGHGUID_PLAYER, fields[2].GetUInt32()); Type = fields[3].GetUInt8(); BackgroundColor = fields[4].GetUInt32(); EmblemStyle = fields[5].GetUInt8(); EmblemColor = fields[6].GetUInt32(); BorderStyle = fields[7].GetUInt8(); BorderColor = fields[8].GetUInt32(); Stats.Rating = fields[9].GetUInt16(); Stats.WeekGames = fields[10].GetUInt16(); Stats.WeekWins = fields[11].GetUInt16(); Stats.SeasonGames = fields[12].GetUInt16(); Stats.SeasonWins = fields[13].GetUInt16(); Stats.Rank = fields[14].GetUInt32(); return true; } bool ArenaTeam::LoadMembersFromDB(QueryResult result) { if (!result) return false; bool captainPresentInTeam = false; do { Field* fields = result->Fetch(); // Prevent crash if db records are broken when all members in result are already processed and current team doesn't have any members if (!fields) break; uint32 arenaTeamId = fields[0].GetUInt32(); // We loaded all members for this arena_team already, break cycle if (arenaTeamId > TeamId) break; ArenaTeamMember newMember; newMember.Guid = ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32()); newMember.WeekGames = fields[2].GetUInt16(); newMember.WeekWins = fields[3].GetUInt16(); newMember.SeasonGames = fields[4].GetUInt16(); newMember.SeasonWins = fields[5].GetUInt16(); newMember.Name = fields[6].GetString(); newMember.Class = fields[7].GetUInt8(); newMember.PersonalRating = fields[8].GetUInt16(); newMember.MatchMakerRating = fields[9].GetUInt16() > 0 ? fields[9].GetUInt16() : sWorld->getIntConfig(CONFIG_ARENA_START_MATCHMAKER_RATING); // Delete member if character information is missing if (newMember.Name.empty()) { TC_LOG_ERROR("sql.sql", "ArenaTeam %u has member with empty name - probably %s doesn't exist, deleting him from memberlist!", arenaTeamId, newMember.Guid.ToString().c_str()); DelMember(newMember.Guid, true); continue; } // Check if team team has a valid captain if (newMember.Guid == GetCaptain()) captainPresentInTeam = true; // Put the player in the team Members.push_back(newMember); } while (result->NextRow()); if (Empty() || !captainPresentInTeam) { // Arena team is empty or captain is not in team, delete from db TC_LOG_DEBUG("bg.arena", "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId); return false; } return true; } bool ArenaTeam::SetName(std::string const& name) { if (TeamName == name || name.empty() || name.length() > 24 || sObjectMgr->IsReservedName(name) || !ObjectMgr::IsValidCharterName(name)) return false; TeamName = name; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_NAME); stmt->setString(0, TeamName); stmt->setUInt32(1, GetId()); CharacterDatabase.Execute(stmt); return true; } void ArenaTeam::SetCaptain(ObjectGuid guid) { // Disable remove/promote buttons Player* oldCaptain = ObjectAccessor::FindPlayer(GetCaptain()); if (oldCaptain) oldCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1); // Set new captain CaptainGuid = guid; // Update database PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_CAPTAIN); stmt->setUInt32(0, guid.GetCounter()); stmt->setUInt32(1, GetId()); CharacterDatabase.Execute(stmt); // Enable remove/promote buttons if (Player* newCaptain = ObjectAccessor::FindPlayer(guid)) { newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0); if (oldCaptain) { TC_LOG_DEBUG("bg.arena", "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u, Name: %s] [Type: %u].", oldCaptain->GetName().c_str(), oldCaptain->GetGUIDLow(), newCaptain->GetName().c_str(), newCaptain->GetGUIDLow(), GetId(), GetName().c_str(), GetType()); } } } void ArenaTeam::DelMember(ObjectGuid guid, bool cleanDb) { // Remove member from team for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) if (itr->Guid == guid) { Members.erase(itr); break; } // Inform player and remove arena team info from player data if (Player* player = ObjectAccessor::FindPlayer(guid)) { player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0); // delete all info regarding this team for (uint32 i = 0; i < ARENA_TEAM_END; ++i) player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0); TC_LOG_DEBUG("bg.arena", "Player: %s [GUID: %u] left arena team type: %u [Id: %u, Name: %s].", player->GetName().c_str(), player->GetGUIDLow(), GetType(), GetId(), GetName().c_str()); } // Only used for single member deletion, for arena team disband we use a single query for more efficiency if (cleanDb) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM_MEMBER); stmt->setUInt32(0, GetId()); stmt->setUInt32(1, guid.GetCounter()); CharacterDatabase.Execute(stmt); } } void ArenaTeam::Disband(WorldSession* session) { // Remove all members from arena team while (!Members.empty()) DelMember(Members.front().Guid, false); // Broadcast update if (session) { BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, ObjectGuid::Empty, 2, session->GetPlayerName(), GetName(), ""); if (Player* player = session->GetPlayer()) TC_LOG_DEBUG("bg.arena", "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u, Name: %s].", player->GetName().c_str(), player->GetGUIDLow(), GetType(), GetId(), GetName().c_str()); } // Update database SQLTransaction trans = CharacterDatabase.BeginTransaction(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM); stmt->setUInt32(0, TeamId); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM_MEMBERS); stmt->setUInt32(0, TeamId); trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); // Remove arena team from ObjectMgr sArenaTeamMgr->RemoveArenaTeam(TeamId); } void ArenaTeam::Disband() { // Remove all members from arena team while (!Members.empty()) DelMember(Members.front().Guid, false); // Update database SQLTransaction trans = CharacterDatabase.BeginTransaction(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM); stmt->setUInt32(0, TeamId); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM_MEMBERS); stmt->setUInt32(0, TeamId); trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); // Remove arena team from ObjectMgr sArenaTeamMgr->RemoveArenaTeam(TeamId); } void ArenaTeam::Roster(WorldSession* session) { Player* player = NULL; uint8 unk308 = 0; WorldPacket data(SMSG_ARENA_TEAM_ROSTER, 100); data << uint32(GetId()); // team id data << uint8(unk308); // 3.0.8 unknown value but affect packet structure data << uint32(GetMembersSize()); // members count data << uint32(GetType()); // arena team type? for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) { player = ObjectAccessor::FindConnectedPlayer(itr->Guid); data << uint64(itr->Guid); // guid data << uint8((player ? 1 : 0)); // online flag data << itr->Name; // member name data << uint32((itr->Guid == GetCaptain() ? 0 : 1)); // captain flag 0 captain 1 member data << uint8((player ? player->getLevel() : 0)); // unknown, level? data << uint8(itr->Class); // class data << uint32(itr->WeekGames); // played this week data << uint32(itr->WeekWins); // wins this week data << uint32(itr->SeasonGames); // played this season data << uint32(itr->SeasonWins); // wins this season data << uint32(itr->PersonalRating); // personal rating //if (unk308) //{ // data << float(0.0f); // 308 unk // data << float(0.0f); // 308 unk //} } session->SendPacket(&data); TC_LOG_DEBUG("network", "WORLD: Sent SMSG_ARENA_TEAM_ROSTER"); } void ArenaTeam::Query(WorldSession* session) { WorldPacket data(SMSG_ARENA_TEAM_QUERY_RESPONSE, 4*7+GetName().size()+1); data << uint32(GetId()); // team id data << GetName(); // team name data << uint32(GetType() == 1 ? 5 : GetType()); // arena team type (2=2x2, 3=3x3 or 5=5x5) data << uint32(BackgroundColor); // background color data << uint32(EmblemStyle); // emblem style data << uint32(EmblemColor); // emblem color data << uint32(BorderStyle); // border style data << uint32(BorderColor); // border color session->SendPacket(&data); TC_LOG_DEBUG("network", "WORLD: Sent SMSG_ARENA_TEAM_QUERY_RESPONSE"); } void ArenaTeam::SendStats(WorldSession* session) { WorldPacket data(SMSG_ARENA_TEAM_STATS, 4*7); data << uint32(GetId()); // team id data << uint32(Stats.Rating); // rating data << uint32(Stats.WeekGames); // games this week data << uint32(Stats.WeekWins); // wins this week data << uint32(Stats.SeasonGames); // played this season data << uint32(Stats.SeasonWins); // wins this season data << uint32(Stats.Rank); // rank session->SendPacket(&data); } void ArenaTeam::NotifyStatsChanged() { // This is called after a rated match ended // Updates arena team stats for every member of the team (not only the ones who participated!) for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) if (Player* player = ObjectAccessor::FindConnectedPlayer(itr->Guid)) SendStats(player->GetSession()); } void ArenaTeam::Inspect(WorldSession* session, ObjectGuid guid) { ArenaTeamMember* member = GetMember(guid); if (!member) return; WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8+1+4*6); data << uint64(guid); // player guid data << uint8(GetSlot()); // slot (0...2) data << uint32(GetId()); // arena team id data << uint32(Stats.Rating); // rating data << uint32(Stats.SeasonGames); // season played data << uint32(Stats.SeasonWins); // season wins data << uint32(member->SeasonGames); // played (count of all games, that the inspected member participated...) data << uint32(member->PersonalRating); // personal rating session->SendPacket(&data); } void ArenaTeamMember::ModifyPersonalRating(Player* player, int32 mod, uint32 type) { if (int32(PersonalRating) + mod < 0) PersonalRating = 0; else PersonalRating += mod; if (player) { player->SetArenaTeamInfoField(ArenaTeam::GetSlotByType(type), ARENA_TEAM_PERSONAL_RATING, PersonalRating); player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_PERSONAL_RATING, PersonalRating, type); } } void ArenaTeamMember::ModifyMatchmakerRating(int32 mod, uint32 /*slot*/) { if (int32(MatchMakerRating) + mod < 0) MatchMakerRating = 0; else MatchMakerRating += mod; } void ArenaTeam::BroadcastPacket(WorldPacket* packet) { for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) if (Player* player = ObjectAccessor::FindConnectedPlayer(itr->Guid)) player->GetSession()->SendPacket(packet); } void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3) { WorldPacket data(SMSG_ARENA_TEAM_EVENT, 1+1+1); data << uint8(event); data << uint8(strCount); switch (strCount) { case 0: break; case 1: data << str1; break; case 2: data << str1 << str2; break; case 3: data << str1 << str2 << str3; break; default: TC_LOG_ERROR("bg.arena", "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount); return; } if (guid) data << uint64(guid); BroadcastPacket(&data); TC_LOG_DEBUG("network", "WORLD: Sent SMSG_ARENA_TEAM_EVENT"); } void ArenaTeam::MassInviteToEvent(WorldSession* session) { WorldPacket data(SMSG_CALENDAR_ARENA_TEAM, (Members.size() - 1) * (4 + 8 + 1)); data << uint32(Members.size() - 1); for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) { if (itr->Guid != session->GetPlayer()->GetGUID()) { data << itr->Guid.WriteAsPacked(); data << uint8(0); // unk } } session->SendPacket(&data); } uint8 ArenaTeam::GetSlotByType(uint32 type) { switch (type) { case ARENA_TEAM_2v2: return 0; case ARENA_TEAM_3v3: return 1; case ARENA_TEAM_5v5: return 2; default: break; } TC_LOG_ERROR("bg.arena", "FATAL: Unknown arena team type %u for some arena team", type); return 0xFF; } bool ArenaTeam::IsMember(ObjectGuid guid) const { for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) if (itr->Guid == guid) return true; return false; } uint32 ArenaTeam::GetPoints(uint32 memberRating) { // Returns how many points would be awarded with this team type with this rating float points; uint32 rating = memberRating + 150 < Stats.Rating ? memberRating : Stats.Rating; if (rating <= 1500) { if (sWorld->getIntConfig(CONFIG_ARENA_SEASON_ID) < 6) points = (float)rating * 0.22f + 14.0f; else points = 344; } else points = 1511.26f / (1.0f + 1639.28f * std::exp(-0.00412f * float(rating))); // Type penalties for teams < 5v5 if (Type == ARENA_TEAM_2v2) points *= 0.76f; else if (Type == ARENA_TEAM_3v3) points *= 0.88f; //else if (Type == ARENA_TEAM_5v5) // 1v1 Arena // points *= sWorld->getFloatConfig(CONFIG_ARENA_1V1_ARENAPOINTS_MULTI); return (uint32) points; } uint32 ArenaTeam::GetAverageMMR(Group* group) const { if (!group) return 0; uint32 matchMakerRating = 0; uint32 playerDivider = 0; for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) { // Skip if player is not online if (!ObjectAccessor::FindConnectedPlayer(itr->Guid)) continue; // Skip if player is not member of group if (!group->IsMember(itr->Guid)) continue; matchMakerRating += itr->MatchMakerRating; ++playerDivider; } // x/0 = crash if (playerDivider == 0) playerDivider = 1; matchMakerRating /= playerDivider; return matchMakerRating; } float ArenaTeam::GetChanceAgainst(uint32 ownRating, uint32 opponentRating) { // Returns the chance to win against a team with the given rating, used in the rating adjustment calculation // ELO system return 1.0f / (1.0f + std::exp(std::log(10.0f) * (float(opponentRating) - float(ownRating)) / 650.0f)); } int32 ArenaTeam::GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won /*, float& confidence_factor*/) { // 'Chance' calculation - to beat the opponent // This is a simulation. Not much info on how it really works float chance = GetChanceAgainst(ownRating, opponentRating); float won_mod = (won) ? 1.0f : 0.0f; float mod = won_mod - chance; // Work in progress: /* // This is a simulation, as there is not much info on how it really works float confidence_mod = min(1.0f - fabs(mod), 0.5f); // Apply confidence factor to the mod: mod *= confidence_factor // And only after that update the new confidence factor confidence_factor -= ((confidence_factor - 1.0f) * confidence_mod) / confidence_factor; */ // Real rating modification mod *= 24.0f; return (int32)ceil(mod); } int32 ArenaTeam::GetRatingMod(uint32 ownRating, uint32 opponentRating, bool won /*, float confidence_factor*/) { // 'Chance' calculation - to beat the opponent // This is a simulation. Not much info on how it really works float chance = GetChanceAgainst(ownRating, opponentRating); float won_mod = (won) ? 1.0f : 0.0f; // Calculate the rating modification float mod; /// @todo Replace this hack with using the confidence factor (limiting the factor to 2.0f) if (won && ownRating < 1300) { if (ownRating < 1000) mod = 48.0f * (won_mod - chance); else mod = (24.0f + (24.0f * (1300.0f - float(ownRating)) / 300.0f)) * (won_mod - chance); } else mod = 24.0f * (won_mod - chance); return (int32)ceil(mod); } void ArenaTeam::FinishGame(int32 mod) { // Rating can only drop to 0 if (int32(Stats.Rating) + mod < 0) Stats.Rating = 0; else { Stats.Rating += mod; // Check if rating related achivements are met for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) if (Player* member = ObjectAccessor::FindConnectedPlayer(itr->Guid)) member->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_TEAM_RATING, Stats.Rating, Type); } // Update number of games played per season or week Stats.WeekGames += 1; Stats.SeasonGames += 1; // Update team's rank, start with rank 1 and increase until no team with more rating was found Stats.Rank = 1; ArenaTeamMgr::ArenaTeamContainer::const_iterator i = sArenaTeamMgr->GetArenaTeamMapBegin(); for (; i != sArenaTeamMgr->GetArenaTeamMapEnd(); ++i) { if (i->second->GetType() == Type && i->second->GetStats().Rating > Stats.Rating) ++Stats.Rank; } } int32 ArenaTeam::WonAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change) { // Called when the team has won // Change in Matchmaker rating int32 mod = GetMatchmakerRatingMod(Own_MMRating, Opponent_MMRating, true); // Change in Team Rating rating_change = GetRatingMod(Stats.Rating, Opponent_MMRating, true); // Modify the team stats accordingly FinishGame(rating_change); // Update number of wins per season and week Stats.WeekWins += 1; Stats.SeasonWins += 1; // Return the rating change, used to display it on the results screen return mod; } int32 ArenaTeam::LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32& rating_change) { // Called when the team has lost // Change in Matchmaker Rating int32 mod = GetMatchmakerRatingMod(Own_MMRating, Opponent_MMRating, false); // Change in Team Rating rating_change = GetRatingMod(Stats.Rating, Opponent_MMRating, false); // Modify the team stats accordingly FinishGame(rating_change); // return the rating change, used to display it on the results screen return mod; } void ArenaTeam::MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange) { // Called for each participant of a match after losing for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) { if (itr->Guid == player->GetGUID()) { // Update personal rating int32 mod = GetRatingMod(itr->PersonalRating, againstMatchmakerRating, false); itr->ModifyPersonalRating(player, mod, GetType()); // Update matchmaker rating itr->ModifyMatchmakerRating(MatchmakerRatingChange, GetSlot()); // Update personal played stats itr->WeekGames +=1; itr->SeasonGames +=1; // update the unit fields player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->WeekGames); player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->SeasonGames); return; } } } void ArenaTeam::OfflineMemberLost(ObjectGuid guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange) { // Called for offline player after ending rated arena match! for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) { if (itr->Guid == guid) { // update personal rating int32 mod = GetRatingMod(itr->PersonalRating, againstMatchmakerRating, false); itr->ModifyPersonalRating(NULL, mod, GetType()); // update matchmaker rating itr->ModifyMatchmakerRating(MatchmakerRatingChange, GetSlot()); // update personal played stats itr->WeekGames += 1; itr->SeasonGames += 1; return; } } } void ArenaTeam::MemberWon(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange) { // called for each participant after winning a match for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) { if (itr->Guid == player->GetGUID()) { // update personal rating int32 mod = GetRatingMod(itr->PersonalRating, againstMatchmakerRating, true); itr->ModifyPersonalRating(player, mod, GetType()); // update matchmaker rating itr->ModifyMatchmakerRating(MatchmakerRatingChange, GetSlot()); // update personal stats itr->WeekGames +=1; itr->SeasonGames +=1; itr->SeasonWins += 1; itr->WeekWins += 1; // update unit fields player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->WeekGames); player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->SeasonGames); return; } } } void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& playerPoints) { // Called after a match has ended and the stats are already modified // Helper function for arena point distribution (this way, when distributing, no actual calculation is required, just a few comparisons) // 10 played games per week is a minimum if (Stats.WeekGames < 10) return; // To get points, a player has to participate in at least 30% of the matches uint32 requiredGames = (uint32)ceil(Stats.WeekGames * 0.3f); for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) { // The player participated in enough games, update his points uint32 pointsToAdd = 0; if (itr->WeekGames >= requiredGames) pointsToAdd = GetPoints(itr->PersonalRating); std::map<uint32, uint32>::iterator plr_itr = playerPoints.find(itr->Guid.GetCounter()); if (plr_itr != playerPoints.end()) { // Check if there is already more points if (plr_itr->second < pointsToAdd) playerPoints[itr->Guid.GetCounter()] = pointsToAdd; } else playerPoints[itr->Guid.GetCounter()] = pointsToAdd; } } void ArenaTeam::SaveToDB() { // Save team and member stats to db // Called after a match has ended or when calculating arena_points SQLTransaction trans = CharacterDatabase.BeginTransaction(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_STATS); stmt->setUInt16(0, Stats.Rating); stmt->setUInt16(1, Stats.WeekGames); stmt->setUInt16(2, Stats.WeekWins); stmt->setUInt16(3, Stats.SeasonGames); stmt->setUInt16(4, Stats.SeasonWins); stmt->setUInt32(5, Stats.Rank); stmt->setUInt32(6, GetId()); trans->Append(stmt); for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_MEMBER); stmt->setUInt16(0, itr->PersonalRating); stmt->setUInt16(1, itr->WeekGames); stmt->setUInt16(2, itr->WeekWins); stmt->setUInt16(3, itr->SeasonGames); stmt->setUInt16(4, itr->SeasonWins); stmt->setUInt32(5, GetId()); stmt->setUInt32(6, itr->Guid.GetCounter()); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CHARACTER_ARENA_STATS); stmt->setUInt32(0, itr->Guid.GetCounter()); stmt->setUInt8(1, GetSlot()); stmt->setUInt16(2, itr->MatchMakerRating); trans->Append(stmt); } CharacterDatabase.CommitTransaction(trans); } void ArenaTeam::FinishWeek() { // Reset team stats Stats.WeekGames = 0; Stats.WeekWins = 0; // Reset member stats for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) { itr->WeekGames = 0; itr->WeekWins = 0; } } bool ArenaTeam::IsFighting() const { for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(itr->Guid)) if (player->GetMap()->IsBattleArena()) return true; return false; } ArenaTeamMember* ArenaTeam::GetMember(const std::string& name) { for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) if (itr->Name == name) return &(*itr); return NULL; } ArenaTeamMember* ArenaTeam::GetMember(ObjectGuid guid) { for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) if (itr->Guid == guid) return &(*itr); return NULL; }
[ "darkmasters@yandex.ru" ]
darkmasters@yandex.ru
4c8360684214ba98ab50cb2e4eb059b693f42ebf
afb4cf30e328c78efc7adad573a4e4a1870754b6
/College/Matthew C++ Classes/Matthew Project/Cs 2/Lab 4/Main.cpp
5bd1fb5e2e86ac258c14fd257fde9367e95409de
[ "Apache-2.0" ]
permissive
mmcclain117/School-Code
5c404aaa9b95df136ba382dff79cb7d44e56b4bc
aa9c501d42fc51fa9a66f53c65b875408a40ea0c
refs/heads/main
2023-01-21T00:27:18.669866
2020-11-29T21:32:52
2020-11-29T21:32:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,583
cpp
#include <stdlib.h> #include "Token.h" WCS_String Temp; Token Toke; void PrintResult() { for (int i = 0; i < Toke.numchars; i++) { cout << Toke.chars[i]; } cout << endl; } void main (int argc, char * argv []) { if (argc < 2) { cout << "You need to place the file name on the command line" << endl; exit (0); } else Temp = argv [1]; // the following three lines are just to show what was entered on the command line cout << "Argv [0] is " << argv [0] << endl; cout << "Argv [1] is " << argv [1] << endl; //return; Token::OpenFile (Temp); do { Toke.Build (); switch (Toke.GetType ()) { case Token::UnknownToken: cout << "I don't have any idea what you are saying" << endl; break; case Token::DelimiterSpaceToken: break; case Token::KeywordEvalToken: cout << "Found Keyword EVAL" << endl; break; case Token::KeywordValueToken: cout << "Found Keyword VALUE" << endl; break; case Token::KeywordExpToken: cout << "Found Keyword EXP" << endl; break; case Token::OperatorPlusToken: cout << "Found Operator +" << endl; break; case Token::OperatorMinusToken: cout << "Found Operator -" << endl; break; case Token::OperatorAsteriskToken: cout << "Found Operator *" << endl; break; case Token::OperatorSlashToken: cout << "Found Operator /" << endl; break; case Token::SymbolOpenParenToken: cout << "Found Symbol (" << endl; break; case Token::SymbolCloseParenToken: cout << "Found Symbol )" << endl; break; case Token::SymbolSemiColonToken: cout << "Found Symbol ;" << endl; break; case Token::ConstantToken: cout << "Found Constant "; PrintResult(); break; case Token::VariableToken: cout << "Found Variable "; PrintResult(); break; case Token::NumAndSemiColToken: cout << "Found Constant "; PrintResult(); cout << "Found Symbol ;" << endl; break; case Token::VarAndSemiColToken: cout << "Found Variable "; PrintResult(); cout << "Found Symbol ;" << endl; break; case Token::ConstAndCPToken: cout << "Found Constant "; PrintResult(); cout << "Found Symbol )" << endl; break; case Token::VarAndCPToken: cout << "Found Variable "; PrintResult(); cout << "Found Symbol )" << endl; break; case Token::EndOfInputToken: cout << "Found end of input file" << endl; break; default: cout << "Should not get here" << endl; } } while (Toke.GetType () != Token::EndOfInputToken); Token::CloseFile (); }
[ "codingmace@gmail.com" ]
codingmace@gmail.com
847928973c9e3a02b58b5bcef28c7009cee9bc4b
88ae8695987ada722184307301e221e1ba3cc2fa
/third_party/grpc/src/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc
b395bff00d620a614f41609487e8d4863bcb82e0
[ "BSD-3-Clause", "MPL-2.0", "Apache-2.0", "LGPL-2.0-or-later", "MIT", "GPL-1.0-or-later" ]
permissive
iridium-browser/iridium-browser
71d9c5ff76e014e6900b825f67389ab0ccd01329
5ee297f53dc7f8e70183031cff62f37b0f19d25f
refs/heads/master
2023-08-03T16:44:16.844552
2023-07-20T15:17:00
2023-07-23T16:09:30
220,016,632
341
40
BSD-3-Clause
2021-08-13T13:54:45
2019-11-06T14:32:31
null
UTF-8
C++
false
false
11,104
cc
// Copyright 2022 gRPC Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include <grpc/support/port_platform.h> #include "src/core/lib/event_engine/posix.h" #include "src/core/lib/iomgr/port.h" #ifdef GRPC_POSIX_SOCKET_TCP #include <errno.h> // IWYU pragma: keep #include <sys/socket.h> // IWYU pragma: keep #include <unistd.h> // IWYU pragma: keep #include <string> #include <utility> #include "absl/functional/any_invocable.h" #include "absl/status/status.h" #include "absl/strings/str_cat.h" #include "absl/types/optional.h" #include <grpc/event_engine/event_engine.h> #include <grpc/event_engine/memory_allocator.h> #include <grpc/support/log.h> #include "src/core/lib/event_engine/posix_engine/event_poller.h" #include "src/core/lib/event_engine/posix_engine/posix_endpoint.h" #include "src/core/lib/event_engine/posix_engine/posix_engine_listener.h" #include "src/core/lib/event_engine/posix_engine/tcp_socket_utils.h" #include "src/core/lib/event_engine/tcp_socket_utils.h" #include "src/core/lib/gprpp/status_helper.h" #include "src/core/lib/iomgr/socket_mutator.h" namespace grpc_event_engine { namespace experimental { PosixEngineListenerImpl::PosixEngineListenerImpl( PosixEventEngineWithFdSupport::PosixAcceptCallback on_accept, absl::AnyInvocable<void(absl::Status)> on_shutdown, const grpc_event_engine::experimental::EndpointConfig& config, std::unique_ptr<grpc_event_engine::experimental::MemoryAllocatorFactory> memory_allocator_factory, PosixEventPoller* poller, std::shared_ptr<EventEngine> engine) : poller_(poller), options_(TcpOptionsFromEndpointConfig(config)), engine_(std::move(engine)), acceptors_(this), on_accept_(std::move(on_accept)), on_shutdown_(std::move(on_shutdown)), memory_allocator_factory_(std::move(memory_allocator_factory)) {} absl::StatusOr<int> PosixEngineListenerImpl::Bind( const EventEngine::ResolvedAddress& addr, PosixListenerWithFdSupport::OnPosixBindNewFdCallback on_bind_new_fd) { absl::MutexLock lock(&this->mu_); if (this->started_) { return absl::FailedPreconditionError( "Listener is already started, ports can no longer be bound"); } EventEngine::ResolvedAddress res_addr = addr; EventEngine::ResolvedAddress addr6_v4mapped; int requested_port = ResolvedAddressGetPort(res_addr); GPR_ASSERT(addr.size() <= EventEngine::ResolvedAddress::MAX_SIZE_BYTES); UnlinkIfUnixDomainSocket(addr); /// Check if this is a wildcard port, and if so, try to keep the port the same /// as some previously created listener socket. for (auto it = acceptors_.begin(); requested_port == 0 && it != acceptors_.end(); it++) { EventEngine::ResolvedAddress sockname_temp; socklen_t len = static_cast<socklen_t>(sizeof(struct sockaddr_storage)); if (0 == getsockname((*it)->Socket().sock.Fd(), const_cast<sockaddr*>(sockname_temp.address()), &len)) { int used_port = ResolvedAddressGetPort(sockname_temp); if (used_port > 0) { requested_port = used_port; ResolvedAddressSetPort(res_addr, requested_port); break; } } } auto used_port = ResolvedAddressIsWildcard(res_addr); // Update the callback. Any subsequent new sockets created and added to // acceptors_ in this function will invoke the new callback. acceptors_.UpdateOnAppendCallback(std::move(on_bind_new_fd)); if (used_port.has_value()) { requested_port = *used_port; return ListenerContainerAddWildcardAddresses(acceptors_, options_, requested_port); } if (ResolvedAddressToV4Mapped(res_addr, &addr6_v4mapped)) { res_addr = addr6_v4mapped; } auto result = CreateAndPrepareListenerSocket(options_, res_addr); GRPC_RETURN_IF_ERROR(result.status()); acceptors_.Append(*result); return result->port; } void PosixEngineListenerImpl::AsyncConnectionAcceptor::Start() { Ref(); handle_->NotifyOnRead(notify_on_accept_); } void PosixEngineListenerImpl::AsyncConnectionAcceptor::NotifyOnAccept( absl::Status status) { if (!status.ok()) { // Shutting down the acceptor. Unref the ref grabbed in // AsyncConnectionAcceptor::Start(). Unref(); return; } // loop until accept4 returns EAGAIN, and then re-arm notification. for (;;) { EventEngine::ResolvedAddress addr; memset(const_cast<sockaddr*>(addr.address()), 0, addr.size()); // Note: If we ever decide to return this address to the user, remember to // strip off the ::ffff:0.0.0.0/96 prefix first. int fd = Accept4(handle_->WrappedFd(), addr, 1, 1); if (fd < 0) { switch (errno) { case EINTR: continue; case EAGAIN: case ECONNABORTED: handle_->NotifyOnRead(notify_on_accept_); return; default: gpr_log(GPR_ERROR, "Closing acceptor. Failed accept4: %s", strerror(errno)); // Shutting down the acceptor. Unref the ref grabbed in // AsyncConnectionAcceptor::Start(). Unref(); return; } } // For UNIX sockets, the accept call might not fill up the member // sun_path of sockaddr_un, so explicitly call getsockname to get it. if (addr.address()->sa_family == AF_UNIX) { socklen_t len = EventEngine::ResolvedAddress::MAX_SIZE_BYTES; if (getsockname(fd, const_cast<sockaddr*>(addr.address()), &len) < 0) { gpr_log(GPR_ERROR, "Closing acceptor. Failed getsockname: %s", strerror(errno)); close(fd); // Shutting down the acceptor. Unref the ref grabbed in // AsyncConnectionAcceptor::Start(). Unref(); return; } addr = EventEngine::ResolvedAddress(addr.address(), len); } PosixSocketWrapper sock(fd); (void)sock.SetSocketNoSigpipeIfPossible(); auto result = sock.ApplySocketMutatorInOptions( GRPC_FD_SERVER_CONNECTION_USAGE, listener_->options_); if (!result.ok()) { gpr_log(GPR_ERROR, "Closing acceptor. Failed to apply socket mutator: %s", result.ToString().c_str()); // Shutting down the acceptor. Unref the ref grabbed in // AsyncConnectionAcceptor::Start(). Unref(); return; } // Create an Endpoint here. auto peer_name = ResolvedAddressToURI(addr); if (!peer_name.ok()) { gpr_log(GPR_ERROR, "Invalid address: %s", peer_name.status().ToString().c_str()); // Shutting down the acceptor. Unref the ref grabbed in // AsyncConnectionAcceptor::Start(). Unref(); return; } auto endpoint = CreatePosixEndpoint( /*handle=*/listener_->poller_->CreateHandle( fd, *peer_name, listener_->poller_->CanTrackErrors()), /*on_shutdown=*/nullptr, /*engine=*/listener_->engine_, // allocator= listener_->memory_allocator_factory_->CreateMemoryAllocator( absl::StrCat("endpoint-tcp-server-connection: ", *peer_name)), /*options=*/listener_->options_); // Call on_accept_ and then resume accepting new connections by continuing // the parent for-loop. listener_->on_accept_( /*listener_fd=*/handle_->WrappedFd(), /*endpoint=*/std::move(endpoint), /*is_external=*/false, /*memory_allocator=*/ listener_->memory_allocator_factory_->CreateMemoryAllocator( absl::StrCat("on-accept-tcp-server-connection: ", *peer_name)), /*pending_data=*/nullptr); } GPR_UNREACHABLE_CODE(return); } absl::Status PosixEngineListenerImpl::HandleExternalConnection( int listener_fd, int fd, SliceBuffer* pending_data) { if (listener_fd < 0) { return absl::UnknownError(absl::StrCat( "HandleExternalConnection: Invalid listener socket: ", listener_fd)); } if (fd < 0) { return absl::UnknownError( absl::StrCat("HandleExternalConnection: Invalid peer socket: ", fd)); } PosixSocketWrapper sock(fd); (void)sock.SetSocketNoSigpipeIfPossible(); auto peer_name = sock.PeerAddressString(); if (!peer_name.ok()) { return absl::UnknownError( absl::StrCat("HandleExternalConnection: peer not connected: ", peer_name.status().ToString())); } auto endpoint = CreatePosixEndpoint( /*handle=*/poller_->CreateHandle(fd, *peer_name, poller_->CanTrackErrors()), /*on_shutdown=*/nullptr, /*engine=*/engine_, /*allocator=*/ memory_allocator_factory_->CreateMemoryAllocator(absl::StrCat( "external:endpoint-tcp-server-connection: ", *peer_name)), /*options=*/options_); on_accept_( /*listener_fd=*/listener_fd, /*endpoint=*/std::move(endpoint), /*is_external=*/true, /*memory_allocator=*/ memory_allocator_factory_->CreateMemoryAllocator(absl::StrCat( "external:on-accept-tcp-server-connection: ", *peer_name)), /*pending_data=*/pending_data); return absl::OkStatus(); } void PosixEngineListenerImpl::AsyncConnectionAcceptor::Shutdown() { // The ShutdownHandle whould trigger any waiting notify_on_accept_ to get // scheduled with the not-OK status. handle_->ShutdownHandle(absl::InternalError("Shutting down acceptor")); Unref(); } absl::Status PosixEngineListenerImpl::Start() { absl::MutexLock lock(&this->mu_); // Start each asynchronous acceptor. GPR_ASSERT(!this->started_); this->started_ = true; for (auto it = acceptors_.begin(); it != acceptors_.end(); it++) { (*it)->Start(); } return absl::OkStatus(); } void PosixEngineListenerImpl::TriggerShutdown() { // This would get invoked from the destructor of the parent // PosixEngineListener object. absl::MutexLock lock(&this->mu_); for (auto it = acceptors_.begin(); it != acceptors_.end(); it++) { // Trigger shutdown of each asynchronous acceptor. This in-turn calls // ShutdownHandle on the associated poller event handle. It may also // immediately delete the asynchronous acceptor if the acceptor was never // started. (*it)->Shutdown(); } } PosixEngineListenerImpl::~PosixEngineListenerImpl() { // This should get invoked only after all the AsyncConnectionAcceptor's have // been destroyed. This is because each AsyncConnectionAcceptor has a // shared_ptr ref to the parent PosixEngineListenerImpl. if (on_shutdown_ != nullptr) { on_shutdown_(absl::OkStatus()); } } } // namespace experimental } // namespace grpc_event_engine #endif // GRPC_POSIX_SOCKET_TCP
[ "jengelh@inai.de" ]
jengelh@inai.de
ced30fabe9373c44d1fb7d7419d2cfbb266ec9f4
45f4a3c690df533d6631d410319b5c9f678c486e
/Source.cpp
0145e7d0561d097d098584cc0c247398ca9a7a91
[]
no_license
KiroAlbear/Bank-Mangment
64814956c2d85ef7aa424b298c764b9469606a65
e0d46ebecd9c0245dc15170e19fda9b02ad998ae
refs/heads/master
2020-12-24T20:52:22.977827
2016-05-20T22:57:46
2016-05-20T22:57:46
59,330,898
0
0
null
2016-05-20T22:57:46
2016-05-20T22:52:22
C++
UTF-8
C++
false
false
9,421
cpp
#include <Windows.h> #include <tchar.h> #include <iostream> #include <string> #include <fstream> #include <cstdlib> #include <string.h> #include <dirent.h> #include <iterator> using namespace std; void deleteClient() { string name, email, temp, line,blr; int id, age, money; cout << "Enter ID number: "; char y; while (true) { cin >> id; string id2 = to_string(id); if (id2.size() != 6) cout << "Please enter a valid number" << endl; else break; } string id2 = to_string(id); id2.append(".txt"); ifstream takedata(id2); takedata >> blr >> id >> email >> age >> name >> money; ofstream savedata(id2); savedata << "De" << endl << "" << endl << "" <<endl << "" << endl << "" << endl << "" << endl; savedata.close(); while (true) { cout << "Press x to return to menu" << endl; cin >> y; if (y == 'x')break; } } void transfer() { long long id, age, money; char y; string blr, email, name,h; cout << "Enter Account that Take money from : "; cin >> id; h = to_string(id); h.append(".txt"); ifstream takedata(h); takedata >> blr >> id >> email >> age >> name >> money; int num; cout << "Your account has " << money << " Pound" << endl << endl; while (true) { cout << "Enter the money you want"<<endl; cin >> num; if (num > money){ cout << "mainf3sh ts7b ya fandam" << endl; cout << "Your account has " << money << " Pound" << endl << endl; } else { num; ofstream savedata(h); savedata << blr << endl << id << endl << email << endl << age << endl << name << endl << money - num << endl; cout << "This Account has " << money -num << " Pound " << endl; savedata.close(); break; } takedata.close(); } cout << "Enter your Account to Put money in : "<<endl; cin >> id; h = to_string(id); h.append(".txt"); ifstream take(h); take >> blr >> id >> email >> age >> name >> money; ofstream save(h); save<< blr << endl << id << endl << email << endl << age << endl << name << endl << money + num << endl; cout << "This Account has " << money + num << " Pound " << endl; save.close(); take.close(); while (true) { cout << "Press x to return to menu" << endl; cin >> y; if (y == 'x')break; } } void modify(string id2,int id) { string name, email,blr,so,line; long long age, money; char num,y; ifstream takedata(id2); takedata >> blr >> id >> email >> age >> name >> money; system("cls"); cout << " What do you want to modify" << endl<<endl; cout << " Name press 1" << endl<<endl; cout << " Email press 2" << endl<<endl; cout << " Age press 3" << endl<<endl; string x; cin >> num; system("cls"); switch (num) { case '1': { cout << "please enter your new name " << endl; cin >> x;//7mada ofstream save(id2); save << blr << endl << id << endl << email << endl << age << endl << x << endl << money << endl; save.close(); break; } case '2': { string email2; cout << "please enter your new Email " << endl; cin >> email2; { ofstream save(id2); save << blr << endl << id << endl << email2 << endl << age << endl << name << endl << money << endl; save.close(); } break; } case '3': { int age2; cout << "please enter your Age " << endl; cin >> age2; ofstream save(id2); save << blr << endl << id << endl << email << endl << age2 << endl << name << endl << money << endl; save.close(); } } while (true) { cout << "Press x to return to menu" << endl; cin >> y; if (y == 'x')break; } } void withdraw(string id2, int id) { string name, email, blr; char f; long long age, money,y; ifstream takedata(id2); takedata >> blr >> id >> email >> age >> name >> money; cout << "Your money = " << money << " Pound" << endl<<endl; cout << "enter number to withdrew" << endl; ofstream savedata(id2); while (true) { cin >> y; if (y > money){ cout << "mainf3sh ts7b ya fandam" << endl; cout << "your account = " << money << endl; } else { savedata << blr << endl << id << endl << email << endl << age << endl << name << endl << money - y << endl; cout << "your Account = " << money - y << endl; break; } } while (true) { cout << "Press x to return to menu" << endl; cin >> f; if (f == 'x')break; } } void secure(string h,int *p) { string name; h.append(".txt"); ifstream takedata(h); while (takedata >>name) { if (name.size()>2) { *p = 1; // lw el *p zad yeb2a el x hayzeed w kda ykoon el esm mtta5ed } } } void deposite(string id2,int id) { long long age, money; string name, email,blr; char y; long long a; cout << "enter number to deposite" << endl; cin >> a; ifstream takedata(id2); takedata >> blr >> id >> email >> age >> name >> money; ofstream savedata(id2); savedata <<blr<<endl<< id << endl << email<< endl << age << endl << name << endl << money + a << endl; savedata.close(); cout << "Total Money is " << money + a << endl; takedata.close(); while (true) { cout << "Press x to exit" << endl; cin >> y; if (y == 'x')break; } } void listAll() { int s = 0, m = 0; DIR *dp; struct dirent *ep; string j, line,y; ifstream inn; const char *dirname = "E:\\UnderStand\\Lot Of Functions\\Lot Of Functions"; dp = opendir(dirname); if (dp != NULL) { while (ep = readdir(dp)) { j = ep->d_name; ifstream take(j); while (getline(take, line)) { if ((line == "--------------")) { s++; } if (s > 0) { line += "\n"; cout << line; } } s = 0; } } while (true)// dy lazmtha enno yestanna w myerga3sh 3al main 3atool { cout << "Press x to return to menu" << endl; cin >> y; if (y == "x")break; } } void input() { string name, email, blr = "--------------"; int age; int id, money = 0; cout << "enter a name : "; cin >> name; cout << "enter a mail : "; cin >> email; cout << "enter age : "; cin >> age; cout << "enter ID : "; int x = 0, m = 0, n = 0; while (true)// el ID hayod5ol f loop 3shan yshoof lw meta5ed aw mda5al ay arkam walla la2 //lw kol 7aga tmam hayo5rog 3ady { int x = 0, m = 0, n = 0; int z = 0, s = 0; cin >> id; string h = to_string(id); if ((h.size() != 6)) { cout << " Please enter only 6 nunber " << endl; s++; } secure(h, &x);// lw el x zaad yeb2a el esm mtta5ed if ((h.size() == 6)) { z++; } if ((x == 1) && (s == 0))//lw el x zad y2ny ba2a 1 yeb2a hi2ollo mayenfa3sh //kman lazm el "s" b "0" 3shan maykonsh da5al fel rsala elly awalania w yetla3lo rsalteen { cout << "This number is taken" << endl; } else { z++; } if (z == 2)break; } string id2 = to_string(id);//7awlna el rakam l string id2.append(".txt");//ednalo extension esmaha".txt" 3shan yeb2a malaf nktb feeh ofstream savedata(id2); savedata << blr<< endl<< id << endl << email << endl << age << endl << name << endl << money << endl; savedata.close(); } void search(string id2,int id) { string name, email,blr; long long age, money; char f; ifstream takedata(id2); takedata >> blr >> id >> email >> age >> name >> money; cout << name << endl << email << endl << age << endl << money << endl << endl << endl; takedata.close(); cout << "y for deposite " << endl; cout << "w for withdraw" << endl; cout << "x to return to menu" << endl; cin >> f; system("cls"); switch (f) { case'y': { deposite(id2, id); } case 'x': { break; } case 'w': { withdraw(id2, id); } } } int main() { int id,z=0; char x; string id2; while (true)// el loop dy 3shan awel may5allas ay function mn dool yerga3 3al "main()" tany mayo5rogsh { system("cls");//dy 3shan ynaddaf el shasha el sooda :D cout << "To input press 1" << endl << endl; cout << "to list all press 3 " << endl; cout << "to delet Account press 4 " << endl; cout << "To search press 2" << endl; cout << "to modify press 5 " << endl; cout << "to Deosit press 6" << endl; cout << "to Transfer press 7" << endl; cout << "to Withdraw press 8" << endl << endl; cout << "to Exitepress x" << endl << endl << endl; cin >> x; system("cls");// dy bardo zyaha if ((x == '2') || (x == '5') || (x == '8') || (x == '6')) { cout << " Enter Your ID :" << endl; cin >> id; // hayda5al rakam id2 = to_string(id); // n7awlo l string id2.append(".txt"); // n2ollo en da malaf ktaba } switch (x) { case '1': { input(); break; } case '3': { listAll();break; } case '4': { deleteClient();break; } case '7': { transfer();break; } case '2': { search(id2, id);break; } case'5': { modify(id2, id); break; } case '6': { deposite(id2, id);break; } case '8': { withdraw(id2, id);break; } } if (x == 'x')break;// dy el 7ala el wa7eeda elly hayetla3 barra el brnameg feeha } }
[ "kirolosa4@gmail.com" ]
kirolosa4@gmail.com
0a4f934eb325f074ac50d4f50f58ad6dfe2baa2f
59461cfb3126538f3e64146e5f9c211d1d8cf02d
/Leetcode-Mooc/Chapter9-动态规划/Q63_Unique_Paths_II.h
b09038066522f7f1ac7f3782e38b664a03cb7996
[]
no_license
shexuan/cpp_practice
4001ea11dfd2812bcb6b489041326fa8c2dfebe8
a5b47ee00735ad3fd27d9cfd354ead4f255f26ce
refs/heads/main
2023-03-17T16:43:43.190405
2021-03-06T17:10:03
2021-03-06T17:10:03
334,880,551
0
0
null
null
null
null
UTF-8
C++
false
false
1,774
h
// // Created by shexuan on 2021/3/5. // #ifndef CHAPTER9__Q63_UNIQUE_PATHS_II_H #define CHAPTER9__Q63_UNIQUE_PATHS_II_H #include <vector> #include <string> using namespace std; class Solution { public: int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) { int nrow = obstacleGrid.size(), ncol = obstacleGrid[0].size(); // 特例1,机器人出发位置就是石头 if(obstacleGrid[0][0]==1) return 0; // 特例2,仅一行或一列 if(ncol==1 || nrow==1){ for(int r=0;r<nrow;r++){ for(int c=0;c<ncol;c++) if(obstacleGrid[r][c]==1) return 0; } return 1; } vector<vector<int> > memo(nrow, vector<int>(ncol, 0)); // base case,首行首列,只要没碰到1,那么走法都为1,碰到了1后面的走法都为0 memo[0][0] = 1; for(int i=1;i<ncol;i++){ // 填充首行 if(obstacleGrid[0][i]!=1){ memo[0][i] = memo[0][i]+memo[0][i-1]; }else{ memo[0][i] = 0; } } for(int i=1;i<nrow;i++){ // 填充首列 if(obstacleGrid[i][0]!=1){ memo[i][0] = memo[i][0]+memo[i-1][0]; }else{ memo[i][0] = 0; } } for(int r=1;r<nrow;r++){ for(int c=1;c<ncol;c++){ if(obstacleGrid[r][c]==1){ // 障碍物,此路不通 memo[r][c] = 0; }else{ memo[r][c] = memo[r-1][c]+memo[r][c-1]; } // cout << memo[r][c] << endl; } } return memo[nrow-1][ncol-1]; } }; #endif //CHAPTER9__Q63_UNIQUE_PATHS_II_H
[ "shexuan@mininglamp.com" ]
shexuan@mininglamp.com
afff494bfaf73cfa47ef9602386e3e2f9b100796
6a16318ae41875c771477a1279044cdc8fc11c83
/Horoscopes/src/managers/loginmanager/facebookloginmanager.cc
997c17070675135c33888ca01d2ae3a6ba6f309c
[]
no_license
JasF/horoscopes
81c5ad2e9809c67d16606a2e918fd96b0450dbee
880fdf92d6cd48a808e24928dc54a106bda34ce6
refs/heads/master
2021-09-10T13:43:46.246063
2018-03-27T06:24:02
2018-03-27T06:24:02
118,770,043
0
0
null
null
null
null
UTF-8
C++
false
false
2,376
cc
// // facebookloginmanager.c // Horoscopes // // Created by Jasf on 29.10.2017. // Copyright © 2017 Freedom. All rights reserved. // #include "facebookloginmanager.h" #include <vector> #include <sstream> namespace horo { using namespace std; FacebookLoginManager::FacebookLoginManager(strong<FacebookManager> facebookManager) : facebookManager_(facebookManager) { SCParameterAssert(facebookManager_.get()); } FacebookLoginManager::~FacebookLoginManager() { } std::vector<std::string> toVector(std::string string, char delimeter) { std::vector<std::string> array; std::stringstream ss(string); std::string tmp; while(std::getline(ss, tmp, delimeter)) { array.push_back(tmp); } return array; } void FacebookLoginManager::requestUserInformation(std::function<void(strong<Person> person)> callback) { facebookManager_->requestPersonalInformation([callback](dictionary data){ //LOG(LS_WARNING) << "FB userInfo: " << data.toStyledString(); string birthday = data["birthday"].asString(); string name = data["name"].asString(); string genderString = data["gender"].asString(); string id = data["id"].asString(); string imageUrl = "https://graph.facebook.com/" + id + "/picture?type=normal"; std::vector<std::string> birthdayVector = toVector(birthday, '/'); if (birthdayVector.size() != 3 || !name.length()) { if (callback) { callback(nullptr); } return; } int day = std::stoi(birthdayVector[0]); int month = std::stoi(birthdayVector[1]); int year = std::stoi(birthdayVector[2]); ZodiacTypes type = Zodiac::zodiacTypeByDate((Months)month, day, year); if (type == Unknown) { if (callback) { callback(nullptr); } return; } Json::Value genders; genders["male"] = Male; genders["female"] = Female; Gender gender = (Gender)genders[genderString].asInt(); strong<Zodiac> zodiac = new Zodiac(type); strong<Person> person = new Person(zodiac, name, imageUrl, "", gender, StatusCompleted, TypeUser, DateWrapper(day, month, year), true); if (callback) { callback(person); } }); } };
[ "andreivoe@gmail.com" ]
andreivoe@gmail.com
9558761e8b4f3bb12a44fc3edb366c68b56f5a95
78ebffe1622c799f6f6169a1c378f69babb7a196
/palindromic_doubly_linked_list.cpp
cdb0ac4da065af38030e0b76d1205b85b1325b60
[]
no_license
Parshantbalwaria129/C-C-Hack2021
e5cc11b4092894c474d41639843e6d38b7ca5ff9
855238de01708ed042b5c13dbd0bbe874c4354fd
refs/heads/main
2023-08-30T09:48:40.619826
2021-10-17T20:21:56
2021-10-17T20:21:56
412,716,910
1
26
null
2021-10-06T09:38:54
2021-10-02T06:56:28
C++
UTF-8
C++
false
false
1,817
cpp
#include<iostream> using namespace std; //Class for Doubly Linked Lists class node{ public: int data; node* next; node* prev; node(int val) { data = val; prev = NULL; next = NULL; } }; void insertAtHead(node* &head, int val) { node* n = new node(val); n->next = head; if (head != NULL) { head->prev = n; } head = n; } void insertAtTail(node* &head, int val) { if (head == NULL) { insertAtHead(head, val); return; } node* n = new node(val); node* temp = head; while (temp->next != NULL) { temp = temp->next; } temp->next = n; n->prev = temp; } void print(node *head) { if(head==NULL) { cout<<"The list id Empty."; return; } if(head->next==NULL) { cout<<head->data<<"->END"; return; } while(head!=NULL) { cout<<head->data<<"->"; head=head->next; } cout<<"END"; } int countNumberOfNodes(node* head) { int n=0; while(head->next!= NULL) { head = head->next; n++; } return n; } node* findTail(node* head) { node*tail = head; while(tail->next != NULL) { tail = tail->next; } return tail; } int main() { node* head = NULL; //Creating the Doubly Linked List insertAtTail(head, 1); insertAtTail(head, 2); insertAtTail(head, 3); insertAtTail(head, 3); insertAtTail(head, 2); insertAtTail(head, 1); //Printing the Linked List cout<<"The List is:\n"; print(head); //Finding the Tail Node node* tail = findTail(head); bool t=true; //Pointer for list int i=0; int j=countNumberOfNodes(head)-1; //Checking while(i<j) { if(head->data == tail->data) { head = head->next; tail = tail->prev; i++; j--; } else { t=false; break; } } //Result if(t) cout<<"\n\nThe given Linked List is Palindromic."<<endl; else cout<<"\n\nThe given Linked List is NOT Palindromic."<<endl; return 0; }
[ "68791455+Gaurisha21@users.noreply.github.com" ]
68791455+Gaurisha21@users.noreply.github.com
3eba9e7a56cad1ab4fb0d28a84463fe90b53401a
d9b5acacda3f9e0ac13ce80611b2465f40e04038
/spoj/ZSUM.cpp
6a1490051b156ff2183f200c116940a0616915e2
[]
no_license
rathoresrikant/competitive-programming-solutions
f71cc8641761e0c0ef05771ffd06212b806276c8
adb85068f1765e608548835b7a25c29f5600638e
refs/heads/master
2021-06-17T08:38:55.477588
2020-10-02T08:30:26
2020-10-02T08:30:26
151,747,671
81
248
null
2023-06-07T09:57:14
2018-10-05T16:17:14
C++
UTF-8
C++
false
false
357
cpp
#define mq 10000007 #include <iostream> using namespace std; typedef long long ll; ll pow(ll a, ll b){ ll ans=1; while(b!=0){ if(b%2==1) ans = (ans*a)%mq; a = (a*a)%mq; b/=2; } return ans; } int main() { ll n,k; cin>>n>>k; while(n!=0&&k!=0){ cout<<(2*(pow(n-1,k)+pow(n-1,n-1)) + pow(n,k) + pow(n,n))%mq<<"\n"; cin>>n>>k; } return 0; }
[ "noreply@github.com" ]
noreply@github.com
9f87f39ec841fd349813394554eb5d195faffaf1
d60fa37053a864b3d2e46c2d1b3d72b899743da9
/DQM/TrackingMonitorClient/interface/TrackingActionExecutor.h
d653dd3d40dd519d6ccbdfb1a072fdeec2c8c2d5
[]
no_license
ikrav/cmssw
ba4528655cc67ac8c549d24ec4a004f6d86c8a92
d94717c9bfaecffb9ae0b401b6f8351e3dc3432d
refs/heads/CMSSW_7_2_X
2020-04-05T23:37:55.903032
2014-08-15T07:56:46
2014-08-15T07:56:46
22,983,843
2
1
null
2016-12-06T20:56:42
2014-08-15T08:43:31
null
UTF-8
C++
false
false
1,478
h
#ifndef _TrackingActionExecutor_h_ #define _TrackingActionExecutor_h_ #include "DQMServices/Core/interface/MonitorElement.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include <iostream> #include <fstream> #include <sstream> #include <map> #include <vector> #include <string> class SiStripSummaryCreator; class DQMStore; class MonitorUserInterface; class SiStripTrackerMapCreator; class TrackingQualityChecker; class SiStripFedCabling; class SiStripDetCabling; class SiStripConfigWriter; class TrackingActionExecutor { public: TrackingActionExecutor(edm::ParameterSet const& ps); virtual ~TrackingActionExecutor(); void createGlobalStatus(DQMStore* dqm_store); void createLSStatus(DQMStore* dqm_store); void fillDummyGlobalStatus(); void fillDummyLSStatus(); void fillGlobalStatus(DQMStore* dqm_store); void fillStatusAtLumi(DQMStore* dqm_store); void createDummyShiftReport(); void createShiftReport(DQMStore * dqm_store); void printReportSummary(MonitorElement* me, std::ostringstream& str_val, std::string name); void printShiftHistoParameters(DQMStore * dqm_store, std::map<std::string, std::vector<std::string> >&layout_map,std::ostringstream& str_val); private: std::vector<std::string> tkMapMENames; TrackingQualityChecker* qualityChecker_; SiStripConfigWriter* configWriter_; edm::ParameterSet pSet_; }; #endif
[ "mia.tosi@cern.ch" ]
mia.tosi@cern.ch
a0da05c15b825ca36b2f092a46ccc9daf34da6ba
48a400042c41feb1b305da0aff3b8a2ad535bdc1
/llvm/lib/IR/DataLayout.cpp
f76ac12ba8ad2347a17cdec962e8b75ad7c59cf4
[ "NCSA", "LLVM-exception", "Apache-2.0" ]
permissive
Daasin/tpc_llvm
d9942f0a031213ba5f23e2053d04c3649aa67b03
ece488f96ae81dd9790f07438a949407dc87ef66
refs/heads/main
2023-07-29T16:10:36.488513
2021-08-23T10:38:48
2021-09-10T05:48:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
31,621
cpp
//===- DataLayout.cpp - Data size & alignment routines ---------------------==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file defines layout properties related to datatype size/offset/alignment // information. // // This structure should be created once, filled in if the defaults are not // correct and then passed around by const&. None of the members functions // require modification to the object. // //===----------------------------------------------------------------------===// #include "llvm/IR/DataLayout.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Triple.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/GetElementPtrTypeIterator.h" #include "llvm/IR/GlobalVariable.h" #include "llvm/IR/Module.h" #include "llvm/IR/Type.h" #include "llvm/IR/Value.h" #include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/TypeSize.h" #include <algorithm> #include <cassert> #include <cstdint> #include <cstdlib> #include <tuple> #include <utility> using namespace llvm; //===----------------------------------------------------------------------===// // Support for StructLayout //===----------------------------------------------------------------------===// StructLayout::StructLayout(StructType *ST, const DataLayout &DL) { assert(!ST->isOpaque() && "Cannot get layout of opaque structs"); StructSize = 0; IsPadded = false; NumElements = ST->getNumElements(); // Loop over each of the elements, placing them in memory. for (unsigned i = 0, e = NumElements; i != e; ++i) { Type *Ty = ST->getElementType(i); const Align TyAlign(ST->isPacked() ? 1 : DL.getABITypeAlignment(Ty)); // Add padding if necessary to align the data element properly. if (!isAligned(TyAlign, StructSize)) { IsPadded = true; StructSize = alignTo(StructSize, TyAlign); } // Keep track of maximum alignment constraint. StructAlignment = std::max(TyAlign, StructAlignment); MemberOffsets[i] = StructSize; StructSize += DL.getTypeAllocSize(Ty); // Consume space for this data item } // Add padding to the end of the struct so that it could be put in an array // and all array elements would be aligned correctly. if (!isAligned(StructAlignment, StructSize)) { IsPadded = true; StructSize = alignTo(StructSize, StructAlignment); } } /// getElementContainingOffset - Given a valid offset into the structure, /// return the structure index that contains it. unsigned StructLayout::getElementContainingOffset(uint64_t Offset) const { const uint64_t *SI = std::upper_bound(&MemberOffsets[0], &MemberOffsets[NumElements], Offset); assert(SI != &MemberOffsets[0] && "Offset not in structure type!"); --SI; assert(*SI <= Offset && "upper_bound didn't work"); assert((SI == &MemberOffsets[0] || *(SI-1) <= Offset) && (SI+1 == &MemberOffsets[NumElements] || *(SI+1) > Offset) && "Upper bound didn't work!"); // Multiple fields can have the same offset if any of them are zero sized. // For example, in { i32, [0 x i32], i32 }, searching for offset 4 will stop // at the i32 element, because it is the last element at that offset. This is // the right one to return, because anything after it will have a higher // offset, implying that this element is non-empty. return SI-&MemberOffsets[0]; } //===----------------------------------------------------------------------===// // LayoutAlignElem, LayoutAlign support //===----------------------------------------------------------------------===// LayoutAlignElem LayoutAlignElem::get(AlignTypeEnum align_type, Align abi_align, Align pref_align, uint32_t bit_width) { assert(abi_align <= pref_align && "Preferred alignment worse than ABI!"); LayoutAlignElem retval; retval.AlignType = align_type; retval.ABIAlign = abi_align; retval.PrefAlign = pref_align; retval.TypeBitWidth = bit_width; return retval; } bool LayoutAlignElem::operator==(const LayoutAlignElem &rhs) const { return (AlignType == rhs.AlignType && ABIAlign == rhs.ABIAlign && PrefAlign == rhs.PrefAlign && TypeBitWidth == rhs.TypeBitWidth); } //===----------------------------------------------------------------------===// // PointerAlignElem, PointerAlign support //===----------------------------------------------------------------------===// PointerAlignElem PointerAlignElem::get(uint32_t AddressSpace, Align ABIAlign, Align PrefAlign, uint32_t TypeByteWidth, uint32_t IndexWidth) { assert(ABIAlign <= PrefAlign && "Preferred alignment worse than ABI!"); PointerAlignElem retval; retval.AddressSpace = AddressSpace; retval.ABIAlign = ABIAlign; retval.PrefAlign = PrefAlign; retval.TypeByteWidth = TypeByteWidth; retval.IndexWidth = IndexWidth; return retval; } bool PointerAlignElem::operator==(const PointerAlignElem &rhs) const { return (ABIAlign == rhs.ABIAlign && AddressSpace == rhs.AddressSpace && PrefAlign == rhs.PrefAlign && TypeByteWidth == rhs.TypeByteWidth && IndexWidth == rhs.IndexWidth); } //===----------------------------------------------------------------------===// // DataLayout Class Implementation //===----------------------------------------------------------------------===// const char *DataLayout::getManglingComponent(const Triple &T) { if (T.isOSBinFormatMachO()) return "-m:o"; if (T.isOSWindows() && T.isOSBinFormatCOFF()) return T.getArch() == Triple::x86 ? "-m:x" : "-m:w"; return "-m:e"; } static const LayoutAlignElem DefaultAlignments[] = { {INTEGER_ALIGN, 1, Align(1), Align(1)}, // i1 {INTEGER_ALIGN, 8, Align(1), Align(1)}, // i8 {INTEGER_ALIGN, 16, Align(2), Align(2)}, // i16 {INTEGER_ALIGN, 32, Align(4), Align(4)}, // i32 {INTEGER_ALIGN, 64, Align(4), Align(8)}, // i64 {FLOAT_ALIGN, 16, Align(2), Align(2)}, // half {FLOAT_ALIGN, 32, Align(4), Align(4)}, // float {FLOAT_ALIGN, 64, Align(8), Align(8)}, // double {FLOAT_ALIGN, 128, Align(16), Align(16)}, // ppcf128, quad, ... {VECTOR_ALIGN, 64, Align(8), Align(8)}, // v2i32, v1i64, ... {VECTOR_ALIGN, 128, Align(16), Align(16)}, // v16i8, v8i16, v4i32, ... {AGGREGATE_ALIGN, 0, Align(1), Align(8)} // struct }; void DataLayout::reset(StringRef Desc) { clear(); LayoutMap = nullptr; BigEndian = false; AllocaAddrSpace = 0; StackNaturalAlign.reset(); ProgramAddrSpace = 0; FunctionPtrAlign.reset(); TheFunctionPtrAlignType = FunctionPtrAlignType::Independent; ManglingMode = MM_None; NonIntegralAddressSpaces.clear(); // Default alignments for (const LayoutAlignElem &E : DefaultAlignments) { setAlignment((AlignTypeEnum)E.AlignType, E.ABIAlign, E.PrefAlign, E.TypeBitWidth); } setPointerAlignment(0, Align(8), Align(8), 8, 8); parseSpecifier(Desc); } /// Checked version of split, to ensure mandatory subparts. static std::pair<StringRef, StringRef> split(StringRef Str, char Separator) { assert(!Str.empty() && "parse error, string can't be empty here"); std::pair<StringRef, StringRef> Split = Str.split(Separator); if (Split.second.empty() && Split.first != Str) report_fatal_error("Trailing separator in datalayout string"); if (!Split.second.empty() && Split.first.empty()) report_fatal_error("Expected token before separator in datalayout string"); return Split; } /// Get an unsigned integer, including error checks. static unsigned getInt(StringRef R) { unsigned Result; bool error = R.getAsInteger(10, Result); (void)error; if (error) report_fatal_error("not a number, or does not fit in an unsigned int"); return Result; } /// Convert bits into bytes. Assert if not a byte width multiple. static unsigned inBytes(unsigned Bits) { if (Bits % 8) report_fatal_error("number of bits must be a byte width multiple"); return Bits / 8; } static unsigned getAddrSpace(StringRef R) { unsigned AddrSpace = getInt(R); if (!isUInt<24>(AddrSpace)) report_fatal_error("Invalid address space, must be a 24-bit integer"); return AddrSpace; } void DataLayout::parseSpecifier(StringRef Desc) { StringRepresentation = Desc; while (!Desc.empty()) { // Split at '-'. std::pair<StringRef, StringRef> Split = split(Desc, '-'); Desc = Split.second; // Split at ':'. Split = split(Split.first, ':'); // Aliases used below. StringRef &Tok = Split.first; // Current token. StringRef &Rest = Split.second; // The rest of the string. if (Tok == "ni") { do { Split = split(Rest, ':'); Rest = Split.second; unsigned AS = getInt(Split.first); if (AS == 0) report_fatal_error("Address space 0 can never be non-integral"); NonIntegralAddressSpaces.push_back(AS); } while (!Rest.empty()); continue; } char Specifier = Tok.front(); Tok = Tok.substr(1); switch (Specifier) { case 's': // Ignored for backward compatibility. // FIXME: remove this on LLVM 4.0. break; case 'E': BigEndian = true; break; case 'e': BigEndian = false; break; case 'p': { // Address space. unsigned AddrSpace = Tok.empty() ? 0 : getInt(Tok); if (!isUInt<24>(AddrSpace)) report_fatal_error("Invalid address space, must be a 24bit integer"); // Size. if (Rest.empty()) report_fatal_error( "Missing size specification for pointer in datalayout string"); Split = split(Rest, ':'); unsigned PointerMemSize = inBytes(getInt(Tok)); if (!PointerMemSize) report_fatal_error("Invalid pointer size of 0 bytes"); // ABI alignment. if (Rest.empty()) report_fatal_error( "Missing alignment specification for pointer in datalayout string"); Split = split(Rest, ':'); unsigned PointerABIAlign = inBytes(getInt(Tok)); if (!isPowerOf2_64(PointerABIAlign)) report_fatal_error( "Pointer ABI alignment must be a power of 2"); // Size of index used in GEP for address calculation. // The parameter is optional. By default it is equal to size of pointer. unsigned IndexSize = PointerMemSize; // Preferred alignment. unsigned PointerPrefAlign = PointerABIAlign; if (!Rest.empty()) { Split = split(Rest, ':'); PointerPrefAlign = inBytes(getInt(Tok)); if (!isPowerOf2_64(PointerPrefAlign)) report_fatal_error( "Pointer preferred alignment must be a power of 2"); // Now read the index. It is the second optional parameter here. if (!Rest.empty()) { Split = split(Rest, ':'); IndexSize = inBytes(getInt(Tok)); if (!IndexSize) report_fatal_error("Invalid index size of 0 bytes"); } } setPointerAlignment(AddrSpace, assumeAligned(PointerABIAlign), assumeAligned(PointerPrefAlign), PointerMemSize, IndexSize); break; } case 'i': case 'v': case 'f': case 'a': { AlignTypeEnum AlignType; switch (Specifier) { default: llvm_unreachable("Unexpected specifier!"); case 'i': AlignType = INTEGER_ALIGN; break; case 'v': AlignType = VECTOR_ALIGN; break; case 'f': AlignType = FLOAT_ALIGN; break; case 'a': AlignType = AGGREGATE_ALIGN; break; } // Bit size. unsigned Size = Tok.empty() ? 0 : getInt(Tok); if (AlignType == AGGREGATE_ALIGN && Size != 0) report_fatal_error( "Sized aggregate specification in datalayout string"); // ABI alignment. if (Rest.empty()) report_fatal_error( "Missing alignment specification in datalayout string"); Split = split(Rest, ':'); const unsigned ABIAlign = inBytes(getInt(Tok)); if (AlignType != AGGREGATE_ALIGN && !ABIAlign) report_fatal_error( "ABI alignment specification must be >0 for non-aggregate types"); if (!isUInt<16>(ABIAlign)) report_fatal_error("Invalid ABI alignment, must be a 16bit integer"); if (ABIAlign != 0 && !isPowerOf2_64(ABIAlign)) report_fatal_error("Invalid ABI alignment, must be a power of 2"); // Preferred alignment. unsigned PrefAlign = ABIAlign; if (!Rest.empty()) { Split = split(Rest, ':'); PrefAlign = inBytes(getInt(Tok)); } if (!isUInt<16>(PrefAlign)) report_fatal_error( "Invalid preferred alignment, must be a 16bit integer"); if (PrefAlign != 0 && !isPowerOf2_64(PrefAlign)) report_fatal_error("Invalid preferred alignment, must be a power of 2"); setAlignment(AlignType, assumeAligned(ABIAlign), assumeAligned(PrefAlign), Size); break; } case 'n': // Native integer types. while (true) { unsigned Width = getInt(Tok); if (Width == 0) report_fatal_error( "Zero width native integer type in datalayout string"); LegalIntWidths.push_back(Width); if (Rest.empty()) break; Split = split(Rest, ':'); } break; case 'S': { // Stack natural alignment. uint64_t Alignment = inBytes(getInt(Tok)); if (Alignment != 0 && !llvm::isPowerOf2_64(Alignment)) report_fatal_error("Alignment is neither 0 nor a power of 2"); StackNaturalAlign = MaybeAlign(Alignment); break; } case 'F': { switch (Tok.front()) { case 'i': TheFunctionPtrAlignType = FunctionPtrAlignType::Independent; break; case 'n': TheFunctionPtrAlignType = FunctionPtrAlignType::MultipleOfFunctionAlign; break; default: report_fatal_error("Unknown function pointer alignment type in " "datalayout string"); } Tok = Tok.substr(1); uint64_t Alignment = inBytes(getInt(Tok)); if (Alignment != 0 && !llvm::isPowerOf2_64(Alignment)) report_fatal_error("Alignment is neither 0 nor a power of 2"); FunctionPtrAlign = MaybeAlign(Alignment); break; } case 'P': { // Function address space. ProgramAddrSpace = getAddrSpace(Tok); break; } case 'A': { // Default stack/alloca address space. AllocaAddrSpace = getAddrSpace(Tok); break; } case 'm': if (!Tok.empty()) report_fatal_error("Unexpected trailing characters after mangling specifier in datalayout string"); if (Rest.empty()) report_fatal_error("Expected mangling specifier in datalayout string"); if (Rest.size() > 1) report_fatal_error("Unknown mangling specifier in datalayout string"); switch(Rest[0]) { default: report_fatal_error("Unknown mangling in datalayout string"); case 'e': ManglingMode = MM_ELF; break; case 'o': ManglingMode = MM_MachO; break; case 'm': ManglingMode = MM_Mips; break; case 'w': ManglingMode = MM_WinCOFF; break; case 'x': ManglingMode = MM_WinCOFFX86; break; } break; default: report_fatal_error("Unknown specifier in datalayout string"); break; } } } DataLayout::DataLayout(const Module *M) { init(M); } void DataLayout::init(const Module *M) { *this = M->getDataLayout(); } bool DataLayout::operator==(const DataLayout &Other) const { bool Ret = BigEndian == Other.BigEndian && AllocaAddrSpace == Other.AllocaAddrSpace && StackNaturalAlign == Other.StackNaturalAlign && ProgramAddrSpace == Other.ProgramAddrSpace && FunctionPtrAlign == Other.FunctionPtrAlign && TheFunctionPtrAlignType == Other.TheFunctionPtrAlignType && ManglingMode == Other.ManglingMode && LegalIntWidths == Other.LegalIntWidths && Alignments == Other.Alignments && Pointers == Other.Pointers; // Note: getStringRepresentation() might differs, it is not canonicalized return Ret; } DataLayout::AlignmentsTy::iterator DataLayout::findAlignmentLowerBound(AlignTypeEnum AlignType, uint32_t BitWidth) { auto Pair = std::make_pair((unsigned)AlignType, BitWidth); return partition_point(Alignments, [=](const LayoutAlignElem &E) { return std::make_pair(E.AlignType, E.TypeBitWidth) < Pair; }); } void DataLayout::setAlignment(AlignTypeEnum align_type, Align abi_align, Align pref_align, uint32_t bit_width) { // AlignmentsTy::ABIAlign and AlignmentsTy::PrefAlign were once stored as // uint16_t, it is unclear if there are requirements for alignment to be less // than 2^16 other than storage. In the meantime we leave the restriction as // an assert. See D67400 for context. assert(Log2(abi_align) < 16 && Log2(pref_align) < 16 && "Alignment too big"); if (!isUInt<24>(bit_width)) report_fatal_error("Invalid bit width, must be a 24bit integer"); if (pref_align < abi_align) report_fatal_error( "Preferred alignment cannot be less than the ABI alignment"); AlignmentsTy::iterator I = findAlignmentLowerBound(align_type, bit_width); if (I != Alignments.end() && I->AlignType == (unsigned)align_type && I->TypeBitWidth == bit_width) { // Update the abi, preferred alignments. I->ABIAlign = abi_align; I->PrefAlign = pref_align; } else { // Insert before I to keep the vector sorted. Alignments.insert(I, LayoutAlignElem::get(align_type, abi_align, pref_align, bit_width)); } } DataLayout::PointersTy::iterator DataLayout::findPointerLowerBound(uint32_t AddressSpace) { return std::lower_bound(Pointers.begin(), Pointers.end(), AddressSpace, [](const PointerAlignElem &A, uint32_t AddressSpace) { return A.AddressSpace < AddressSpace; }); } void DataLayout::setPointerAlignment(uint32_t AddrSpace, Align ABIAlign, Align PrefAlign, uint32_t TypeByteWidth, uint32_t IndexWidth) { if (PrefAlign < ABIAlign) report_fatal_error( "Preferred alignment cannot be less than the ABI alignment"); PointersTy::iterator I = findPointerLowerBound(AddrSpace); if (I == Pointers.end() || I->AddressSpace != AddrSpace) { Pointers.insert(I, PointerAlignElem::get(AddrSpace, ABIAlign, PrefAlign, TypeByteWidth, IndexWidth)); } else { I->ABIAlign = ABIAlign; I->PrefAlign = PrefAlign; I->TypeByteWidth = TypeByteWidth; I->IndexWidth = IndexWidth; } } /// getAlignmentInfo - Return the alignment (either ABI if ABIInfo = true or /// preferred if ABIInfo = false) the layout wants for the specified datatype. Align DataLayout::getAlignmentInfo(AlignTypeEnum AlignType, uint32_t BitWidth, bool ABIInfo, Type *Ty) const { AlignmentsTy::const_iterator I = findAlignmentLowerBound(AlignType, BitWidth); // See if we found an exact match. Of if we are looking for an integer type, // but don't have an exact match take the next largest integer. This is where // the lower_bound will point to when it fails an exact match. if (I != Alignments.end() && I->AlignType == (unsigned)AlignType && (I->TypeBitWidth == BitWidth || AlignType == INTEGER_ALIGN)) return ABIInfo ? I->ABIAlign : I->PrefAlign; if (AlignType == INTEGER_ALIGN) { // If we didn't have a larger value try the largest value we have. if (I != Alignments.begin()) { --I; // Go to the previous entry and see if its an integer. if (I->AlignType == INTEGER_ALIGN) return ABIInfo ? I->ABIAlign : I->PrefAlign; } } else if (AlignType == VECTOR_ALIGN) { // By default, use natural alignment for vector types. This is consistent // with what clang and llvm-gcc do. unsigned Alignment = getTypeAllocSize(cast<VectorType>(Ty)->getElementType()); Alignment *= cast<VectorType>(Ty)->getNumElements(); Alignment = PowerOf2Ceil(Alignment); return Align(Alignment); } // If we still couldn't find a reasonable default alignment, fall back // to a simple heuristic that the alignment is the first power of two // greater-or-equal to the store size of the type. This is a reasonable // approximation of reality, and if the user wanted something less // less conservative, they should have specified it explicitly in the data // layout. unsigned Alignment = getTypeStoreSize(Ty); Alignment = PowerOf2Ceil(Alignment); return Align(Alignment); } namespace { class StructLayoutMap { using LayoutInfoTy = DenseMap<StructType*, StructLayout*>; LayoutInfoTy LayoutInfo; public: ~StructLayoutMap() { // Remove any layouts. for (const auto &I : LayoutInfo) { StructLayout *Value = I.second; Value->~StructLayout(); free(Value); } } StructLayout *&operator[](StructType *STy) { return LayoutInfo[STy]; } }; } // end anonymous namespace void DataLayout::clear() { LegalIntWidths.clear(); Alignments.clear(); Pointers.clear(); delete static_cast<StructLayoutMap *>(LayoutMap); LayoutMap = nullptr; } DataLayout::~DataLayout() { clear(); } const StructLayout *DataLayout::getStructLayout(StructType *Ty) const { if (!LayoutMap) LayoutMap = new StructLayoutMap(); StructLayoutMap *STM = static_cast<StructLayoutMap*>(LayoutMap); StructLayout *&SL = (*STM)[Ty]; if (SL) return SL; // Otherwise, create the struct layout. Because it is variable length, we // malloc it, then use placement new. int NumElts = Ty->getNumElements(); StructLayout *L = (StructLayout *) safe_malloc(sizeof(StructLayout)+(NumElts-1) * sizeof(uint64_t)); // Set SL before calling StructLayout's ctor. The ctor could cause other // entries to be added to TheMap, invalidating our reference. SL = L; new (L) StructLayout(Ty, *this); return L; } Align DataLayout::getPointerABIAlignment(unsigned AS) const { PointersTy::const_iterator I = findPointerLowerBound(AS); if (I == Pointers.end() || I->AddressSpace != AS) { I = findPointerLowerBound(0); assert(I->AddressSpace == 0); } return I->ABIAlign; } Align DataLayout::getPointerPrefAlignment(unsigned AS) const { PointersTy::const_iterator I = findPointerLowerBound(AS); if (I == Pointers.end() || I->AddressSpace != AS) { I = findPointerLowerBound(0); assert(I->AddressSpace == 0); } return I->PrefAlign; } unsigned DataLayout::getPointerSize(unsigned AS) const { PointersTy::const_iterator I = findPointerLowerBound(AS); if (I == Pointers.end() || I->AddressSpace != AS) { I = findPointerLowerBound(0); assert(I->AddressSpace == 0); } return I->TypeByteWidth; } unsigned DataLayout::getMaxPointerSize() const { unsigned MaxPointerSize = 0; for (auto &P : Pointers) MaxPointerSize = std::max(MaxPointerSize, P.TypeByteWidth); return MaxPointerSize; } unsigned DataLayout::getPointerTypeSizeInBits(Type *Ty) const { assert(Ty->isPtrOrPtrVectorTy() && "This should only be called with a pointer or pointer vector type"); Ty = Ty->getScalarType(); return getPointerSizeInBits(cast<PointerType>(Ty)->getAddressSpace()); } unsigned DataLayout::getIndexSize(unsigned AS) const { PointersTy::const_iterator I = findPointerLowerBound(AS); if (I == Pointers.end() || I->AddressSpace != AS) { I = findPointerLowerBound(0); assert(I->AddressSpace == 0); } return I->IndexWidth; } unsigned DataLayout::getIndexTypeSizeInBits(Type *Ty) const { assert(Ty->isPtrOrPtrVectorTy() && "This should only be called with a pointer or pointer vector type"); Ty = Ty->getScalarType(); return getIndexSizeInBits(cast<PointerType>(Ty)->getAddressSpace()); } /*! \param abi_or_pref Flag that determines which alignment is returned. true returns the ABI alignment, false returns the preferred alignment. \param Ty The underlying type for which alignment is determined. Get the ABI (\a abi_or_pref == true) or preferred alignment (\a abi_or_pref == false) for the requested type \a Ty. */ Align DataLayout::getAlignment(Type *Ty, bool abi_or_pref) const { AlignTypeEnum AlignType; assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"); switch (Ty->getTypeID()) { // Early escape for the non-numeric types. case Type::LabelTyID: return abi_or_pref ? getPointerABIAlignment(0) : getPointerPrefAlignment(0); case Type::PointerTyID: { unsigned AS = cast<PointerType>(Ty)->getAddressSpace(); return abi_or_pref ? getPointerABIAlignment(AS) : getPointerPrefAlignment(AS); } case Type::ArrayTyID: return getAlignment(cast<ArrayType>(Ty)->getElementType(), abi_or_pref); case Type::StructTyID: { // Packed structure types always have an ABI alignment of one. if (cast<StructType>(Ty)->isPacked() && abi_or_pref) return Align::None(); // Get the layout annotation... which is lazily created on demand. const StructLayout *Layout = getStructLayout(cast<StructType>(Ty)); const Align Align = getAlignmentInfo(AGGREGATE_ALIGN, 0, abi_or_pref, Ty); return std::max(Align, Layout->getAlignment()); } case Type::IntegerTyID: AlignType = INTEGER_ALIGN; break; case Type::HalfTyID: case Type::FloatTyID: case Type::DoubleTyID: // PPC_FP128TyID and FP128TyID have different data contents, but the // same size and alignment, so they look the same here. case Type::PPC_FP128TyID: case Type::FP128TyID: case Type::X86_FP80TyID: #ifdef LLVM_TPC_COMPILER case Type::F8_143ID: case Type::F8_152ID: case Type::BFloat16ID: #endif AlignType = FLOAT_ALIGN; break; case Type::X86_MMXTyID: case Type::VectorTyID: AlignType = VECTOR_ALIGN; break; default: llvm_unreachable("Bad type for getAlignment!!!"); } // If we're dealing with a scalable vector, we just need the known minimum // size for determining alignment. If not, we'll get the exact size. return getAlignmentInfo(AlignType, getTypeSizeInBits(Ty).getKnownMinSize(), abi_or_pref, Ty); } unsigned DataLayout::getABITypeAlignment(Type *Ty) const { return getAlignment(Ty, true).value(); } /// getABIIntegerTypeAlignment - Return the minimum ABI-required alignment for /// an integer type of the specified bitwidth. Align DataLayout::getABIIntegerTypeAlignment(unsigned BitWidth) const { return getAlignmentInfo(INTEGER_ALIGN, BitWidth, true, nullptr); } unsigned DataLayout::getPrefTypeAlignment(Type *Ty) const { return getAlignment(Ty, false).value(); } IntegerType *DataLayout::getIntPtrType(LLVMContext &C, unsigned AddressSpace) const { return IntegerType::get(C, getPointerSizeInBits(AddressSpace)); } Type *DataLayout::getIntPtrType(Type *Ty) const { assert(Ty->isPtrOrPtrVectorTy() && "Expected a pointer or pointer vector type."); unsigned NumBits = getPointerTypeSizeInBits(Ty); IntegerType *IntTy = IntegerType::get(Ty->getContext(), NumBits); if (VectorType *VecTy = dyn_cast<VectorType>(Ty)) return VectorType::get(IntTy, VecTy->getNumElements()); return IntTy; } Type *DataLayout::getSmallestLegalIntType(LLVMContext &C, unsigned Width) const { for (unsigned LegalIntWidth : LegalIntWidths) if (Width <= LegalIntWidth) return Type::getIntNTy(C, LegalIntWidth); return nullptr; } unsigned DataLayout::getLargestLegalIntTypeSizeInBits() const { auto Max = std::max_element(LegalIntWidths.begin(), LegalIntWidths.end()); return Max != LegalIntWidths.end() ? *Max : 0; } Type *DataLayout::getIndexType(Type *Ty) const { assert(Ty->isPtrOrPtrVectorTy() && "Expected a pointer or pointer vector type."); unsigned NumBits = getIndexTypeSizeInBits(Ty); IntegerType *IntTy = IntegerType::get(Ty->getContext(), NumBits); if (VectorType *VecTy = dyn_cast<VectorType>(Ty)) return VectorType::get(IntTy, VecTy->getNumElements()); return IntTy; } int64_t DataLayout::getIndexedOffsetInType(Type *ElemTy, ArrayRef<Value *> Indices) const { int64_t Result = 0; generic_gep_type_iterator<Value* const*> GTI = gep_type_begin(ElemTy, Indices), GTE = gep_type_end(ElemTy, Indices); for (; GTI != GTE; ++GTI) { Value *Idx = GTI.getOperand(); if (StructType *STy = GTI.getStructTypeOrNull()) { assert(Idx->getType()->isIntegerTy(32) && "Illegal struct idx"); unsigned FieldNo = cast<ConstantInt>(Idx)->getZExtValue(); // Get structure layout information... const StructLayout *Layout = getStructLayout(STy); // Add in the offset, as calculated by the structure layout info... Result += Layout->getElementOffset(FieldNo); } else { // Get the array index and the size of each array element. if (int64_t arrayIdx = cast<ConstantInt>(Idx)->getSExtValue()) Result += arrayIdx * getTypeAllocSize(GTI.getIndexedType()); } } return Result; } /// getPreferredAlignment - Return the preferred alignment of the specified /// global. This includes an explicitly requested alignment (if the global /// has one). unsigned DataLayout::getPreferredAlignment(const GlobalVariable *GV) const { unsigned GVAlignment = GV->getAlignment(); // If a section is specified, always precisely honor explicit alignment, // so we don't insert padding into a section we don't control. if (GVAlignment && GV->hasSection()) return GVAlignment; // If no explicit alignment is specified, compute the alignment based on // the IR type. If an alignment is specified, increase it to match the ABI // alignment of the IR type. // // FIXME: Not sure it makes sense to use the alignment of the type if // there's already an explicit alignment specification. Type *ElemType = GV->getValueType(); unsigned Alignment = getPrefTypeAlignment(ElemType); if (GVAlignment >= Alignment) { Alignment = GVAlignment; } else if (GVAlignment != 0) { Alignment = std::max(GVAlignment, getABITypeAlignment(ElemType)); } // If no explicit alignment is specified, and the global is large, increase // the alignment to 16. // FIXME: Why 16, specifically? if (GV->hasInitializer() && GVAlignment == 0) { if (Alignment < 16) { // If the global is not external, see if it is large. If so, give it a // larger alignment. if (getTypeSizeInBits(ElemType) > 128) Alignment = 16; // 16-byte alignment. } } return Alignment; } /// getPreferredAlignmentLog - Return the preferred alignment of the /// specified global, returned in log form. This includes an explicitly /// requested alignment (if the global has one). unsigned DataLayout::getPreferredAlignmentLog(const GlobalVariable *GV) const { return Log2_32(getPreferredAlignment(GV)); }
[ "ogabbay@kernel.org" ]
ogabbay@kernel.org
dbbbe7d6b5ee96478d8989779fc74195d729ffbc
037d518773420f21d74079ee492827212ba6e434
/blazetest/src/mathtest/dmatdmatschur/DDaMDa.cpp
3e58d97bd3a81d61873a971d95c202c2025d7b69
[ "BSD-3-Clause" ]
permissive
chkob/forked-blaze
8d228f3e8d1f305a9cf43ceaba9d5fcd603ecca8
b0ce91c821608e498b3c861e956951afc55c31eb
refs/heads/master
2021-09-05T11:52:03.715469
2018-01-27T02:31:51
2018-01-27T02:31:51
112,014,398
0
0
null
null
null
null
UTF-8
C++
false
false
3,998
cpp
//================================================================================================= /*! // \file src/mathtest/dmatdmatschur/DDaMDa.cpp // \brief Source file for the DDaMDa dense matrix/dense matrix Schur product math test // // Copyright (C) 2012-2018 Klaus Iglberger - All Rights Reserved // // This file is part of the Blaze library. You can redistribute it and/or modify it under // the terms of the New (Revised) BSD License. Redistribution and use in source and binary // forms, with or without modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list // of conditions and the following disclaimer in the documentation and/or other materials // provided with the distribution. // 3. Neither the names of the Blaze development group nor the names of its contributors // may be used to endorse or promote products derived from this software without specific // prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH // DAMAGE. */ //================================================================================================= //************************************************************************************************* // Includes //************************************************************************************************* #include <cstdlib> #include <iostream> #include <blaze/math/DiagonalMatrix.h> #include <blaze/math/DynamicMatrix.h> #include <blazetest/mathtest/Creator.h> #include <blazetest/mathtest/dmatdmatschur/OperationTest.h> #include <blazetest/system/MathTest.h> //================================================================================================= // // MAIN FUNCTION // //================================================================================================= //************************************************************************************************* int main() { std::cout << " Running 'DDaMDa'..." << std::endl; using blazetest::mathtest::TypeA; try { // Matrix type definitions typedef blaze::DiagonalMatrix< blaze::DynamicMatrix<TypeA> > DDa; typedef blaze::DynamicMatrix<TypeA> MDa; // Creator type definitions typedef blazetest::Creator<DDa> CDDa; typedef blazetest::Creator<MDa> CMDa; // Running tests with small matrices for( size_t i=0UL; i<=9UL; ++i ) { RUN_DMATDMATSCHUR_OPERATION_TEST( CDDa( i ), CMDa( i, i ) ); } // Running tests with large matrices RUN_DMATDMATSCHUR_OPERATION_TEST( CDDa( 67UL ), CMDa( 67UL, 67UL ) ); RUN_DMATDMATSCHUR_OPERATION_TEST( CDDa( 128UL ), CMDa( 128UL, 128UL ) ); } catch( std::exception& ex ) { std::cerr << "\n\n ERROR DETECTED during dense matrix/dense matrix Schur product:\n" << ex.what() << "\n"; return EXIT_FAILURE; } return EXIT_SUCCESS; } //*************************************************************************************************
[ "klaus.iglberger@gmail.com" ]
klaus.iglberger@gmail.com
f11ab9a14d5c7eb816404542b4a1d697f8c090aa
3569a7ffe4fde10dacc3967f6bb1b7a43e156b11
/examples/ping_pong.cpp
d8ca4c258aa2f3b37f4494972830364855e8c690
[]
no_license
PlumpMath/cosche
afb93cf006f17eb36c9754e3441e161cf5e21434
f177ea686c559717bb33107bb5ccce20086fe649
refs/heads/master
2021-01-20T09:54:24.040850
2016-10-02T09:08:05
2016-10-02T09:08:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,782
cpp
#include "scheduler.hpp" #include "cycle.hpp" #include "task.hpp" #include <iostream> #include <cstdlib> #include <future> #include <chrono> int main() { cosche::Scheduler scheduler; //scheduler.reserveTasks<void>(2); auto ping = scheduler.getNewTask<void>(); auto pong = scheduler.getNewTask<void>(); ping ( [&]() { std::cout << "ping" << std::endl; pong.detach(ping); ping.attach(pong); std::cout << "ping" << std::endl; ping.release(); // DO NOT use as it does not register // an edge in the dependency graph ping.wait(pong.getFuture()); ping.waitFor(std::chrono::seconds(1), std::async(std::launch::async, []() { std::this_thread::sleep_for(std::chrono::seconds(2)); std::cout << "task" << std::endl; } ) ); std::cout << "ping" << std::endl; } ); pong ( [&]() { std::cout << "pong" << std::endl; //pong.throwing(std::runtime_error("throw !")); ping.detach(pong); pong.attach(ping); std::cout << "pong" << std::endl; } ); ping.onCycle([]() { std::cerr << "ping belongs to a cycle" << std::endl; }); pong.onCycle([]() { std::cerr << "pong belongs to a cycle" << std::endl; }); pong.attach(ping); try { scheduler.run(); } catch (const cosche::Cycle& cycle) { std::cerr << "The scheduler ended on a cycle !" << std::endl; cycle(); exit(EXIT_FAILURE); } return EXIT_SUCCESS; }
[ "camille.brugel@openmailbox.org" ]
camille.brugel@openmailbox.org
28a6bf19c6fea3a22bb0bec4a078d2b680dcab3f
f9e9f62e77407c1554e500e9b823fcf78fbcda96
/src/argo_rc/argo_rc_lib.hpp
de8dee2eb4e22156e363a27aa26580f22a8fbe08
[]
no_license
DavidFair/argo_arduino
bd4534ef792ba70b9a02f830f99b3583b8487083
f0a399f293fc1c8ced3c5c66a76aa437500dd309
refs/heads/master
2021-03-24T12:50:55.916790
2018-04-26T20:09:32
2018-04-26T20:09:32
121,495,519
0
0
null
null
null
null
UTF-8
C++
false
false
3,195
hpp
#ifndef ARGO_RC_LIB_H_ #define ARGO_RC_LIB_H_ #include <stdint.h> #include "ArduinoInterface.hpp" #include "Encoder.hpp" #include "PidController.hpp" #include "SerialComms.hpp" #include "Timer.hpp" #include "move.hpp" namespace ArgoRcLib { /// Implements main loop to be executed on the vehicle class ArgoRc { public: /// Constructs an object which uses the given hardwareInterface explicit ArgoRc(Hardware::ArduinoInterface &hardwareInterface, bool usePingTimeout = true); ~ArgoRc() = default; // Disable copy constructors that way we don't get temporaries ArgoRc(ArgoRc &) = delete; ArgoRc operator=(ArgoRc &) = delete; // Move constructors - used in unit tests ArgoRc(ArgoRc &&other) : m_usePingTimeout(other.m_usePingTimeout), m_pingTimer(Libs::move(other.m_pingTimer)), m_serialOutputTimer(Libs::move(other.m_serialOutputTimer)), m_hardwareInterface(other.m_hardwareInterface), m_encoders(Libs::move(other.m_encoders)), m_commsObject(Libs::move(other.m_commsObject)), m_pidController(Libs::move(other.m_pidController)) {} ArgoRc &operator=(ArgoRc &&other) { m_hardwareInterface = other.m_hardwareInterface; m_encoders = Libs::move(other.m_encoders); m_commsObject = Libs::move(other.m_commsObject); m_pidController = Libs::move(other.m_pidController); return *this; } /// Sets the various pins and serial line up void setup(); /// Switches relays ready to move forward left void forward_left(); /// Switches relays ready to move forward right void forward_right(); /// Switches relays ready to move reverse left void reverse_left(); /// Switches relays ready to move reverse right void reverse_right(); /// Switches relays to engage the footswitch on for driving void footswitch_on(); /// Switches relays to disengage the footswitch void footswitch_off(); /// Main loop which controls the vehicle void loop(); /// Switches all relays off to a safe state void direction_relays_off(); private: /// Applies the specified PWM targets to the motors void applyPwmOutput(const PwmTargets &pwmValues); /// Calculates the target speeds based on RC velocity and angular momentum Hardware::WheelSpeeds calculateVelocities(int velocity, int angularMomentum); /// Reads the current speed targets whilst using remote control Hardware::WheelSpeeds mapRcInput(); /// Sets the digital pin modes to their apppropriate values void setupDigitalPins(); /// Holds whether pings are considered for stopping the vehicle const bool m_usePingTimeout; /// Time till the next ping is sent Libs::Timer m_pingTimer; /// Time until the next serial output is sent Libs::Timer m_serialOutputTimer; /// Reference to the Arduino hardware Hardware::ArduinoInterface &m_hardwareInterface; /// Object which interfaces to the device encoders Hardware::Encoder m_encoders; /// Object which handles serial communications for the vehicle SerialComms m_commsObject; /// Object which handles calculating PWM values under ROS control PidController m_pidController; }; } // namespace ArgoRcLib #endif // ARGO_RC_LIB_H_
[ "DavidFair@users.noreply.github.com" ]
DavidFair@users.noreply.github.com
200153ea4cffa60b81e63921b3b3979b2acb341e
25d77f8535bf00ecebc0755b41d8fe60390daf85
/TILE/src/LYSimPrimaryGeneratorAction.cc
d3ed1ef164809cf92e316f47e4f98987c0a963f8
[]
no_license
umd-fire-spd/HGCal-Dimple-Tile
ae27cd658d71141cb2349b10b93d009e6c25d1e8
bc4b333a735415f8c30d551559b75accde2ed1d8
refs/heads/master
2020-05-14T22:16:25.910594
2019-02-25T15:30:01
2019-02-25T15:30:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,218
cc
// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // // $Id$ // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "Analysis.hh" #include "LYSimPrimaryGeneratorAction.hh" #include "LYSimDetectorConstruction.hh" #include "LYSimPrimaryGeneratorMessenger.hh" #include "Randomize.hh" #include "G4Event.hh" #include "G4GeneralParticleSource.hh" #include "G4ParticleTypes.hh" #include "G4ParticleTable.hh" #include "G4ParticleDefinition.hh" #include "G4UnitsTable.hh" #include "G4SystemOfUnits.hh" #include "G4RandomDirection.hh" #include "G4TransportationManager.hh" #include <CLHEP/Units/PhysicalConstants.h> //#include "G4OpticalPhoton.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... LYSimPrimaryGeneratorAction::LYSimPrimaryGeneratorAction(LYSimDetectorConstruction* det) { std::cout<<"[LYSIM] entering LYSIMPrimaryGeneratorAction"<<std::endl; fDetector = det; fprimarygeneratorMessenger = new LYSimPrimaryGeneratorMessenger(this); particleSource = new G4GeneralParticleSource(); source000_toggle=false; angle000_toggle=false; G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); G4ParticleDefinition* particle = G4OpticalPhoton::OpticalPhotonDefinition(); particleSource->SetParticleDefinition(particle); particleSource->SetParticleTime(0.0*ns); G4ThreeVector point1 (0.*mm,0.*mm,0.*mm); particleSource->SetParticlePosition(point1); //particleSource->SetParticleEnergy(2.95*eV); //particleSource->SetParticleMomentumDirection(G4ThreeVector (0.,0.,1.)); G4ThreeVector meme =particleSource->GetParticlePosition(); std::cout<<"[LYSIM] set default particle position to "<<meme.x()<<","<<meme.y()<<","<<meme.z()<<std::endl; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... LYSimPrimaryGeneratorAction::~LYSimPrimaryGeneratorAction() { delete particleSource; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void LYSimPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) { if (particleSource->GetParticleDefinition()->GetParticleName() == "opticalphoton") { SetOptPhotonPolar(); } //G4ThreeVector pos = particleSource->GetParticlePosition(); //std::cout << "XYZXYZXYZ " << pos.x()<<" "<<pos.y()<<" "<<pos.z() << std::endl; std::string name="World"; int icnt=0; G4ThreeVector point1(0.*mm,0.*mm,0.*mm); if(!source000_toggle) { while((name!="Rod")&&(icnt<10)) { if(icnt!=0) std::cout<<"rethrowing since name is "<<name<<" at coord "<<point1.x()<<","<<point1.y()<<","<<point1.z()<<std::endl; G4double xx = fDetector->GetScintSizeX()*(-0.5+G4UniformRand()); G4double yy = fDetector->GetScintSizeY()*(-0.5+G4UniformRand()); G4double zz = fDetector->GetScintThickness()*(-0.5+G4UniformRand()); point1.setX(xx); point1.setY(yy); point1.setZ(zz); // check if it is in scintillator G4VPhysicalVolume* pv = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->LocateGlobalPointAndSetup(point1, (const G4ThreeVector*)0,false, true ); name=pv->GetName(); icnt++; } if(icnt==10) std::cout<<"Danger Danger Will Robinson"<<std::endl; } particleSource->SetParticlePosition(point1); // // set photon direction randomly G4ThreeVector Direction(0.,0.,1.); if(!angle000_toggle) { double phi = pi*G4UniformRand(); double costheta = -1+2.*G4UniformRand(); double sintheta= sqrt(1.-costheta*costheta); Direction.setX(cos(phi)*sintheta); Direction.setY(sin(phi)*sintheta); Direction.setZ(costheta); } //particleSource->SetParticleMomentumDirection(Direction); //std::cout<<" photon position is "<<point1.x()<<","<<point1.y()<<","<<point1.z()<<" and direction is "<<Direction.x()<<","<<Direction.y()<<","<<Direction.z()<<std::endl; particleSource->GeneratePrimaryVertex(anEvent); //Analysis //Analysis::GetInstance()->AddPhotonCount(1); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //Photon polarization is randomized void LYSimPrimaryGeneratorAction::SetOptPhotonPolar() { G4double angle = G4UniformRand() * 360.0*deg; SetOptPhotonPolar(angle); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void LYSimPrimaryGeneratorAction::SetOptPhotonPolar(G4double angle) { if (particleSource->GetParticleDefinition()->GetParticleName() == "opticalphoton") { G4ThreeVector normal (1., 0., 0.); G4ThreeVector kphoton = particleSource->GetParticleMomentumDirection(); G4ThreeVector product = normal.cross(kphoton); G4double modul2 = product*product; G4ThreeVector e_perpend (0., 0., 1.); if (modul2 > 0.) e_perpend = (1./std::sqrt(modul2))*product; G4ThreeVector e_paralle = e_perpend.cross(kphoton); G4ThreeVector polar = std::cos(angle)*e_paralle + std::sin(angle)*e_perpend; particleSource->SetParticlePolarization(polar); } } const G4ThreeVector LYSimPrimaryGeneratorAction::GetSourcePosition() { G4ThreeVector pos = particleSource->GetParticlePosition(); return pos; } const G4ThreeVector LYSimPrimaryGeneratorAction::GetParticleMomentumDirection() { G4ThreeVector p = particleSource->GetParticleMomentumDirection(); return p; } //....oooOO-1OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
[ "noreply@github.com" ]
noreply@github.com
90ba32fcc74901393d2d022cbe3c12b98207d2a2
020d93bf1bacc3edaff58445076cd4f4c7fd15b9
/CloudJudge/L14/Rational.cpp
cf067284f929bd9f708647719b60263a2861299b
[]
no_license
mushrooms1121/OOP
63ac63b82ea8a5221831d0cc32841f61382af31c
8883c9195e3f673d29e1dd31bab763d2225c155d
refs/heads/master
2022-11-05T14:52:18.651856
2020-06-23T18:28:17
2020-06-23T18:28:17
259,918,824
0
0
null
null
null
null
UTF-8
C++
false
false
3,837
cpp
#include"Rational.h" Rational::Rational(int numerator, int denominator) :numerator(0), denominator(0) { int factor = gcd(numerator, denominator); this->numerator = ((denominator > 0 ? 1 : 0) * numerator / factor); this->denominator = abs(denominator) / factor; } int Rational::getNumerator() const { return numerator; } int Rational::getDenominator() const { return denominator; } int Rational::gcd(int n, int d) { int n1 = abs(n); int n2 = abs(d); int gcd = 1; for (int i = 1; i <= n1 && i <= n2; i++) { if (n1 % i == 0 && n2 % i == 0) gcd = i; } return gcd; } Rational Rational::operator+(const Rational& r2) const { int n = numerator * r2.getDenominator() + denominator * r2.getNumerator(); int d = denominator * r2.getDenominator(); return Rational(n, d); } Rational Rational::operator-(const Rational& r2) const { int n = numerator * r2.getDenominator() - denominator * r2.getNumerator(); int d = denominator * r2.getDenominator(); return Rational(n, d); } Rational Rational::operator*(const Rational& r2) const { int n = numerator * r2.getNumerator(); int d = denominator * r2.getDenominator(); return Rational(n, d); } Rational Rational::operator/(const Rational& r2) const { int n = numerator * r2.getDenominator(); int d = denominator * r2.numerator; return Rational(n, d); } int Rational::compareTo(const Rational& r2) const { Rational temp = *this - r2; if (temp.getNumerator() == 0) return 0; else if (temp.getNumerator() < 0) return -1; else return 1; } bool Rational::operator<(const Rational& r2) const { return (compareTo(r2) < 0); } bool Rational::operator<=(const Rational& r2) const { return (compareTo(r2) <= 0); } bool Rational::operator>=(const Rational& r2) const { return (compareTo(r2) >= 0); } bool Rational::operator==(const Rational& r2)const { return (compareTo(r2) == 0); } bool Rational::operator!=(const Rational& r2) const { return (compareTo(r2) != 0); } bool Rational::operator<<(const Rational& r2) { return (compareTo(r2) << 0); } bool Rational::operator>>(const Rational& r2) { return (compareTo(r2) >> 0); } int Rational::operator[](int num) { if (num == 0) return numerator; else return denominator; } Rational Rational::operator+=(const Rational& r2) { Rational temp = *this + r2; return temp; } Rational Rational::operator-=(const Rational& r2) { Rational temp = *this - r2; return temp; } Rational Rational::operator*=(const Rational& r2) { Rational temp = *this * r2; return temp; } Rational Rational::operator/=(const Rational& r2) { Rational temp = *this / r2; return temp; } Rational Rational::operator++(int num) { Rational temp(numerator, denominator); numerator += denominator; return temp; } Rational Rational::operator--(int num) { Rational temp(numerator, denominator); numerator -= denominator; return temp; } Rational& Rational::operator++() { numerator += denominator; return *this; } Rational& Rational::operator--() { numerator -= denominator; return *this; } string Rational::toString() const { stringstream ss; ss << numerator; if (denominator > 1) ss << "/" << denominator; return ss.str(); } void Rational::compareToVoid(const Rational& r2) { if (compareTo(r2) == 0) cout << numerator << "/" << denominator << "=" << r2.toString(); else if (compareTo(r2) < 0) cout << numerator << "/" << denominator << "<" << r2.toString(); else cout << numerator << "/" << denominator << ">" << r2.toString(); }
[ "noreply@github.com" ]
noreply@github.com
00d284c881016fe6a7e04725ae7c4defb821a6c6
4e8691216558f94d128c0103bef689586d1a5743
/Lab's_Cit/Client_lab's/Client_lab_1/client.cpp
4f4ada3ec3f54e596850f21dc7526096ed11255a
[]
no_license
MacDouglas/labs_from_university
c8fe28dd85f4ee4e4fbd1bbc6f2336af6bc09de4
cbcc5a0d5ba4031d42792bafa56f11f98c1bf91b
refs/heads/master
2022-04-07T12:43:32.840361
2020-02-27T02:28:18
2020-02-27T02:28:18
217,210,693
0
0
null
null
null
null
UTF-8
C++
false
false
773
cpp
#include "client.h" using namespace std; namespace clients_objects { client::client(int port) { WSADATA WsaData; err = WSAStartup(0x0101, &WsaData); if (err == SOCKET_ERROR) { printf("WSAStartup() failed: %ld\n", GetLastError()); throw "Error with a creation socked"; } int s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); struct sockaddr_in sin; sin.sin_family = AF_INET; sin.sin_port = htons(port); inet_pton(AF_INET, "192.168.43.97", &(sin.sin_addr.S_un.S_addr)); err = connect(s, (const struct sockaddr*) & sin, sizeof(sin)); int sz = recv(s, buf, sizeof(buf), 0); //cout << "Buf = " << buf << endl; string str = (char*)buf; param = stod(str); closesocket(s); } double client::get_param() const { return param; } }
[ "stalkergta-99@mail.ru" ]
stalkergta-99@mail.ru
10cc4065ed9fce25e1ecb7b3d8768016661e6aad
851f81f109966962af55bee8f231e13b43baed8d
/КСиС/Server/Server/Server.cpp
af8605839d97d4286984c1dccab6a811d927dceb
[]
no_license
Beeelzebub/labs
0a0829ad8c476fd9ae0be2429e5a96bc09f9713b
bb5f0abd6b5a02450a0b0a0ceedab179d8de5582
refs/heads/master
2022-10-24T21:13:42.634382
2020-06-19T13:12:57
2020-06-19T13:12:57
259,646,792
0
0
null
null
null
null
UTF-8
C++
false
false
907
cpp
#pragma comment(lib, "ws2_32.lib") #include <winsock2.h> #include <iostream> #pragma warning(disable: 4996) int main() { WSAData wsaData; WORD DLLVersion = MAKEWORD(2, 1); if (WSAStartup(DLLVersion, &wsaData) != 0) { std::cout << "Error" << std::endl; exit(1); } SOCKADDR_IN addr; int sizeofaddr = sizeof(addr); addr.sin_addr.s_addr = inet_addr("192.168.1.40"); addr.sin_port = htons(1111); addr.sin_family = AF_INET; SOCKET sListen = socket(AF_INET, SOCK_STREAM, NULL); bind(sListen, (SOCKADDR*)&addr, sizeof(addr)); listen(sListen, SOMAXCONN); SOCKET newConnection; newConnection = accept(sListen, (SOCKADDR*)&addr, &sizeofaddr); if (newConnection == 0) { std::cout << "Error #2\n"; } else { std::cout << "Client Connected!\n"; char msg[256] = "Hello. It`s my first network program!"; send(newConnection, msg, sizeof(msg), NULL); } system("pause"); return 0; }
[ "43516722+Beeelzebub@users.noreply.github.com" ]
43516722+Beeelzebub@users.noreply.github.com
6759f83862003f3aab5ee0c516e9741a2fa2b580
830db549df5998b80ddb05e730439ceb4d8d5733
/ext_deepmimic01/DeepMimicCore/scenes/SceneImitateTargetHeading.cpp
8c56f7abfee4866a0cbef90babbbcd5aacb6ea0f
[ "MIT" ]
permissive
TwTravel/Dem2Ue4
9d9d14ff50f6a99ce2a5842f1ef19a445d4d63e2
0dbbbab01f0ccfedbbf6a7c72103475050799119
refs/heads/master
2020-05-16T01:22:06.554419
2019-04-22T01:17:02
2019-04-22T01:17:02
182,600,663
0
0
null
null
null
null
UTF-8
C++
false
false
8,136
cpp
#include "SceneImitateTargetHeading.h" #include "SceneImitate.h" #include <iostream> cSceneImitateTargetHeading::cSceneImitateTargetHeading() { mEnableRandRotReset = false; mSyncCharRootPos = true; mSyncCharRootRot = false; mEnableRootRotFail = false; mHoldEndFrame = 0; mSceneGoal<< 0.5, 0.5; } cSceneImitateTargetHeading::~cSceneImitateTargetHeading() { } std::string cSceneImitateTargetHeading::GetName() const { return "Imitate_Target_Heading"; } const std::shared_ptr<cKinCharacter>& cSceneImitateTargetHeading::GetKinChar() const { return mKinChar; } const std::vector<std::shared_ptr<cKinCharacter>>& cSceneImitateTargetHeading::GetKinChars() const { return mKinMultiChar; } void cSceneImitateTargetHeading::ParseArgs(const std::shared_ptr<cArgParser>& parser) { cRLSceneSimChar::ParseArgs(parser); parser->ParseBool("enable_rand_rot_reset", mEnableRandRotReset); parser->ParseBool("sync_char_root_pos", mSyncCharRootPos); parser->ParseBool("sync_char_root_rot", mSyncCharRootRot); parser->ParseBool("enable_root_rot_fail", mEnableRootRotFail); parser->ParseDouble("hold_end_frame", mHoldEndFrame); parser->ParseStrings("motion_files", mMotionFiles); for(size_t i =0; i<mMotionFiles.size(); ++i) { std::cout << mMotionFiles[i] << std::endl; } } void cSceneImitateTargetHeading::Init() { for(size_t i=0; i<mKinMultiChar.size(); ++i) { mKinMultiChar[i].reset(); } mKinChar.reset(); BuildKinChars(); int i = mRand.RandInt(0, mKinMultiChar.size()); // printf("%s with the motion %i. \n", "Init all characters", i); mKinChar = mKinMultiChar[i]; cRLSceneSimChar::Init(); InitJointWeights(); } double cSceneImitateTargetHeading::CalcReward(int agent_id) const { const cSimCharacter* sim_char = GetAgentChar(agent_id); bool fallen = HasFallen(*sim_char); double r = 0; int max_id = 0; if (!fallen) { r = CalcRewardImitateTargetHeading(*sim_char, mKinMultiChar); } return r; } double cSceneImitateTargetHeading::CalcRewardImitateTargetHeading(const cSimCharacter& sim_char, const std::vector<std::shared_ptr<cKinCharacter>>& ref_chars) const { double i_reward = 0; double reward = 0; double temp_r = 0; for (size_t i = 0; i<mKinMultiChar.size(); ++i) { temp_r = cSceneImitate::CalcRewardImitate(sim_char, *mKinMultiChar[i]); i_reward = std::max(i_reward, temp_r); // printf("%s %lu's reward is %.4f\n", "Motion", i, temp_r); } double g_scale = 2.5; double limit_vel = 1.0; double err_scale = 1.0; // std::cout << "mSceneGoal\n" << mSceneGoal << std::endl; tVector dir(mSceneGoal(0), 0.0, mSceneGoal(1), 0.0); tVector unit_dir = dir / dir.norm(); tVector com_vel0_world = sim_char.CalcCOMVel(); double g_diff = std::max(0.0, limit_vel - com_vel0_world.dot(unit_dir)); double g_err = g_diff * g_diff; double g_reward = exp(-err_scale * g_scale * g_err); double i_w = 0.7; double g_w = 0.3; reward = i_w * i_reward + g_w * g_reward; return reward; } void cSceneImitateTargetHeading::BuildKinChars() { bool succ = BuildKinCharacters(mKinMultiChar); if (!succ) { printf("Failed to build kin characters\n"); assert(false); } } bool cSceneImitateTargetHeading::BuildKinCharacters(std::vector<std::shared_ptr<cKinCharacter>>& out_multi_char) const { bool succ = false; for (size_t i = 0; i < mMotionFiles.size(); ++i) { auto kin_char = std::shared_ptr<cKinCharacter>(new cKinCharacter()); const cSimCharacter::tParams& sim_char_params = mCharParams[0]; cKinCharacter::tParams kin_char_params; kin_char_params.mID = i; kin_char_params.mCharFile = sim_char_params.mCharFile; kin_char_params.mOrigin = sim_char_params.mInitPos; kin_char_params.mLoadDrawShapes = false; kin_char_params.mMotionFile = mMotionFiles[i]; succ = kin_char->Init(kin_char_params); if (succ) { out_multi_char.push_back(kin_char); printf("Motion %i 's duration is %.5f\n", i, kin_char->GetMotionDuration() ); } else { return false; } } return succ; } void cSceneImitateTargetHeading::UpdateCharacters(double timestep) { count++; // printf("Updating: %i, %.8f, \n", int(count / 20), timestep * 20); UpdateKinMultiChar(timestep); cRLSceneSimChar::UpdateCharacters(timestep); } void cSceneImitateTargetHeading::UpdateKinMultiChar(double timestep) { for (size_t i=0; i<mKinMultiChar.size(); ++i) { const auto& kin_char = mKinMultiChar[i]; double prev_phase = kin_char->GetPhase(); kin_char->Update(timestep); double curr_phase = kin_char->GetPhase(); if (curr_phase < prev_phase) { const auto& sim_char = GetCharacter(); SyncKinCharNewCycle(*sim_char, *kin_char); } } } void cSceneImitateTargetHeading::ResetCharacters() { int i = mRand.RandInt(0, mKinMultiChar.size()); // printf("%lu\n", mKinMultiChar.size()); // printf("%s with the motion %i. \n", "Reset all characters", i); mKinChar.reset(); mKinChar = mKinMultiChar[i]; cRLSceneSimChar::ResetCharacters(); ResetKinMultiChar(); if (EnableSyncChar()) { SyncCharacters(); } } void cSceneImitateTargetHeading::ResetKinMultiChar() { double rand_time = CalcRandKinResetTime(); const cSimCharacter::tParams& char_params = mCharParams[0]; double rand_theta = mRand.RandDouble(-M_PI, M_PI); // const auto& kin_char = GetKinChar(); for(size_t i =0; i<mKinMultiChar.size(); ++i) { const auto& kin_char = mKinMultiChar[i]; kin_char->Reset(); kin_char->SetOriginRot(tQuaternion::Identity()); kin_char->SetOriginPos(char_params.mInitPos); // reset origin kin_char->SetTime(rand_time); kin_char->Pose(rand_time); if (EnabledRandRotReset()) { kin_char->RotateOrigin(cMathUtil::EulerToQuaternion(tVector(0, rand_theta, 0, 0))); } } } // void cSceneImitateTargetHeading::RecordGoal(int agent_id, Eigen::VectorXd& out_goal) const // { // const auto& ctrl = GetController(agent_id); // ctrl->RecordGoal(out_goal); // } // int cSceneImitateTargetHeading::GetGoalSize(int agent_id) const // { // const auto& ctrl = GetController(agent_id); // return ctrl->GetGoalSize(); // } // void cSceneImitateTargetHeading::BuildGoalOffsetScale(int agent_id, Eigen::VectorXd& out_offset, Eigen::VectorXd& out_scale) const // { // const auto& ctrl = GetController(agent_id); // ctrl->BuildGoalOffsetScale(out_offset, out_scale); // } // void cSceneImitateTargetHeading::BuildGoalNormGroups(int agent_id, Eigen::VectorXi& out_groups) const // { // const auto& ctrl = GetController(agent_id); // ctrl->BuildGoalNormGroups(out_groups); // } void cSceneImitateTargetHeading::SyncKinCharRoot() { const auto& sim_char = GetCharacter(); tVector sim_root_pos = sim_char->GetRootPos(); double sim_heading = sim_char->CalcHeading(); for (size_t i=0; i<mKinMultiChar.size(); ++i) { const auto& kin_char = mKinMultiChar[i]; double kin_heading = kin_char->CalcHeading(); tQuaternion drot = tQuaternion::Identity(); if (mSyncCharRootRot) { drot = cMathUtil::AxisAngleToQuaternion(tVector(0, 1, 0, 0), sim_heading - kin_heading); } kin_char->RotateRoot(drot); kin_char->SetRootPos(sim_root_pos); } } void cSceneImitateTargetHeading::RecordGoal(int agent_id, Eigen::VectorXd& out_goal) const { out_goal = mSceneGoal; } int cSceneImitateTargetHeading::GetGoalSize(int agent_id) const { return 2; } void cSceneImitateTargetHeading::BuildGoalOffsetScale(int agent_id, Eigen::VectorXd& out_offset, Eigen::VectorXd& out_scale) const { int goal_size = GetGoalSize(agent_id); out_offset = Eigen::VectorXd::Zero(goal_size); out_scale = Eigen::VectorXd::Ones(goal_size); } void cSceneImitateTargetHeading::BuildGoalNormGroups(int agent_id, Eigen::VectorXi& out_groups) const { int goal_size = GetGoalSize(agent_id); int gNormGroupSingle = 0; out_groups = gNormGroupSingle * Eigen::VectorXi::Ones(goal_size); } void cSceneImitateTargetHeading::SetGoal(int agent_id, const Eigen::VectorXd& out_goal) { printf("%s\n", " In the Target Heading set goal."); int goal_size = GetGoalSize(agent_id); if(out_goal.size() == goal_size) { mSceneGoal = out_goal / out_goal.norm(); } else { printf("Wrong goal size.\n"); assert(false); } }
[ "twtravel@126.com" ]
twtravel@126.com
8d412e7aa677f48cff2d4312418d74e2a47d72d7
eb2abebe422deeec4041153a94f50075fd9e6be3
/lectures/inheritance/virtual.cpp
d830071568592b5540b262217c41f3719b6c05ca
[]
no_license
apachalieva/advanced_programming
2592295cc34daf2967f81041c4284896fd39e4bc
076894eb4df8024abebb031693f2df42e90bb244
refs/heads/master
2020-05-29T11:57:43.081744
2014-01-30T14:32:06
2014-01-30T14:32:06
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,265
cpp
/** @file * This file is part of the Advanced Progamming lecture. * * @author Alexander Breuer (breuera AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Dipl.-Math._Alexander_Breuer) * * @section LICENSE * Copyright (c) 2014 * Technische Universitaet Muenchen * Department of Informatics * Chair of Scientific Computing * http://www5.in.tum.de/ * * @section DESCRIPTION * Example of inheritance with interfaces and implementations. **/ #define _USE_MATH_DEFINES #include <cmath> #undef _USE_MATH_DEFINES #include <iostream> class Shape { //private: int m_color; public: Shape( int i_color=0 ): m_color( i_color ) {}; virtual ~Shape(){}; int getColor() const { return m_color; }; // purely virtual function virtual double getSurfaceArea() const = 0; // virtual function with default implementation //virtual double getSurfaceArea() const { return 0.0; }; }; class Circle: public Shape { //private: double m_radius; public: Circle( double i_radius ): Shape(), m_radius( i_radius ) { std::cout << "constructed a circle, radius: " << m_radius << std::endl; }; virtual ~Circle(){}; virtual double getSurfaceArea() const { return M_PI * m_radius * m_radius; }; // allowed, but usually bad practice.. // int getColor() const { return -1; }; }; class Rectangle: public Shape { //private: double m_width, m_height; public: Rectangle( double i_width, double i_height, int i_color = 0 ): Shape( i_color), m_width( i_width ), m_height( i_height) { std::cout << "constructed rectangle, width/height: " << m_width << "/" << m_height << std::endl; }; virtual ~Rectangle{}; virtual double getSurfaceArea() const { return m_width * m_height; }; }; int main() { Circle l_circle( 2.3 ); Rectangle l_rectangle( 4.2, 1.8, 3 ); Shape* l_shapes[2]; l_shapes[0] = &l_circle; l_shapes[1] = &l_rectangle; for( int l_shapeId = 0; l_shapeId < 2; l_shapeId ++ ) { std::cout << l_shapes[l_shapeId]->getColor() << ", " << l_shapes[l_shapeId]->getSurfaceArea() << std::endl; } // not allowed for virtual function w/o default implementation //Shape l_shape1(); return 0; }
[ "breuer@mytum.de" ]
breuer@mytum.de
cdfb1fd85ef8cbad5eb2b04b4ae20a1d0dae24cc
0bcf6cf143f30781288d67d23ef3fa5efdf10b94
/cs16/lab08/linkedListFuncs.cpp
9b16c0d9db3eec814539a9db22065f70ccfb6233
[]
no_license
Gopu2001/ucsb_ccs_labs
e787f2f2a330a512563cd9d1f03b09693c045278
c02ae4c698bd8e9e1662c8ad09c3ce4a504180d5
refs/heads/master
2023-01-29T18:43:20.583703
2020-12-14T21:40:22
2020-12-14T21:40:22
301,958,082
0
0
null
null
null
null
UTF-8
C++
false
false
1,884
cpp
#include <iostream> #include <string> #include <sstream> // for ostringstream #include <cassert> #include "linkedList.h" #include "linkedListFuncs.h" LinkedList * arrayToLinkedList(int *a, int size) { LinkedList * list = new LinkedList; list->head=NULL; list->tail=NULL; for (int i=0; i<size; i++) { // add array[i] to the list if ( list->head==NULL) { list->head = new Node; list->head->data = a[i]; // (*head).data = a[i]; list->head->next = NULL; list->tail = list->head; } else { list->tail->next = new Node; list->tail = list->tail->next; list->tail->next = NULL; list->tail->data = a[i]; } } return list; // return ptr to new list } // intToString converts an int to a string std::string intToString(int i) { // creates a stream like cout, cerr that writes to a string std::ostringstream oss; oss << i; return oss.str(); // return the string result } std::string arrayToString(int a[], int size) { std::ostringstream oss; // fencepost problem; first element gets no comma in front oss << "{"; if (size>0) oss << intToString(a[0]); for (int i=1; i<size; i++) { oss << "," << intToString(a[i]); } oss << "}"; return oss.str(); } // free up every node on this linked list // nice clean code thanks to @sashavolv2 (on Twitter) #woot void freeLinkedList(LinkedList * list) { Node *next; for (Node *p=list->head; p!=NULL; p=next) { next = p->next; delete p; } delete list; // returns memory to the heap (freestore) } std::string linkedListToString(LinkedList *list) { std::string result=""; for (const Node * p=list->head; p!=NULL; p=p->next) { result += "[" + intToString(p->data) + "]->"; } result += "null"; return result; }
[ "41317321+Gopu2001@users.noreply.github.com" ]
41317321+Gopu2001@users.noreply.github.com
6cca666c246533157deee3edf1136b24573e1c24
e32e47ec121d70d975bad723ca143efb0157e1fc
/Samples/Chapter 7/DisplayTable/main.cpp
2cae76062b055a0740e47d7024f4975e43638e92
[ "MIT" ]
permissive
Anil1111/COSC1436
02d781045fad38066e7f21c836566a52a53cacb4
33a607e51f2a51c70ab11a24945f3f06de50f7fc
refs/heads/master
2020-03-30T18:33:22.439731
2017-08-15T01:05:01
2017-08-15T01:05:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
894
cpp
/* * COSC 1436 * * Demonstrates enumerating a table of values. */ #include <iostream> #include <iomanip> using namespace std; const int ARRAY_SIZE = 12; //Prints out a table. void DisplayTable ( int table[][ARRAY_SIZE], int rows ) { //Display header cout << left << setw(4) << "Row"; for (int col = 0; col < ARRAY_SIZE; ++col) { cout << left << setw(4) << col + 1; }; cout << endl; //Display table for (int row = 0; row < rows; ++row) { cout << left << setw(4) << row + 1; for (int col = 0; col < ARRAY_SIZE; ++col) { cout << left << setw(4) << table[row][col]; }; cout << endl; }; }; void main ( ) { int table[ARRAY_SIZE][ARRAY_SIZE] = { 0 }; //Initialize for (int row = 0; row < ARRAY_SIZE; ++row) for (int col = 0; col < ARRAY_SIZE; ++col) table[row][col] = (row + 1) * (col + 1); //Display the table DisplayTable(table, ARRAY_SIZE); }
[ "michael.taylor769@my.tccd.edu" ]
michael.taylor769@my.tccd.edu
1188116b4e2b4d748f3a861bd78e50fcfd244b85
5456502f97627278cbd6e16d002d50f1de3da7bb
/ui/gfx/image/image_family.h
ee40898705554d946676766f0e5e1680ec0bf60f
[ "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
6,101
h
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_GFX_IMAGE_IMAGE_FAMILY_H_ #define UI_GFX_IMAGE_IMAGE_FAMILY_H_ #include <iterator> #include <map> #include <utility> #include "ui/gfx/gfx_export.h" #include "ui/gfx/image/image.h" namespace gfx { class ImageSkia; class Size; // A collection of images at different sizes. The images should be different // representations of the same basic concept (for example, an icon) at various // sizes and (optionally) aspect ratios. A method is provided for finding the // most appropriate image to fit in a given rectangle. // // NOTE: This is not appropriate for storing an image at a single logical pixel // size, with high-DPI bitmap versions; use an Image or ImageSkia for that. Each // image in an ImageFamily should have a different logical size (and may also // include high-DPI representations). class GFX_EXPORT ImageFamily { private: // An <aspect ratio, DIP width> pair. // A 0x0 image has aspect ratio 1.0. 0xN and Nx0 images are treated as 0x0. struct MapKey : std::pair<float, int> { MapKey(float aspect, int width) : std::pair<float, int>(aspect, width) {} float aspect() const { return first; } int width() const { return second; } }; public: // Type for iterating over all images in the family, in order. // Dereferencing this iterator returns a gfx::Image. class GFX_EXPORT const_iterator : std::iterator<std::bidirectional_iterator_tag, const gfx::Image> { public: const_iterator(); const_iterator(const const_iterator& other); ~const_iterator(); const_iterator& operator++() { ++map_iterator_; return *this; } const_iterator operator++(int /*unused*/) { const_iterator result(*this); ++(*this); return result; } const_iterator& operator--() { --map_iterator_; return *this; } const_iterator operator--(int /*unused*/) { const_iterator result(*this); --(*this); return result; } bool operator==(const const_iterator& other) const { return map_iterator_ == other.map_iterator_; } bool operator!=(const const_iterator& other) const { return map_iterator_ != other.map_iterator_; } const gfx::Image& operator*() const { return map_iterator_->second; } const gfx::Image* operator->() const { return &**this; } private: friend class ImageFamily; explicit const_iterator( const std::map<MapKey, gfx::Image>::const_iterator& other); std::map<MapKey, gfx::Image>::const_iterator map_iterator_; }; ImageFamily(); ~ImageFamily(); // Gets an iterator to the first image. const_iterator begin() const { return const_iterator(map_.begin()); } // Gets an iterator to one after the last image. const_iterator end() const { return const_iterator(map_.end()); } // Determines whether the image family has no images in it. bool empty() const { return map_.empty(); } // Removes all images from the family. void clear() { return map_.clear(); } // Adds an image to the family. If another image is already present at the // same size, it will be overwritten. void Add(const gfx::Image& image); // Adds an image to the family. If another image is already present at the // same size, it will be overwritten. void Add(const gfx::ImageSkia& image_skia); // Gets the best image to use in a rectangle of |width|x|height|. // Gets an image at the same aspect ratio as |width|:|height|, if possible, or // if not, the closest aspect ratio. Among images of that aspect ratio, // returns the smallest image with both its width and height bigger or equal // to the requested size. If none exists, returns the largest image of that // aspect ratio. If there are no images in the family, returns NULL. const gfx::Image* GetBest(int width, int height) const; // Gets the best image to use in a rectangle of |size|. // Gets an image at the same aspect ratio as |size.width()|:|size.height()|, // if possible, or if not, the closest aspect ratio. Among images of that // aspect ratio, returns the smallest image with both its width and height // bigger or equal to the requested size. If none exists, returns the largest // image of that aspect ratio. If there are no images in the family, returns // NULL. const gfx::Image* GetBest(const gfx::Size& size) const; // Gets an image of size |width|x|height|. If no image of that exact size // exists, chooses the nearest larger image using GetBest() and scales it to // the desired size. If there are no images in the family, returns an empty // image. gfx::Image CreateExact(int width, int height) const; // Gets an image of size |size|. If no image of that exact size exists, // chooses the nearest larger image using GetBest() and scales it to the // desired size. If there are no images in the family, returns an empty image. gfx::Image CreateExact(const gfx::Size& size) const; private: // Find the closest aspect ratio in the map to |desired_aspect|. // Ties are broken by the thinner aspect. // |map_| must not be empty. |desired_aspect| must be > 0.0. float GetClosestAspect(float desired_aspect) const; // Gets an image with aspect ratio |aspect|, at the best size for |width|. // Returns the smallest image of aspect ratio |aspect| with its width bigger // or equal to |width|. If none exists, returns the largest image of aspect // ratio |aspect|. Behavior is undefined if there is not at least one image in // |map_| of aspect ratio |aspect|. const gfx::Image* GetWithExactAspect(float aspect, int width) const; // Map from (aspect ratio, width) to image. std::map<MapKey, gfx::Image> map_; }; } // namespace gfx #endif // UI_GFX_IMAGE_IMAGE_FAMILY_H_
[ "lixiaodonglove7@aliyun.com" ]
lixiaodonglove7@aliyun.com
f7f94305cda2905d08852ff05ad2d40246b8f773
6f40de67648684c5f5112aeb550d7efb5bf8251b
/UVa/10369.cpp
92360f8463edb3f7a5d19684bc9161df04e107aa
[]
no_license
Mohib04/Competitive-Programming
91381fa5ba2ff2e9b6cf0aeee165f7cf31b43d0d
529f7db770b801eff32f2f23b31a98b1b9f35e51
refs/heads/master
2021-10-21T07:53:03.645288
2019-03-03T14:53:47
2019-03-03T14:53:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,007
cpp
#include <bits/stdc++.h> using namespace std; struct edge { int first,second; double w; edge(int uu, int vv, double ww) { first=uu; second=vv; w=ww; } bool operator < (const edge e) const { return w < e.w; } }; double dist(pair<int,int>p1, pair<int,int>p2 ) { return sqrt( (p1.first-p2.first)*(p1.first-p2.first) + (p1.second-p2.second)*(p1.second-p2.second) ); } vector<edge>edges, MSTEdges; int par[505]; int findSet(int a) { if(par[a] == a) return a; return par[a] = findSet(par[a]); } int main() { int t; cin >> t; while(t--) { int s,p; pair<int,int>coOrdinates[505]; edges.clear(); MSTEdges.clear(); cin >> s >> p; for(int i=0; i<p; i++) { int x,y; cin >> x >> y; coOrdinates[i] = make_pair(x,y); } for(int i=0; i<p; i++) { for(int j=i+1; j<p; j++) { edges.push_back(edge(i,j, dist(coOrdinates[i],coOrdinates[j]))); } } sort(edges.begin(), edges.end()); //int par[505]; for(int i=0; i<p; i++) par[i] = i; int sz = edges.size(); for(int i=0; i<sz; i++) { edge e = edges[i]; if(findSet(e.first) != findSet(e.second)) { par[ par[e.first] ] = par[e.second]; MSTEdges.push_back(e); } } int sat[505] = {0}; cout << "prothome " << MSTEdges[ MSTEdges.size() - 1 ].w << endl; int MSTSize = MSTEdges.size()-1; while(s) { bool con1 = false, con2=false; edge e = MSTEdges[MSTSize--]; cout << "top edge er weight hoilo : " << e.w << endl; if(!sat[e.first] && s>0) { sat[e.first] = 1; s--; con1 = true; cout << e.first << " 1 e dhukse " << e.second << endl; } else if(sat[e.first]) { con1 = true; cout << e.first << " 2 e dhukse " << e.second << endl; } if(!sat[e.second] && s>0) { sat[e.second] = 1; s--; con2 = true; cout << e.first << " 3 e dhukse " << e.second << endl; } else if(sat[e.second]) { con2 = true; cout << e.first << " 4 e dhukse " << e.second << endl; } if(con1 && con2) MSTEdges.pop_back();cout << e.w << endl; } while(!MSTEdges.empty()) { edge e = MSTEdges[MSTEdges.size()-1]; if(sat[ e.first ] && sat[ e.second ]) { MSTEdges.pop_back(); } else { break; } } //cout << setprecision(2) << MSTEdges[MSTSize].w << endl; if(MSTEdges.empty()) printf("0.00\n"); else printf("%.2lf\n", MSTEdges[MSTEdges.size() - 1].w); } return 0; }
[ "shariarsajib@gmail.com" ]
shariarsajib@gmail.com
3121b676bb52103ae287f81e6cd6944c51db766e
ce7326d8186d3732095047d7b40da6faece2d114
/src/qt/tradeplus_coin/receivewidget.cpp
d782614200cdd421d57c3898773acc5d6c999ab7
[ "MIT" ]
permissive
tdpsdevextreme/TradePlusCoin
e094d60c3d8d088f26bc16819194930ce39f7f6d
b3f49f72dff3c61edaed2f4be95c4dfa21893f7f
refs/heads/master
2020-09-05T18:47:52.916679
2020-07-29T07:37:59
2020-07-29T07:37:59
220,183,704
0
0
null
null
null
null
UTF-8
C++
false
false
10,772
cpp
// Copyright (c) 2019 The TradePlus_Coin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "qt/tradeplus_coin/receivewidget.h" #include "qt/tradeplus_coin/forms/ui_receivewidget.h" #include "qt/tradeplus_coin/requestdialog.h" #include "qt/tradeplus_coin/addnewcontactdialog.h" #include "qt/tradeplus_coin/qtutils.h" #include "qt/tradeplus_coin/myaddressrow.h" #include "qt/tradeplus_coin/furlistrow.h" #include "walletmodel.h" #include "guiutil.h" #include <QModelIndex> #include <QColor> #include <QDateTime> #define DECORATION_SIZE 70 #define NUM_ITEMS 3 class AddressHolder : public FurListRow<QWidget*> { public: AddressHolder(); explicit AddressHolder(bool _isLightTheme) : FurListRow(), isLightTheme(_isLightTheme){} MyAddressRow* createHolder(int pos) override{ return new MyAddressRow(); } void init(QWidget* holder,const QModelIndex &index, bool isHovered, bool isSelected) const override{ MyAddressRow *row = static_cast<MyAddressRow*>(holder); QString address = index.data(Qt::DisplayRole).toString(); QString label = index.sibling(index.row(), AddressTableModel::Label).data(Qt::DisplayRole).toString(); uint time = index.sibling(index.row(), AddressTableModel::Date).data(Qt::DisplayRole).toUInt(); QString date = (time == 0) ? "" : GUIUtil::dateTimeStr(QDateTime::fromTime_t(time)); row->updateView(address, label, date); } QColor rectColor(bool isHovered, bool isSelected) override{ return getRowColor(isLightTheme, isHovered, isSelected); } ~AddressHolder() override{} bool isLightTheme; }; ReceiveWidget::ReceiveWidget(TradePlus_CoinGUI* parent) : PWidget(parent), ui(new Ui::ReceiveWidget) { ui->setupUi(this); this->setStyleSheet(parent->styleSheet()); delegate = new FurAbstractListItemDelegate( DECORATION_SIZE, new AddressHolder(isLightTheme()), this ); // Containers setCssProperty(ui->left, "container"); ui->left->setContentsMargins(20,20,20,20); setCssProperty(ui->right, "container-right"); ui->right->setContentsMargins(0,9,0,0); // Title ui->labelTitle->setText(tr("Receive")); ui->labelSubtitle1->setText(tr("Scan the QR code or copy the address to receive TDPS.")); setCssTitleScreen(ui->labelTitle); setCssSubtitleScreen(ui->labelSubtitle1); // Address ui->labelAddress->setText(tr("No address ")); setCssProperty(ui->labelAddress, "label-address-box"); ui->labelDate->setText("Dec. 19, 2018"); setCssSubtitleScreen(ui->labelDate); ui->labelLabel->setText(""); setCssSubtitleScreen(ui->labelLabel); // Options ui->btnMyAddresses->setTitleClassAndText("btn-title-grey", "My Addresses"); ui->btnMyAddresses->setSubTitleClassAndText("text-subtitle", "List your own addresses."); ui->btnMyAddresses->layout()->setMargin(0); ui->btnMyAddresses->setRightIconClass("ic-arrow"); ui->btnRequest->setTitleClassAndText("btn-title-grey", "Create Request"); ui->btnRequest->setSubTitleClassAndText("text-subtitle", "Request payment with a fixed amount."); ui->btnRequest->layout()->setMargin(0); ui->pushButtonLabel->setText(tr("Add Label")); ui->pushButtonLabel->setLayoutDirection(Qt::RightToLeft); setCssProperty(ui->pushButtonLabel, "btn-secundary-label"); ui->pushButtonNewAddress->setText(tr("Generate Address")); ui->pushButtonNewAddress->setLayoutDirection(Qt::RightToLeft); setCssProperty(ui->pushButtonNewAddress, "btn-secundary-new-address"); ui->pushButtonCopy->setText(tr("Copy")); ui->pushButtonCopy->setLayoutDirection(Qt::RightToLeft); setCssProperty(ui->pushButtonCopy, "btn-secundary-copy"); // List Addresses setCssProperty(ui->listViewAddress, "container"); ui->listViewAddress->setItemDelegate(delegate); ui->listViewAddress->setIconSize(QSize(DECORATION_SIZE, DECORATION_SIZE)); ui->listViewAddress->setMinimumHeight(NUM_ITEMS * (DECORATION_SIZE + 2)); ui->listViewAddress->setAttribute(Qt::WA_MacShowFocusRect, false); ui->listViewAddress->setSelectionBehavior(QAbstractItemView::SelectRows); spacer = new QSpacerItem(40, 20, QSizePolicy::Maximum, QSizePolicy::Expanding); ui->btnMyAddresses->setChecked(true); ui->container_right->addItem(spacer); ui->listViewAddress->setVisible(false); // Connect connect(ui->pushButtonLabel, SIGNAL(clicked()), this, SLOT(onLabelClicked())); connect(ui->pushButtonCopy, SIGNAL(clicked()), this, SLOT(onCopyClicked())); connect(ui->pushButtonNewAddress, SIGNAL(clicked()), this, SLOT(onNewAddressClicked())); connect(ui->listViewAddress, SIGNAL(clicked(QModelIndex)), this, SLOT(handleAddressClicked(QModelIndex))); connect(ui->btnRequest, SIGNAL(clicked()), this, SLOT(onRequestClicked())); connect(ui->btnMyAddresses, SIGNAL(clicked()), this, SLOT(onMyAddressesClicked())); } void ReceiveWidget::loadWalletModel(){ if(walletModel) { this->addressTableModel = walletModel->getAddressTableModel(); this->filter = new AddressFilterProxyModel(AddressTableModel::Receive, this); this->filter->setSourceModel(addressTableModel); ui->listViewAddress->setModel(this->filter); ui->listViewAddress->setModelColumn(AddressTableModel::Address); if(!info) info = new SendCoinsRecipient(); refreshView(); // data change connect(this->addressTableModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(refreshView())); } } void ReceiveWidget::refreshView(QString refreshAddress){ try { QString latestAddress = (refreshAddress.isEmpty()) ? this->addressTableModel->getLastUnusedAddress() : refreshAddress; if (latestAddress.isEmpty()) // new default address latestAddress = QString::fromStdString(walletModel->getNewAddress("Default").ToString()); ui->labelAddress->setText(latestAddress); int64_t time = walletModel->getKeyCreationTime(CBitcoinAddress(latestAddress.toStdString())); ui->labelDate->setText(GUIUtil::dateTimeStr(QDateTime::fromTime_t(static_cast<uint>(time)))); updateQr(latestAddress); updateLabel(); } catch (const std::runtime_error& error){ ui->labelQrImg->setText(tr("No available address, try unlocking the wallet")); inform(tr("Error generating address")); } } void ReceiveWidget::updateLabel(){ if(!info->address.isEmpty()) { // Check if address label exists QString label = addressTableModel->labelForAddress(info->address); if (!label.isEmpty()) { ui->labelLabel->setVisible(true); ui->labelLabel->setText(label); ui->pushButtonLabel->setText(tr("Change Label")); }else{ ui->labelLabel->setVisible(false); } } } void ReceiveWidget::updateQr(QString address){ info->address = address; QString uri = GUIUtil::formatBitcoinURI(*info); ui->labelQrImg->setText(""); QString error; QColor qrColor("#4f322f"); QPixmap pixmap = encodeToQr(uri, error, qrColor); if(!pixmap.isNull()){ qrImage = &pixmap; ui->labelQrImg->setPixmap(qrImage->scaled(ui->labelQrImg->width(), ui->labelQrImg->height())); }else{ ui->labelQrImg->setText(!error.isEmpty() ? error : "Error encoding address"); } } void ReceiveWidget::handleAddressClicked(const QModelIndex &index){ QModelIndex rIndex = filter->mapToSource(index); refreshView(rIndex.data(Qt::DisplayRole).toString()); } void ReceiveWidget::onLabelClicked(){ if(walletModel && !isShowingDialog) { isShowingDialog = true; showHideOp(true); AddNewContactDialog *dialog = new AddNewContactDialog(window); dialog->setTexts(tr("Edit Address Label")); dialog->setData(info->address, addressTableModel->labelForAddress(info->address)); if (openDialogWithOpaqueBackgroundY(dialog, window, 3.5, 6)) { QString label = dialog->getLabel(); const CBitcoinAddress address = CBitcoinAddress(info->address.toUtf8().constData()); if (!label.isEmpty() && walletModel->updateAddressBookLabels( address.Get(), label.toUtf8().constData(), "receive" ) ) { // update label status (icon color) updateLabel(); inform(tr("Address label saved")); } else { inform(tr("Error storing address label")); } } isShowingDialog = false; } } void ReceiveWidget::onNewAddressClicked(){ try { if (!verifyWalletUnlocked()) return; CBitcoinAddress address = walletModel->getNewAddress(""); updateQr(QString::fromStdString(address.ToString())); ui->labelAddress->setText(!info->address.isEmpty() ? info->address : tr("No address")); updateLabel(); inform(tr("New address created")); } catch (const std::runtime_error& error){ // Error generating address inform("Error generating address"); } } void ReceiveWidget::onCopyClicked(){ GUIUtil::setClipboard(info->address); inform(tr("Address copied")); } void ReceiveWidget::onRequestClicked(){ if(walletModel && !isShowingDialog) { if (!verifyWalletUnlocked()) return; isShowingDialog = true; showHideOp(true); RequestDialog *dialog = new RequestDialog(window); dialog->setWalletModel(walletModel); openDialogWithOpaqueBackgroundY(dialog, window, 3.5, 12); if (dialog->res == 1){ inform(tr("URI copied to clipboard")); } else if (dialog->res == 2){ inform(tr("Address copied to clipboard")); } dialog->deleteLater(); isShowingDialog = false; } } void ReceiveWidget::onMyAddressesClicked(){ bool isVisible = ui->listViewAddress->isVisible(); if(!isVisible){ ui->btnMyAddresses->setRightIconClass("btn-dropdown", true); ui->listViewAddress->setVisible(true); ui->container_right->removeItem(spacer); ui->listViewAddress->update(); }else{ ui->btnMyAddresses->setRightIconClass("ic-arrow", true); ui->container_right->addItem(spacer); ui->listViewAddress->setVisible(false); } } void ReceiveWidget::changeTheme(bool isLightTheme, QString& theme){ static_cast<AddressHolder*>(this->delegate->getRowFactory())->isLightTheme = isLightTheme; } ReceiveWidget::~ReceiveWidget(){ delete ui; }
[ "57004535+tdpsdevextreme@users.noreply.github.com" ]
57004535+tdpsdevextreme@users.noreply.github.com
633bc76ad7c72fbf9bbe5202900d5f305306a5a8
387549ab27d89668e656771a19c09637612d57ed
/DRGLib UE project/Source/FSD/Public/IconGeneratable.h
19aa793436106aa620b9bafa523ccf8b9c0ced71
[ "MIT" ]
permissive
SamsDRGMods/DRGLib
3b7285488ef98b7b22ab4e00fec64a4c3fb6a30a
76f17bc76dd376f0d0aa09400ac8cb4daad34ade
refs/heads/main
2023-07-03T10:37:47.196444
2023-04-07T23:18:54
2023-04-07T23:18:54
383,509,787
16
5
MIT
2023-04-07T23:18:55
2021-07-06T15:08:14
C++
UTF-8
C++
false
false
270
h
#pragma once #include "CoreMinimal.h" #include "UObject/Interface.h" #include "IconGeneratable.generated.h" UINTERFACE() class UIconGeneratable : public UInterface { GENERATED_BODY() }; class IIconGeneratable : public IInterface { GENERATED_BODY() public: };
[ "samamstar@gmail.com" ]
samamstar@gmail.com
24c718d70add411f060c930681170600495796d3
1e0eb2151d862465d8c1ba9974fdda35c68628bb
/tensorflow/core/grappler/op_types.h
8667f72c7ecd213d61c92edabc62610a7e7f1595
[ "Apache-2.0" ]
permissive
cpy321/tensorflow
e4dcbb584bd740742d6c940d7f870f6bdc27243f
08e4863ea6c7e75c85f097760216509f85081916
refs/heads/master
2020-03-08T23:43:22.461608
2018-04-06T20:29:34
2018-04-06T20:29:34
128,471,182
0
1
Apache-2.0
2018-04-06T21:15:45
2018-04-06T21:15:44
null
UTF-8
C++
false
false
6,833
h
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_GRAPPLER_OP_TYPES_H_ #define TENSORFLOW_GRAPPLER_OP_TYPES_H_ #include "tensorflow/core/framework/node_def.pb.h" #include "tensorflow/core/lib/core/status.h" namespace tensorflow { namespace grappler { bool IsAdd(const NodeDef& node); bool IsAddN(const NodeDef& node); bool IsAll(const NodeDef& node); bool IsAngle(const NodeDef& node); bool IsAny(const NodeDef& node); bool IsAnyDiv(const NodeDef& node); bool IsApproximateEqual(const NodeDef& node); bool IsAvgPoolGrad(const NodeDef& node); bool IsAssert(const NodeDef& node); bool IsAtan2(const NodeDef& node); bool IsBetainc(const NodeDef& node); bool IsBiasAdd(const NodeDef& node); bool IsBiasAddGrad(const NodeDef& node); bool IsBitcast(const NodeDef& node); bool IsCast(const NodeDef& node); bool IsCheckNumerics(const NodeDef& node); bool IsComplex(const NodeDef& node); bool IsComplexAbs(const NodeDef& node); bool IsConj(const NodeDef& node); bool IsConjugateTranspose(const NodeDef& node); bool IsConcat(const NodeDef& node); bool IsConcatOffset(const NodeDef& node); bool IsConstant(const NodeDef& node); bool IsConv2D(const NodeDef& node); bool IsConv2DBackpropFilter(const NodeDef& node); bool IsConv2DBackpropInput(const NodeDef& node); bool IsDepthwiseConv2dNative(const NodeDef& node); bool IsDepthwiseConv2dNativeBackpropFilter(const NodeDef& node); bool IsDepthwiseConv2dNativeBackpropInput(const NodeDef& node); bool IsDequeueOp(const NodeDef& node); bool IsDiv(const NodeDef& node); bool IsEluGrad(const NodeDef& node); bool IsEnter(const NodeDef& node); bool IsEqual(const NodeDef& node); bool IsExit(const NodeDef& node); bool IsFill(const NodeDef& node); bool IsFloorDiv(const NodeDef& node); bool IsFloorMod(const NodeDef& node); bool IsFusedBatchNormGrad(const NodeDef& node); bool IsGreater(const NodeDef& node); bool IsGreaterEqual(const NodeDef& node); bool IsHistogramSummary(const NodeDef& node); bool IsIdentity(const NodeDef& node); bool IsIdentityN(const NodeDef& node); bool IsIgamma(const NodeDef& node); bool IsIgammac(const NodeDef& node); bool IsImag(const NodeDef& node); bool IsInvGrad(const NodeDef& node); bool IsLess(const NodeDef& node); bool IsLessEqual(const NodeDef& node); bool IsLogicalAnd(const NodeDef& node); bool IsLogicalNot(const NodeDef& node); bool IsLogicalOr(const NodeDef& node); bool IsMax(const NodeDef& node); bool IsMaximum(const NodeDef& node); bool IsMean(const NodeDef& node); bool IsMerge(const NodeDef& node); bool IsMin(const NodeDef& node); bool IsMinimum(const NodeDef& node); bool IsMirrorPad(const NodeDef& node); bool IsMirrorPadGrad(const NodeDef& node); bool IsMod(const NodeDef& node); bool IsMul(const NodeDef& node); bool IsMatMul(const NodeDef& node); bool IsNextIteration(const NodeDef& node); bool IsPack(const NodeDef& node); bool IsPad(const NodeDef& node); bool IsPack(const NodeDef& node); bool IsNeg(const NodeDef& node); bool IsNoOp(const NodeDef& node); bool IsNotEqual(const NodeDef& node); bool IsPlaceholder(const NodeDef& node); bool IsPolygamma(const NodeDef& node); bool IsProd(const NodeDef& node); bool IsPow(const NodeDef& node); bool IsReal(const NodeDef& node); bool IsRealDiv(const NodeDef& node); bool IsRelu6Grad(const NodeDef& node); bool IsReluGrad(const NodeDef& node); bool IsReciprocalGrad(const NodeDef& node); bool IsRecv(const NodeDef& node); bool IsReduction(const NodeDef& node); bool IsReshape(const NodeDef& node); bool IsRestore(const NodeDef& node); bool IsReverse(const NodeDef& node); bool IsReverseV2(const NodeDef& node); bool IsRsqrtGrad(const NodeDef& node); bool IsSelect(const NodeDef& node); bool IsSeluGrad(const NodeDef& node); bool IsSend(const NodeDef& node); bool IsSlice(const NodeDef& node); bool IsShape(const NodeDef& node); bool IsShapeN(const NodeDef& node); bool IsShuffle(const NodeDef& node); bool IsSigmoidGrad(const NodeDef& node); bool IsSoftplusGrad(const NodeDef& node); bool IsSoftsignGrad(const NodeDef& node); bool IsSplit(const NodeDef& node); bool IsSplitV(const NodeDef& node); bool IsSqrtGrad(const NodeDef& node); bool IsSquare(const NodeDef& node); bool IsSquaredDifference(const NodeDef& node); bool IsSqueeze(const NodeDef& node); bool IsStackOp(const NodeDef& node); bool IsStackCloseOp(const NodeDef& node); bool IsStackPushOp(const NodeDef& node); bool IsStackPopOp(const NodeDef& node); bool IsStopGradient(const NodeDef& node); bool IsStridedSlice(const NodeDef& node); bool IsStridedSliceGrad(const NodeDef& node); bool IsSub(const NodeDef& node); bool IsSum(const NodeDef& node); bool IsSwitch(const NodeDef& node); bool IsTanhGrad(const NodeDef& node); bool IsTile(const NodeDef& node); bool IsTranspose(const NodeDef& node); bool IsTruncateDiv(const NodeDef& node); bool IsTruncateMod(const NodeDef& node); bool IsUnpack(const NodeDef& node); bool IsVariable(const NodeDef& node); bool IsZeta(const NodeDef& node); // Return true if the op is an aggregation (e.g. Add, AddN). // Returns false if it could not be determined to be so. bool IsAggregate(const NodeDef& node); // Return true if the op is commutative (e.g. Mul, Add). // Returns false if it could not be determined to be so. bool IsCommutative(const NodeDef& node); // Returns true if the node is known to use persistent memory to store its // value. bool IsPersistent(const NodeDef& node); bool IsFreeOfSideEffect(const NodeDef& node); bool ModifiesFrameInfo(const NodeDef& node); // Returns true if the op is known to write to one or more of its inputs. bool ModifiesInputsInPlace(const NodeDef& node); // Returns true if the op is an element-wise involution, i.e. if it is its // own inverse such that f(f(x)) == x. bool IsInvolution(const NodeDef& node); // Returns true if the op in node only rearranges the order of elements in its // first input tensor and possible changes its shape. More precisely, this // function returns true if the op commutes with all element-wise operations. bool IsValuePreserving(const NodeDef& node); // Returns true if we can find an opdef corresponding to the op of the node. bool HasOpDef(const NodeDef& node); } // end namespace grappler } // end namespace tensorflow #endif // TENSORFLOW_GRAPPLER_OP_TYPES_H_
[ "gardener@tensorflow.org" ]
gardener@tensorflow.org
a12a4947cd0f2829ba675e5b7f72b6525615275e
9baba146d8ace8a675069f5266377380f37734a0
/Motor Control/courseMovement/courseMovement.ino
d71476a1ef7d0b56416c029962a73e11931a3e61
[]
no_license
kw531/UMKC-Robot-Team-01
9c32e5e2f5e236be66bee0e80a691d0ef4d6ca1d
49acc005f46c0eddf7bf12b38ddd3c842c5ac587
refs/heads/master
2021-09-11T00:20:02.126477
2018-04-04T23:53:01
2018-04-04T23:53:01
104,284,120
0
0
null
null
null
null
UTF-8
C++
false
false
536
ino
#include "path.h" #include "motion.h" void setup() { motionSetup(); pinMode(goPin, INPUT); pinMode(modePin, OUTPUT); pinMode(dispensePin,OUTPUT); digitalWrite(modePin, LOW); digitalWrite(dispensePin, LOW); } void loop() { // if (digitalRead(goPin) == HIGH) { //Serial.print("I made it!"); //runConveyor(); delay(3000); roundOne(); //delay(5000); //stopConveyor(); //digitalWrite(modePin, HIGH); // Tell the Pi to be thinking about dispensing dispense(); delay(10000); //} }
[ "katiwilliams531@gmail.com" ]
katiwilliams531@gmail.com
dbaf70d7e211d8d8b470702832b9f936b63f70f2
b718ced8853ef2ea733fe549f1d06ff035878f85
/source/test/main.cpp
af8ba0e7f4c13e043397ba4f96fa74500f6179e1
[ "BSD-3-Clause" ]
permissive
erje3158/1d_fem_dem_frac
db7fe54d790c54d2d9ee1f8bfa8b476c7b7c14b6
beb79589bc74ce1b848367feac6a4be0f359d0f6
refs/heads/master
2021-01-23T17:04:15.217225
2020-02-04T19:07:45
2020-02-04T19:07:45
102,755,354
4
0
null
null
null
null
UTF-8
C++
false
false
481
cpp
// // userinput.cpp // Jensen_code // // Created by Erik Jensen 8/11/2017. // Copyright �� 2017 Erik Jensen. All rights reserved. // #include <iostream> #include <fstream> #include <string> #include "userInput.h" using namespace std; int main (int argc, char * argv[]) { const char * inputFile = argv[1]; userInput myinput; myinput.readData(inputFile); myinput.echoData(); double testVar = myinput.alphaM; cout << "testVar = " << testVar << endl; }
[ "erje3158@topaz04.erdc.hpc.mil" ]
erje3158@topaz04.erdc.hpc.mil
e6348cdefe3ac3341f49b8f3f7dfd49d55120ee3
95a43c10c75b16595c30bdf6db4a1c2af2e4765d
/codecrawler/_code/hdu5387/16216745.cpp
a28e113970516c62caff93e15de506841813faf2
[]
no_license
kunhuicho/crawl-tools
945e8c40261dfa51fb13088163f0a7bece85fc9d
8eb8c4192d39919c64b84e0a817c65da0effad2d
refs/heads/master
2021-01-21T01:05:54.638395
2016-08-28T17:01:37
2016-08-28T17:01:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,893
cpp
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; int main() { int T; int hh,mm,ss; scanf("%d",&T); while(T--) { scanf("%d:%d:%d",&hh, &mm, &ss); int sum = hh * 60 * 60 + mm * 60 + ss; sum %= (12 * 3600); int h = sum % (12 * 60 * 60); int m = sum % (60 * 60); int x = h - m * 12; if(x < 0) x = -x; int y = 120; int z = __gcd(x,y); x/=z;y/=z; if(x > y * 180) { int xx = 360 * y - x; int yy = y; int zz = __gcd(xx, yy); xx /= zz; yy /= zz; x = xx; y = yy; } if(x == 0 || x % y == 0) { printf("%d ", x/ y); } else { printf("%d/%d ",x,y); } h = sum % (12 * 60 * 60); m = sum % 60; x = h - m * 12 * 60; if(x < 0) x = -x; y = 120; z = __gcd(x,y); x/=z;y/=z; if(x > y * 180) { int xx = 360 * y - x; int yy = y; int zz = __gcd(xx, yy); xx /= zz; yy /= zz; x = xx; y = yy; } if(x == 0 || x % y == 0) { printf("%d ", x/ y); } else { printf("%d/%d ",x,y); } h = sum % (60 * 60); m = sum % 60; x = h - m * 60; if(x < 0) x = -x; y = 10; z = __gcd(x,y); x/=z;y/=z; if(x > y * 180) { int xx = 360 * y - x; int yy = y; int zz = __gcd(xx, yy); xx /= zz; yy /= zz; x = xx; y = yy; } if(x == 0 || x % y == 0) { printf("%d ", x/ y); } else { printf("%d/%d ",x,y); } puts(""); } }
[ "zhouhai02@meituan.com" ]
zhouhai02@meituan.com
1dee4d3fba315777c55cf3432226a8434c0decd0
1d161076bd2fe2a395e02ed7ca08afdd23618abc
/ListaFactura/nodofactura.h
ed015c8b3d0ea74d005430cca4075c4691d7502e
[]
no_license
MacoChave/Practica1_SalesManager
3d4d0c74549c3edb12d97309a72bd081229a3c07
0dce62b149a0db9a94a16178bf7978662e6ad56e
refs/heads/master
2021-05-01T09:06:55.265813
2018-03-18T19:00:33
2018-03-18T19:00:33
121,093,133
3
0
null
2018-03-25T05:01:11
2018-02-11T06:30:30
C++
UTF-8
C++
false
false
569
h
#ifndef NODOFACTURA_H #define NODOFACTURA_H #include <QString> #include "Tad/tadfactura.h" class NodoFactura { TADFactura *item; NodoFactura *anterior; NodoFactura *siguiente; public: NodoFactura(); NodoFactura(TADFactura *value); ~NodoFactura(); void setItem(TADFactura *value); TADFactura *getItem(); void setAnterior(NodoFactura *value); NodoFactura *getAnterior(); void setSiguiente(NodoFactura *value); NodoFactura *getSiguiente(); QString getNombreNodo(); QString toString(); }; #endif // NODOFACTURA_H
[ "totto_cha@hotmail.com" ]
totto_cha@hotmail.com
dcb5604ca11dc09a174660339c913ef788554eb0
4daed53ef188fe57fc90771c9042dd137e306261
/WebKit/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h
8527c528b8b7032caad102e5811c375c68250f9c
[ "Apache-2.0" ]
permissive
JavaScriptTesting/LJS
ece7d0537b514e06f7f6b26cb06a9ab4e6cd7e10
9818dbdb421036569fff93124ac2385d45d01c3a
refs/heads/master
2020-03-12T14:28:41.437178
2018-04-25T10:55:15
2018-04-25T10:55:15
130,668,210
1
0
null
null
null
null
UTF-8
C++
false
false
4,891
h
/* Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) 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. */ #ifndef LayerTreeHostQt_h #define LayerTreeHostQt_h #include "LayerTreeContext.h" #include "LayerTreeHost.h" #include "Timer.h" #include "WebGraphicsLayer.h" #include <WebCore/GraphicsLayerClient.h> #include <wtf/OwnPtr.h> namespace WebKit { class UpdateInfo; class WebPage; class LayerTreeHostQt : public LayerTreeHost, WebCore::GraphicsLayerClient #if USE(TILED_BACKING_STORE) , public WebLayerTreeTileClient #endif { public: static PassRefPtr<LayerTreeHostQt> create(WebPage*); virtual ~LayerTreeHostQt(); static bool supportsAcceleratedCompositing(); virtual const LayerTreeContext& layerTreeContext() { return m_layerTreeContext; } virtual void setLayerFlushSchedulingEnabled(bool); virtual void scheduleLayerFlush(); virtual void setShouldNotifyAfterNextScheduledLayerFlush(bool); virtual void setRootCompositingLayer(WebCore::GraphicsLayer*); virtual void invalidate(); virtual void setNonCompositedContentsNeedDisplay(const WebCore::IntRect&); virtual void scrollNonCompositedContents(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset); virtual void forceRepaint(); virtual void sizeDidChange(const WebCore::IntSize& newSize); virtual void didInstallPageOverlay(); virtual void didUninstallPageOverlay(); virtual void setPageOverlayNeedsDisplay(const WebCore::IntRect&); virtual void pauseRendering() { m_isSuspended = true; } virtual void resumeRendering() { m_isSuspended = false; scheduleLayerFlush(); } virtual void deviceScaleFactorDidChange() { } virtual int64_t adoptImageBackingStore(Image*); virtual void releaseImageBackingStore(int64_t); #if USE(TILED_BACKING_STORE) virtual void createTile(WebLayerID, int tileID, const UpdateInfo&); virtual void updateTile(WebLayerID, int tileID, const UpdateInfo&); virtual void removeTile(WebLayerID, int tileID); virtual void setVisibleContentRectForLayer(int layerID, const WebCore::IntRect&); virtual void renderNextFrame(); virtual void purgeBackingStores(); virtual bool layerTreeTileUpdatesAllowed() const; virtual void setVisibleContentRectAndScale(const IntRect&, float scale); virtual void setVisibleContentRectTrajectoryVector(const FloatPoint&); virtual void didSyncCompositingStateForLayer(const WebLayerInfo&); virtual void didDeleteLayer(WebLayerID); #endif protected: explicit LayerTreeHostQt(WebPage*); private: // GraphicsLayerClient virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time); virtual void notifySyncRequired(const WebCore::GraphicsLayer*); virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect); virtual bool showDebugBorders() const; virtual bool showRepaintCounter() const; // LayerTreeHostQt void createPageOverlayLayer(); void destroyPageOverlayLayer(); bool flushPendingLayerChanges(); void cancelPendingLayerFlush(); void performScheduledLayerFlush(); void sendLayersToUI(); void recreateBackingStoreIfNeeded(); OwnPtr<WebCore::GraphicsLayer> m_rootLayer; // The layer which contains all non-composited content. OwnPtr<WebCore::GraphicsLayer> m_nonCompositedContentLayer; // The page overlay layer. Will be null if there's no page overlay. OwnPtr<WebCore::GraphicsLayer> m_pageOverlayLayer; HashMap<int64_t, int> m_directlyCompositedImageRefCounts; bool m_notifyAfterScheduledLayerFlush; bool m_isValid; #if USE(TILED_BACKING_STORE) bool m_waitingForUIProcess; bool m_isSuspended; #endif LayerTreeContext m_layerTreeContext; bool m_shouldSyncFrame; bool m_shouldSyncRootLayer; void layerFlushTimerFired(WebCore::Timer<LayerTreeHostQt>*); WebCore::Timer<LayerTreeHostQt> m_layerFlushTimer; bool m_layerFlushSchedulingEnabled; bool m_shouldRecreateBackingStore; }; } #endif // LayerTreeHostQt_h
[ "cumtcsgpf@gmail.com" ]
cumtcsgpf@gmail.com
ebc976458b41aee4d0a76d53591a3fa334fddad3
1dbf007249acad6038d2aaa1751cbde7e7842c53
/gaussdbforopengauss/include/huaweicloud/gaussdbforopengauss/v3/model/OpenGaussCoordinators.h
11512399e8462307b03ed5c50a869603723d0677
[]
permissive
huaweicloud/huaweicloud-sdk-cpp-v3
24fc8d93c922598376bdb7d009e12378dff5dd20
71674f4afbb0cd5950f880ec516cfabcde71afe4
refs/heads/master
2023-08-04T19:37:47.187698
2023-08-03T08:25:43
2023-08-03T08:25:43
324,328,641
11
10
Apache-2.0
2021-06-24T07:25:26
2020-12-25T09:11:43
C++
UTF-8
C++
false
false
1,742
h
#ifndef HUAWEICLOUD_SDK_GAUSSDBFOROPENGAUSS_V3_MODEL_OpenGaussCoordinators_H_ #define HUAWEICLOUD_SDK_GAUSSDBFOROPENGAUSS_V3_MODEL_OpenGaussCoordinators_H_ #include <huaweicloud/gaussdbforopengauss/v3/GaussDBforopenGaussExport.h> #include <huaweicloud/core/utils/ModelBase.h> #include <huaweicloud/core/http/HttpResponse.h> #include <string> namespace HuaweiCloud { namespace Sdk { namespace Gaussdbforopengauss { namespace V3 { namespace Model { using namespace HuaweiCloud::Sdk::Core::Utils; using namespace HuaweiCloud::Sdk::Core::Http; /// <summary> /// CN横向扩容时必填 /// </summary> class HUAWEICLOUD_GAUSSDBFOROPENGAUSS_V3_EXPORT OpenGaussCoordinators : public ModelBase { public: OpenGaussCoordinators(); virtual ~OpenGaussCoordinators(); ///////////////////////////////////////////// /// ModelBase overrides void validate() override; web::json::value toJson() const override; bool fromJson(const web::json::value& json) override; ///////////////////////////////////////////// /// OpenGaussCoordinators members /// <summary> /// 新增CN横向扩容每个节点的可用区。如果需要扩容多个CN,请分别填写待扩容CN所在的可用区。 不同区域的可用区请参考[地区和终端节点](https://developer.huaweicloud.com/endpoint)。 说明: 扩容后,实例中CN节点的数量必须小于或等于两倍的分片数量。 /// </summary> std::string getAzCode() const; bool azCodeIsSet() const; void unsetazCode(); void setAzCode(const std::string& value); protected: std::string azCode_; bool azCodeIsSet_; }; } } } } } #endif // HUAWEICLOUD_SDK_GAUSSDBFOROPENGAUSS_V3_MODEL_OpenGaussCoordinators_H_
[ "hwcloudsdk@huawei.com" ]
hwcloudsdk@huawei.com
5bdbfaad5b245e44ce62c616e548af7da4fac546
65d7c3f2d18258603a03caa04aa026c00b43aef4
/src/test/zerocoin_denomination_tests.cpp
7a7367e0cda0107008cbe961d45457d3970149ae
[ "MIT" ]
permissive
xdccash/xdcash-core
ac9faecf5cd518a2dd4c525128ad734b8a272faa
4a59768fa49b248b904f7077d366ce50ba9d0914
refs/heads/master
2020-06-05T23:54:24.263259
2019-07-06T14:36:46
2019-07-06T14:36:46
192,578,921
1
0
null
null
null
null
UTF-8
C++
false
false
21,491
cpp
// Copyright (c) 2012-2014 The Bitcoin Core developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "amount.h" #include "chainparams.h" #include "coincontrol.h" #include "denomination_functions.h" #include "main.h" #include "txdb.h" #include "wallet.h" #include "walletdb.h" #include <boost/test/unit_test.hpp> #include <iostream> using namespace libzerocoin; BOOST_AUTO_TEST_SUITE(zerocoin_denom_tests) //translation from xdcash quantity to zerocoin denomination BOOST_AUTO_TEST_CASE(amount_to_denomination_test) { cout << "Running amount_to_denomination_test...\n"; //valid amount (min edge) CAmount amount = 1 * COIN; BOOST_CHECK_MESSAGE(AmountToZerocoinDenomination(amount) == ZQ_ONE, "For COIN denomination should be ZQ_ONE"); //valid amount (max edge) CAmount amount1 = 5000 * COIN; BOOST_CHECK_MESSAGE(AmountToZerocoinDenomination(amount1) == ZQ_FIVE_THOUSAND, "For 5000*COIN denomination should be ZQ_ONE"); //invalid amount (too much) CAmount amount2 = 7000 * COIN; BOOST_CHECK_MESSAGE(AmountToZerocoinDenomination(amount2) == ZQ_ERROR, "For 7000*COIN denomination should be Invalid -> ZQ_ERROR"); //invalid amount (not enough) CAmount amount3 = 1; BOOST_CHECK_MESSAGE(AmountToZerocoinDenomination(amount3) == ZQ_ERROR, "For 1 denomination should be Invalid -> ZQ_ERROR"); } BOOST_AUTO_TEST_CASE(denomination_to_value_test) { cout << "Running ZerocoinDenominationToValue_test...\n"; int64_t Value = 1 * COIN; CoinDenomination denomination = ZQ_ONE; BOOST_CHECK_MESSAGE(ZerocoinDenominationToAmount(denomination) == Value, "Wrong Value - should be 1"); Value = 10 * COIN; denomination = ZQ_TEN; BOOST_CHECK_MESSAGE(ZerocoinDenominationToAmount(denomination) == Value, "Wrong Value - should be 10"); Value = 50 * COIN; denomination = ZQ_FIFTY; BOOST_CHECK_MESSAGE(ZerocoinDenominationToAmount(denomination) == Value, "Wrong Value - should be 50"); Value = 500 * COIN; denomination = ZQ_FIVE_HUNDRED; BOOST_CHECK_MESSAGE(ZerocoinDenominationToAmount(denomination) == Value, "Wrong Value - should be 500"); Value = 100 * COIN; denomination = ZQ_ONE_HUNDRED; BOOST_CHECK_MESSAGE(ZerocoinDenominationToAmount(denomination) == Value, "Wrong Value - should be 100"); Value = 0 * COIN; denomination = ZQ_ERROR; BOOST_CHECK_MESSAGE(ZerocoinDenominationToAmount(denomination) == Value, "Wrong Value - should be 0"); } BOOST_AUTO_TEST_CASE(zerocoin_spend_test241) { const int nMaxNumberOfSpends = 4; const bool fMinimizeChange = false; const int DenomAmounts[] = {1, 2, 3, 4, 0, 0, 0, 0}; CAmount nSelectedValue; std::list<CZerocoinMint> listMints; std::map<CoinDenomination, CAmount> mapDenom; int j = 0; CAmount nTotalAmount = 0; int CoinsHeld = 0; // Create a set of Minted coins that fits profile given by DenomAmounts // Also setup Map array corresponding to DenomAmount which is the current set of coins available for (const auto& denom : zerocoinDenomList) { for (int i = 0; i < DenomAmounts[j]; i++) { CAmount currentAmount = ZerocoinDenominationToAmount(denom); nTotalAmount += currentAmount; CBigNum value; CBigNum rand; CBigNum serial; bool isUsed = false; CZerocoinMint mint(denom, value, rand, serial, isUsed); listMints.push_back(mint); } mapDenom.insert(std::pair<CoinDenomination, CAmount>(denom, DenomAmounts[j])); j++; } CoinsHeld = nTotalAmount / COIN; std::cout << "Curremt Amount held = " << CoinsHeld << ": "; // Show what we have j = 0; for (const auto& denom : zerocoinDenomList) std::cout << DenomAmounts[j++] << "*" << ZerocoinDenominationToAmount(denom) / COIN << " + "; std::cout << "\n"; // For DenomAmounts[] = {1,2,3,4,0,0,0,0}; we can spend up to 200 without requiring more than 4 Spends // Amounts above this can not be met CAmount MaxLimit = 200; CAmount OneCoinAmount = ZerocoinDenominationToAmount(ZQ_ONE); CAmount nValueTarget = OneCoinAmount; int nCoinsReturned; int nNeededSpends = 0; // Number of spends which would be needed if selection failed bool fDebug = 0; // Go through all possible spend between 1 and 241 and see if it's possible or not for (int i = 0; i < CoinsHeld; i++) { std::vector<CZerocoinMint> vSpends = SelectMintsFromList(nValueTarget, nSelectedValue, nMaxNumberOfSpends, fMinimizeChange, nCoinsReturned, listMints, mapDenom, nNeededSpends); if (fDebug) { if (vSpends.size() > 0) { std::cout << "SUCCESS : Coins = " << nValueTarget / COIN << " # spends used = " << vSpends.size() << " # of coins returned = " << nCoinsReturned << " Spend Amount = " << nSelectedValue / COIN << " Held = " << CoinsHeld << "\n"; } else { std::cout << "FAILED : Coins = " << nValueTarget / COIN << " Held = " << CoinsHeld << "\n"; } } if (i < MaxLimit) { BOOST_CHECK_MESSAGE(vSpends.size() < 5, "Too many spends"); BOOST_CHECK_MESSAGE(vSpends.size() > 0, "No spends"); } else { bool spends_not_ok = ((vSpends.size() >= 4) || (vSpends.size() == 0)); BOOST_CHECK_MESSAGE(spends_not_ok, "Expected to fail but didn't"); } nValueTarget += OneCoinAmount; } //std::cout << "241 Test done!\n"; } BOOST_AUTO_TEST_CASE(zerocoin_spend_test115) { const int nMaxNumberOfSpends = 4; const bool fMinimizeChange = false; const int DenomAmounts[] = {0, 1, 1, 2, 0, 0, 0, 0}; CAmount nSelectedValue; std::list<CZerocoinMint> listMints; std::map<CoinDenomination, CAmount> mapDenom; int j = 0; CAmount nTotalAmount = 0; int CoinsHeld = 0; // Create a set of Minted coins that fits profile given by DenomAmounts // Also setup Map array corresponding to DenomAmount which is the current set of coins available for (const auto& denom : zerocoinDenomList) { for (int i = 0; i < DenomAmounts[j]; i++) { CAmount currentAmount = ZerocoinDenominationToAmount(denom); nTotalAmount += currentAmount; CBigNum value; CBigNum rand; CBigNum serial; bool isUsed = false; CZerocoinMint mint(denom, value, rand, serial, isUsed); listMints.push_back(mint); } mapDenom.insert(std::pair<CoinDenomination, CAmount>(denom, DenomAmounts[j])); j++; } CoinsHeld = nTotalAmount / COIN; std::cout << "Curremt Amount held = " << CoinsHeld << ": "; // Show what we have j = 0; for (const auto& denom : zerocoinDenomList) std::cout << DenomAmounts[j++] << "*" << ZerocoinDenominationToAmount(denom) / COIN << " + "; std::cout << "\n"; CAmount OneCoinAmount = ZerocoinDenominationToAmount(ZQ_ONE); CAmount nValueTarget = OneCoinAmount; bool fDebug = 0; int nCoinsReturned; int nNeededSpends = 0; // Number of spends which would be needed if selection failed std::vector<CZerocoinMint> vSpends = SelectMintsFromList(nValueTarget, nSelectedValue, nMaxNumberOfSpends, fMinimizeChange, nCoinsReturned, listMints, mapDenom, nNeededSpends); if (fDebug) { if (vSpends.size() > 0) { std::cout << "SUCCESS : Coins = " << nValueTarget / COIN << " # spends used = " << vSpends.size() << " # of coins returned = " << nCoinsReturned << " Spend Amount = " << nSelectedValue / COIN << " Held = " << CoinsHeld << "\n"; } else { std::cout << "FAILED : Coins = " << nValueTarget / COIN << " Held = " << CoinsHeld << "\n"; } } BOOST_CHECK_MESSAGE(vSpends.size() < 5, "Too many spends"); BOOST_CHECK_MESSAGE(vSpends.size() > 0, "No spends"); nValueTarget += OneCoinAmount; } BOOST_AUTO_TEST_CASE(zerocoin_spend_test_from_245) { const int nMaxNumberOfSpends = 5; // For 36: // const int nSpendValue = 36; // Here have a 50 so use for 36 since can't meet exact amount // const int DenomAmounts[] = {0,1,4,1,0,0,0,0}; // Here have 45 so use 4*10 for 36 since can't meet exact amount // const int DenomAmounts[] = {0, 1, 4, 0, 0, 0, 0, 0}; // For 51 //const int nSpendValue = 51; // CoinsHeld = 245 const int DenomAmounts[] = {0, 1, 4, 2, 1, 0, 0, 0}; // We can spend up to this amount for above set for less 6 spends // Otherwise, 6 spends are required const int nMaxSpendAmount = 220; CAmount nSelectedValue; std::list<CZerocoinMint> listMints; std::map<CoinDenomination, CAmount> mapOfDenomsHeld; int j = 0; CAmount nTotalAmount = 0; int CoinsHeld = 0; // Create a set of Minted coins that fits profile given by DenomAmounts // Also setup Map array corresponding to DenomAmount which is the current set of coins available for (const auto& denom : zerocoinDenomList) { for (int i = 0; i < DenomAmounts[j]; i++) { CAmount currentAmount = ZerocoinDenominationToAmount(denom); nTotalAmount += currentAmount; CBigNum value; CBigNum rand; CBigNum serial; bool isUsed = false; CZerocoinMint mint(denom, value, rand, serial, isUsed); listMints.push_back(mint); } mapOfDenomsHeld.insert(std::pair<CoinDenomination, CAmount>(denom, DenomAmounts[j])); j++; } CoinsHeld = nTotalAmount / COIN; std::cout << "Curremt Amount held = " << CoinsHeld << ": "; // Show what we have j = 0; for (const auto& denom : zerocoinDenomList) std::cout << DenomAmounts[j++] << "*" << ZerocoinDenominationToAmount(denom) / COIN << " + "; std::cout << "\n"; CAmount OneCoinAmount = ZerocoinDenominationToAmount(ZQ_ONE); CAmount nValueTarget = OneCoinAmount; bool fDebug = 0; int nCoinsReturned; int nNeededSpends = 0; // Number of spends which would be needed if selection failed // Go through all possible spend between 1 and 241 and see if it's possible or not for (int i = 0; i < CoinsHeld; i++) { std::vector<CZerocoinMint> vSpends = SelectMintsFromList(nValueTarget, nSelectedValue, nMaxNumberOfSpends, false, nCoinsReturned, listMints, mapOfDenomsHeld, nNeededSpends); if (fDebug) { if (vSpends.size() > 0) { std::cout << "SUCCESS : Coins = " << nValueTarget / COIN << " # spends = " << vSpends.size() << " # coins returned = " << nCoinsReturned << " Amount = " << nSelectedValue / COIN << " Held = " << CoinsHeld << " "; } else { std::cout << "UNABLE TO SPEND : Coins = " << nValueTarget / COIN << " Held = " << CoinsHeld << "\n"; } } bool spends_not_ok = ((vSpends.size() > nMaxNumberOfSpends) || (vSpends.size() == 0)); if (i < nMaxSpendAmount) BOOST_CHECK_MESSAGE(!spends_not_ok, "Too many spends"); else BOOST_CHECK_MESSAGE(spends_not_ok, "Expected to fail but didn't"); std::vector<CZerocoinMint> vSpendsAlt = SelectMintsFromList(nValueTarget, nSelectedValue, nMaxNumberOfSpends, true, nCoinsReturned, listMints, mapOfDenomsHeld, nNeededSpends); if (fDebug) { if (vSpendsAlt.size() > 0) { std::cout << "# spends = " << vSpendsAlt.size() << " # coins returned = " << nCoinsReturned << " Amount = " << nSelectedValue / COIN << "\n"; } else { std::cout << "UNABLE TO SPEND : Coins = " << nValueTarget / COIN << " Held = " << CoinsHeld << "\n"; } } spends_not_ok = ((vSpendsAlt.size() > nMaxNumberOfSpends) || (vSpendsAlt.size() == 0)); if (i < nMaxSpendAmount) BOOST_CHECK_MESSAGE(!spends_not_ok, "Too many spends"); else BOOST_CHECK_MESSAGE(spends_not_ok, "Expected to fail but didn't"); nValueTarget += OneCoinAmount; } } BOOST_AUTO_TEST_CASE(zerocoin_spend_test_from_145) { const int nMaxNumberOfSpends = 5; // CoinsHeld = 145 const int DenomAmounts[] = {0, 1, 4, 2, 0, 0, 0, 0}; CAmount nSelectedValue; std::list<CZerocoinMint> listMints; std::map<CoinDenomination, CAmount> mapOfDenomsHeld; int j = 0; CAmount nTotalAmount = 0; int CoinsHeld = 0; // Create a set of Minted coins that fits profile given by DenomAmounts // Also setup Map array corresponding to DenomAmount which is the current set of coins available for (const auto& denom : zerocoinDenomList) { for (int i = 0; i < DenomAmounts[j]; i++) { CAmount currentAmount = ZerocoinDenominationToAmount(denom); nTotalAmount += currentAmount; CBigNum value; CBigNum rand; CBigNum serial; bool isUsed = false; CZerocoinMint mint(denom, value, rand, serial, isUsed); listMints.push_back(mint); } mapOfDenomsHeld.insert(std::pair<CoinDenomination, CAmount>(denom, DenomAmounts[j])); j++; } CoinsHeld = nTotalAmount / COIN; std::cout << "Curremt Amount held = " << CoinsHeld << ": "; // We can spend up to this amount for above set for less 6 spends // Otherwise, 6 spends are required const int nMaxSpendAmount = 130; // Show what we have j = 0; for (const auto& denom : zerocoinDenomList) std::cout << DenomAmounts[j++] << "*" << ZerocoinDenominationToAmount(denom) / COIN << " + "; std::cout << "\n"; CAmount OneCoinAmount = ZerocoinDenominationToAmount(ZQ_ONE); CAmount nValueTarget = OneCoinAmount; bool fDebug = 0; int nCoinsReturned; int nNeededSpends = 0; // Number of spends which would be needed if selection failed // Go through all possible spend between 1 and 241 and see if it's possible or not for (int i = 0; i < CoinsHeld; i++) { std::vector<CZerocoinMint> vSpends = SelectMintsFromList(nValueTarget, nSelectedValue, nMaxNumberOfSpends, false, nCoinsReturned, listMints, mapOfDenomsHeld, nNeededSpends); if (fDebug) { if (vSpends.size() > 0) { std::cout << "SUCCESS : Coins = " << nValueTarget / COIN << " # spends = " << vSpends.size() << " # coins returned = " << nCoinsReturned << " Amount = " << nSelectedValue / COIN << " Held = " << CoinsHeld << " "; } else { std::cout << "UNABLE TO SPEND : Coins = " << nValueTarget / COIN << " Held = " << CoinsHeld << "\n"; } } bool spends_not_ok = ((vSpends.size() > nMaxNumberOfSpends) || (vSpends.size() == 0)); if (i < nMaxSpendAmount) BOOST_CHECK_MESSAGE(!spends_not_ok, "Too many spends"); else BOOST_CHECK_MESSAGE(spends_not_ok, "Expected to fail but didn't"); std::vector<CZerocoinMint> vSpendsAlt = SelectMintsFromList(nValueTarget, nSelectedValue, nMaxNumberOfSpends, true, nCoinsReturned, listMints, mapOfDenomsHeld, nNeededSpends); if (fDebug) { if (vSpendsAlt.size() > 0) { std::cout << "# spends = " << vSpendsAlt.size() << " # coins returned = " << nCoinsReturned << " Amount = " << nSelectedValue / COIN << "\n"; } else { std::cout << "UNABLE TO SPEND : Coins = " << nValueTarget / COIN << " Held = " << CoinsHeld << "\n"; } } spends_not_ok = ((vSpendsAlt.size() > nMaxNumberOfSpends) || (vSpendsAlt.size() == 0)); if (i < nMaxSpendAmount) BOOST_CHECK_MESSAGE(!spends_not_ok, "Too many spends"); else BOOST_CHECK_MESSAGE(spends_not_ok, "Expected to fail but didn't"); nValueTarget += OneCoinAmount; } } BOOST_AUTO_TEST_CASE(zerocoin_spend_test99) { const int nMaxNumberOfSpends = 4; const bool fMinimizeChange = false; const int DenomAmounts[] = {0, 1, 4, 2, 1, 0, 0, 0}; CAmount nSelectedValue; std::list<CZerocoinMint> listMints; std::map<CoinDenomination, CAmount> mapOfDenomsHeld; int j = 0; CAmount nTotalAmount = 0; int CoinsHeld = 0; // Create a set of Minted coins that fits profile given by DenomAmounts // Also setup Map array corresponding to DenomAmount which is the current set of coins available for (const auto& denom : zerocoinDenomList) { for (int i = 0; i < DenomAmounts[j]; i++) { CAmount currentAmount = ZerocoinDenominationToAmount(denom); nTotalAmount += currentAmount; CBigNum value; CBigNum rand; CBigNum serial; bool isUsed = false; CZerocoinMint mint(denom, value, rand, serial, isUsed); listMints.push_back(mint); } mapOfDenomsHeld.insert(std::pair<CoinDenomination, CAmount>(denom, DenomAmounts[j])); j++; } CoinsHeld = nTotalAmount / COIN; std::cout << "Curremt Amount held = " << CoinsHeld << ": "; // Show what we have j = 0; for (const auto& denom : zerocoinDenomList) std::cout << DenomAmounts[j++] << "*" << ZerocoinDenominationToAmount(denom) / COIN << " + "; std::cout << "\n"; CAmount OneCoinAmount = ZerocoinDenominationToAmount(ZQ_ONE); CAmount nValueTarget = 99 * OneCoinAmount; bool fDebug = 0; int nCoinsReturned; int nNeededSpends = 0; // Number of spends which would be needed if selection failed std::vector<CZerocoinMint> vSpends = SelectMintsFromList(nValueTarget, nSelectedValue, nMaxNumberOfSpends, fMinimizeChange, nCoinsReturned, listMints, mapOfDenomsHeld, nNeededSpends); if (fDebug) { if (vSpends.size() > 0) { std::cout << "SUCCESS : Coins = " << nValueTarget / COIN << " # spends used = " << vSpends.size() << " # of coins returned = " << nCoinsReturned << " Spend Amount = " << nSelectedValue / COIN << " Held = " << CoinsHeld << "\n"; } else { std::cout << "FAILED : Coins = " << nValueTarget / COIN << " Held = " << CoinsHeld << "\n"; } } BOOST_CHECK_MESSAGE(vSpends.size() < 5, "Too many spends"); BOOST_CHECK_MESSAGE(vSpends.size() > 0, "No spends"); nValueTarget += OneCoinAmount; } BOOST_AUTO_TEST_SUITE_END()
[ "51966303+xdccash@users.noreply.github.com" ]
51966303+xdccash@users.noreply.github.com
2faab1e5c72ae7d1a54fe47a7e4a9d44d104bd85
604838d93fc6c9a7df1db59856126da74abc2853
/SoftEngine/Library/Graphics/TriangleBuffer.h
2c7140295cacf45b4c41e19acea406f7fd6e9561
[]
no_license
mbellman/dungeon-crawler
b7a4f78e418eda7dd47b0a549d05e213b0fc059a
b73afbffdad6d300f70ce37b61c18735f8932c38
refs/heads/master
2020-04-28T07:11:30.848512
2019-05-11T16:17:59
2019-05-11T16:17:59
175,083,562
0
0
null
null
null
null
UTF-8
C++
false
false
609
h
#pragma once #include <System/Geometry.h> #include <vector> namespace Soft { class TriangleBuffer { public: TriangleBuffer(); ~TriangleBuffer(); void bufferTriangle(Triangle* triangle); const std::vector<Triangle*>& getBufferedTriangles(); int getTotalRequestedTriangles(); int getTotalNonStaticTriangles(); Triangle* requestTriangle(); void reset(); void resetAll(); private: bool isSwapped = false; int totalRequestedTriangles = 0; std::vector<Triangle*> triangleBufferA; std::vector<Triangle*> triangleBufferB; Triangle* trianglePoolA; Triangle* trianglePoolB; }; } // namespace Soft
[ "mbellman@nwe.com" ]
mbellman@nwe.com
d5b818b9cbbf440d22e54fe254ab5de09f0dab58
d115cf7a1b374d857f6b094d4b4ccd8e9b1ac189
/pyplusplus_dev/indexing_suite_v2/indexing_suite/list.hpp
27f271f0a96a91fade9636ac79bc63c689de7259
[ "BSL-1.0" ]
permissive
gatoatigrado/pyplusplusclone
30af9065fb6ac3dcce527c79ed5151aade6a742f
a64dc9aeeb718b2f30bd6a5ff8dcd8bfb1cd2ede
refs/heads/master
2016-09-05T23:32:08.595261
2010-05-16T10:53:45
2010-05-16T10:53:45
700,369
4
2
null
null
null
null
UTF-8
C++
false
false
5,762
hpp
// Copyright (c) 2003 Raoul M. Gough // // Use, modification and distribution is subject to 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) // // Header file list.hpp // // Indexing algorithms support for std::list instances // // History // ======= // 2003/10/28 rmg File creation from algo_selector.hpp // 2008/12/08 Roman Change indexing suite layout // // $Id: list.hpp,v 1.1.2.7 2004/02/08 18:57:42 raoulgough Exp $ // #ifndef BOOST_PYTHON_INDEXING_LIST_HPP #define BOOST_PYTHON_INDEXING_LIST_HPP #include <indexing_suite/container_traits.hpp> #include <indexing_suite/container_suite.hpp> #include <indexing_suite/algorithms.hpp> #include <list> #if BOOST_WORKAROUND (BOOST_MSVC, == 1200) # include <boost/static_assert.hpp> # include <boost/type_traits.hpp> #endif namespace boost { namespace python { namespace indexing { ///////////////////////////////////////////////////////////////////////// // ContainerTraits implementation for std::list instances ///////////////////////////////////////////////////////////////////////// template<typename Container, typename ValueTraits = detail::no_override> class list_traits : public base_container_traits<Container, ValueTraits> { typedef base_container_traits<Container, ValueTraits> base_class; public: typedef typename base_class::value_traits_type value_traits_type; BOOST_STATIC_CONSTANT( method_set_type, supported_methods = ( method_len | method_iter | detail::method_set_if< value_traits_type::equality_comparable, method_contains | method_count >::value | detail::method_set_if< base_class::is_mutable, method_reverse | method_append >::value | detail::method_set_if< type_traits::ice_and< base_class::is_mutable, value_traits_type::less_than_comparable >::value, method_sort >::value )); }; ///////////////////////////////////////////////////////////////////////// // Algorithms implementation for std::list instances ///////////////////////////////////////////////////////////////////////// template<typename ContainerTraits, typename Ovr = detail::no_override> class list_algorithms : public default_algorithms <ContainerTraits, typename detail::maybe_override <list_algorithms<ContainerTraits, Ovr>, Ovr> ::type> { typedef list_algorithms<ContainerTraits, Ovr> self_type; typedef typename detail::maybe_override<self_type, Ovr>::type most_derived; typedef default_algorithms<ContainerTraits, most_derived> Parent; public: typedef typename Parent::container container; // Use member functions for the following (hiding base class versions) static void reverse (container &); static void sort (container &); // static void sort (container &, PyObject *); }; #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) namespace detail { /////////////////////////////////////////////////////////////////////// // algorithms support for std::list instances /////////////////////////////////////////////////////////////////////// template <class T, class Allocator> class algorithms_selector<std::list<T, Allocator> > { typedef std::list<T, Allocator> Container; typedef list_traits<Container> mutable_traits; typedef list_traits<Container const> const_traits; public: typedef list_algorithms<mutable_traits> mutable_algorithms; typedef list_algorithms<const_traits> const_algorithms; }; } #endif template< class Container, method_set_type MethodMask = all_methods, class Traits = list_traits<Container> > struct list_suite : container_suite<Container, MethodMask, list_algorithms<Traits> > { }; ///////////////////////////////////////////////////////////////////////// // Reverse the contents of a list (using member function) ///////////////////////////////////////////////////////////////////////// template<typename ContainerTraits, typename Ovr> void list_algorithms<ContainerTraits, Ovr>::reverse (container &c) { c.reverse(); } ///////////////////////////////////////////////////////////////////////// // Sort the contents of a list (using member function) ///////////////////////////////////////////////////////////////////////// template<typename ContainerTraits, typename Ovr> void list_algorithms<ContainerTraits, Ovr>::sort (container &c) { typedef typename self_type::container_traits::value_traits_type vtraits; typedef typename vtraits::less comparison; #if BOOST_WORKAROUND (BOOST_MSVC, == 1200) // MSVC6 doesn't have a templated sort member in list, so we just // use the parameterless version. This gives the correct behaviour // provided that value_traits_type::less is exactly // std::less<value_type>. It would be possible to support // std::greater<T> (the only other overload of list::sort in // MSVC6) with some additional work. BOOST_STATIC_ASSERT( (::boost::is_same<comparison, std::less<value_type> >::value)); c.sort (); #else c.sort (comparison()); #endif } } } } #endif // BOOST_PYTHON_INDEXING_LIST_HPP
[ "roman_yakovenko@dc5859f9-2512-0410-ae5c-dd123cda1f76" ]
roman_yakovenko@dc5859f9-2512-0410-ae5c-dd123cda1f76
85bf1ab4e22a82c3739bf20176e426cc629b77ea
f875f2ff25629091b2f234140891f407ef537608
/aws-cpp-sdk-lexv2-models/include/aws/lexv2-models/model/DescribeBotLocaleRequest.h
0651be4da96400c75885ff72578b944799e72959
[ "MIT", "Apache-2.0", "JSON" ]
permissive
Adam9911/aws-sdk-cpp
39f0c057c25053929aec41ef8de81a9664c1a616
da78cc54da7de3894af2742316cec2814832b3c1
refs/heads/main
2023-06-03T10:25:53.887456
2021-05-15T14:49:26
2021-05-15T14:49:26
367,572,100
0
0
Apache-2.0
2021-05-15T07:52:14
2021-05-15T07:52:13
null
UTF-8
C++
false
false
7,766
h
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/lexv2-models/LexModelsV2_EXPORTS.h> #include <aws/lexv2-models/LexModelsV2Request.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { namespace LexModelsV2 { namespace Model { /** */ class AWS_LEXMODELSV2_API DescribeBotLocaleRequest : public LexModelsV2Request { public: DescribeBotLocaleRequest(); // Service request name is the Operation name which will send this request out, // each operation should has unique request name, so that we can get operation's name from this request. // Note: this is not true for response, multiple operations may have the same response name, // so we can not get operation's name from response. inline virtual const char* GetServiceRequestName() const override { return "DescribeBotLocale"; } Aws::String SerializePayload() const override; /** * <p>The identifier of the bot associated with the locale.</p> */ inline const Aws::String& GetBotId() const{ return m_botId; } /** * <p>The identifier of the bot associated with the locale.</p> */ inline bool BotIdHasBeenSet() const { return m_botIdHasBeenSet; } /** * <p>The identifier of the bot associated with the locale.</p> */ inline void SetBotId(const Aws::String& value) { m_botIdHasBeenSet = true; m_botId = value; } /** * <p>The identifier of the bot associated with the locale.</p> */ inline void SetBotId(Aws::String&& value) { m_botIdHasBeenSet = true; m_botId = std::move(value); } /** * <p>The identifier of the bot associated with the locale.</p> */ inline void SetBotId(const char* value) { m_botIdHasBeenSet = true; m_botId.assign(value); } /** * <p>The identifier of the bot associated with the locale.</p> */ inline DescribeBotLocaleRequest& WithBotId(const Aws::String& value) { SetBotId(value); return *this;} /** * <p>The identifier of the bot associated with the locale.</p> */ inline DescribeBotLocaleRequest& WithBotId(Aws::String&& value) { SetBotId(std::move(value)); return *this;} /** * <p>The identifier of the bot associated with the locale.</p> */ inline DescribeBotLocaleRequest& WithBotId(const char* value) { SetBotId(value); return *this;} /** * <p>The identifier of the version of the bot associated with the locale.</p> */ inline const Aws::String& GetBotVersion() const{ return m_botVersion; } /** * <p>The identifier of the version of the bot associated with the locale.</p> */ inline bool BotVersionHasBeenSet() const { return m_botVersionHasBeenSet; } /** * <p>The identifier of the version of the bot associated with the locale.</p> */ inline void SetBotVersion(const Aws::String& value) { m_botVersionHasBeenSet = true; m_botVersion = value; } /** * <p>The identifier of the version of the bot associated with the locale.</p> */ inline void SetBotVersion(Aws::String&& value) { m_botVersionHasBeenSet = true; m_botVersion = std::move(value); } /** * <p>The identifier of the version of the bot associated with the locale.</p> */ inline void SetBotVersion(const char* value) { m_botVersionHasBeenSet = true; m_botVersion.assign(value); } /** * <p>The identifier of the version of the bot associated with the locale.</p> */ inline DescribeBotLocaleRequest& WithBotVersion(const Aws::String& value) { SetBotVersion(value); return *this;} /** * <p>The identifier of the version of the bot associated with the locale.</p> */ inline DescribeBotLocaleRequest& WithBotVersion(Aws::String&& value) { SetBotVersion(std::move(value)); return *this;} /** * <p>The identifier of the version of the bot associated with the locale.</p> */ inline DescribeBotLocaleRequest& WithBotVersion(const char* value) { SetBotVersion(value); return *this;} /** * <p>The unique identifier of the locale to describe. The string must match one of * the supported locales. For more information, see <a * href="https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html">https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html</a>. * </p> */ inline const Aws::String& GetLocaleId() const{ return m_localeId; } /** * <p>The unique identifier of the locale to describe. The string must match one of * the supported locales. For more information, see <a * href="https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html">https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html</a>. * </p> */ inline bool LocaleIdHasBeenSet() const { return m_localeIdHasBeenSet; } /** * <p>The unique identifier of the locale to describe. The string must match one of * the supported locales. For more information, see <a * href="https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html">https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html</a>. * </p> */ inline void SetLocaleId(const Aws::String& value) { m_localeIdHasBeenSet = true; m_localeId = value; } /** * <p>The unique identifier of the locale to describe. The string must match one of * the supported locales. For more information, see <a * href="https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html">https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html</a>. * </p> */ inline void SetLocaleId(Aws::String&& value) { m_localeIdHasBeenSet = true; m_localeId = std::move(value); } /** * <p>The unique identifier of the locale to describe. The string must match one of * the supported locales. For more information, see <a * href="https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html">https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html</a>. * </p> */ inline void SetLocaleId(const char* value) { m_localeIdHasBeenSet = true; m_localeId.assign(value); } /** * <p>The unique identifier of the locale to describe. The string must match one of * the supported locales. For more information, see <a * href="https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html">https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html</a>. * </p> */ inline DescribeBotLocaleRequest& WithLocaleId(const Aws::String& value) { SetLocaleId(value); return *this;} /** * <p>The unique identifier of the locale to describe. The string must match one of * the supported locales. For more information, see <a * href="https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html">https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html</a>. * </p> */ inline DescribeBotLocaleRequest& WithLocaleId(Aws::String&& value) { SetLocaleId(std::move(value)); return *this;} /** * <p>The unique identifier of the locale to describe. The string must match one of * the supported locales. For more information, see <a * href="https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html">https://docs.aws.amazon.com/lex/latest/dg/supported-locales.html</a>. * </p> */ inline DescribeBotLocaleRequest& WithLocaleId(const char* value) { SetLocaleId(value); return *this;} private: Aws::String m_botId; bool m_botIdHasBeenSet; Aws::String m_botVersion; bool m_botVersionHasBeenSet; Aws::String m_localeId; bool m_localeIdHasBeenSet; }; } // namespace Model } // namespace LexModelsV2 } // namespace Aws
[ "aws-sdk-cpp-automation@github.com" ]
aws-sdk-cpp-automation@github.com
a87d32f7b168015de16195b0f4ff37307df52a98
7a83513e32715f1f17b72e4e74b8b9d28b480ce9
/main.cpp
155873c2eda5a62695a2ea0d3e9d42d1300fa931
[]
no_license
kannan-xiao4/opengl-tutorial
bc83cbf170bd678b2a519956cf58aa7d6f27a39a
a4d59875bcb5269e29f61ac76ccbcd085ffc1cd8
refs/heads/master
2020-07-22T05:30:07.531373
2019-09-24T15:04:48
2019-09-24T15:04:48
207,087,170
0
0
null
null
null
null
UTF-8
C++
false
false
9,339
cpp
#include <cmath> #include <cstdlib> #include <iostream> #include <vector> #include <memory> #include <unistd.h> #include <GL/glew.h> #include <GLFW/glfw3.h> #include "load_window.hpp" #include "class/Object.h" #include "class/Shape.h" #include "class/ShapeIndex.h" #include "class/SolidShapeIndex.h" #include "class/SolidShape.h" #include "class/Window.h" #include "class/Matrix.h" #include "class/Vector.h" #include "class/Material.h" #include "class/Uniform.h" static constexpr Object::Vertex rectangleVertex[] = { { -0.5f, -0.5f }, { 0.5f, -0.5f }, { 0.5f, 0.5f }, { -0.5f, 0.5f } }; constexpr Object::Vertex octahedronVertex[] = { { 0.0f, 1.0f, 0.0f }, { -1.0f, 0.0f, 0.0f }, { 0.0f, -1.0f, 0.0f }, { 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, { 0.0f, 0.0f, 1.0f }, { 0.0f, -1.0f, 0.0f }, { 0.0f, 0.0f, -1.0f }, { -1.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 1.0f }, { 1.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, -1.0f } }; constexpr Object::Vertex cubeVertex[] = { { -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f }, // (0) { -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.8f }, // (1) { -1.0f, 1.0f, 1.0f, 0.0f, 0.8f, 0.0f }, // (2) { -1.0f, 1.0f, -1.0f, 0.0f, 0.8f, 0.8f }, // (3) { 1.0f, 1.0f, -1.0f, 0.8f, 0.0f, 0.0f }, // (4) { 1.0f, -1.0f, -1.0f, 0.8f, 0.0f, 0.8f }, // (5) { 1.0f, -1.0f, 1.0f, 0.8f, 0.8f, 0.0f }, // (6) { 1.0f, 1.0f, 1.0f, 0.8f, 0.8f, 0.8f } // (7) }; // 六面体の稜線の両端点のインデックス constexpr GLuint wireCubeIndex[] = { 1, 0, // (a) 2, 7, // (b) 3, 0, // (c) 4, 7, // (d) 5, 0, // (e) 6, 7, // (f) 1, 2, // (g) 2, 3, // (h) 3, 4, // (i) 4, 5, // (j) 5, 6, // (k) 6, 1 // (l) }; constexpr Object::Vertex solidCubeVertex[] = { // 左 { -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f }, { -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f }, { -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f }, { -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f }, { -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f }, { -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f }, // 裏 { 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f }, { -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f }, { -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f }, { 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f }, { -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f }, { 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f }, // 下 { -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f }, { 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f }, { 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f }, { -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f }, { 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f }, { -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f }, // 右 { 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f }, { 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f }, { 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f }, { 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f }, { 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f }, { 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f }, // 上 { -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f }, { -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f }, { 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f }, { -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f }, { 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f }, { 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f }, // 前 { -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f }, { 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f }, { 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f }, { -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f }, { 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f }, { -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f } }; constexpr GLuint solidCubeIndex[] = { 0, 1, 2, 3, 4, 5, // 左 6, 7, 8, 9,10,11,//裏 12, 13, 14, 15, 16, 17, // 下 18, 19, 20, 21, 22, 23, //右 24, 25, 26, 27, 28, 29, // 上 30,31,32,33,34,35 //前 }; int main(int argc, const char * argv[]) { char dir[255]; getcwd(dir,255); std::cout << "Current Directory : " << dir << std::endl; if (glfwInit() == GL_FALSE) { std::cerr << "Cant initialize GLFW" << std::endl; return 1; } atexit(glfwTerminate); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); Window window; glClearColor(1.0f, 1.0f, 1.0f, 0.0f); glFrontFace(GL_CCW); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); glClearDepth(1.0); glDepthFunc(GL_LESS); glEnable(GL_DEPTH_TEST); const GLuint program(loadProgram("point.vert", "point.frag")); const GLint modelViewLoc(glGetUniformLocation(program, "modelview")); const GLint projectionLoc(glGetUniformLocation(program, "projection")); const GLint normalMatrixLoc(glGetUniformLocation(program, "normalMatrix")); const GLint LposLoc(glGetUniformLocation(program, "Lpos")); const GLint LambLoc(glGetUniformLocation(program, "Lamb")); const GLint LdiffLoc(glGetUniformLocation(program, "Ldiff")); const GLint LspecLoc(glGetUniformLocation(program, "Lspec")); const GLint materialLoc(glGetUniformBlockIndex(program, "Material")); glUniformBlockBinding(program, materialLoc, 0); const int slices(16), stacks(8); std::vector<Object::Vertex> solidSphereVertex; for (int j = 0; j <= stacks; ++j) { const float t(static_cast<float>(j) / static_cast<float>(stacks)); const float y(cos(3.141593f * t)), r(sin(3.141593f * t)); for (int i = 0; i <= slices; ++i) { const float s(static_cast<float>(i) / static_cast<float>(slices)); const float z(r * cos(2.0f * 3.141593f * s)), x(r * sin(2.0f * 3.141593f * s)); const Object::Vertex v = {x, y, z, x, y, z}; solidSphereVertex.emplace_back(v); } } std::vector<GLuint> solidSphereIndex; for (int j = 0; j <= stacks; ++j) { const int k((slices + 1) * j); for (int i = 0; i <= slices; ++i) { const GLuint k0(k + i); const GLuint k1(k0 + 1); const GLuint k2(k1 + slices); const GLuint k3(k2 + 1); solidSphereIndex.emplace_back(k0); solidSphereIndex.emplace_back(k2); solidSphereIndex.emplace_back(k3); solidSphereIndex.emplace_back(k0); solidSphereIndex.emplace_back(k3); solidSphereIndex.emplace_back(k1); } } //std::unique_ptr<const Shape> shape(new SolidShapeIndex(3, 36, solidCubeVertex, 36, solidCubeIndex)); std::unique_ptr<const Shape> shape(new SolidShapeIndex(3, static_cast<GLsizei>(solidSphereVertex.size()), solidSphereVertex.data(), static_cast<GLsizei>(solidSphereIndex.size()), solidSphereIndex.data())); static constexpr int Lcount(2); static constexpr Vector Lpos[] = {0.0f, 0.0f, 5.0f, 1.0f, 8.0f, 0.0f, 0.0f, 1.0f}; static constexpr GLfloat Lamb[] = {0.2f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f}; static constexpr GLfloat Ldiff[] = {1.0f, 0.5f, 0.5f, 0.9f, 0.9f, 0.9f}; static constexpr GLfloat Lspec[] = {1.0f, 0.5f, 0.5f, 0.9f, 0.9f, 0.9f}; static constexpr Material color[] = { // Kamb Kdiff Kspec Kshi { 0.6f, 0.6f, 0.2f, 0.6f, 0.6f, 0.2f, 0.3f, 0.3f, 0.3f, 30.0f }, { 0.1f, 0.1f, 0.5f, 0.1f, 0.1f, 0.5f, 0.4f, 0.4f, 0.4f, 60.0f } }; const Uniform<Material> material(color, 2); glfwSetTime(0.0); while (window) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glUseProgram(program); const GLfloat *const size(window.getSize()); const GLfloat fovy(window.getScale() * 0.01f); const GLfloat aspect(size[0] / size[1]); const Matrix projection(Matrix::perspective(fovy, aspect, 1.0f, 10.0f)); const GLfloat *const location(window.getLocation()); const Matrix r(Matrix::rotate(static_cast<GLfloat>(glfwGetTime()), 0.0f, 1.0f, 0.0f)); const Matrix model(Matrix::translate(location[0], location[1], 0.0f) * r); const Matrix view(Matrix::lookat(3.0f, 4.0f, 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f)); GLfloat normalMatrix[9]; const Matrix modelview(view * model); modelview.getNormalMatrix(normalMatrix); glUniformMatrix4fv(projectionLoc, 1, GL_FALSE, projection.data()); glUniformMatrix4fv(modelViewLoc, 1, GL_FALSE, modelview.data()); glUniformMatrix3fv(normalMatrixLoc, 1, GL_FALSE, normalMatrix); for (int i = 0; i < Lcount; ++i) { glUniform4fv(LposLoc+i, 1, (view * Lpos[i]).data()); } glUniform3fv(LambLoc, Lcount, Lamb); glUniform3fv(LdiffLoc, Lcount, Ldiff); glUniform3fv(LspecLoc, Lcount, Lspec); material.select(0, 0); shape->draw(); const Matrix modelview1(modelview * Matrix::translate(0.0f, 0.0f, 3.0f)); modelview1.getNormalMatrix(normalMatrix); glUniformMatrix4fv(modelViewLoc, 1, GL_FALSE, modelview1.data()); glUniformMatrix3fv(normalMatrixLoc, 1, GL_FALSE, normalMatrix); material.select(0, 1); shape->draw(); window.swapBuffers(); } }
[ "wingrakhi@live.jp" ]
wingrakhi@live.jp
9cfdcdfa9d41ce203280c22c83ab3ad03fa8e237
bb107c57ebf239a25d127f9c98978c42c4dd4405
/cpp/faceDetection.cpp
2e5a279d0dc47381333945859137971e0cb8876f
[]
no_license
pato/cfcontroller
2e8691c40fec1c6a6a46401b5537b693384bc207
7c47026d0ff94b7fa01d5da85979a5d11721d0f9
refs/heads/master
2020-06-03T16:48:47.244187
2014-05-06T18:54:37
2014-05-06T18:54:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,419
cpp
#include "opencv2/objdetect/objdetect.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include <iostream> #include <stdio.h> using namespace std; using namespace cv; /** Function Headers */ void detectAndDisplay( Mat frame ); /** Global variables */ String face_cascade_name = "haarcascade_frontalface_alt.xml"; String eyes_cascade_name = "haarcascade_eye_tree_eyeglasses.xml"; CascadeClassifier face_cascade; CascadeClassifier eyes_cascade; string window_name = "Capture - Face detection"; RNG rng(12345); /** @function main */ int main( int argc, const char** argv ) { CvCapture* capture; Mat frame; //-- 1. Load the cascades if( !face_cascade.load( face_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; }; if( !eyes_cascade.load( eyes_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; }; //-- 2. Read the video stream capture = cvCaptureFromCAM( -1 ); if( capture ) { while( true ) { frame = cvQueryFrame( capture ); //-- 3. Apply the classifier to the frame if( !frame.empty() ) { detectAndDisplay( frame ); } else { printf(" --(!) No captured frame -- Break!"); break; } int c = waitKey(10); if( (char)c == 'c' ) { break; } } } return 0; } /** @function detectAndDisplay */ void detectAndDisplay( Mat frame ) { std::vector<Rect> faces; Mat frame_gray; cvtColor( frame, frame_gray, CV_BGR2GRAY ); equalizeHist( frame_gray, frame_gray ); //-- Detect faces face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) ); for( size_t i = 0; i < faces.size(); i++ ) { Point center( faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5 ); ellipse( frame, center, Size( faces[i].width*0.5, faces[i].height*0.5), 0, 0, 360, Scalar( 255, 0, 255 ), 4, 8, 0 ); Mat faceROI = frame_gray( faces[i] ); std::vector<Rect> eyes; //-- In each face, detect eyes eyes_cascade.detectMultiScale( faceROI, eyes, 1.1, 2, 0 |CV_HAAR_SCALE_IMAGE, Size(30, 30) ); for( size_t j = 0; j < eyes.size(); j++ ) { Point center( faces[i].x + eyes[j].x + eyes[j].width*0.5, faces[i].y + eyes[j].y + eyes[j].height*0.5 ); int radius = cvRound( (eyes[j].width + eyes[j].height)*0.25 ); circle( frame, center, radius, Scalar( 255, 0, 0 ), 4, 8, 0 ); } } //-- Show what you got imshow( window_name, frame ); }
[ "plankenau@gmail.com" ]
plankenau@gmail.com
0c6984cf39ae1b2f3d7cacdd29bfa4eb3023223c
6ca69f81bc9ce9362ab36a72940ebd9abc55c312
/evaluation/2refactor/mse-error.h
b8b6a46e759bedfadb040d345415aaae3c08c1e1
[ "Apache-2.0" ]
permissive
nicholasRenninger/dfasat
18414e1fd776923db25a52e5376d4aa0553046b8
d1cf04ada0831d0605a3651971ef9a02091d8823
refs/heads/master
2023-07-23T16:37:18.329120
2020-02-28T20:33:18
2020-02-28T20:33:18
237,639,593
2
1
NOASSERTION
2023-07-06T21:08:41
2020-02-01T16:04:08
C++
UTF-8
C++
false
false
585
h
#ifndef __MSEERROR__ #define __MSEERROR__ #include "evaluate.h" class mse_error: public evaluation_function{ protected: REGISTER_DEC_TYPE(mse_error); public: double merge_error; virtual bool consistent(state_merger *merger, apta_node* left, apta_node* right); virtual void update_score(state_merger *merger, apta_node* left, apta_node* right); virtual int compute_score(state_merger*, apta_node* left, apta_node* right); virtual void reset(state_merger *merger); virtual bool compute_consistency(state_merger *merger, apta_node* left, apta_node* right); }; #endif
[ "christian.hammerschmidt@uni.lu" ]
christian.hammerschmidt@uni.lu
ffc25ba3e488b3073b52b24fd51ad13711c0c367
7eb2988d141e1ff7e22640a031a2e4cf493e40fc
/Hmwk/Assignment 1/Savitch_9thEd_Chap1_Prob3_CoinCounter/main.cpp
da5e8f2a588d9de2604bb425d34ba61ed49fadd7
[]
no_license
junotang96/TangMinhQuan_2648772
b9147f57cb87ae3c80c52c520780ba781916f43a
e96c71a0c571bfc9f1ec343cb449ad9d38dd5f78
refs/heads/master
2020-04-10T19:45:55.893026
2016-12-12T16:54:35
2016-12-12T16:54:35
68,021,414
0
0
null
null
null
null
UTF-8
C++
false
false
758
cpp
/* File: main Author: Minh Quan Tang Created on September 15, 2016, 5:08 PM Purpose: Count the number of coin */ //System Libraries #include <iostream> //Input/Output objects using namespace std; //Name-space used in the System Library //User Libraries //Global Constants //Function prototypes //Execution Begins Here! int main(int argc, char** argv) { //Declaration of Variables int quar=25, dim=10, nick=5, total; //Input values cout<<"Enter the number of quarters, dimes and nickels:\n";cin>>quar>>dim>>nick; total = 25 * quar + 10 * dim + 5 * nick; //total in cents cout<<"The coins are worth ";if (total >= 100) {cout<<total / 100<<" dollar(s) "; } cout<<total % 100<<" cents\n"; return 0; }
[ "junolais@hotmail.com" ]
junolais@hotmail.com
7f8246b13ec2c945d3fce31c8f517363ddd51ef3
2fded77fc7028f6c7ae11233f8162e5adae3dadb
/vtkVisualizer/inc/vtk/Rendering/Volume/Testing/Cxx/TestGPUVolumeRayCastMapper.cxx
c0faf2631b99c99be07a1cfcdf7d3de10b13bf56
[]
no_license
nagyistge/MedicalVisualization
ab70c38100c487fb9fa94beb6938530de913813e
40bcd54f465f1acdb18ccd641105a6002374fe05
refs/heads/master
2020-04-11T23:46:30.450284
2016-01-18T16:30:55
2016-01-18T16:30:55
52,168,821
2
0
null
2016-02-20T18:34:11
2016-02-20T18:34:11
null
UTF-8
C++
false
false
47,746
cxx
/*========================================================================= Program: Visualization Toolkit Module: TestGPUVolumeRayCastMapper.cxx Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // Description // This is a basic test that creates and volume renders the wavelet dataset. #include "vtkCamera.h" #include "vtkColorTransferFunction.h" #include "vtkGPUVolumeRayCastMapper.h" #include "vtkImageData.h" #include "vtkInteractorStyleTrackballCamera.h" #include "vtkNew.h" #include "vtkPiecewiseFunction.h" #include "vtkRenderer.h" #include "vtkRenderWindow.h" #include "vtkRenderWindowInteractor.h" #include "vtkRTAnalyticSource.h" #include "vtkTesting.h" #include "vtkTimerLog.h" #include "vtkVolume.h" #include "vtkVolumeProperty.h" static const char * TestGPUVolumeRayCastMapperLog = "# StreamVersion 1\n" "EnterEvent 299 0 0 0 0 0 0\n" "MouseMoveEvent 299 0 0 0 0 0 0\n" "MouseMoveEvent 298 2 0 0 0 0 0\n" "MouseMoveEvent 297 4 0 0 0 0 0\n" "MouseMoveEvent 297 6 0 0 0 0 0\n" "MouseMoveEvent 296 8 0 0 0 0 0\n" "MouseMoveEvent 294 11 0 0 0 0 0\n" "MouseMoveEvent 292 14 0 0 0 0 0\n" "MouseMoveEvent 290 18 0 0 0 0 0\n" "MouseMoveEvent 287 23 0 0 0 0 0\n" "MouseMoveEvent 283 29 0 0 0 0 0\n" "MouseMoveEvent 279 37 0 0 0 0 0\n" "MouseMoveEvent 275 44 0 0 0 0 0\n" "MouseMoveEvent 271 51 0 0 0 0 0\n" "MouseMoveEvent 270 58 0 0 0 0 0\n" "MouseMoveEvent 267 65 0 0 0 0 0\n" "MouseMoveEvent 265 72 0 0 0 0 0\n" "MouseMoveEvent 262 80 0 0 0 0 0\n" "MouseMoveEvent 260 89 0 0 0 0 0\n" "MouseMoveEvent 257 99 0 0 0 0 0\n" "MouseMoveEvent 255 109 0 0 0 0 0\n" "MouseMoveEvent 253 119 0 0 0 0 0\n" "MouseMoveEvent 251 126 0 0 0 0 0\n" "MouseMoveEvent 251 132 0 0 0 0 0\n" "MouseMoveEvent 251 139 0 0 0 0 0\n" "MouseMoveEvent 250 145 0 0 0 0 0\n" "MouseMoveEvent 250 151 0 0 0 0 0\n" "MouseMoveEvent 248 157 0 0 0 0 0\n" "MouseMoveEvent 248 163 0 0 0 0 0\n" "MouseMoveEvent 246 168 0 0 0 0 0\n" "MouseMoveEvent 244 172 0 0 0 0 0\n" "MouseMoveEvent 244 176 0 0 0 0 0\n" "MouseMoveEvent 243 180 0 0 0 0 0\n" "MouseMoveEvent 243 182 0 0 0 0 0\n" "MouseMoveEvent 243 184 0 0 0 0 0\n" "MouseMoveEvent 243 186 0 0 0 0 0\n" "MouseMoveEvent 242 188 0 0 0 0 0\n" "MouseMoveEvent 242 190 0 0 0 0 0\n" "MouseMoveEvent 241 193 0 0 0 0 0\n" "MouseMoveEvent 241 196 0 0 0 0 0\n" "MouseMoveEvent 240 198 0 0 0 0 0\n" "MouseMoveEvent 239 200 0 0 0 0 0\n" "MouseMoveEvent 239 204 0 0 0 0 0\n" "MouseMoveEvent 238 206 0 0 0 0 0\n" "MouseMoveEvent 237 209 0 0 0 0 0\n" "MouseMoveEvent 236 212 0 0 0 0 0\n" "MouseMoveEvent 236 214 0 0 0 0 0\n" "MouseMoveEvent 236 216 0 0 0 0 0\n" "MouseMoveEvent 235 219 0 0 0 0 0\n" "MouseMoveEvent 235 220 0 0 0 0 0\n" "MouseMoveEvent 233 223 0 0 0 0 0\n" "MouseMoveEvent 233 224 0 0 0 0 0\n" "MouseMoveEvent 232 225 0 0 0 0 0\n" "MouseMoveEvent 232 226 0 0 0 0 0\n" "MouseMoveEvent 231 227 0 0 0 0 0\n" "MouseMoveEvent 231 228 0 0 0 0 0\n" "MouseMoveEvent 230 230 0 0 0 0 0\n" "MouseMoveEvent 229 232 0 0 0 0 0\n" "MouseMoveEvent 229 233 0 0 0 0 0\n" "MouseMoveEvent 228 235 0 0 0 0 0\n" "MouseMoveEvent 227 236 0 0 0 0 0\n" "MouseMoveEvent 227 237 0 0 0 0 0\n" "MouseMoveEvent 227 238 0 0 0 0 0\n" "MouseMoveEvent 226 239 0 0 0 0 0\n" "MouseMoveEvent 226 240 0 0 0 0 0\n" "MouseMoveEvent 225 241 0 0 0 0 0\n" "MouseMoveEvent 224 241 0 0 0 0 0\n" "MouseMoveEvent 223 242 0 0 0 0 0\n" "MouseMoveEvent 223 243 0 0 0 0 0\n" "MouseMoveEvent 222 245 0 0 0 0 0\n" "MouseMoveEvent 222 246 0 0 0 0 0\n" "MouseMoveEvent 222 249 0 0 0 0 0\n" "MouseMoveEvent 222 251 0 0 0 0 0\n" "MouseMoveEvent 221 253 0 0 0 0 0\n" "MouseMoveEvent 221 255 0 0 0 0 0\n" "MouseMoveEvent 221 256 0 0 0 0 0\n" "MouseMoveEvent 220 258 0 0 0 0 0\n" "MouseMoveEvent 220 259 0 0 0 0 0\n" "MouseMoveEvent 220 260 0 0 0 0 0\n" "MouseMoveEvent 220 261 0 0 0 0 0\n" "MouseMoveEvent 220 262 0 0 0 0 0\n" "MouseMoveEvent 220 263 0 0 0 0 0\n" "MouseMoveEvent 220 264 0 0 0 0 0\n" "MouseMoveEvent 219 266 0 0 0 0 0\n" "MouseMoveEvent 219 267 0 0 0 0 0\n" "MouseMoveEvent 219 268 0 0 0 0 0\n" "MouseMoveEvent 219 269 0 0 0 0 0\n" "MouseMoveEvent 218 271 0 0 0 0 0\n" "MouseMoveEvent 218 272 0 0 0 0 0\n" "LeftButtonPressEvent 218 272 0 0 0 0 0\n" "StartInteractionEvent 218 272 0 0 0 0 0\n" "MouseMoveEvent 219 273 0 0 0 0 0\n" "RenderEvent 219 273 0 0 0 0 0\n" "InteractionEvent 219 273 0 0 0 0 0\n" "MouseMoveEvent 220 272 0 0 0 0 0\n" "RenderEvent 220 272 0 0 0 0 0\n" "InteractionEvent 220 272 0 0 0 0 0\n" "MouseMoveEvent 220 271 0 0 0 0 0\n" "RenderEvent 220 271 0 0 0 0 0\n" "InteractionEvent 220 271 0 0 0 0 0\n" "MouseMoveEvent 221 270 0 0 0 0 0\n" "RenderEvent 221 270 0 0 0 0 0\n" "InteractionEvent 221 270 0 0 0 0 0\n" "MouseMoveEvent 221 269 0 0 0 0 0\n" "RenderEvent 221 269 0 0 0 0 0\n" "InteractionEvent 221 269 0 0 0 0 0\n" "MouseMoveEvent 221 268 0 0 0 0 0\n" "RenderEvent 221 268 0 0 0 0 0\n" "InteractionEvent 221 268 0 0 0 0 0\n" "MouseMoveEvent 221 266 0 0 0 0 0\n" "RenderEvent 221 266 0 0 0 0 0\n" "InteractionEvent 221 266 0 0 0 0 0\n" "MouseMoveEvent 221 265 0 0 0 0 0\n" "RenderEvent 221 265 0 0 0 0 0\n" "InteractionEvent 221 265 0 0 0 0 0\n" "MouseMoveEvent 222 263 0 0 0 0 0\n" "RenderEvent 222 263 0 0 0 0 0\n" "InteractionEvent 222 263 0 0 0 0 0\n" "MouseMoveEvent 222 262 0 0 0 0 0\n" "RenderEvent 222 262 0 0 0 0 0\n" "InteractionEvent 222 262 0 0 0 0 0\n" "MouseMoveEvent 222 258 0 0 0 0 0\n" "RenderEvent 222 258 0 0 0 0 0\n" "InteractionEvent 222 258 0 0 0 0 0\n" "MouseMoveEvent 223 255 0 0 0 0 0\n" "RenderEvent 223 255 0 0 0 0 0\n" "InteractionEvent 223 255 0 0 0 0 0\n" "MouseMoveEvent 223 253 0 0 0 0 0\n" "RenderEvent 223 253 0 0 0 0 0\n" "InteractionEvent 223 253 0 0 0 0 0\n" "MouseMoveEvent 223 250 0 0 0 0 0\n" "RenderEvent 223 250 0 0 0 0 0\n" "InteractionEvent 223 250 0 0 0 0 0\n" "MouseMoveEvent 223 248 0 0 0 0 0\n" "RenderEvent 223 248 0 0 0 0 0\n" "InteractionEvent 223 248 0 0 0 0 0\n" "MouseMoveEvent 223 247 0 0 0 0 0\n" "RenderEvent 223 247 0 0 0 0 0\n" "InteractionEvent 223 247 0 0 0 0 0\n" "MouseMoveEvent 223 246 0 0 0 0 0\n" "RenderEvent 223 246 0 0 0 0 0\n" "InteractionEvent 223 246 0 0 0 0 0\n" "MouseMoveEvent 223 245 0 0 0 0 0\n" "RenderEvent 223 245 0 0 0 0 0\n" "InteractionEvent 223 245 0 0 0 0 0\n" "MouseMoveEvent 223 244 0 0 0 0 0\n" "RenderEvent 223 244 0 0 0 0 0\n" "InteractionEvent 223 244 0 0 0 0 0\n" "MouseMoveEvent 223 242 0 0 0 0 0\n" "RenderEvent 223 242 0 0 0 0 0\n" "InteractionEvent 223 242 0 0 0 0 0\n" "MouseMoveEvent 223 241 0 0 0 0 0\n" "RenderEvent 223 241 0 0 0 0 0\n" "InteractionEvent 223 241 0 0 0 0 0\n" "MouseMoveEvent 223 240 0 0 0 0 0\n" "RenderEvent 223 240 0 0 0 0 0\n" "InteractionEvent 223 240 0 0 0 0 0\n" "MouseMoveEvent 223 238 0 0 0 0 0\n" "RenderEvent 223 238 0 0 0 0 0\n" "InteractionEvent 223 238 0 0 0 0 0\n" "MouseMoveEvent 223 237 0 0 0 0 0\n" "RenderEvent 223 237 0 0 0 0 0\n" "InteractionEvent 223 237 0 0 0 0 0\n" "MouseMoveEvent 223 235 0 0 0 0 0\n" "RenderEvent 223 235 0 0 0 0 0\n" "InteractionEvent 223 235 0 0 0 0 0\n" "MouseMoveEvent 223 233 0 0 0 0 0\n" "RenderEvent 223 233 0 0 0 0 0\n" "InteractionEvent 223 233 0 0 0 0 0\n" "MouseMoveEvent 223 232 0 0 0 0 0\n" "RenderEvent 223 232 0 0 0 0 0\n" "InteractionEvent 223 232 0 0 0 0 0\n" "MouseMoveEvent 223 230 0 0 0 0 0\n" "RenderEvent 223 230 0 0 0 0 0\n" "InteractionEvent 223 230 0 0 0 0 0\n" "MouseMoveEvent 223 228 0 0 0 0 0\n" "RenderEvent 223 228 0 0 0 0 0\n" "InteractionEvent 223 228 0 0 0 0 0\n" "MouseMoveEvent 223 226 0 0 0 0 0\n" "RenderEvent 223 226 0 0 0 0 0\n" "InteractionEvent 223 226 0 0 0 0 0\n" "MouseMoveEvent 223 223 0 0 0 0 0\n" "RenderEvent 223 223 0 0 0 0 0\n" "InteractionEvent 223 223 0 0 0 0 0\n" "MouseMoveEvent 223 221 0 0 0 0 0\n" "RenderEvent 223 221 0 0 0 0 0\n" "InteractionEvent 223 221 0 0 0 0 0\n" "MouseMoveEvent 223 220 0 0 0 0 0\n" "RenderEvent 223 220 0 0 0 0 0\n" "InteractionEvent 223 220 0 0 0 0 0\n" "MouseMoveEvent 223 219 0 0 0 0 0\n" "RenderEvent 223 219 0 0 0 0 0\n" "InteractionEvent 223 219 0 0 0 0 0\n" "MouseMoveEvent 223 217 0 0 0 0 0\n" "RenderEvent 223 217 0 0 0 0 0\n" "InteractionEvent 223 217 0 0 0 0 0\n" "MouseMoveEvent 223 215 0 0 0 0 0\n" "RenderEvent 223 215 0 0 0 0 0\n" "InteractionEvent 223 215 0 0 0 0 0\n" "MouseMoveEvent 223 214 0 0 0 0 0\n" "RenderEvent 223 214 0 0 0 0 0\n" "InteractionEvent 223 214 0 0 0 0 0\n" "MouseMoveEvent 223 213 0 0 0 0 0\n" "RenderEvent 223 213 0 0 0 0 0\n" "InteractionEvent 223 213 0 0 0 0 0\n" "MouseMoveEvent 223 212 0 0 0 0 0\n" "RenderEvent 223 212 0 0 0 0 0\n" "InteractionEvent 223 212 0 0 0 0 0\n" "MouseMoveEvent 223 210 0 0 0 0 0\n" "RenderEvent 223 210 0 0 0 0 0\n" "InteractionEvent 223 210 0 0 0 0 0\n" "MouseMoveEvent 223 209 0 0 0 0 0\n" "RenderEvent 223 209 0 0 0 0 0\n" "InteractionEvent 223 209 0 0 0 0 0\n" "MouseMoveEvent 223 208 0 0 0 0 0\n" "RenderEvent 223 208 0 0 0 0 0\n" "InteractionEvent 223 208 0 0 0 0 0\n" "MouseMoveEvent 223 206 0 0 0 0 0\n" "RenderEvent 223 206 0 0 0 0 0\n" "InteractionEvent 223 206 0 0 0 0 0\n" "MouseMoveEvent 223 205 0 0 0 0 0\n" "RenderEvent 223 205 0 0 0 0 0\n" "InteractionEvent 223 205 0 0 0 0 0\n" "MouseMoveEvent 223 204 0 0 0 0 0\n" "RenderEvent 223 204 0 0 0 0 0\n" "InteractionEvent 223 204 0 0 0 0 0\n" "MouseMoveEvent 223 203 0 0 0 0 0\n" "RenderEvent 223 203 0 0 0 0 0\n" "InteractionEvent 223 203 0 0 0 0 0\n" "MouseMoveEvent 223 202 0 0 0 0 0\n" "RenderEvent 223 202 0 0 0 0 0\n" "InteractionEvent 223 202 0 0 0 0 0\n" "MouseMoveEvent 223 201 0 0 0 0 0\n" "RenderEvent 223 201 0 0 0 0 0\n" "InteractionEvent 223 201 0 0 0 0 0\n" "MouseMoveEvent 223 200 0 0 0 0 0\n" "RenderEvent 223 200 0 0 0 0 0\n" "InteractionEvent 223 200 0 0 0 0 0\n" "MouseMoveEvent 223 199 0 0 0 0 0\n" "RenderEvent 223 199 0 0 0 0 0\n" "InteractionEvent 223 199 0 0 0 0 0\n" "MouseMoveEvent 223 198 0 0 0 0 0\n" "RenderEvent 223 198 0 0 0 0 0\n" "InteractionEvent 223 198 0 0 0 0 0\n" "MouseMoveEvent 223 197 0 0 0 0 0\n" "RenderEvent 223 197 0 0 0 0 0\n" "InteractionEvent 223 197 0 0 0 0 0\n" "MouseMoveEvent 223 196 0 0 0 0 0\n" "RenderEvent 223 196 0 0 0 0 0\n" "InteractionEvent 223 196 0 0 0 0 0\n" "MouseMoveEvent 223 195 0 0 0 0 0\n" "RenderEvent 223 195 0 0 0 0 0\n" "InteractionEvent 223 195 0 0 0 0 0\n" "MouseMoveEvent 223 194 0 0 0 0 0\n" "RenderEvent 223 194 0 0 0 0 0\n" "InteractionEvent 223 194 0 0 0 0 0\n" "MouseMoveEvent 223 192 0 0 0 0 0\n" "RenderEvent 223 192 0 0 0 0 0\n" "InteractionEvent 223 192 0 0 0 0 0\n" "MouseMoveEvent 223 191 0 0 0 0 0\n" "RenderEvent 223 191 0 0 0 0 0\n" "InteractionEvent 223 191 0 0 0 0 0\n" "MouseMoveEvent 223 190 0 0 0 0 0\n" "RenderEvent 223 190 0 0 0 0 0\n" "InteractionEvent 223 190 0 0 0 0 0\n" "MouseMoveEvent 223 189 0 0 0 0 0\n" "RenderEvent 223 189 0 0 0 0 0\n" "InteractionEvent 223 189 0 0 0 0 0\n" "MouseMoveEvent 223 188 0 0 0 0 0\n" "RenderEvent 223 188 0 0 0 0 0\n" "InteractionEvent 223 188 0 0 0 0 0\n" "MouseMoveEvent 223 187 0 0 0 0 0\n" "RenderEvent 223 187 0 0 0 0 0\n" "InteractionEvent 223 187 0 0 0 0 0\n" "MouseMoveEvent 223 185 0 0 0 0 0\n" "RenderEvent 223 185 0 0 0 0 0\n" "InteractionEvent 223 185 0 0 0 0 0\n" "MouseMoveEvent 223 183 0 0 0 0 0\n" "RenderEvent 223 183 0 0 0 0 0\n" "InteractionEvent 223 183 0 0 0 0 0\n" "MouseMoveEvent 223 182 0 0 0 0 0\n" "RenderEvent 223 182 0 0 0 0 0\n" "InteractionEvent 223 182 0 0 0 0 0\n" "MouseMoveEvent 223 181 0 0 0 0 0\n" "RenderEvent 223 181 0 0 0 0 0\n" "InteractionEvent 223 181 0 0 0 0 0\n" "MouseMoveEvent 223 180 0 0 0 0 0\n" "RenderEvent 223 180 0 0 0 0 0\n" "InteractionEvent 223 180 0 0 0 0 0\n" "MouseMoveEvent 223 178 0 0 0 0 0\n" "RenderEvent 223 178 0 0 0 0 0\n" "InteractionEvent 223 178 0 0 0 0 0\n" "MouseMoveEvent 223 176 0 0 0 0 0\n" "RenderEvent 223 176 0 0 0 0 0\n" "InteractionEvent 223 176 0 0 0 0 0\n" "MouseMoveEvent 223 175 0 0 0 0 0\n" "RenderEvent 223 175 0 0 0 0 0\n" "InteractionEvent 223 175 0 0 0 0 0\n" "MouseMoveEvent 223 173 0 0 0 0 0\n" "RenderEvent 223 173 0 0 0 0 0\n" "InteractionEvent 223 173 0 0 0 0 0\n" "MouseMoveEvent 223 172 0 0 0 0 0\n" "RenderEvent 223 172 0 0 0 0 0\n" "InteractionEvent 223 172 0 0 0 0 0\n" "MouseMoveEvent 223 170 0 0 0 0 0\n" "RenderEvent 223 170 0 0 0 0 0\n" "InteractionEvent 223 170 0 0 0 0 0\n" "MouseMoveEvent 223 169 0 0 0 0 0\n" "RenderEvent 223 169 0 0 0 0 0\n" "InteractionEvent 223 169 0 0 0 0 0\n" "MouseMoveEvent 223 166 0 0 0 0 0\n" "RenderEvent 223 166 0 0 0 0 0\n" "InteractionEvent 223 166 0 0 0 0 0\n" "MouseMoveEvent 223 165 0 0 0 0 0\n" "RenderEvent 223 165 0 0 0 0 0\n" "InteractionEvent 223 165 0 0 0 0 0\n" "MouseMoveEvent 223 164 0 0 0 0 0\n" "RenderEvent 223 164 0 0 0 0 0\n" "InteractionEvent 223 164 0 0 0 0 0\n" "MouseMoveEvent 223 162 0 0 0 0 0\n" "RenderEvent 223 162 0 0 0 0 0\n" "InteractionEvent 223 162 0 0 0 0 0\n" "MouseMoveEvent 223 160 0 0 0 0 0\n" "RenderEvent 223 160 0 0 0 0 0\n" "InteractionEvent 223 160 0 0 0 0 0\n" "MouseMoveEvent 223 158 0 0 0 0 0\n" "RenderEvent 223 158 0 0 0 0 0\n" "InteractionEvent 223 158 0 0 0 0 0\n" "MouseMoveEvent 223 157 0 0 0 0 0\n" "RenderEvent 223 157 0 0 0 0 0\n" "InteractionEvent 223 157 0 0 0 0 0\n" "MouseMoveEvent 223 156 0 0 0 0 0\n" "RenderEvent 223 156 0 0 0 0 0\n" "InteractionEvent 223 156 0 0 0 0 0\n" "MouseMoveEvent 223 155 0 0 0 0 0\n" "RenderEvent 223 155 0 0 0 0 0\n" "InteractionEvent 223 155 0 0 0 0 0\n" "MouseMoveEvent 223 154 0 0 0 0 0\n" "RenderEvent 223 154 0 0 0 0 0\n" "InteractionEvent 223 154 0 0 0 0 0\n" "MouseMoveEvent 223 153 0 0 0 0 0\n" "RenderEvent 223 153 0 0 0 0 0\n" "InteractionEvent 223 153 0 0 0 0 0\n" "MouseMoveEvent 223 152 0 0 0 0 0\n" "RenderEvent 223 152 0 0 0 0 0\n" "InteractionEvent 223 152 0 0 0 0 0\n" "LeftButtonReleaseEvent 223 152 0 0 0 0 0\n" "EndInteractionEvent 223 152 0 0 0 0 0\n" "RenderEvent 223 152 0 0 0 0 0\n" "MouseMoveEvent 222 151 0 0 0 0 0\n" "MouseMoveEvent 221 151 0 0 0 0 0\n" "MouseMoveEvent 219 153 0 0 0 0 0\n" "MouseMoveEvent 219 155 0 0 0 0 0\n" "MouseMoveEvent 218 158 0 0 0 0 0\n" "MouseMoveEvent 217 161 0 0 0 0 0\n" "MouseMoveEvent 217 164 0 0 0 0 0\n" "MouseMoveEvent 217 167 0 0 0 0 0\n" "MouseMoveEvent 217 170 0 0 0 0 0\n" "MouseMoveEvent 217 175 0 0 0 0 0\n" "MouseMoveEvent 217 180 0 0 0 0 0\n" "MouseMoveEvent 217 184 0 0 0 0 0\n" "MouseMoveEvent 216 187 0 0 0 0 0\n" "MouseMoveEvent 216 188 0 0 0 0 0\n" "MouseMoveEvent 216 190 0 0 0 0 0\n" "MouseMoveEvent 216 192 0 0 0 0 0\n" "MouseMoveEvent 216 194 0 0 0 0 0\n" "MouseMoveEvent 216 196 0 0 0 0 0\n" "MouseMoveEvent 216 198 0 0 0 0 0\n" "MouseMoveEvent 216 199 0 0 0 0 0\n" "MouseMoveEvent 216 200 0 0 0 0 0\n" "RightButtonPressEvent 216 200 0 0 0 0 0\n" "StartInteractionEvent 216 200 0 0 0 0 0\n" "MouseMoveEvent 216 203 0 0 0 0 0\n" "RenderEvent 216 203 0 0 0 0 0\n" "InteractionEvent 216 203 0 0 0 0 0\n" "MouseMoveEvent 216 205 0 0 0 0 0\n" "RenderEvent 216 205 0 0 0 0 0\n" "InteractionEvent 216 205 0 0 0 0 0\n" "MouseMoveEvent 216 208 0 0 0 0 0\n" "RenderEvent 216 208 0 0 0 0 0\n" "InteractionEvent 216 208 0 0 0 0 0\n" "MouseMoveEvent 216 213 0 0 0 0 0\n" "RenderEvent 216 213 0 0 0 0 0\n" "InteractionEvent 216 213 0 0 0 0 0\n" "MouseMoveEvent 216 220 0 0 0 0 0\n" "RenderEvent 216 220 0 0 0 0 0\n" "InteractionEvent 216 220 0 0 0 0 0\n" "MouseMoveEvent 216 226 0 0 0 0 0\n" "RenderEvent 216 226 0 0 0 0 0\n" "InteractionEvent 216 226 0 0 0 0 0\n" "MouseMoveEvent 216 229 0 0 0 0 0\n" "RenderEvent 216 229 0 0 0 0 0\n" "InteractionEvent 216 229 0 0 0 0 0\n" "MouseMoveEvent 217 232 0 0 0 0 0\n" "RenderEvent 217 232 0 0 0 0 0\n" "InteractionEvent 217 232 0 0 0 0 0\n" "MouseMoveEvent 218 234 0 0 0 0 0\n" "RenderEvent 218 234 0 0 0 0 0\n" "InteractionEvent 218 234 0 0 0 0 0\n" "MouseMoveEvent 218 236 0 0 0 0 0\n" "RenderEvent 218 236 0 0 0 0 0\n" "InteractionEvent 218 236 0 0 0 0 0\n" "MouseMoveEvent 219 239 0 0 0 0 0\n" "RenderEvent 219 239 0 0 0 0 0\n" "InteractionEvent 219 239 0 0 0 0 0\n" "MouseMoveEvent 219 242 0 0 0 0 0\n" "RenderEvent 219 242 0 0 0 0 0\n" "InteractionEvent 219 242 0 0 0 0 0\n" "MouseMoveEvent 219 245 0 0 0 0 0\n" "RenderEvent 219 245 0 0 0 0 0\n" "InteractionEvent 219 245 0 0 0 0 0\n" "MouseMoveEvent 219 247 0 0 0 0 0\n" "RenderEvent 219 247 0 0 0 0 0\n" "InteractionEvent 219 247 0 0 0 0 0\n" "MouseMoveEvent 219 250 0 0 0 0 0\n" "RenderEvent 219 250 0 0 0 0 0\n" "InteractionEvent 219 250 0 0 0 0 0\n" "MouseMoveEvent 220 254 0 0 0 0 0\n" "RenderEvent 220 254 0 0 0 0 0\n" "InteractionEvent 220 254 0 0 0 0 0\n" "MouseMoveEvent 220 257 0 0 0 0 0\n" "RenderEvent 220 257 0 0 0 0 0\n" "InteractionEvent 220 257 0 0 0 0 0\n" "MouseMoveEvent 221 260 0 0 0 0 0\n" "RenderEvent 221 260 0 0 0 0 0\n" "InteractionEvent 221 260 0 0 0 0 0\n" "MouseMoveEvent 221 264 0 0 0 0 0\n" "RenderEvent 221 264 0 0 0 0 0\n" "InteractionEvent 221 264 0 0 0 0 0\n" "MouseMoveEvent 222 266 0 0 0 0 0\n" "RenderEvent 222 266 0 0 0 0 0\n" "InteractionEvent 222 266 0 0 0 0 0\n" "MouseMoveEvent 222 270 0 0 0 0 0\n" "RenderEvent 222 270 0 0 0 0 0\n" "InteractionEvent 222 270 0 0 0 0 0\n" "MouseMoveEvent 223 273 0 0 0 0 0\n" "RenderEvent 223 273 0 0 0 0 0\n" "InteractionEvent 223 273 0 0 0 0 0\n" "MouseMoveEvent 225 279 0 0 0 0 0\n" "RenderEvent 225 279 0 0 0 0 0\n" "InteractionEvent 225 279 0 0 0 0 0\n" "MouseMoveEvent 225 282 0 0 0 0 0\n" "RenderEvent 225 282 0 0 0 0 0\n" "InteractionEvent 225 282 0 0 0 0 0\n" "MouseMoveEvent 225 285 0 0 0 0 0\n" "RenderEvent 225 285 0 0 0 0 0\n" "InteractionEvent 225 285 0 0 0 0 0\n" "MouseMoveEvent 226 287 0 0 0 0 0\n" "RenderEvent 226 287 0 0 0 0 0\n" "InteractionEvent 226 287 0 0 0 0 0\n" "MouseMoveEvent 226 291 0 0 0 0 0\n" "RenderEvent 226 291 0 0 0 0 0\n" "InteractionEvent 226 291 0 0 0 0 0\n" "MouseMoveEvent 227 295 0 0 0 0 0\n" "RenderEvent 227 295 0 0 0 0 0\n" "InteractionEvent 227 295 0 0 0 0 0\n" "MouseMoveEvent 227 298 0 0 0 0 0\n" "RenderEvent 227 298 0 0 0 0 0\n" "InteractionEvent 227 298 0 0 0 0 0\n" "MouseMoveEvent 228 300 0 0 0 0 0\n" "RenderEvent 228 300 0 0 0 0 0\n" "InteractionEvent 228 300 0 0 0 0 0\n" "MouseMoveEvent 228 302 0 0 0 0 0\n" "RenderEvent 228 302 0 0 0 0 0\n" "InteractionEvent 228 302 0 0 0 0 0\n" "MouseMoveEvent 228 304 0 0 0 0 0\n" "RenderEvent 228 304 0 0 0 0 0\n" "InteractionEvent 228 304 0 0 0 0 0\n" "MouseMoveEvent 228 305 0 0 0 0 0\n" "RenderEvent 228 305 0 0 0 0 0\n" "InteractionEvent 228 305 0 0 0 0 0\n" "MouseMoveEvent 229 307 0 0 0 0 0\n" "RenderEvent 229 307 0 0 0 0 0\n" "InteractionEvent 229 307 0 0 0 0 0\n" "MouseMoveEvent 229 308 0 0 0 0 0\n" "RenderEvent 229 308 0 0 0 0 0\n" "InteractionEvent 229 308 0 0 0 0 0\n" "MouseMoveEvent 229 309 0 0 0 0 0\n" "RenderEvent 229 309 0 0 0 0 0\n" "InteractionEvent 229 309 0 0 0 0 0\n" "MouseMoveEvent 229 310 0 0 0 0 0\n" "RenderEvent 229 310 0 0 0 0 0\n" "InteractionEvent 229 310 0 0 0 0 0\n" "MouseMoveEvent 230 312 0 0 0 0 0\n" "RenderEvent 230 312 0 0 0 0 0\n" "InteractionEvent 230 312 0 0 0 0 0\n" "MouseMoveEvent 231 315 0 0 0 0 0\n" "RenderEvent 231 315 0 0 0 0 0\n" "InteractionEvent 231 315 0 0 0 0 0\n" "MouseMoveEvent 232 318 0 0 0 0 0\n" "RenderEvent 232 318 0 0 0 0 0\n" "InteractionEvent 232 318 0 0 0 0 0\n" "MouseMoveEvent 233 321 0 0 0 0 0\n" "RenderEvent 233 321 0 0 0 0 0\n" "InteractionEvent 233 321 0 0 0 0 0\n" "MouseMoveEvent 234 323 0 0 0 0 0\n" "RenderEvent 234 323 0 0 0 0 0\n" "InteractionEvent 234 323 0 0 0 0 0\n" "MouseMoveEvent 234 324 0 0 0 0 0\n" "RenderEvent 234 324 0 0 0 0 0\n" "InteractionEvent 234 324 0 0 0 0 0\n" "MouseMoveEvent 234 325 0 0 0 0 0\n" "RenderEvent 234 325 0 0 0 0 0\n" "InteractionEvent 234 325 0 0 0 0 0\n" "MouseMoveEvent 234 327 0 0 0 0 0\n" "RenderEvent 234 327 0 0 0 0 0\n" "InteractionEvent 234 327 0 0 0 0 0\n" "MouseMoveEvent 235 329 0 0 0 0 0\n" "RenderEvent 235 329 0 0 0 0 0\n" "InteractionEvent 235 329 0 0 0 0 0\n" "MouseMoveEvent 235 330 0 0 0 0 0\n" "RenderEvent 235 330 0 0 0 0 0\n" "InteractionEvent 235 330 0 0 0 0 0\n" "MouseMoveEvent 235 332 0 0 0 0 0\n" "RenderEvent 235 332 0 0 0 0 0\n" "InteractionEvent 235 332 0 0 0 0 0\n" "MouseMoveEvent 235 334 0 0 0 0 0\n" "RenderEvent 235 334 0 0 0 0 0\n" "InteractionEvent 235 334 0 0 0 0 0\n" "MouseMoveEvent 235 335 0 0 0 0 0\n" "RenderEvent 235 335 0 0 0 0 0\n" "InteractionEvent 235 335 0 0 0 0 0\n" "MouseMoveEvent 235 336 0 0 0 0 0\n" "RenderEvent 235 336 0 0 0 0 0\n" "InteractionEvent 235 336 0 0 0 0 0\n" "MouseMoveEvent 235 338 0 0 0 0 0\n" "RenderEvent 235 338 0 0 0 0 0\n" "InteractionEvent 235 338 0 0 0 0 0\n" "MouseMoveEvent 235 339 0 0 0 0 0\n" "RenderEvent 235 339 0 0 0 0 0\n" "InteractionEvent 235 339 0 0 0 0 0\n" "MouseMoveEvent 235 341 0 0 0 0 0\n" "RenderEvent 235 341 0 0 0 0 0\n" "InteractionEvent 235 341 0 0 0 0 0\n" "MouseMoveEvent 235 342 0 0 0 0 0\n" "RenderEvent 235 342 0 0 0 0 0\n" "InteractionEvent 235 342 0 0 0 0 0\n" "MouseMoveEvent 235 343 0 0 0 0 0\n" "RenderEvent 235 343 0 0 0 0 0\n" "InteractionEvent 235 343 0 0 0 0 0\n" "MouseMoveEvent 235 344 0 0 0 0 0\n" "RenderEvent 235 344 0 0 0 0 0\n" "InteractionEvent 235 344 0 0 0 0 0\n" "MouseMoveEvent 235 346 0 0 0 0 0\n" "RenderEvent 235 346 0 0 0 0 0\n" "InteractionEvent 235 346 0 0 0 0 0\n" "MouseMoveEvent 235 347 0 0 0 0 0\n" "RenderEvent 235 347 0 0 0 0 0\n" "InteractionEvent 235 347 0 0 0 0 0\n" "MouseMoveEvent 234 349 0 0 0 0 0\n" "RenderEvent 234 349 0 0 0 0 0\n" "InteractionEvent 234 349 0 0 0 0 0\n" "MouseMoveEvent 234 350 0 0 0 0 0\n" "RenderEvent 234 350 0 0 0 0 0\n" "InteractionEvent 234 350 0 0 0 0 0\n" "MouseMoveEvent 234 351 0 0 0 0 0\n" "RenderEvent 234 351 0 0 0 0 0\n" "InteractionEvent 234 351 0 0 0 0 0\n" "MouseMoveEvent 233 352 0 0 0 0 0\n" "RenderEvent 233 352 0 0 0 0 0\n" "InteractionEvent 233 352 0 0 0 0 0\n" "RightButtonReleaseEvent 233 352 0 0 0 0 0\n" "EndInteractionEvent 233 352 0 0 0 0 0\n" "RenderEvent 233 352 0 0 0 0 0\n" "MouseMoveEvent 232 353 0 0 0 0 0\n" "MiddleButtonPressEvent 232 353 0 0 0 0 0\n" "StartInteractionEvent 232 353 0 0 0 0 0\n" "MouseMoveEvent 232 352 0 0 0 0 0\n" "RenderEvent 232 352 0 0 0 0 0\n" "InteractionEvent 232 352 0 0 0 0 0\n" "MouseMoveEvent 232 351 0 0 0 0 0\n" "RenderEvent 232 351 0 0 0 0 0\n" "InteractionEvent 232 351 0 0 0 0 0\n" "MouseMoveEvent 232 350 0 0 0 0 0\n" "RenderEvent 232 350 0 0 0 0 0\n" "InteractionEvent 232 350 0 0 0 0 0\n" "MouseMoveEvent 232 348 0 0 0 0 0\n" "RenderEvent 232 348 0 0 0 0 0\n" "InteractionEvent 232 348 0 0 0 0 0\n" "MouseMoveEvent 232 344 0 0 0 0 0\n" "RenderEvent 232 344 0 0 0 0 0\n" "InteractionEvent 232 344 0 0 0 0 0\n" "MouseMoveEvent 232 340 0 0 0 0 0\n" "RenderEvent 232 340 0 0 0 0 0\n" "InteractionEvent 232 340 0 0 0 0 0\n" "MouseMoveEvent 232 333 0 0 0 0 0\n" "RenderEvent 232 333 0 0 0 0 0\n" "InteractionEvent 232 333 0 0 0 0 0\n" "MouseMoveEvent 231 329 0 0 0 0 0\n" "RenderEvent 231 329 0 0 0 0 0\n" "InteractionEvent 231 329 0 0 0 0 0\n" "MouseMoveEvent 230 326 0 0 0 0 0\n" "RenderEvent 230 326 0 0 0 0 0\n" "InteractionEvent 230 326 0 0 0 0 0\n" "MouseMoveEvent 230 324 0 0 0 0 0\n" "RenderEvent 230 324 0 0 0 0 0\n" "InteractionEvent 230 324 0 0 0 0 0\n" "MouseMoveEvent 230 321 0 0 0 0 0\n" "RenderEvent 230 321 0 0 0 0 0\n" "InteractionEvent 230 321 0 0 0 0 0\n" "MouseMoveEvent 229 318 0 0 0 0 0\n" "RenderEvent 229 318 0 0 0 0 0\n" "InteractionEvent 229 318 0 0 0 0 0\n" "MouseMoveEvent 228 314 0 0 0 0 0\n" "RenderEvent 228 314 0 0 0 0 0\n" "InteractionEvent 228 314 0 0 0 0 0\n" "MouseMoveEvent 227 311 0 0 0 0 0\n" "RenderEvent 227 311 0 0 0 0 0\n" "InteractionEvent 227 311 0 0 0 0 0\n" "MouseMoveEvent 226 309 0 0 0 0 0\n" "RenderEvent 226 309 0 0 0 0 0\n" "InteractionEvent 226 309 0 0 0 0 0\n" "MouseMoveEvent 225 306 0 0 0 0 0\n" "RenderEvent 225 306 0 0 0 0 0\n" "InteractionEvent 225 306 0 0 0 0 0\n" "MouseMoveEvent 224 302 0 0 0 0 0\n" "RenderEvent 224 302 0 0 0 0 0\n" "InteractionEvent 224 302 0 0 0 0 0\n" "MouseMoveEvent 223 299 0 0 0 0 0\n" "RenderEvent 223 299 0 0 0 0 0\n" "InteractionEvent 223 299 0 0 0 0 0\n" "MouseMoveEvent 222 295 0 0 0 0 0\n" "RenderEvent 222 295 0 0 0 0 0\n" "InteractionEvent 222 295 0 0 0 0 0\n" "MouseMoveEvent 219 289 0 0 0 0 0\n" "RenderEvent 219 289 0 0 0 0 0\n" "InteractionEvent 219 289 0 0 0 0 0\n" "MouseMoveEvent 219 285 0 0 0 0 0\n" "RenderEvent 219 285 0 0 0 0 0\n" "InteractionEvent 219 285 0 0 0 0 0\n" "MouseMoveEvent 218 281 0 0 0 0 0\n" "RenderEvent 218 281 0 0 0 0 0\n" "InteractionEvent 218 281 0 0 0 0 0\n" "MouseMoveEvent 217 278 0 0 0 0 0\n" "RenderEvent 217 278 0 0 0 0 0\n" "InteractionEvent 217 278 0 0 0 0 0\n" "MouseMoveEvent 217 274 0 0 0 0 0\n" "RenderEvent 217 274 0 0 0 0 0\n" "InteractionEvent 217 274 0 0 0 0 0\n" "MouseMoveEvent 217 270 0 0 0 0 0\n" "RenderEvent 217 270 0 0 0 0 0\n" "InteractionEvent 217 270 0 0 0 0 0\n" "MouseMoveEvent 216 267 0 0 0 0 0\n" "RenderEvent 216 267 0 0 0 0 0\n" "InteractionEvent 216 267 0 0 0 0 0\n" "MouseMoveEvent 216 263 0 0 0 0 0\n" "RenderEvent 216 263 0 0 0 0 0\n" "InteractionEvent 216 263 0 0 0 0 0\n" "MouseMoveEvent 216 259 0 0 0 0 0\n" "RenderEvent 216 259 0 0 0 0 0\n" "InteractionEvent 216 259 0 0 0 0 0\n" "MouseMoveEvent 216 254 0 0 0 0 0\n" "RenderEvent 216 254 0 0 0 0 0\n" "InteractionEvent 216 254 0 0 0 0 0\n" "MouseMoveEvent 216 249 0 0 0 0 0\n" "RenderEvent 216 249 0 0 0 0 0\n" "InteractionEvent 216 249 0 0 0 0 0\n" "MouseMoveEvent 217 244 0 0 0 0 0\n" "RenderEvent 217 244 0 0 0 0 0\n" "InteractionEvent 217 244 0 0 0 0 0\n" "MouseMoveEvent 219 237 0 0 0 0 0\n" "RenderEvent 219 237 0 0 0 0 0\n" "InteractionEvent 219 237 0 0 0 0 0\n" "MouseMoveEvent 220 232 0 0 0 0 0\n" "RenderEvent 220 232 0 0 0 0 0\n" "InteractionEvent 220 232 0 0 0 0 0\n" "MouseMoveEvent 223 227 0 0 0 0 0\n" "RenderEvent 223 227 0 0 0 0 0\n" "InteractionEvent 223 227 0 0 0 0 0\n" "MouseMoveEvent 224 224 0 0 0 0 0\n" "RenderEvent 224 224 0 0 0 0 0\n" "InteractionEvent 224 224 0 0 0 0 0\n" "MouseMoveEvent 227 219 0 0 0 0 0\n" "RenderEvent 227 219 0 0 0 0 0\n" "InteractionEvent 227 219 0 0 0 0 0\n" "MouseMoveEvent 229 213 0 0 0 0 0\n" "RenderEvent 229 213 0 0 0 0 0\n" "InteractionEvent 229 213 0 0 0 0 0\n" "MouseMoveEvent 231 208 0 0 0 0 0\n" "RenderEvent 231 208 0 0 0 0 0\n" "InteractionEvent 231 208 0 0 0 0 0\n" "MouseMoveEvent 232 203 0 0 0 0 0\n" "RenderEvent 232 203 0 0 0 0 0\n" "InteractionEvent 232 203 0 0 0 0 0\n" "MouseMoveEvent 233 201 0 0 0 0 0\n" "RenderEvent 233 201 0 0 0 0 0\n" "InteractionEvent 233 201 0 0 0 0 0\n" "MouseMoveEvent 234 197 0 0 0 0 0\n" "RenderEvent 234 197 0 0 0 0 0\n" "InteractionEvent 234 197 0 0 0 0 0\n" "MouseMoveEvent 234 196 0 0 0 0 0\n" "RenderEvent 234 196 0 0 0 0 0\n" "InteractionEvent 234 196 0 0 0 0 0\n" "MouseMoveEvent 235 194 0 0 0 0 0\n" "RenderEvent 235 194 0 0 0 0 0\n" "InteractionEvent 235 194 0 0 0 0 0\n" "MouseMoveEvent 236 191 0 0 0 0 0\n" "RenderEvent 236 191 0 0 0 0 0\n" "InteractionEvent 236 191 0 0 0 0 0\n" "MouseMoveEvent 237 189 0 0 0 0 0\n" "RenderEvent 237 189 0 0 0 0 0\n" "InteractionEvent 237 189 0 0 0 0 0\n" "MouseMoveEvent 238 187 0 0 0 0 0\n" "RenderEvent 238 187 0 0 0 0 0\n" "InteractionEvent 238 187 0 0 0 0 0\n" "MouseMoveEvent 240 184 0 0 0 0 0\n" "RenderEvent 240 184 0 0 0 0 0\n" "InteractionEvent 240 184 0 0 0 0 0\n" "MouseMoveEvent 241 181 0 0 0 0 0\n" "RenderEvent 241 181 0 0 0 0 0\n" "InteractionEvent 241 181 0 0 0 0 0\n" "MouseMoveEvent 243 177 0 0 0 0 0\n" "RenderEvent 243 177 0 0 0 0 0\n" "InteractionEvent 243 177 0 0 0 0 0\n" "MouseMoveEvent 243 176 0 0 0 0 0\n" "RenderEvent 243 176 0 0 0 0 0\n" "InteractionEvent 243 176 0 0 0 0 0\n" "MouseMoveEvent 244 173 0 0 0 0 0\n" "RenderEvent 244 173 0 0 0 0 0\n" "InteractionEvent 244 173 0 0 0 0 0\n" "MouseMoveEvent 245 169 0 0 0 0 0\n" "RenderEvent 245 169 0 0 0 0 0\n" "InteractionEvent 245 169 0 0 0 0 0\n" "MouseMoveEvent 246 165 0 0 0 0 0\n" "RenderEvent 246 165 0 0 0 0 0\n" "InteractionEvent 246 165 0 0 0 0 0\n" "MouseMoveEvent 247 161 0 0 0 0 0\n" "RenderEvent 247 161 0 0 0 0 0\n" "InteractionEvent 247 161 0 0 0 0 0\n" "MouseMoveEvent 249 157 0 0 0 0 0\n" "RenderEvent 249 157 0 0 0 0 0\n" "InteractionEvent 249 157 0 0 0 0 0\n" "MouseMoveEvent 251 152 0 0 0 0 0\n" "RenderEvent 251 152 0 0 0 0 0\n" "InteractionEvent 251 152 0 0 0 0 0\n" "MouseMoveEvent 252 147 0 0 0 0 0\n" "RenderEvent 252 147 0 0 0 0 0\n" "InteractionEvent 252 147 0 0 0 0 0\n" "MouseMoveEvent 253 142 0 0 0 0 0\n" "RenderEvent 253 142 0 0 0 0 0\n" "InteractionEvent 253 142 0 0 0 0 0\n" "MouseMoveEvent 254 138 0 0 0 0 0\n" "RenderEvent 254 138 0 0 0 0 0\n" "InteractionEvent 254 138 0 0 0 0 0\n" "MouseMoveEvent 255 133 0 0 0 0 0\n" "RenderEvent 255 133 0 0 0 0 0\n" "InteractionEvent 255 133 0 0 0 0 0\n" "MouseMoveEvent 257 129 0 0 0 0 0\n" "RenderEvent 257 129 0 0 0 0 0\n" "InteractionEvent 257 129 0 0 0 0 0\n" "MouseMoveEvent 259 125 0 0 0 0 0\n" "RenderEvent 259 125 0 0 0 0 0\n" "InteractionEvent 259 125 0 0 0 0 0\n" "MiddleButtonReleaseEvent 259 125 0 0 0 0 0\n" "EndInteractionEvent 259 125 0 0 0 0 0\n" "RenderEvent 259 125 0 0 0 0 0\n" "MouseMoveEvent 259 124 0 0 0 0 0\n" "MouseMoveEvent 256 120 0 0 0 0 0\n" "MouseMoveEvent 252 115 0 0 0 0 0\n" "MouseMoveEvent 248 111 0 0 0 0 0\n" "MouseMoveEvent 244 108 0 0 0 0 0\n" "MouseMoveEvent 238 102 0 0 0 0 0\n" "MouseMoveEvent 234 98 0 0 0 0 0\n" "MouseMoveEvent 230 94 0 0 0 0 0\n" "MouseMoveEvent 226 89 0 0 0 0 0\n" "MouseMoveEvent 222 85 0 0 0 0 0\n" "MouseMoveEvent 222 84 0 0 0 0 0\n" "MouseMoveEvent 221 83 0 0 0 0 0\n" "MouseMoveEvent 221 82 0 0 0 0 0\n" "MouseMoveEvent 221 81 0 0 0 0 0\n" "MouseMoveEvent 220 80 0 0 0 0 0\n" "RightButtonPressEvent 220 80 0 0 0 0 0\n" "StartInteractionEvent 220 80 0 0 0 0 0\n" "MouseMoveEvent 220 82 0 0 0 0 0\n" "RenderEvent 220 82 0 0 0 0 0\n" "InteractionEvent 220 82 0 0 0 0 0\n" "MouseMoveEvent 220 85 0 0 0 0 0\n" "RenderEvent 220 85 0 0 0 0 0\n" "InteractionEvent 220 85 0 0 0 0 0\n" "MouseMoveEvent 220 87 0 0 0 0 0\n" "RenderEvent 220 87 0 0 0 0 0\n" "InteractionEvent 220 87 0 0 0 0 0\n" "MouseMoveEvent 219 93 0 0 0 0 0\n" "RenderEvent 219 93 0 0 0 0 0\n" "InteractionEvent 219 93 0 0 0 0 0\n" "MouseMoveEvent 219 99 0 0 0 0 0\n" "RenderEvent 219 99 0 0 0 0 0\n" "InteractionEvent 219 99 0 0 0 0 0\n" "MouseMoveEvent 219 105 0 0 0 0 0\n" "RenderEvent 219 105 0 0 0 0 0\n" "InteractionEvent 219 105 0 0 0 0 0\n" "MouseMoveEvent 219 111 0 0 0 0 0\n" "RenderEvent 219 111 0 0 0 0 0\n" "InteractionEvent 219 111 0 0 0 0 0\n" "MouseMoveEvent 219 116 0 0 0 0 0\n" "RenderEvent 219 116 0 0 0 0 0\n" "InteractionEvent 219 116 0 0 0 0 0\n" "MouseMoveEvent 219 120 0 0 0 0 0\n" "RenderEvent 219 120 0 0 0 0 0\n" "InteractionEvent 219 120 0 0 0 0 0\n" "MouseMoveEvent 219 124 0 0 0 0 0\n" "RenderEvent 219 124 0 0 0 0 0\n" "InteractionEvent 219 124 0 0 0 0 0\n" "MouseMoveEvent 219 128 0 0 0 0 0\n" "RenderEvent 219 128 0 0 0 0 0\n" "InteractionEvent 219 128 0 0 0 0 0\n" "MouseMoveEvent 219 132 0 0 0 0 0\n" "RenderEvent 219 132 0 0 0 0 0\n" "InteractionEvent 219 132 0 0 0 0 0\n" "MouseMoveEvent 219 136 0 0 0 0 0\n" "RenderEvent 219 136 0 0 0 0 0\n" "InteractionEvent 219 136 0 0 0 0 0\n" "MouseMoveEvent 219 139 0 0 0 0 0\n" "RenderEvent 219 139 0 0 0 0 0\n" "InteractionEvent 219 139 0 0 0 0 0\n" "MouseMoveEvent 219 143 0 0 0 0 0\n" "RenderEvent 219 143 0 0 0 0 0\n" "InteractionEvent 219 143 0 0 0 0 0\n" "MouseMoveEvent 219 147 0 0 0 0 0\n" "RenderEvent 219 147 0 0 0 0 0\n" "InteractionEvent 219 147 0 0 0 0 0\n" "MouseMoveEvent 219 152 0 0 0 0 0\n" "RenderEvent 219 152 0 0 0 0 0\n" "InteractionEvent 219 152 0 0 0 0 0\n" "MouseMoveEvent 219 156 0 0 0 0 0\n" "RenderEvent 219 156 0 0 0 0 0\n" "InteractionEvent 219 156 0 0 0 0 0\n" "MouseMoveEvent 219 159 0 0 0 0 0\n" "RenderEvent 219 159 0 0 0 0 0\n" "InteractionEvent 219 159 0 0 0 0 0\n" "MouseMoveEvent 219 162 0 0 0 0 0\n" "RenderEvent 219 162 0 0 0 0 0\n" "InteractionEvent 219 162 0 0 0 0 0\n" "MouseMoveEvent 219 165 0 0 0 0 0\n" "RenderEvent 219 165 0 0 0 0 0\n" "InteractionEvent 219 165 0 0 0 0 0\n" "MouseMoveEvent 219 169 0 0 0 0 0\n" "RenderEvent 219 169 0 0 0 0 0\n" "InteractionEvent 219 169 0 0 0 0 0\n" "MouseMoveEvent 220 173 0 0 0 0 0\n" "RenderEvent 220 173 0 0 0 0 0\n" "InteractionEvent 220 173 0 0 0 0 0\n" "MouseMoveEvent 220 176 0 0 0 0 0\n" "RenderEvent 220 176 0 0 0 0 0\n" "InteractionEvent 220 176 0 0 0 0 0\n" "MouseMoveEvent 221 180 0 0 0 0 0\n" "RenderEvent 221 180 0 0 0 0 0\n" "InteractionEvent 221 180 0 0 0 0 0\n" "MouseMoveEvent 221 184 0 0 0 0 0\n" "RenderEvent 221 184 0 0 0 0 0\n" "InteractionEvent 221 184 0 0 0 0 0\n" "MouseMoveEvent 222 187 0 0 0 0 0\n" "RenderEvent 222 187 0 0 0 0 0\n" "InteractionEvent 222 187 0 0 0 0 0\n" "MouseMoveEvent 222 189 0 0 0 0 0\n" "RenderEvent 222 189 0 0 0 0 0\n" "InteractionEvent 222 189 0 0 0 0 0\n" "MouseMoveEvent 222 193 0 0 0 0 0\n" "RenderEvent 222 193 0 0 0 0 0\n" "InteractionEvent 222 193 0 0 0 0 0\n" "MouseMoveEvent 222 195 0 0 0 0 0\n" "RenderEvent 222 195 0 0 0 0 0\n" "InteractionEvent 222 195 0 0 0 0 0\n" "MouseMoveEvent 222 197 0 0 0 0 0\n" "RenderEvent 222 197 0 0 0 0 0\n" "InteractionEvent 222 197 0 0 0 0 0\n" "MouseMoveEvent 222 198 0 0 0 0 0\n" "RenderEvent 222 198 0 0 0 0 0\n" "InteractionEvent 222 198 0 0 0 0 0\n" "MouseMoveEvent 222 199 0 0 0 0 0\n" "RenderEvent 222 199 0 0 0 0 0\n" "InteractionEvent 222 199 0 0 0 0 0\n" "MouseMoveEvent 222 201 0 0 0 0 0\n" "RenderEvent 222 201 0 0 0 0 0\n" "InteractionEvent 222 201 0 0 0 0 0\n" "MouseMoveEvent 222 202 0 0 0 0 0\n" "RenderEvent 222 202 0 0 0 0 0\n" "InteractionEvent 222 202 0 0 0 0 0\n" "MouseMoveEvent 222 203 0 0 0 0 0\n" "RenderEvent 222 203 0 0 0 0 0\n" "InteractionEvent 222 203 0 0 0 0 0\n" "MouseMoveEvent 222 204 0 0 0 0 0\n" "RenderEvent 222 204 0 0 0 0 0\n" "InteractionEvent 222 204 0 0 0 0 0\n" "MouseMoveEvent 223 205 0 0 0 0 0\n" "RenderEvent 223 205 0 0 0 0 0\n" "InteractionEvent 223 205 0 0 0 0 0\n" "MouseMoveEvent 223 206 0 0 0 0 0\n" "RenderEvent 223 206 0 0 0 0 0\n" "InteractionEvent 223 206 0 0 0 0 0\n" "MouseMoveEvent 223 207 0 0 0 0 0\n" "RenderEvent 223 207 0 0 0 0 0\n" "InteractionEvent 223 207 0 0 0 0 0\n" "MouseMoveEvent 223 208 0 0 0 0 0\n" "RenderEvent 223 208 0 0 0 0 0\n" "InteractionEvent 223 208 0 0 0 0 0\n" "MouseMoveEvent 223 209 0 0 0 0 0\n" "RenderEvent 223 209 0 0 0 0 0\n" "InteractionEvent 223 209 0 0 0 0 0\n" "MouseMoveEvent 223 210 0 0 0 0 0\n" "RenderEvent 223 210 0 0 0 0 0\n" "InteractionEvent 223 210 0 0 0 0 0\n" "MouseMoveEvent 224 211 0 0 0 0 0\n" "RenderEvent 224 211 0 0 0 0 0\n" "InteractionEvent 224 211 0 0 0 0 0\n" "MouseMoveEvent 224 212 0 0 0 0 0\n" "RenderEvent 224 212 0 0 0 0 0\n" "InteractionEvent 224 212 0 0 0 0 0\n" "MouseMoveEvent 224 215 0 0 0 0 0\n" "RenderEvent 224 215 0 0 0 0 0\n" "InteractionEvent 224 215 0 0 0 0 0\n" "MouseMoveEvent 224 218 0 0 0 0 0\n" "RenderEvent 224 218 0 0 0 0 0\n" "InteractionEvent 224 218 0 0 0 0 0\n" "MouseMoveEvent 225 221 0 0 0 0 0\n" "RenderEvent 225 221 0 0 0 0 0\n" "InteractionEvent 225 221 0 0 0 0 0\n" "MouseMoveEvent 225 222 0 0 0 0 0\n" "RenderEvent 225 222 0 0 0 0 0\n" "InteractionEvent 225 222 0 0 0 0 0\n" "MouseMoveEvent 225 223 0 0 0 0 0\n" "RenderEvent 225 223 0 0 0 0 0\n" "InteractionEvent 225 223 0 0 0 0 0\n" "MouseMoveEvent 225 224 0 0 0 0 0\n" "RenderEvent 225 224 0 0 0 0 0\n" "InteractionEvent 225 224 0 0 0 0 0\n" "MouseMoveEvent 225 226 0 0 0 0 0\n" "RenderEvent 225 226 0 0 0 0 0\n" "InteractionEvent 225 226 0 0 0 0 0\n" "MouseMoveEvent 225 227 0 0 0 0 0\n" "RenderEvent 225 227 0 0 0 0 0\n" "InteractionEvent 225 227 0 0 0 0 0\n" "MouseMoveEvent 225 229 0 0 0 0 0\n" "RenderEvent 225 229 0 0 0 0 0\n" "InteractionEvent 225 229 0 0 0 0 0\n" "MouseMoveEvent 225 231 0 0 0 0 0\n" "RenderEvent 225 231 0 0 0 0 0\n" "InteractionEvent 225 231 0 0 0 0 0\n" "MouseMoveEvent 225 232 0 0 0 0 0\n" "RenderEvent 225 232 0 0 0 0 0\n" "InteractionEvent 225 232 0 0 0 0 0\n" "MouseMoveEvent 225 233 0 0 0 0 0\n" "RenderEvent 225 233 0 0 0 0 0\n" "InteractionEvent 225 233 0 0 0 0 0\n" "RightButtonReleaseEvent 225 233 0 0 0 0 0\n" "EndInteractionEvent 225 233 0 0 0 0 0\n" "RenderEvent 225 233 0 0 0 0 0\n" "MouseMoveEvent 227 235 0 0 0 0 0\n" "MouseMoveEvent 228 236 0 0 0 0 0\n" "MouseMoveEvent 230 238 0 0 0 0 0\n" "MouseMoveEvent 231 238 0 0 0 0 0\n" "MouseMoveEvent 233 240 0 0 0 0 0\n" "MouseMoveEvent 234 241 0 0 0 0 0\n" "MouseMoveEvent 236 243 0 0 0 0 0\n" "MouseMoveEvent 237 244 0 0 0 0 0\n" "MouseMoveEvent 238 245 0 0 0 0 0\n" "MouseMoveEvent 239 246 0 0 0 0 0\n" "MouseMoveEvent 240 248 0 0 0 0 0\n" "MouseMoveEvent 242 251 0 0 0 0 0\n" "MouseMoveEvent 244 253 0 0 0 0 0\n" "MouseMoveEvent 245 254 0 0 0 0 0\n" "MouseMoveEvent 245 255 0 0 0 0 0\n" "MouseMoveEvent 246 257 0 0 0 0 0\n" "MouseMoveEvent 247 258 0 0 0 0 0\n" "MiddleButtonPressEvent 247 258 0 0 0 0 0\n" "StartInteractionEvent 247 258 0 0 0 0 0\n" "MouseMoveEvent 247 256 0 0 0 0 0\n" "RenderEvent 247 256 0 0 0 0 0\n" "InteractionEvent 247 256 0 0 0 0 0\n" "MouseMoveEvent 247 254 0 0 0 0 0\n" "RenderEvent 247 254 0 0 0 0 0\n" "InteractionEvent 247 254 0 0 0 0 0\n" "MouseMoveEvent 247 252 0 0 0 0 0\n" "RenderEvent 247 252 0 0 0 0 0\n" "InteractionEvent 247 252 0 0 0 0 0\n" "MouseMoveEvent 247 248 0 0 0 0 0\n" "RenderEvent 247 248 0 0 0 0 0\n" "InteractionEvent 247 248 0 0 0 0 0\n" "MouseMoveEvent 247 243 0 0 0 0 0\n" "RenderEvent 247 243 0 0 0 0 0\n" "InteractionEvent 247 243 0 0 0 0 0\n" "MouseMoveEvent 247 239 0 0 0 0 0\n" "RenderEvent 247 239 0 0 0 0 0\n" "InteractionEvent 247 239 0 0 0 0 0\n" "MouseMoveEvent 247 235 0 0 0 0 0\n" "RenderEvent 247 235 0 0 0 0 0\n" "InteractionEvent 247 235 0 0 0 0 0\n" "MouseMoveEvent 247 231 0 0 0 0 0\n" "RenderEvent 247 231 0 0 0 0 0\n" "InteractionEvent 247 231 0 0 0 0 0\n" "MouseMoveEvent 247 226 0 0 0 0 0\n" "RenderEvent 247 226 0 0 0 0 0\n" "InteractionEvent 247 226 0 0 0 0 0\n" "MouseMoveEvent 247 221 0 0 0 0 0\n" "RenderEvent 247 221 0 0 0 0 0\n" "InteractionEvent 247 221 0 0 0 0 0\n" "MouseMoveEvent 248 215 0 0 0 0 0\n" "RenderEvent 248 215 0 0 0 0 0\n" "InteractionEvent 248 215 0 0 0 0 0\n" "MouseMoveEvent 249 207 0 0 0 0 0\n" "RenderEvent 249 207 0 0 0 0 0\n" "InteractionEvent 249 207 0 0 0 0 0\n" "MouseMoveEvent 249 200 0 0 0 0 0\n" "RenderEvent 249 200 0 0 0 0 0\n" "InteractionEvent 249 200 0 0 0 0 0\n" "MouseMoveEvent 249 196 0 0 0 0 0\n" "RenderEvent 249 196 0 0 0 0 0\n" "InteractionEvent 249 196 0 0 0 0 0\n" "MouseMoveEvent 250 191 0 0 0 0 0\n" "RenderEvent 250 191 0 0 0 0 0\n" "InteractionEvent 250 191 0 0 0 0 0\n" "MouseMoveEvent 250 189 0 0 0 0 0\n" "RenderEvent 250 189 0 0 0 0 0\n" "InteractionEvent 250 189 0 0 0 0 0\n" "MouseMoveEvent 250 185 0 0 0 0 0\n" "RenderEvent 250 185 0 0 0 0 0\n" "InteractionEvent 250 185 0 0 0 0 0\n" "MouseMoveEvent 250 179 0 0 0 0 0\n" "RenderEvent 250 179 0 0 0 0 0\n" "InteractionEvent 250 179 0 0 0 0 0\n" "MouseMoveEvent 251 178 0 0 0 0 0\n" "RenderEvent 251 178 0 0 0 0 0\n" "InteractionEvent 251 178 0 0 0 0 0\n" "MouseMoveEvent 251 177 0 0 0 0 0\n" "RenderEvent 251 177 0 0 0 0 0\n" "InteractionEvent 251 177 0 0 0 0 0\n" "MouseMoveEvent 251 176 0 0 0 0 0\n" "RenderEvent 251 176 0 0 0 0 0\n" "InteractionEvent 251 176 0 0 0 0 0\n" "MouseMoveEvent 251 175 0 0 0 0 0\n" "RenderEvent 251 175 0 0 0 0 0\n" "InteractionEvent 251 175 0 0 0 0 0\n" "MouseMoveEvent 251 174 0 0 0 0 0\n" "RenderEvent 251 174 0 0 0 0 0\n" "InteractionEvent 251 174 0 0 0 0 0\n" "MouseMoveEvent 251 172 0 0 0 0 0\n" "RenderEvent 251 172 0 0 0 0 0\n" "InteractionEvent 251 172 0 0 0 0 0\n" "MouseMoveEvent 251 170 0 0 0 0 0\n" "RenderEvent 251 170 0 0 0 0 0\n" "InteractionEvent 251 170 0 0 0 0 0\n" "MouseMoveEvent 251 167 0 0 0 0 0\n" "RenderEvent 251 167 0 0 0 0 0\n" "InteractionEvent 251 167 0 0 0 0 0\n" "MouseMoveEvent 251 166 0 0 0 0 0\n" "RenderEvent 251 166 0 0 0 0 0\n" "InteractionEvent 251 166 0 0 0 0 0\n" "MouseMoveEvent 251 165 0 0 0 0 0\n" "RenderEvent 251 165 0 0 0 0 0\n" "InteractionEvent 251 165 0 0 0 0 0\n" "MouseMoveEvent 251 164 0 0 0 0 0\n" "RenderEvent 251 164 0 0 0 0 0\n" "InteractionEvent 251 164 0 0 0 0 0\n" "MouseMoveEvent 251 162 0 0 0 0 0\n" "RenderEvent 251 162 0 0 0 0 0\n" "InteractionEvent 251 162 0 0 0 0 0\n" "MouseMoveEvent 251 161 0 0 0 0 0\n" "RenderEvent 251 161 0 0 0 0 0\n" "InteractionEvent 251 161 0 0 0 0 0\n" "MouseMoveEvent 251 159 0 0 0 0 0\n" "RenderEvent 251 159 0 0 0 0 0\n" "InteractionEvent 251 159 0 0 0 0 0\n" "MouseMoveEvent 251 157 0 0 0 0 0\n" "RenderEvent 251 157 0 0 0 0 0\n" "InteractionEvent 251 157 0 0 0 0 0\n" "MouseMoveEvent 250 159 0 0 0 0 0\n" "RenderEvent 250 159 0 0 0 0 0\n" "InteractionEvent 250 159 0 0 0 0 0\n" "MouseMoveEvent 250 160 0 0 0 0 0\n" "RenderEvent 250 160 0 0 0 0 0\n" "InteractionEvent 250 160 0 0 0 0 0\n" "MouseMoveEvent 249 162 0 0 0 0 0\n" "RenderEvent 249 162 0 0 0 0 0\n" "InteractionEvent 249 162 0 0 0 0 0\n" "MouseMoveEvent 249 163 0 0 0 0 0\n" "RenderEvent 249 163 0 0 0 0 0\n" "InteractionEvent 249 163 0 0 0 0 0\n" "MouseMoveEvent 249 165 0 0 0 0 0\n" "RenderEvent 249 165 0 0 0 0 0\n" "InteractionEvent 249 165 0 0 0 0 0\n" "MouseMoveEvent 249 167 0 0 0 0 0\n" "RenderEvent 249 167 0 0 0 0 0\n" "InteractionEvent 249 167 0 0 0 0 0\n" "MouseMoveEvent 249 168 0 0 0 0 0\n" "RenderEvent 249 168 0 0 0 0 0\n" "InteractionEvent 249 168 0 0 0 0 0\n" "MouseMoveEvent 249 169 0 0 0 0 0\n" "RenderEvent 249 169 0 0 0 0 0\n" "InteractionEvent 249 169 0 0 0 0 0\n" "MouseMoveEvent 249 170 0 0 0 0 0\n" "RenderEvent 249 170 0 0 0 0 0\n" "InteractionEvent 249 170 0 0 0 0 0\n" "MouseMoveEvent 249 171 0 0 0 0 0\n" "RenderEvent 249 171 0 0 0 0 0\n" "InteractionEvent 249 171 0 0 0 0 0\n" "MouseMoveEvent 249 172 0 0 0 0 0\n" "RenderEvent 249 172 0 0 0 0 0\n" "InteractionEvent 249 172 0 0 0 0 0\n" "MouseMoveEvent 249 173 0 0 0 0 0\n" "RenderEvent 249 173 0 0 0 0 0\n" "InteractionEvent 249 173 0 0 0 0 0\n" "MouseMoveEvent 249 174 0 0 0 0 0\n" "RenderEvent 249 174 0 0 0 0 0\n" "InteractionEvent 249 174 0 0 0 0 0\n" "MouseMoveEvent 249 175 0 0 0 0 0\n" "RenderEvent 249 175 0 0 0 0 0\n" "InteractionEvent 249 175 0 0 0 0 0\n" "MouseMoveEvent 249 176 0 0 0 0 0\n" "RenderEvent 249 176 0 0 0 0 0\n" "InteractionEvent 249 176 0 0 0 0 0\n" "MouseMoveEvent 249 177 0 0 0 0 0\n" "RenderEvent 249 177 0 0 0 0 0\n" "InteractionEvent 249 177 0 0 0 0 0\n" "MouseMoveEvent 249 178 0 0 0 0 0\n" "RenderEvent 249 178 0 0 0 0 0\n" "InteractionEvent 249 178 0 0 0 0 0\n" "MouseMoveEvent 249 179 0 0 0 0 0\n" "RenderEvent 249 179 0 0 0 0 0\n" "InteractionEvent 249 179 0 0 0 0 0\n" "MouseMoveEvent 250 181 0 0 0 0 0\n" "RenderEvent 250 181 0 0 0 0 0\n" "InteractionEvent 250 181 0 0 0 0 0\n" "MiddleButtonReleaseEvent 250 181 0 0 0 0 0\n" "EndInteractionEvent 250 181 0 0 0 0 0\n" "RenderEvent 250 181 0 0 0 0 0\n" "MouseMoveEvent 251 182 0 0 0 0 0\n" "MouseMoveEvent 252 180 0 0 0 0 0\n" "MouseMoveEvent 253 179 0 0 0 0 0\n" "MouseMoveEvent 254 176 0 0 0 0 0\n" "MouseMoveEvent 255 174 0 0 0 0 0\n" "MouseMoveEvent 256 171 0 0 0 0 0\n" "MouseMoveEvent 258 167 0 0 0 0 0\n" "MouseMoveEvent 259 165 0 0 0 0 0\n" "MouseMoveEvent 260 162 0 0 0 0 0\n" "MouseMoveEvent 261 159 0 0 0 0 0\n" "MouseMoveEvent 262 157 0 0 0 0 0\n" "MouseMoveEvent 263 156 0 0 0 0 0\n" "MouseMoveEvent 264 154 0 0 0 0 0\n" "MouseMoveEvent 265 153 0 0 0 0 0\n" "MouseMoveEvent 266 151 0 0 0 0 0\n" "MouseMoveEvent 267 148 0 0 0 0 0\n" "MouseMoveEvent 268 146 0 0 0 0 0\n" "MouseMoveEvent 269 144 0 0 0 0 0\n" "MouseMoveEvent 271 141 0 0 0 0 0\n" "MouseMoveEvent 272 139 0 0 0 0 0\n" "MouseMoveEvent 274 137 0 0 0 0 0\n" "MouseMoveEvent 276 134 0 0 0 0 0\n" "MouseMoveEvent 278 131 0 0 0 0 0\n" "MouseMoveEvent 280 129 0 0 0 0 0\n" "MouseMoveEvent 281 128 0 0 0 0 0\n" "MouseMoveEvent 283 125 0 0 0 0 0\n" "MouseMoveEvent 284 124 0 0 0 0 0\n" "MouseMoveEvent 286 122 0 0 0 0 0\n" "MouseMoveEvent 287 119 0 0 0 0 0\n" "MouseMoveEvent 288 117 0 0 0 0 0\n" "MouseMoveEvent 289 115 0 0 0 0 0\n" "MouseMoveEvent 289 113 0 0 0 0 0\n" "MouseMoveEvent 290 111 0 0 0 0 0\n" "MouseMoveEvent 291 108 0 0 0 0 0\n" "MouseMoveEvent 292 105 0 0 0 0 0\n" "MouseMoveEvent 293 102 0 0 0 0 0\n" "MouseMoveEvent 295 98 0 0 0 0 0\n" "MouseMoveEvent 296 96 0 0 0 0 0\n" "MouseMoveEvent 298 92 0 0 0 0 0\n" "MouseMoveEvent 300 89 0 0 0 0 0\n" "MouseMoveEvent 301 87 0 0 0 0 0\n" "MouseMoveEvent 303 82 0 0 0 0 0\n" "MouseMoveEvent 304 79 0 0 0 0 0\n" "MouseMoveEvent 306 75 0 0 0 0 0\n" "MouseMoveEvent 308 70 0 0 0 0 0\n" "MouseMoveEvent 312 65 0 0 0 0 0\n" "MouseMoveEvent 318 59 0 0 0 0 0\n" "MouseMoveEvent 325 53 0 0 0 0 0\n" "MouseMoveEvent 334 47 0 0 0 0 0\n" "MouseMoveEvent 344 41 0 0 0 0 0\n" "MouseMoveEvent 354 33 0 0 0 0 0\n" "MouseMoveEvent 364 27 0 0 0 0 0\n" "MouseMoveEvent 371 22 0 0 0 0 0\n" "MouseMoveEvent 377 22 0 0 0 0 0\n" "MouseMoveEvent 378 22 0 0 0 0 0\n" "MouseMoveEvent 378 23 0 0 0 0 0\n" "MouseMoveEvent 379 25 0 0 0 0 0\n" "MouseMoveEvent 380 26 0 0 0 0 0\n" "MouseMoveEvent 381 27 0 0 0 0 0\n" "MouseMoveEvent 380 27 0 0 0 0 0\n" "MouseMoveEvent 379 27 0 0 0 0 0\n" "MouseMoveEvent 378 27 0 0 0 0 0\n" "MouseMoveEvent 377 27 0 0 0 0 0\n" "MouseMoveEvent 376 26 0 0 0 0 0\n" "MouseMoveEvent 374 25 0 0 0 0 0\n" "MouseMoveEvent 371 24 0 0 0 0 0\n" "MouseMoveEvent 369 23 0 0 0 0 0\n" "MouseMoveEvent 367 22 0 0 0 0 0\n" "MouseMoveEvent 366 22 0 0 0 0 0\n" "MouseMoveEvent 364 20 0 0 0 0 0\n" "MouseMoveEvent 364 18 0 0 0 0 0\n" "MouseMoveEvent 364 16 0 0 0 0 0\n" "MouseMoveEvent 365 13 0 0 0 0 0\n" "MouseMoveEvent 367 11 0 0 0 0 0\n" "MouseMoveEvent 368 10 0 0 0 0 0\n" "MouseMoveEvent 372 8 0 0 0 0 0\n" "MouseMoveEvent 375 6 0 0 0 0 0\n" "MouseMoveEvent 384 1 0 0 0 0 0\n" "LeaveEvent 399 -8 0 0 0 0 0\n" ; int TestGPUVolumeRayCastMapper(int argc, char *argv[]) { cout << "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)" << endl; vtkNew<vtkRTAnalyticSource> wavelet; wavelet->SetWholeExtent(-10, 10, -10, 10, -10, 10); wavelet->SetCenter(0.0, 0.0, 0.0); vtkNew<vtkGPUVolumeRayCastMapper> volumeMapper; volumeMapper->SetAutoAdjustSampleDistances(0); volumeMapper->SetSampleDistance(0.5); volumeMapper->SetInputConnection(wavelet->GetOutputPort()); vtkNew<vtkVolumeProperty> volumeProperty; vtkNew<vtkColorTransferFunction> ctf; ctf->AddRGBPoint(37.3531, 0.2, 0.29, 1); ctf->AddRGBPoint(157.091, 0.87, 0.87, 0.87); ctf->AddRGBPoint(276.829, 0.7, 0.015, 0.15); vtkNew<vtkPiecewiseFunction> pwf; pwf->AddPoint(37.3531, 0.0); pwf->AddPoint(276.829, 1.0); volumeProperty->SetColor(ctf.GetPointer()); volumeProperty->SetScalarOpacity(pwf.GetPointer()); volumeProperty->SetShade(0); volumeProperty->SetScalarOpacityUnitDistance(1.732); vtkNew<vtkVolume> volume; volume->SetMapper(volumeMapper.GetPointer()); volume->SetProperty(volumeProperty.GetPointer()); // Create the renderwindow, interactor and renderer vtkNew<vtkRenderWindow> renderWindow; renderWindow->SetMultiSamples(0); renderWindow->SetSize(401, 399); // NPOT size vtkNew<vtkRenderWindowInteractor> iren; iren->SetRenderWindow(renderWindow.GetPointer()); vtkNew<vtkInteractorStyleTrackballCamera> style; iren->SetInteractorStyle(style.GetPointer()); vtkNew<vtkRenderer> renderer; renderer->SetBackground(0.3, 0.3, 0.4); renderWindow->AddRenderer(renderer.GetPointer()); renderer->AddVolume(volume.GetPointer()); renderer->ResetCamera(); renderWindow->Render(); int valid = volumeMapper->IsRenderSupported(renderWindow.GetPointer(), volumeProperty.GetPointer()); int retVal; if (valid) { retVal = !( vtkTesting::InteractorEventLoop(argc, argv, iren.GetPointer(), TestGPUVolumeRayCastMapperLog)); } else { retVal = vtkTesting::PASSED; cout << "Required extensions not supported." << endl; } return !retVal; }
[ "gguayaqu@purdue.edu" ]
gguayaqu@purdue.edu
b34a7a6e486a23bba05355af1ae54113d315adaa
4dbb45758447dcfa13c0be21e4749d62588aab70
/iOS/Classes/Native/mscorlib_U3CPrivateImplementationDetailsU3E_U24Arr3379220377.h
7d2830e6e8ba24c70ec769e7fa9aa940e60a31ba
[ "MIT" ]
permissive
mopsicus/unity-share-plugin-ios-android
6dd6ccd2fa05c73f0bf5e480a6f2baecb7e7a710
3ee99aef36034a1e4d7b156172953f9b4dfa696f
refs/heads/master
2020-12-25T14:38:03.861759
2016-07-19T10:06:04
2016-07-19T10:06:04
63,676,983
12
0
null
null
null
null
UTF-8
C++
false
false
1,265
h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include "mscorlib_System_ValueType1744280289.h" #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // <PrivateImplementationDetails>/$ArrayType$20 #pragma pack(push, tp, 1) struct U24ArrayTypeU2420_t3379220377 { public: union { struct { union { }; }; uint8_t U24ArrayTypeU2420_t3379220377__padding[20]; }; public: }; #pragma pack(pop, tp) #ifdef __clang__ #pragma clang diagnostic pop #endif // Native definition for marshalling of: <PrivateImplementationDetails>/$ArrayType$20 #pragma pack(push, tp, 1) struct U24ArrayTypeU2420_t3379220377_marshaled_pinvoke { union { struct { union { }; }; uint8_t U24ArrayTypeU2420_t3379220377__padding[20]; }; }; #pragma pack(pop, tp) // Native definition for marshalling of: <PrivateImplementationDetails>/$ArrayType$20 #pragma pack(push, tp, 1) struct U24ArrayTypeU2420_t3379220377_marshaled_com { union { struct { union { }; }; uint8_t U24ArrayTypeU2420_t3379220377__padding[20]; }; }; #pragma pack(pop, tp)
[ "lii@rstgames.com" ]
lii@rstgames.com
f43b6bf84dafc918a8d736eb4b2b339141be6d93
4d98e912914065939775b3aa4ecbd78b18ca00c2
/main.cpp
b5388c21cc58a8586e644dbd8d31126710f5693b
[]
no_license
longyf/exer-18
9dff58cb504f71a1a3f843e4c5a2fb27e47b7897
6523cb0589351c8dc86a1b67c797a82042ee9222
refs/heads/master
2020-03-13T06:51:46.242908
2018-04-25T13:48:39
2018-04-25T13:48:39
131,013,467
0
1
null
null
null
null
UTF-8
C++
false
false
1,913
cpp
#include <iostream> #include <stdexcept> #include "listNode.h" using namespace std; void printList(ListNode **head) { if (*head==nullptr) { cout<<"The list is already empty."<<endl; return; } ListNode *pNode=head[0]; while (pNode!=nullptr) { cout<<pNode->value<<" "; pNode=pNode->next; } cout<<endl; } void deleteNode(ListNode **head, ListNode *deleted) { if (head==nullptr||(*head)==nullptr||deleted==nullptr) throw invalid_argument("Pay attention to the inputs."); //只有一个节点。 if ((*head)->next==nullptr) { *head=nullptr; return; } //不是尾节点。 if (deleted->next!=nullptr) { //也不是倒数第二个节点。 if (deleted->next->next!=nullptr) { deleted->value=deleted->next->value; deleted->next=deleted->next->next; } //是倒数第二个节点。 else { deleted->value=deleted->next->value; deleted->next=nullptr; } } //是尾节点。 else { ListNode *pNode=*head; while (pNode->next->next!=nullptr) pNode=pNode->next; pNode->next=nullptr; } } int main() { ListNode **head; ListNode *node0=new ListNode(); ListNode *node1=new ListNode(); ListNode *node2=new ListNode(); ListNode *node3=new ListNode(); ListNode *node4=new ListNode(); ListNode *node5=new ListNode(); *head=node0; (*head)->value=0; (*head)->next=node1; node1->value=1; node1->next=node2; node2->value=2; node2->next=node3; node3->value=3; node3->next=node4; node4->value=4; node4->next=node5; node5->value=5; node5->next=nullptr; printList(head); deleteNode(head,node3); printList(head); deleteNode(head,node3); printList(head); deleteNode(head,node3); printList(head); deleteNode(head,*head); printList(head); deleteNode(head,*head); printList(head); deleteNode(head,*head); printList(head); return 0; }
[ "longyf@pku.edu.cn" ]
longyf@pku.edu.cn
457de1198fd7634d8a5123cdd513db7227392cff
1d9b1b78887bdff6dd5342807c4ee20f504a2a75
/lib/libcxx/include/__algorithm/ranges_fill.h
7ce4a76ba9e967d7eba1fd4829dd55c707fab305
[ "MIT", "LicenseRef-scancode-other-permissive", "NCSA", "LLVM-exception", "Apache-2.0" ]
permissive
mikdusan/zig
86831722d86f518d1734ee5a1ca89d3ffe9555e8
b2ffe113d3fd2835b25ddf2de1cc8dd49f5de722
refs/heads/master
2023-08-31T21:29:04.425401
2022-11-13T15:43:29
2022-11-13T15:43:29
173,955,807
1
0
MIT
2021-11-02T03:19:36
2019-03-05T13:52:53
Zig
UTF-8
C++
false
false
1,900
h
//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef _LIBCPP___ALGORITHM_RANGES_FILL_H #define _LIBCPP___ALGORITHM_RANGES_FILL_H #include <__algorithm/ranges_fill_n.h> #include <__config> #include <__iterator/concepts.h> #include <__ranges/access.h> #include <__ranges/concepts.h> #include <__ranges/dangling.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { namespace __fill { struct __fn { template <class _Type, output_iterator<const _Type&> _Iter, sentinel_for<_Iter> _Sent> _LIBCPP_HIDE_FROM_ABI constexpr _Iter operator()(_Iter __first, _Sent __last, const _Type& __value) const { if constexpr(random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>) { return ranges::fill_n(__first, __last - __first, __value); } else { for (; __first != __last; ++__first) *__first = __value; return __first; } } template <class _Type, output_range<const _Type&> _Range> _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range> operator()(_Range&& __range, const _Type& __value) const { return (*this)(ranges::begin(__range), ranges::end(__range), __value); } }; } // namespace __fill inline namespace __cpo { inline constexpr auto fill = __fill::__fn{}; } // namespace __cpo } // namespace ranges _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) #endif // _LIBCPP___ALGORITHM_RANGES_FILL_H
[ "andrew@ziglang.org" ]
andrew@ziglang.org
c8c0da0a5d22e1ce59881302b5bc6eb047806dde
1af97641ad391b037572113151c4e4a9f40308a7
/Tetris/Component.h
4fadba56be74939a9c577a0e9e2ec46d54b86609
[]
no_license
axelbertrand/Tetris
5c075c6aa14ac8dba0fc78a5782d6cdfb3f057cc
673a3a8cf19aa6dfcc29f2a0af1cacd7b4a3ad00
refs/heads/master
2022-04-10T18:29:19.385818
2020-02-26T20:50:59
2020-02-26T20:50:59
116,061,109
0
0
null
null
null
null
UTF-8
C++
false
false
571
h
#pragma once #include "GameLib.h" #include <memory> namespace gui { class Component : public sf::Drawable, public sf::Transformable, private sf::NonCopyable { public: Component() = default; virtual ~Component() = default; virtual bool isSelectable() const = 0; bool isSelected() const; virtual void select(); virtual void deselect(); virtual bool isActive() const; virtual void activate(); virtual void deactivate(); virtual void handleEvent(const sf::Event& event) = 0; private: bool mIsSelected{ false }; bool mIsActive{ false }; }; }
[ "axel.bertrand2@etu.univ-lyon1.fr" ]
axel.bertrand2@etu.univ-lyon1.fr
377e6e27cf51e5f3f356429e4c005dc35c7b2167
b28305dab0be0e03765c62b97bcd7f49a4f8073d
/chrome/browser/net/spdyproxy/data_reduction_proxy_browsertest.cc
9b1a8a5b44524bd2a249009fe56d172449f4026a
[ "BSD-3-Clause" ]
permissive
svarvel/browser-android-tabs
9e5e27e0a6e302a12fe784ca06123e5ce090ced5
bd198b4c7a1aca2f3e91f33005d881f42a8d0c3f
refs/heads/base-72.0.3626.105
2020-04-24T12:16:31.442851
2019-08-02T19:15:36
2019-08-02T19:15:36
171,950,555
1
2
NOASSERTION
2019-08-02T19:15:37
2019-02-21T21:47:44
null
UTF-8
C++
false
false
28,884
cc
// Copyright 2018 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 <tuple> #include "base/strings/strcat.h" #include "base/strings/string_util.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "chrome/browser/metrics/subprocess_metrics_provider.h" #include "chrome/browser/page_load_metrics/page_load_metrics_test_waiter.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client_test_utils.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_util.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h" #include "components/data_reduction_proxy/core/common/uma_util.h" #include "components/data_reduction_proxy/proto/client_config.pb.h" #include "components/prefs/pref_service.h" #include "content/public/browser/network_service_instance.h" #include "content/public/common/service_manager_connection.h" #include "content/public/common/service_names.mojom.h" #include "content/public/test/browser_test_utils.h" #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/controllable_http_response.h" #include "net/test/embedded_test_server/default_handlers.h" #include "net/test/embedded_test_server/http_request.h" #include "net/test/embedded_test_server/http_response.h" #include "services/network/public/cpp/features.h" #include "services/network/public/cpp/network_switches.h" #include "services/network/public/mojom/network_service_test.mojom.h" #include "services/service_manager/public/cpp/connector.h" #include "testing/gmock/include/gmock/gmock.h" namespace data_reduction_proxy { namespace { using testing::HasSubstr; using testing::Not; constexpr char kSessionKey[] = "TheSessionKeyYay!"; constexpr char kMockHost[] = "mock.host"; constexpr char kDummyBody[] = "dummy"; constexpr char kPrimaryResponse[] = "primary"; constexpr char kSecondaryResponse[] = "secondary"; std::unique_ptr<net::test_server::HttpResponse> BasicResponse( const std::string& content, const net::test_server::HttpRequest& request) { auto response = std::make_unique<net::test_server::BasicHttpResponse>(); response->set_content(content); response->set_content_type("text/plain"); return response; } std::unique_ptr<net::test_server::HttpResponse> IncrementRequestCount( const std::string& relative_url, int* request_count, const net::test_server::HttpRequest& request) { if (request.relative_url == relative_url) (*request_count)++; return std::make_unique<net::test_server::BasicHttpResponse>(); } void SimulateNetworkChange(network::mojom::ConnectionType type) { if (base::FeatureList::IsEnabled(network::features::kNetworkService) && !content::IsNetworkServiceRunningInProcess()) { network::mojom::NetworkServiceTestPtr network_service_test; content::ServiceManagerConnection::GetForProcess() ->GetConnector() ->BindInterface(content::mojom::kNetworkServiceName, &network_service_test); base::RunLoop run_loop; network_service_test->SimulateNetworkChange(type, run_loop.QuitClosure()); run_loop.Run(); return; } net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests( net::NetworkChangeNotifier::ConnectionType(type)); } ClientConfig CreateConfigForServer(const net::EmbeddedTestServer& server) { net::HostPortPair host_port_pair = server.host_port_pair(); return CreateConfig( kSessionKey, 1000, 0, ProxyServer_ProxyScheme_HTTP, host_port_pair.host(), host_port_pair.port(), ProxyServer::CORE, ProxyServer_ProxyScheme_HTTP, "fallback.net", 80, ProxyServer::UNSPECIFIED_TYPE, 0.5f, false); } } // namespace class DataReductionProxyBrowsertestBase : public InProcessBrowserTest { public: void SetUpCommandLine(base::CommandLine* command_line) override { command_line->AppendSwitchASCII( network::switches::kForceEffectiveConnectionType, "4G"); secure_proxy_check_server_.RegisterRequestHandler( base::BindRepeating(&BasicResponse, "OK")); ASSERT_TRUE(secure_proxy_check_server_.Start()); command_line->AppendSwitchASCII( switches::kDataReductionProxySecureProxyCheckURL, secure_proxy_check_server_.base_url().spec()); config_server_.RegisterRequestHandler(base::BindRepeating( &DataReductionProxyBrowsertestBase::GetConfigResponse, base::Unretained(this))); ASSERT_TRUE(config_server_.Start()); command_line->AppendSwitchASCII(switches::kDataReductionProxyConfigURL, config_server_.base_url().spec()); } void SetUp() override { scoped_feature_list_.InitAndEnableFeature( features::kDataReductionProxyEnabledWithNetworkService); param_feature_list_.InitAndEnableFeatureWithParameters( features::kDataReductionProxyRobustConnection, {{params::GetMissingViaBypassParamName(), "true"}, {"warmup_fetch_callback_enabled", "true"}}); InProcessBrowserTest::SetUp(); } void SetUpOnMainThread() override { // Make sure the favicon doesn't mess with the tests. favicon_catcher_ = std::make_unique<net::test_server::ControllableHttpResponse>( embedded_test_server(), "/favicon.ico"); ASSERT_TRUE(embedded_test_server()->Start()); // Set a default proxy config if one isn't set yet. if (!config_.has_proxy_config()) SetConfig(CreateConfigForServer(*embedded_test_server())); host_resolver()->AddRule(kMockHost, "127.0.0.1"); EnableDataSaver(true); // Make sure initial config has been loaded. WaitForConfig(); } protected: void EnableDataSaver(bool enabled) { PrefService* prefs = browser()->profile()->GetPrefs(); prefs->SetBoolean(::prefs::kDataSaverEnabled, enabled); base::RunLoop().RunUntilIdle(); } std::string GetBody() { return GetBody(browser()); } std::string GetBody(Browser* browser) { std::string body; EXPECT_TRUE(content::ExecuteScriptAndExtractString( browser->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(document.body.textContent);", &body)); return body; } GURL GetURLWithMockHost(const net::EmbeddedTestServer& server, const std::string& relative_url) { GURL server_base_url = server.base_url(); GURL base_url = GURL(base::StrCat({server_base_url.scheme(), "://", kMockHost, ":", server_base_url.port()})); EXPECT_TRUE(base_url.is_valid()) << base_url.possibly_invalid_spec(); return base_url.Resolve(relative_url); } void SetConfig(const ClientConfig& config) { config_run_loop_ = std::make_unique<base::RunLoop>(); config_ = config; } void WaitForConfig() { config_run_loop_->Run(); } private: std::unique_ptr<net::test_server::HttpResponse> GetConfigResponse( const net::test_server::HttpRequest& request) { auto response = std::make_unique<net::test_server::BasicHttpResponse>(); response->set_content(config_.SerializeAsString()); response->set_content_type("text/plain"); if (config_run_loop_) config_run_loop_->Quit(); return response; } ClientConfig config_; std::unique_ptr<base::RunLoop> config_run_loop_; base::test::ScopedFeatureList scoped_feature_list_; base::test::ScopedFeatureList param_feature_list_; net::EmbeddedTestServer secure_proxy_check_server_; net::EmbeddedTestServer config_server_; std::unique_ptr<net::test_server::ControllableHttpResponse> favicon_catcher_; }; class DataReductionProxyBrowsertest : public DataReductionProxyBrowsertestBase { public: void SetUpCommandLine(base::CommandLine* command_line) override { DataReductionProxyBrowsertestBase::SetUpCommandLine(command_line); command_line->AppendSwitch( switches::kDisableDataReductionProxyWarmupURLFetch); } }; IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest, UpdateConfig) { net::EmbeddedTestServer original_server; original_server.RegisterRequestHandler( base::BindRepeating(&BasicResponse, kPrimaryResponse)); ASSERT_TRUE(original_server.Start()); SetConfig(CreateConfigForServer(original_server)); // A network change forces the config to be fetched. SimulateNetworkChange(network::mojom::ConnectionType::CONNECTION_3G); WaitForConfig(); ui_test_utils::NavigateToURL(browser(), GURL("http://does.not.resolve/foo")); EXPECT_EQ(GetBody(), kPrimaryResponse); net::EmbeddedTestServer new_server; new_server.RegisterRequestHandler( base::BindRepeating(&BasicResponse, kSecondaryResponse)); ASSERT_TRUE(new_server.Start()); SetConfig(CreateConfigForServer(new_server)); // A network change forces the config to be fetched. SimulateNetworkChange(network::mojom::ConnectionType::CONNECTION_2G); WaitForConfig(); ui_test_utils::NavigateToURL(browser(), GURL("http://does.not.resolve/foo")); EXPECT_EQ(GetBody(), kSecondaryResponse); } IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest, ChromeProxyHeaderSet) { // Proxy will be used, so it shouldn't matter if the host cannot be resolved. ui_test_utils::NavigateToURL( browser(), GURL("http://does.not.resolve/echoheader?Chrome-Proxy")); std::string body = GetBody(); EXPECT_THAT(body, HasSubstr(kSessionKey)); EXPECT_THAT(body, HasSubstr("pid=")); } IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest, DisabledOnIncognito) { net::EmbeddedTestServer test_server; test_server.RegisterRequestHandler( base::BindRepeating(&BasicResponse, kDummyBody)); ASSERT_TRUE(test_server.Start()); Browser* incognito = CreateIncognitoBrowser(); ui_test_utils::NavigateToURL( incognito, GetURLWithMockHost(test_server, "/echoheader?Chrome-Proxy")); EXPECT_EQ(GetBody(incognito), kDummyBody); // Make sure subresource doesn't use DRP either. std::string script = R"((url => { var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.onload = () => domAutomationController.send(xhr.responseText); xhr.send(); }))"; std::string result; ASSERT_TRUE(ExecuteScriptAndExtractString( incognito->tab_strip_model()->GetActiveWebContents(), script + "('" + GetURLWithMockHost(test_server, "/echoheader?Chrome-Proxy").spec() + "')", &result)); EXPECT_EQ(result, kDummyBody); } IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest, ChromeProxyHeaderSetForSubresource) { net::EmbeddedTestServer test_server; test_server.RegisterRequestHandler( base::BindRepeating(&BasicResponse, kDummyBody)); ASSERT_TRUE(test_server.Start()); ui_test_utils::NavigateToURL(browser(), GetURLWithMockHost(test_server, "/echo")); std::string script = R"((url => { var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.onload = () => domAutomationController.send(xhr.responseText); xhr.send(); }))"; std::string result; ASSERT_TRUE(ExecuteScriptAndExtractString( browser()->tab_strip_model()->GetActiveWebContents(), script + "('" + GetURLWithMockHost(test_server, "/echoheader?Chrome-Proxy").spec() + "')", &result)); EXPECT_THAT(result, HasSubstr(kSessionKey)); EXPECT_THAT(result, Not(HasSubstr("pid="))); } IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest, ChromeProxyEctHeaderSet) { // Proxy will be used, so it shouldn't matter if the host cannot be resolved. ui_test_utils::NavigateToURL( browser(), GURL("http://does.not.resolve/echoheader?Chrome-Proxy-Ect")); EXPECT_EQ(GetBody(), "4G"); } IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest, ProxyNotUsedWhenDisabled) { net::EmbeddedTestServer test_server; test_server.RegisterRequestHandler( base::BindRepeating(&BasicResponse, kDummyBody)); ASSERT_TRUE(test_server.Start()); ui_test_utils::NavigateToURL( browser(), GetURLWithMockHost(test_server, "/echoheader?Chrome-Proxy")); EXPECT_THAT(GetBody(), testing::HasSubstr(kSessionKey)); EnableDataSaver(false); // |test_server| only has the BasicResponse handler, so should return the // dummy response no matter what the URL if it is not being proxied. ui_test_utils::NavigateToURL( browser(), GetURLWithMockHost(test_server, "/echoheader?Chrome-Proxy")); EXPECT_EQ(GetBody(), kDummyBody); } IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest, UMAMetricsRecorded) { base::HistogramTester histogram_tester; // Make sure we wait for timing information. page_load_metrics::PageLoadMetricsTestWaiter waiter( browser()->tab_strip_model()->GetActiveWebContents()); waiter.AddPageExpectation( page_load_metrics::PageLoadMetricsTestWaiter::TimingField::kFirstPaint); // Proxy will be used, so it shouldn't matter if the host cannot be resolved. ui_test_utils::NavigateToURL(browser(), GURL("http://does.not.resolve/echo")); waiter.Wait(); SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); histogram_tester.ExpectUniqueSample("DataReductionProxy.ProxySchemeUsed", ProxyScheme::PROXY_SCHEME_HTTP, 1); histogram_tester.ExpectTotalCount( "PageLoad.Clients.DataReductionProxy.PaintTiming." "NavigationToFirstContentfulPaint", 1); } class DataReductionProxyBrowsertestWithNetworkService : public DataReductionProxyBrowsertest { public: void SetUp() override { scoped_feature_list_.InitAndEnableFeature( network::features::kNetworkService); DataReductionProxyBrowsertest::SetUp(); } base::test::ScopedFeatureList scoped_feature_list_; }; IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertestWithNetworkService, DataUsePrefsRecorded) { PrefService* prefs = browser()->profile()->GetPrefs(); // Make sure we wait for timing information. page_load_metrics::PageLoadMetricsTestWaiter waiter( browser()->tab_strip_model()->GetActiveWebContents()); waiter.AddPageExpectation( page_load_metrics::PageLoadMetricsTestWaiter::TimingField::kFirstPaint); // Proxy will be used, so it shouldn't matter if the host cannot be resolved. ui_test_utils::NavigateToURL(browser(), GURL("http://does.not.resolve/echo")); waiter.Wait(); ASSERT_GE(0, prefs->GetInt64( data_reduction_proxy::prefs::kHttpReceivedContentLength)); ASSERT_GE(0, prefs->GetInt64( data_reduction_proxy::prefs::kHttpOriginalContentLength)); } class DataReductionProxyFallbackBrowsertest : public DataReductionProxyBrowsertest { public: void SetUpOnMainThread() override { // Set up a primary server which will return the Chrome-Proxy header set by // SetHeader() and status set by SetStatusCode(). Secondary server will just // return the secondary response. primary_server_.RegisterRequestHandler(base::BindRepeating( &DataReductionProxyFallbackBrowsertest::AddChromeProxyHeader, base::Unretained(this))); ASSERT_TRUE(primary_server_.Start()); secondary_server_.RegisterRequestHandler( base::BindRepeating(&BasicResponse, kSecondaryResponse)); ASSERT_TRUE(secondary_server_.Start()); net::HostPortPair primary_host_port_pair = primary_server_.host_port_pair(); net::HostPortPair secondary_host_port_pair = secondary_server_.host_port_pair(); SetConfig(CreateConfig( kSessionKey, 1000, 0, ProxyServer_ProxyScheme_HTTP, primary_host_port_pair.host(), primary_host_port_pair.port(), ProxyServer::CORE, ProxyServer_ProxyScheme_HTTP, secondary_host_port_pair.host(), secondary_host_port_pair.port(), ProxyServer::CORE, 0.5f, false)); DataReductionProxyBrowsertest::SetUpOnMainThread(); } void SetHeader(const std::string& header) { header_ = header; } void SetStatusCode(net::HttpStatusCode status_code) { status_code_ = status_code; } private: std::unique_ptr<net::test_server::HttpResponse> AddChromeProxyHeader( const net::test_server::HttpRequest& request) { auto response = std::make_unique<net::test_server::BasicHttpResponse>(); if (!header_.empty()) response->AddCustomHeader(chrome_proxy_header(), header_); response->set_code(status_code_); response->set_content(kPrimaryResponse); response->set_content_type("text/plain"); return response; } net::HttpStatusCode status_code_ = net::HTTP_OK; std::string header_; net::EmbeddedTestServer primary_server_; net::EmbeddedTestServer secondary_server_; }; IN_PROC_BROWSER_TEST_F(DataReductionProxyFallbackBrowsertest, FallbackProxyUsedOn500Status) { // Should fall back to the secondary proxy if a 500 error occurs. SetStatusCode(net::HTTP_INTERNAL_SERVER_ERROR); ui_test_utils::NavigateToURL( browser(), GURL("http://does.not.resolve/echoheader?Chrome-Proxy")); EXPECT_THAT(GetBody(), kSecondaryResponse); // Bad proxy should still be bypassed. SetStatusCode(net::HTTP_OK); ui_test_utils::NavigateToURL( browser(), GURL("http://does.not.resolve/echoheader?Chrome-Proxy")); EXPECT_THAT(GetBody(), kSecondaryResponse); } IN_PROC_BROWSER_TEST_F(DataReductionProxyFallbackBrowsertest, FallbackProxyUsedWhenBypassHeaderSent) { // Should fall back to the secondary proxy if the bypass header is set. SetHeader("bypass=100"); ui_test_utils::NavigateToURL( browser(), GURL("http://does.not.resolve/echoheader?Chrome-Proxy")); EXPECT_THAT(GetBody(), kSecondaryResponse); // Bad proxy should still be bypassed. SetHeader(""); ui_test_utils::NavigateToURL( browser(), GURL("http://does.not.resolve/echoheader?Chrome-Proxy")); EXPECT_THAT(GetBody(), kSecondaryResponse); } IN_PROC_BROWSER_TEST_F(DataReductionProxyFallbackBrowsertest, BadProxiesResetWhenDisabled) { SetHeader("bypass=100"); ui_test_utils::NavigateToURL( browser(), GURL("http://does.not.resolve/echoheader?Chrome-Proxy")); EXPECT_THAT(GetBody(), kSecondaryResponse); // Disabling and enabling DRP should clear the bypass. EnableDataSaver(false); EnableDataSaver(true); SetHeader(""); ui_test_utils::NavigateToURL( browser(), GURL("http://does.not.resolve/echoheader?Chrome-Proxy")); EXPECT_THAT(GetBody(), kPrimaryResponse); } IN_PROC_BROWSER_TEST_F(DataReductionProxyFallbackBrowsertest, NoProxyUsedWhenBlockOnceHeaderSent) { net::EmbeddedTestServer test_server; test_server.RegisterRequestHandler( base::BindRepeating(&BasicResponse, kDummyBody)); ASSERT_TRUE(test_server.Start()); // Request should not use a proxy. SetHeader("block-once"); ui_test_utils::NavigateToURL(browser(), GetURLWithMockHost(test_server, "/echo")); EXPECT_THAT(GetBody(), kDummyBody); // Proxy should no longer be blocked, and use first proxy. SetHeader(""); ui_test_utils::NavigateToURL(browser(), GetURLWithMockHost(test_server, "/echo")); EXPECT_EQ(GetBody(), kPrimaryResponse); } IN_PROC_BROWSER_TEST_F(DataReductionProxyFallbackBrowsertest, FallbackProxyUsedWhenBlockHeaderSent) { net::EmbeddedTestServer test_server; test_server.RegisterRequestHandler( base::BindRepeating(&BasicResponse, kDummyBody)); ASSERT_TRUE(test_server.Start()); // Request should not use a proxy. SetHeader("block=100"); ui_test_utils::NavigateToURL(browser(), GetURLWithMockHost(test_server, "/echo")); EXPECT_THAT(GetBody(), kDummyBody); // Request should still not use proxy. SetHeader(""); ui_test_utils::NavigateToURL(browser(), GetURLWithMockHost(test_server, "/echo")); EXPECT_THAT(GetBody(), kDummyBody); } IN_PROC_BROWSER_TEST_F(DataReductionProxyFallbackBrowsertest, FallbackProxyUsedWhenBlockZeroHeaderSent) { net::EmbeddedTestServer test_server; test_server.RegisterRequestHandler( base::BindRepeating(&BasicResponse, kDummyBody)); ASSERT_TRUE(test_server.Start()); // Request should not use a proxy. Sending 0 for the block param will block // requests for a random duration between 1 and 5 minutes. SetHeader("block=0"); ui_test_utils::NavigateToURL(browser(), GetURLWithMockHost(test_server, "/echo")); EXPECT_THAT(GetBody(), kDummyBody); // Request should still not use proxy. SetHeader(""); ui_test_utils::NavigateToURL(browser(), GetURLWithMockHost(test_server, "/echo")); EXPECT_THAT(GetBody(), kDummyBody); } class DataReductionProxyResourceTypeBrowsertest : public DataReductionProxyBrowsertest { public: void SetUpOnMainThread() override { // Two proxies are set up here, one with type CORE and one UNSPECIFIED_TYPE. // The CORE proxy is the secondary, and should be used for requests from the // <video> tag. unspecified_server_.RegisterRequestHandler(base::BindRepeating( &IncrementRequestCount, "/video", &unspecified_request_count_)); ASSERT_TRUE(unspecified_server_.Start()); core_server_.RegisterRequestHandler(base::BindRepeating( &IncrementRequestCount, "/video", &core_request_count_)); ASSERT_TRUE(core_server_.Start()); net::HostPortPair unspecified_host_port_pair = unspecified_server_.host_port_pair(); net::HostPortPair core_host_port_pair = core_server_.host_port_pair(); SetConfig(CreateConfig( kSessionKey, 1000, 0, ProxyServer_ProxyScheme_HTTP, unspecified_host_port_pair.host(), unspecified_host_port_pair.port(), ProxyServer::UNSPECIFIED_TYPE, ProxyServer_ProxyScheme_HTTP, core_host_port_pair.host(), core_host_port_pair.port(), ProxyServer::CORE, 0.5f, false)); DataReductionProxyBrowsertest::SetUpOnMainThread(); } int unspecified_request_count_ = 0; int core_request_count_ = 0; private: net::EmbeddedTestServer unspecified_server_; net::EmbeddedTestServer core_server_; }; IN_PROC_BROWSER_TEST_F(DataReductionProxyResourceTypeBrowsertest, CoreProxyUsedForMedia) { ui_test_utils::NavigateToURL( browser(), GetURLWithMockHost(*embedded_test_server(), "/echo")); std::string script = R"((url => { var video = document.createElement('video'); // Use onerror since the response is not a valid video. video.onerror = () => domAutomationController.send('done'); video.src = url; video.load(); document.body.appendChild(video); }))"; std::string result; ASSERT_TRUE(ExecuteScriptAndExtractString( browser()->tab_strip_model()->GetActiveWebContents(), script + "('" + GetURLWithMockHost(*embedded_test_server(), "/video").spec() + "')", &result)); EXPECT_EQ(result, "done"); EXPECT_EQ(unspecified_request_count_, 0); EXPECT_EQ(core_request_count_, 1); } class DataReductionProxyWarmupURLBrowsertest : public ::testing::WithParamInterface< std::tuple<ProxyServer_ProxyScheme, bool>>, public DataReductionProxyBrowsertestBase { public: DataReductionProxyWarmupURLBrowsertest() : via_header_(std::get<1>(GetParam()) ? "1.1 Chrome-Compression-Proxy" : "bad"), primary_server_(GetTestServerType()), secondary_server_(GetTestServerType()) {} void SetUpOnMainThread() override { primary_server_loop_ = std::make_unique<base::RunLoop>(); primary_server_.RegisterRequestHandler(base::BindRepeating( &DataReductionProxyWarmupURLBrowsertest::WaitForWarmupRequest, base::Unretained(this), primary_server_loop_.get())); ASSERT_TRUE(primary_server_.Start()); secondary_server_loop_ = std::make_unique<base::RunLoop>(); secondary_server_.RegisterRequestHandler(base::BindRepeating( &DataReductionProxyWarmupURLBrowsertest::WaitForWarmupRequest, base::Unretained(this), secondary_server_loop_.get())); ASSERT_TRUE(secondary_server_.Start()); net::HostPortPair primary_host_port_pair = primary_server_.host_port_pair(); net::HostPortPair secondary_host_port_pair = secondary_server_.host_port_pair(); SetConfig(CreateConfig( kSessionKey, 1000, 0, std::get<0>(GetParam()), primary_host_port_pair.host(), primary_host_port_pair.port(), ProxyServer::UNSPECIFIED_TYPE, std::get<0>(GetParam()), secondary_host_port_pair.host(), secondary_host_port_pair.port(), ProxyServer::CORE, 0.5f, false)); DataReductionProxyBrowsertestBase::SetUpOnMainThread(); } // Retries fetching |histogram_name| until it contains at least |count| // samples. void RetryForHistogramUntilCountReached( base::HistogramTester* histogram_tester, const std::string& histogram_name, size_t count) { base::RunLoop().RunUntilIdle(); for (size_t attempt = 0; attempt < 3; ++attempt) { const std::vector<base::Bucket> buckets = histogram_tester->GetAllSamples(histogram_name); size_t total_count = 0; for (const auto& bucket : buckets) total_count += bucket.count; if (total_count >= count) return; content::FetchHistogramsFromChildProcesses(); SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); base::RunLoop().RunUntilIdle(); } } std::string GetHistogramName(ProxyServer::ProxyType type) { return base::StrCat( {"DataReductionProxy.WarmupURLFetcherCallback.SuccessfulFetch.", std::get<0>(GetParam()) == ProxyServer_ProxyScheme_HTTP ? "Insecure" : "Secure", "Proxy.", type == ProxyServer::CORE ? "Core" : "NonCore"}); } std::unique_ptr<base::RunLoop> primary_server_loop_; std::unique_ptr<base::RunLoop> secondary_server_loop_; base::HistogramTester histogram_tester_; private: net::EmbeddedTestServer::Type GetTestServerType() { if (std::get<0>(GetParam()) == ProxyServer_ProxyScheme_HTTP) return net::EmbeddedTestServer::TYPE_HTTP; return net::EmbeddedTestServer::TYPE_HTTPS; } std::unique_ptr<net::test_server::HttpResponse> WaitForWarmupRequest( base::RunLoop* run_loop, const net::test_server::HttpRequest& request) { if (base::StartsWith(request.relative_url, "/e2e_probe", base::CompareCase::SENSITIVE)) { run_loop->Quit(); } auto response = std::make_unique<net::test_server::BasicHttpResponse>(); response->set_content("content"); response->AddCustomHeader("via", via_header_); return response; } const std::string via_header_; net::EmbeddedTestServer primary_server_; net::EmbeddedTestServer secondary_server_; }; IN_PROC_BROWSER_TEST_P(DataReductionProxyWarmupURLBrowsertest, WarmupURLsFetchedForEachProxy) { primary_server_loop_->Run(); secondary_server_loop_->Run(); SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); RetryForHistogramUntilCountReached( &histogram_tester_, GetHistogramName(ProxyServer::UNSPECIFIED_TYPE), 1); RetryForHistogramUntilCountReached(&histogram_tester_, GetHistogramName(ProxyServer::CORE), 1); histogram_tester_.ExpectUniqueSample( GetHistogramName(ProxyServer::UNSPECIFIED_TYPE), std::get<1>(GetParam()), 1); histogram_tester_.ExpectUniqueSample(GetHistogramName(ProxyServer::CORE), std::get<1>(GetParam()), 1); } // First parameter indicate proxy scheme for proxies that are being tested. // Second parameter is true if the test proxy server should set via header // correctly on the response headers. INSTANTIATE_TEST_CASE_P( , DataReductionProxyWarmupURLBrowsertest, ::testing::Combine(testing::Values(ProxyServer_ProxyScheme_HTTP, ProxyServer_ProxyScheme_HTTPS), ::testing::Bool())); // TODO(eroman): Test that config changes are observed by the DRP throttles. } // namespace data_reduction_proxy
[ "artem@brave.com" ]
artem@brave.com
15ab615739117bf6be17060b2f6eae9d9874f81d
a46fae5a473963f970f3cfc654498dba455d5208
/src/recsys/thrift/cpp/DataHost.h
647bb71fd7b050f5ab06fd9d887f83420600d2b4
[]
no_license
manazhao/RecEngine
1465e60511bdc6866b53ff5ee2f703e45042313b
8a9081ed68742a9bc46a467e2dc0a106e034e719
refs/heads/master
2020-05-01T03:40:07.573554
2014-10-06T12:14:17
2014-10-06T12:14:17
18,185,495
0
0
null
null
null
null
UTF-8
C++
false
true
39,979
h
/** * Autogenerated by Thrift Compiler (1.0.0-dev) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ #ifndef DataHost_H #define DataHost_H #include <thrift/TDispatchProcessor.h> #include "data_types.h" namespace recsys { namespace thrift { class DataHostIf { public: virtual ~DataHostIf() {} virtual void index_interaction(Response& _return, const std::string& fromId, const int8_t fromType, const std::string& toId, const int8_t toType, const int8_t type, const double val) = 0; virtual void query_entity_interacts(std::map<int8_t, std::vector<Interact> > & _return, const int64_t id) = 0; virtual void query_entity_name(std::string& _return, const int64_t id) = 0; virtual void query_entity_names(std::vector<std::string> & _return, const std::vector<int64_t> & idList) = 0; virtual int64_t query_entity_id(const std::string& name, const int8_t type) = 0; virtual void get_dataset(Dataset& _return, const DSType::type dsType) = 0; virtual void get_cv_train(Dataset& _return, const int8_t foldIdx) = 0; virtual void get_cv_test(Dataset& _return, const int8_t foldIdx) = 0; }; class DataHostIfFactory { public: typedef DataHostIf Handler; virtual ~DataHostIfFactory() {} virtual DataHostIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0; virtual void releaseHandler(DataHostIf* /* handler */) = 0; }; class DataHostIfSingletonFactory : virtual public DataHostIfFactory { public: DataHostIfSingletonFactory(const boost::shared_ptr<DataHostIf>& iface) : iface_(iface) {} virtual ~DataHostIfSingletonFactory() {} virtual DataHostIf* getHandler(const ::apache::thrift::TConnectionInfo&) { return iface_.get(); } virtual void releaseHandler(DataHostIf* /* handler */) {} protected: boost::shared_ptr<DataHostIf> iface_; }; class DataHostNull : virtual public DataHostIf { public: virtual ~DataHostNull() {} void index_interaction(Response& /* _return */, const std::string& /* fromId */, const int8_t /* fromType */, const std::string& /* toId */, const int8_t /* toType */, const int8_t /* type */, const double /* val */) { return; } void query_entity_interacts(std::map<int8_t, std::vector<Interact> > & /* _return */, const int64_t /* id */) { return; } void query_entity_name(std::string& /* _return */, const int64_t /* id */) { return; } void query_entity_names(std::vector<std::string> & /* _return */, const std::vector<int64_t> & /* idList */) { return; } int64_t query_entity_id(const std::string& /* name */, const int8_t /* type */) { int64_t _return = 0; return _return; } void get_dataset(Dataset& /* _return */, const DSType::type /* dsType */) { return; } void get_cv_train(Dataset& /* _return */, const int8_t /* foldIdx */) { return; } void get_cv_test(Dataset& /* _return */, const int8_t /* foldIdx */) { return; } }; typedef struct _DataHost_index_interaction_args__isset { _DataHost_index_interaction_args__isset() : fromId(false), fromType(false), toId(false), toType(false), type(false), val(false) {} bool fromId; bool fromType; bool toId; bool toType; bool type; bool val; } _DataHost_index_interaction_args__isset; class DataHost_index_interaction_args { public: static const char* ascii_fingerprint; // = "348EDE5F22B35256BA2F606F133CB209"; static const uint8_t binary_fingerprint[16]; // = {0x34,0x8E,0xDE,0x5F,0x22,0xB3,0x52,0x56,0xBA,0x2F,0x60,0x6F,0x13,0x3C,0xB2,0x09}; DataHost_index_interaction_args() : fromId(), fromType(0), toId(), toType(0), type(0), val(0) { } virtual ~DataHost_index_interaction_args() throw() {} std::string fromId; int8_t fromType; std::string toId; int8_t toType; int8_t type; double val; _DataHost_index_interaction_args__isset __isset; void __set_fromId(const std::string& val) { fromId = val; } void __set_fromType(const int8_t val) { fromType = val; } void __set_toId(const std::string& val) { toId = val; } void __set_toType(const int8_t val) { toType = val; } void __set_type(const int8_t val) { type = val; } void __set_val(const double val) { this->val = val; } bool operator == (const DataHost_index_interaction_args & rhs) const { if (!(fromId == rhs.fromId)) return false; if (!(fromType == rhs.fromType)) return false; if (!(toId == rhs.toId)) return false; if (!(toType == rhs.toType)) return false; if (!(type == rhs.type)) return false; if (!(val == rhs.val)) return false; return true; } bool operator != (const DataHost_index_interaction_args &rhs) const { return !(*this == rhs); } bool operator < (const DataHost_index_interaction_args & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class DataHost_index_interaction_pargs { public: static const char* ascii_fingerprint; // = "348EDE5F22B35256BA2F606F133CB209"; static const uint8_t binary_fingerprint[16]; // = {0x34,0x8E,0xDE,0x5F,0x22,0xB3,0x52,0x56,0xBA,0x2F,0x60,0x6F,0x13,0x3C,0xB2,0x09}; virtual ~DataHost_index_interaction_pargs() throw() {} const std::string* fromId; const int8_t* fromType; const std::string* toId; const int8_t* toType; const int8_t* type; const double* val; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _DataHost_index_interaction_result__isset { _DataHost_index_interaction_result__isset() : success(false) {} bool success; } _DataHost_index_interaction_result__isset; class DataHost_index_interaction_result { public: static const char* ascii_fingerprint; // = "9C1BA839512A4F2BC86BC780CA8C3AD8"; static const uint8_t binary_fingerprint[16]; // = {0x9C,0x1B,0xA8,0x39,0x51,0x2A,0x4F,0x2B,0xC8,0x6B,0xC7,0x80,0xCA,0x8C,0x3A,0xD8}; DataHost_index_interaction_result() { } virtual ~DataHost_index_interaction_result() throw() {} Response success; _DataHost_index_interaction_result__isset __isset; void __set_success(const Response& val) { success = val; } bool operator == (const DataHost_index_interaction_result & rhs) const { if (!(success == rhs.success)) return false; return true; } bool operator != (const DataHost_index_interaction_result &rhs) const { return !(*this == rhs); } bool operator < (const DataHost_index_interaction_result & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _DataHost_index_interaction_presult__isset { _DataHost_index_interaction_presult__isset() : success(false) {} bool success; } _DataHost_index_interaction_presult__isset; class DataHost_index_interaction_presult { public: static const char* ascii_fingerprint; // = "9C1BA839512A4F2BC86BC780CA8C3AD8"; static const uint8_t binary_fingerprint[16]; // = {0x9C,0x1B,0xA8,0x39,0x51,0x2A,0x4F,0x2B,0xC8,0x6B,0xC7,0x80,0xCA,0x8C,0x3A,0xD8}; virtual ~DataHost_index_interaction_presult() throw() {} Response* success; _DataHost_index_interaction_presult__isset __isset; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; typedef struct _DataHost_query_entity_interacts_args__isset { _DataHost_query_entity_interacts_args__isset() : id(false) {} bool id; } _DataHost_query_entity_interacts_args__isset; class DataHost_query_entity_interacts_args { public: static const char* ascii_fingerprint; // = "56A59CE7FFAF82BCA8A19FAACDE4FB75"; static const uint8_t binary_fingerprint[16]; // = {0x56,0xA5,0x9C,0xE7,0xFF,0xAF,0x82,0xBC,0xA8,0xA1,0x9F,0xAA,0xCD,0xE4,0xFB,0x75}; DataHost_query_entity_interacts_args() : id(0) { } virtual ~DataHost_query_entity_interacts_args() throw() {} int64_t id; _DataHost_query_entity_interacts_args__isset __isset; void __set_id(const int64_t val) { id = val; } bool operator == (const DataHost_query_entity_interacts_args & rhs) const { if (!(id == rhs.id)) return false; return true; } bool operator != (const DataHost_query_entity_interacts_args &rhs) const { return !(*this == rhs); } bool operator < (const DataHost_query_entity_interacts_args & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class DataHost_query_entity_interacts_pargs { public: static const char* ascii_fingerprint; // = "56A59CE7FFAF82BCA8A19FAACDE4FB75"; static const uint8_t binary_fingerprint[16]; // = {0x56,0xA5,0x9C,0xE7,0xFF,0xAF,0x82,0xBC,0xA8,0xA1,0x9F,0xAA,0xCD,0xE4,0xFB,0x75}; virtual ~DataHost_query_entity_interacts_pargs() throw() {} const int64_t* id; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _DataHost_query_entity_interacts_result__isset { _DataHost_query_entity_interacts_result__isset() : success(false) {} bool success; } _DataHost_query_entity_interacts_result__isset; class DataHost_query_entity_interacts_result { public: static const char* ascii_fingerprint; // = "DD17DF9F44F4FE032B3C1C27410151D5"; static const uint8_t binary_fingerprint[16]; // = {0xDD,0x17,0xDF,0x9F,0x44,0xF4,0xFE,0x03,0x2B,0x3C,0x1C,0x27,0x41,0x01,0x51,0xD5}; DataHost_query_entity_interacts_result() { } virtual ~DataHost_query_entity_interacts_result() throw() {} std::map<int8_t, std::vector<Interact> > success; _DataHost_query_entity_interacts_result__isset __isset; void __set_success(const std::map<int8_t, std::vector<Interact> > & val) { success = val; } bool operator == (const DataHost_query_entity_interacts_result & rhs) const { if (!(success == rhs.success)) return false; return true; } bool operator != (const DataHost_query_entity_interacts_result &rhs) const { return !(*this == rhs); } bool operator < (const DataHost_query_entity_interacts_result & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _DataHost_query_entity_interacts_presult__isset { _DataHost_query_entity_interacts_presult__isset() : success(false) {} bool success; } _DataHost_query_entity_interacts_presult__isset; class DataHost_query_entity_interacts_presult { public: static const char* ascii_fingerprint; // = "DD17DF9F44F4FE032B3C1C27410151D5"; static const uint8_t binary_fingerprint[16]; // = {0xDD,0x17,0xDF,0x9F,0x44,0xF4,0xFE,0x03,0x2B,0x3C,0x1C,0x27,0x41,0x01,0x51,0xD5}; virtual ~DataHost_query_entity_interacts_presult() throw() {} std::map<int8_t, std::vector<Interact> > * success; _DataHost_query_entity_interacts_presult__isset __isset; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; typedef struct _DataHost_query_entity_name_args__isset { _DataHost_query_entity_name_args__isset() : id(false) {} bool id; } _DataHost_query_entity_name_args__isset; class DataHost_query_entity_name_args { public: static const char* ascii_fingerprint; // = "56A59CE7FFAF82BCA8A19FAACDE4FB75"; static const uint8_t binary_fingerprint[16]; // = {0x56,0xA5,0x9C,0xE7,0xFF,0xAF,0x82,0xBC,0xA8,0xA1,0x9F,0xAA,0xCD,0xE4,0xFB,0x75}; DataHost_query_entity_name_args() : id(0) { } virtual ~DataHost_query_entity_name_args() throw() {} int64_t id; _DataHost_query_entity_name_args__isset __isset; void __set_id(const int64_t val) { id = val; } bool operator == (const DataHost_query_entity_name_args & rhs) const { if (!(id == rhs.id)) return false; return true; } bool operator != (const DataHost_query_entity_name_args &rhs) const { return !(*this == rhs); } bool operator < (const DataHost_query_entity_name_args & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class DataHost_query_entity_name_pargs { public: static const char* ascii_fingerprint; // = "56A59CE7FFAF82BCA8A19FAACDE4FB75"; static const uint8_t binary_fingerprint[16]; // = {0x56,0xA5,0x9C,0xE7,0xFF,0xAF,0x82,0xBC,0xA8,0xA1,0x9F,0xAA,0xCD,0xE4,0xFB,0x75}; virtual ~DataHost_query_entity_name_pargs() throw() {} const int64_t* id; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _DataHost_query_entity_name_result__isset { _DataHost_query_entity_name_result__isset() : success(false) {} bool success; } _DataHost_query_entity_name_result__isset; class DataHost_query_entity_name_result { public: static const char* ascii_fingerprint; // = "9A73381FEFD6B67F432E717102246330"; static const uint8_t binary_fingerprint[16]; // = {0x9A,0x73,0x38,0x1F,0xEF,0xD6,0xB6,0x7F,0x43,0x2E,0x71,0x71,0x02,0x24,0x63,0x30}; DataHost_query_entity_name_result() : success() { } virtual ~DataHost_query_entity_name_result() throw() {} std::string success; _DataHost_query_entity_name_result__isset __isset; void __set_success(const std::string& val) { success = val; } bool operator == (const DataHost_query_entity_name_result & rhs) const { if (!(success == rhs.success)) return false; return true; } bool operator != (const DataHost_query_entity_name_result &rhs) const { return !(*this == rhs); } bool operator < (const DataHost_query_entity_name_result & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _DataHost_query_entity_name_presult__isset { _DataHost_query_entity_name_presult__isset() : success(false) {} bool success; } _DataHost_query_entity_name_presult__isset; class DataHost_query_entity_name_presult { public: static const char* ascii_fingerprint; // = "9A73381FEFD6B67F432E717102246330"; static const uint8_t binary_fingerprint[16]; // = {0x9A,0x73,0x38,0x1F,0xEF,0xD6,0xB6,0x7F,0x43,0x2E,0x71,0x71,0x02,0x24,0x63,0x30}; virtual ~DataHost_query_entity_name_presult() throw() {} std::string* success; _DataHost_query_entity_name_presult__isset __isset; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; typedef struct _DataHost_query_entity_names_args__isset { _DataHost_query_entity_names_args__isset() : idList(false) {} bool idList; } _DataHost_query_entity_names_args__isset; class DataHost_query_entity_names_args { public: static const char* ascii_fingerprint; // = "E49D7D1A9013CC81CD0F69D631EF82E4"; static const uint8_t binary_fingerprint[16]; // = {0xE4,0x9D,0x7D,0x1A,0x90,0x13,0xCC,0x81,0xCD,0x0F,0x69,0xD6,0x31,0xEF,0x82,0xE4}; DataHost_query_entity_names_args() { } virtual ~DataHost_query_entity_names_args() throw() {} std::vector<int64_t> idList; _DataHost_query_entity_names_args__isset __isset; void __set_idList(const std::vector<int64_t> & val) { idList = val; } bool operator == (const DataHost_query_entity_names_args & rhs) const { if (!(idList == rhs.idList)) return false; return true; } bool operator != (const DataHost_query_entity_names_args &rhs) const { return !(*this == rhs); } bool operator < (const DataHost_query_entity_names_args & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class DataHost_query_entity_names_pargs { public: static const char* ascii_fingerprint; // = "E49D7D1A9013CC81CD0F69D631EF82E4"; static const uint8_t binary_fingerprint[16]; // = {0xE4,0x9D,0x7D,0x1A,0x90,0x13,0xCC,0x81,0xCD,0x0F,0x69,0xD6,0x31,0xEF,0x82,0xE4}; virtual ~DataHost_query_entity_names_pargs() throw() {} const std::vector<int64_t> * idList; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _DataHost_query_entity_names_result__isset { _DataHost_query_entity_names_result__isset() : success(false) {} bool success; } _DataHost_query_entity_names_result__isset; class DataHost_query_entity_names_result { public: static const char* ascii_fingerprint; // = "C844643081B14EA3A81E57199FB2B504"; static const uint8_t binary_fingerprint[16]; // = {0xC8,0x44,0x64,0x30,0x81,0xB1,0x4E,0xA3,0xA8,0x1E,0x57,0x19,0x9F,0xB2,0xB5,0x04}; DataHost_query_entity_names_result() { } virtual ~DataHost_query_entity_names_result() throw() {} std::vector<std::string> success; _DataHost_query_entity_names_result__isset __isset; void __set_success(const std::vector<std::string> & val) { success = val; } bool operator == (const DataHost_query_entity_names_result & rhs) const { if (!(success == rhs.success)) return false; return true; } bool operator != (const DataHost_query_entity_names_result &rhs) const { return !(*this == rhs); } bool operator < (const DataHost_query_entity_names_result & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _DataHost_query_entity_names_presult__isset { _DataHost_query_entity_names_presult__isset() : success(false) {} bool success; } _DataHost_query_entity_names_presult__isset; class DataHost_query_entity_names_presult { public: static const char* ascii_fingerprint; // = "C844643081B14EA3A81E57199FB2B504"; static const uint8_t binary_fingerprint[16]; // = {0xC8,0x44,0x64,0x30,0x81,0xB1,0x4E,0xA3,0xA8,0x1E,0x57,0x19,0x9F,0xB2,0xB5,0x04}; virtual ~DataHost_query_entity_names_presult() throw() {} std::vector<std::string> * success; _DataHost_query_entity_names_presult__isset __isset; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; typedef struct _DataHost_query_entity_id_args__isset { _DataHost_query_entity_id_args__isset() : name(false), type(false) {} bool name; bool type; } _DataHost_query_entity_id_args__isset; class DataHost_query_entity_id_args { public: static const char* ascii_fingerprint; // = "EAF0A51FCCA478B8CA6B466F7A29473A"; static const uint8_t binary_fingerprint[16]; // = {0xEA,0xF0,0xA5,0x1F,0xCC,0xA4,0x78,0xB8,0xCA,0x6B,0x46,0x6F,0x7A,0x29,0x47,0x3A}; DataHost_query_entity_id_args() : name(), type(0) { } virtual ~DataHost_query_entity_id_args() throw() {} std::string name; int8_t type; _DataHost_query_entity_id_args__isset __isset; void __set_name(const std::string& val) { name = val; } void __set_type(const int8_t val) { type = val; } bool operator == (const DataHost_query_entity_id_args & rhs) const { if (!(name == rhs.name)) return false; if (!(type == rhs.type)) return false; return true; } bool operator != (const DataHost_query_entity_id_args &rhs) const { return !(*this == rhs); } bool operator < (const DataHost_query_entity_id_args & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class DataHost_query_entity_id_pargs { public: static const char* ascii_fingerprint; // = "EAF0A51FCCA478B8CA6B466F7A29473A"; static const uint8_t binary_fingerprint[16]; // = {0xEA,0xF0,0xA5,0x1F,0xCC,0xA4,0x78,0xB8,0xCA,0x6B,0x46,0x6F,0x7A,0x29,0x47,0x3A}; virtual ~DataHost_query_entity_id_pargs() throw() {} const std::string* name; const int8_t* type; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _DataHost_query_entity_id_result__isset { _DataHost_query_entity_id_result__isset() : success(false) {} bool success; } _DataHost_query_entity_id_result__isset; class DataHost_query_entity_id_result { public: static const char* ascii_fingerprint; // = "1CF279170B7E876D4ABB450CC8994359"; static const uint8_t binary_fingerprint[16]; // = {0x1C,0xF2,0x79,0x17,0x0B,0x7E,0x87,0x6D,0x4A,0xBB,0x45,0x0C,0xC8,0x99,0x43,0x59}; DataHost_query_entity_id_result() : success(0) { } virtual ~DataHost_query_entity_id_result() throw() {} int64_t success; _DataHost_query_entity_id_result__isset __isset; void __set_success(const int64_t val) { success = val; } bool operator == (const DataHost_query_entity_id_result & rhs) const { if (!(success == rhs.success)) return false; return true; } bool operator != (const DataHost_query_entity_id_result &rhs) const { return !(*this == rhs); } bool operator < (const DataHost_query_entity_id_result & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _DataHost_query_entity_id_presult__isset { _DataHost_query_entity_id_presult__isset() : success(false) {} bool success; } _DataHost_query_entity_id_presult__isset; class DataHost_query_entity_id_presult { public: static const char* ascii_fingerprint; // = "1CF279170B7E876D4ABB450CC8994359"; static const uint8_t binary_fingerprint[16]; // = {0x1C,0xF2,0x79,0x17,0x0B,0x7E,0x87,0x6D,0x4A,0xBB,0x45,0x0C,0xC8,0x99,0x43,0x59}; virtual ~DataHost_query_entity_id_presult() throw() {} int64_t* success; _DataHost_query_entity_id_presult__isset __isset; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; typedef struct _DataHost_get_dataset_args__isset { _DataHost_get_dataset_args__isset() : dsType(false) {} bool dsType; } _DataHost_get_dataset_args__isset; class DataHost_get_dataset_args { public: static const char* ascii_fingerprint; // = "8BBB3D0C3B370CB38F2D1340BB79F0AA"; static const uint8_t binary_fingerprint[16]; // = {0x8B,0xBB,0x3D,0x0C,0x3B,0x37,0x0C,0xB3,0x8F,0x2D,0x13,0x40,0xBB,0x79,0xF0,0xAA}; DataHost_get_dataset_args() : dsType((DSType::type)0) { } virtual ~DataHost_get_dataset_args() throw() {} DSType::type dsType; _DataHost_get_dataset_args__isset __isset; void __set_dsType(const DSType::type val) { dsType = val; } bool operator == (const DataHost_get_dataset_args & rhs) const { if (!(dsType == rhs.dsType)) return false; return true; } bool operator != (const DataHost_get_dataset_args &rhs) const { return !(*this == rhs); } bool operator < (const DataHost_get_dataset_args & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class DataHost_get_dataset_pargs { public: static const char* ascii_fingerprint; // = "8BBB3D0C3B370CB38F2D1340BB79F0AA"; static const uint8_t binary_fingerprint[16]; // = {0x8B,0xBB,0x3D,0x0C,0x3B,0x37,0x0C,0xB3,0x8F,0x2D,0x13,0x40,0xBB,0x79,0xF0,0xAA}; virtual ~DataHost_get_dataset_pargs() throw() {} const DSType::type* dsType; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _DataHost_get_dataset_result__isset { _DataHost_get_dataset_result__isset() : success(false) {} bool success; } _DataHost_get_dataset_result__isset; class DataHost_get_dataset_result { public: static const char* ascii_fingerprint; // = "9474DE59E738FA6F126A024D54BE68F9"; static const uint8_t binary_fingerprint[16]; // = {0x94,0x74,0xDE,0x59,0xE7,0x38,0xFA,0x6F,0x12,0x6A,0x02,0x4D,0x54,0xBE,0x68,0xF9}; DataHost_get_dataset_result() { } virtual ~DataHost_get_dataset_result() throw() {} Dataset success; _DataHost_get_dataset_result__isset __isset; void __set_success(const Dataset& val) { success = val; } bool operator == (const DataHost_get_dataset_result & rhs) const { if (!(success == rhs.success)) return false; return true; } bool operator != (const DataHost_get_dataset_result &rhs) const { return !(*this == rhs); } bool operator < (const DataHost_get_dataset_result & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _DataHost_get_dataset_presult__isset { _DataHost_get_dataset_presult__isset() : success(false) {} bool success; } _DataHost_get_dataset_presult__isset; class DataHost_get_dataset_presult { public: static const char* ascii_fingerprint; // = "9474DE59E738FA6F126A024D54BE68F9"; static const uint8_t binary_fingerprint[16]; // = {0x94,0x74,0xDE,0x59,0xE7,0x38,0xFA,0x6F,0x12,0x6A,0x02,0x4D,0x54,0xBE,0x68,0xF9}; virtual ~DataHost_get_dataset_presult() throw() {} Dataset* success; _DataHost_get_dataset_presult__isset __isset; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; typedef struct _DataHost_get_cv_train_args__isset { _DataHost_get_cv_train_args__isset() : foldIdx(false) {} bool foldIdx; } _DataHost_get_cv_train_args__isset; class DataHost_get_cv_train_args { public: static const char* ascii_fingerprint; // = "A7D440367E85134EBDBAA7BCA01056D0"; static const uint8_t binary_fingerprint[16]; // = {0xA7,0xD4,0x40,0x36,0x7E,0x85,0x13,0x4E,0xBD,0xBA,0xA7,0xBC,0xA0,0x10,0x56,0xD0}; DataHost_get_cv_train_args() : foldIdx(0) { } virtual ~DataHost_get_cv_train_args() throw() {} int8_t foldIdx; _DataHost_get_cv_train_args__isset __isset; void __set_foldIdx(const int8_t val) { foldIdx = val; } bool operator == (const DataHost_get_cv_train_args & rhs) const { if (!(foldIdx == rhs.foldIdx)) return false; return true; } bool operator != (const DataHost_get_cv_train_args &rhs) const { return !(*this == rhs); } bool operator < (const DataHost_get_cv_train_args & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class DataHost_get_cv_train_pargs { public: static const char* ascii_fingerprint; // = "A7D440367E85134EBDBAA7BCA01056D0"; static const uint8_t binary_fingerprint[16]; // = {0xA7,0xD4,0x40,0x36,0x7E,0x85,0x13,0x4E,0xBD,0xBA,0xA7,0xBC,0xA0,0x10,0x56,0xD0}; virtual ~DataHost_get_cv_train_pargs() throw() {} const int8_t* foldIdx; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _DataHost_get_cv_train_result__isset { _DataHost_get_cv_train_result__isset() : success(false) {} bool success; } _DataHost_get_cv_train_result__isset; class DataHost_get_cv_train_result { public: static const char* ascii_fingerprint; // = "9474DE59E738FA6F126A024D54BE68F9"; static const uint8_t binary_fingerprint[16]; // = {0x94,0x74,0xDE,0x59,0xE7,0x38,0xFA,0x6F,0x12,0x6A,0x02,0x4D,0x54,0xBE,0x68,0xF9}; DataHost_get_cv_train_result() { } virtual ~DataHost_get_cv_train_result() throw() {} Dataset success; _DataHost_get_cv_train_result__isset __isset; void __set_success(const Dataset& val) { success = val; } bool operator == (const DataHost_get_cv_train_result & rhs) const { if (!(success == rhs.success)) return false; return true; } bool operator != (const DataHost_get_cv_train_result &rhs) const { return !(*this == rhs); } bool operator < (const DataHost_get_cv_train_result & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _DataHost_get_cv_train_presult__isset { _DataHost_get_cv_train_presult__isset() : success(false) {} bool success; } _DataHost_get_cv_train_presult__isset; class DataHost_get_cv_train_presult { public: static const char* ascii_fingerprint; // = "9474DE59E738FA6F126A024D54BE68F9"; static const uint8_t binary_fingerprint[16]; // = {0x94,0x74,0xDE,0x59,0xE7,0x38,0xFA,0x6F,0x12,0x6A,0x02,0x4D,0x54,0xBE,0x68,0xF9}; virtual ~DataHost_get_cv_train_presult() throw() {} Dataset* success; _DataHost_get_cv_train_presult__isset __isset; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; typedef struct _DataHost_get_cv_test_args__isset { _DataHost_get_cv_test_args__isset() : foldIdx(false) {} bool foldIdx; } _DataHost_get_cv_test_args__isset; class DataHost_get_cv_test_args { public: static const char* ascii_fingerprint; // = "A7D440367E85134EBDBAA7BCA01056D0"; static const uint8_t binary_fingerprint[16]; // = {0xA7,0xD4,0x40,0x36,0x7E,0x85,0x13,0x4E,0xBD,0xBA,0xA7,0xBC,0xA0,0x10,0x56,0xD0}; DataHost_get_cv_test_args() : foldIdx(0) { } virtual ~DataHost_get_cv_test_args() throw() {} int8_t foldIdx; _DataHost_get_cv_test_args__isset __isset; void __set_foldIdx(const int8_t val) { foldIdx = val; } bool operator == (const DataHost_get_cv_test_args & rhs) const { if (!(foldIdx == rhs.foldIdx)) return false; return true; } bool operator != (const DataHost_get_cv_test_args &rhs) const { return !(*this == rhs); } bool operator < (const DataHost_get_cv_test_args & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class DataHost_get_cv_test_pargs { public: static const char* ascii_fingerprint; // = "A7D440367E85134EBDBAA7BCA01056D0"; static const uint8_t binary_fingerprint[16]; // = {0xA7,0xD4,0x40,0x36,0x7E,0x85,0x13,0x4E,0xBD,0xBA,0xA7,0xBC,0xA0,0x10,0x56,0xD0}; virtual ~DataHost_get_cv_test_pargs() throw() {} const int8_t* foldIdx; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _DataHost_get_cv_test_result__isset { _DataHost_get_cv_test_result__isset() : success(false) {} bool success; } _DataHost_get_cv_test_result__isset; class DataHost_get_cv_test_result { public: static const char* ascii_fingerprint; // = "9474DE59E738FA6F126A024D54BE68F9"; static const uint8_t binary_fingerprint[16]; // = {0x94,0x74,0xDE,0x59,0xE7,0x38,0xFA,0x6F,0x12,0x6A,0x02,0x4D,0x54,0xBE,0x68,0xF9}; DataHost_get_cv_test_result() { } virtual ~DataHost_get_cv_test_result() throw() {} Dataset success; _DataHost_get_cv_test_result__isset __isset; void __set_success(const Dataset& val) { success = val; } bool operator == (const DataHost_get_cv_test_result & rhs) const { if (!(success == rhs.success)) return false; return true; } bool operator != (const DataHost_get_cv_test_result &rhs) const { return !(*this == rhs); } bool operator < (const DataHost_get_cv_test_result & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _DataHost_get_cv_test_presult__isset { _DataHost_get_cv_test_presult__isset() : success(false) {} bool success; } _DataHost_get_cv_test_presult__isset; class DataHost_get_cv_test_presult { public: static const char* ascii_fingerprint; // = "9474DE59E738FA6F126A024D54BE68F9"; static const uint8_t binary_fingerprint[16]; // = {0x94,0x74,0xDE,0x59,0xE7,0x38,0xFA,0x6F,0x12,0x6A,0x02,0x4D,0x54,0xBE,0x68,0xF9}; virtual ~DataHost_get_cv_test_presult() throw() {} Dataset* success; _DataHost_get_cv_test_presult__isset __isset; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; class DataHostClient : virtual public DataHostIf { public: DataHostClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot); } DataHostClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { setProtocol(iprot,oprot); } private: void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot,prot); } void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { piprot_=iprot; poprot_=oprot; iprot_ = iprot.get(); oprot_ = oprot.get(); } public: boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { return piprot_; } boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } void index_interaction(Response& _return, const std::string& fromId, const int8_t fromType, const std::string& toId, const int8_t toType, const int8_t type, const double val); void send_index_interaction(const std::string& fromId, const int8_t fromType, const std::string& toId, const int8_t toType, const int8_t type, const double val); void recv_index_interaction(Response& _return); void query_entity_interacts(std::map<int8_t, std::vector<Interact> > & _return, const int64_t id); void send_query_entity_interacts(const int64_t id); void recv_query_entity_interacts(std::map<int8_t, std::vector<Interact> > & _return); void query_entity_name(std::string& _return, const int64_t id); void send_query_entity_name(const int64_t id); void recv_query_entity_name(std::string& _return); void query_entity_names(std::vector<std::string> & _return, const std::vector<int64_t> & idList); void send_query_entity_names(const std::vector<int64_t> & idList); void recv_query_entity_names(std::vector<std::string> & _return); int64_t query_entity_id(const std::string& name, const int8_t type); void send_query_entity_id(const std::string& name, const int8_t type); int64_t recv_query_entity_id(); void get_dataset(Dataset& _return, const DSType::type dsType); void send_get_dataset(const DSType::type dsType); void recv_get_dataset(Dataset& _return); void get_cv_train(Dataset& _return, const int8_t foldIdx); void send_get_cv_train(const int8_t foldIdx); void recv_get_cv_train(Dataset& _return); void get_cv_test(Dataset& _return, const int8_t foldIdx); void send_get_cv_test(const int8_t foldIdx); void recv_get_cv_test(Dataset& _return); protected: boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; ::apache::thrift::protocol::TProtocol* iprot_; ::apache::thrift::protocol::TProtocol* oprot_; }; class DataHostProcessor : public ::apache::thrift::TDispatchProcessor { protected: boost::shared_ptr<DataHostIf> iface_; virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext); private: typedef void (DataHostProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); typedef std::map<std::string, ProcessFunction> ProcessMap; ProcessMap processMap_; void process_index_interaction(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_query_entity_interacts(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_query_entity_name(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_query_entity_names(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_query_entity_id(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_get_dataset(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_get_cv_train(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_get_cv_test(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: DataHostProcessor(boost::shared_ptr<DataHostIf> iface) : iface_(iface) { processMap_["index_interaction"] = &DataHostProcessor::process_index_interaction; processMap_["query_entity_interacts"] = &DataHostProcessor::process_query_entity_interacts; processMap_["query_entity_name"] = &DataHostProcessor::process_query_entity_name; processMap_["query_entity_names"] = &DataHostProcessor::process_query_entity_names; processMap_["query_entity_id"] = &DataHostProcessor::process_query_entity_id; processMap_["get_dataset"] = &DataHostProcessor::process_get_dataset; processMap_["get_cv_train"] = &DataHostProcessor::process_get_cv_train; processMap_["get_cv_test"] = &DataHostProcessor::process_get_cv_test; } virtual ~DataHostProcessor() {} }; class DataHostProcessorFactory : public ::apache::thrift::TProcessorFactory { public: DataHostProcessorFactory(const ::boost::shared_ptr< DataHostIfFactory >& handlerFactory) : handlerFactory_(handlerFactory) {} ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); protected: ::boost::shared_ptr< DataHostIfFactory > handlerFactory_; }; class DataHostMultiface : virtual public DataHostIf { public: DataHostMultiface(std::vector<boost::shared_ptr<DataHostIf> >& ifaces) : ifaces_(ifaces) { } virtual ~DataHostMultiface() {} protected: std::vector<boost::shared_ptr<DataHostIf> > ifaces_; DataHostMultiface() {} void add(boost::shared_ptr<DataHostIf> iface) { ifaces_.push_back(iface); } public: void index_interaction(Response& _return, const std::string& fromId, const int8_t fromType, const std::string& toId, const int8_t toType, const int8_t type, const double val) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { ifaces_[i]->index_interaction(_return, fromId, fromType, toId, toType, type, val); } ifaces_[i]->index_interaction(_return, fromId, fromType, toId, toType, type, val); return; } void query_entity_interacts(std::map<int8_t, std::vector<Interact> > & _return, const int64_t id) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { ifaces_[i]->query_entity_interacts(_return, id); } ifaces_[i]->query_entity_interacts(_return, id); return; } void query_entity_name(std::string& _return, const int64_t id) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { ifaces_[i]->query_entity_name(_return, id); } ifaces_[i]->query_entity_name(_return, id); return; } void query_entity_names(std::vector<std::string> & _return, const std::vector<int64_t> & idList) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { ifaces_[i]->query_entity_names(_return, idList); } ifaces_[i]->query_entity_names(_return, idList); return; } int64_t query_entity_id(const std::string& name, const int8_t type) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { ifaces_[i]->query_entity_id(name, type); } return ifaces_[i]->query_entity_id(name, type); } void get_dataset(Dataset& _return, const DSType::type dsType) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { ifaces_[i]->get_dataset(_return, dsType); } ifaces_[i]->get_dataset(_return, dsType); return; } void get_cv_train(Dataset& _return, const int8_t foldIdx) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { ifaces_[i]->get_cv_train(_return, foldIdx); } ifaces_[i]->get_cv_train(_return, foldIdx); return; } void get_cv_test(Dataset& _return, const int8_t foldIdx) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { ifaces_[i]->get_cv_test(_return, foldIdx); } ifaces_[i]->get_cv_test(_return, foldIdx); return; } }; }} // namespace #endif
[ "manazhao@gmail.com" ]
manazhao@gmail.com
921da29a2a172607c235743c27ac90fb0fc46581
b3b965f9ae51dc255af6d16b4f057b2648507830
/source/Level1.cpp
03c9fb811b95f9a0a86e859a1313d607d83a6bd7
[]
no_license
rad-corps/FinalDefense
9fd956575f13202066bd29f49e42a2a31ea97460
a85aeee6c59a989c59c4ad988a5646a06c68f7b9
refs/heads/master
2020-04-06T04:28:58.589028
2015-03-25T10:17:49
2015-03-25T10:17:49
32,300,295
0
0
null
null
null
null
UTF-8
C++
false
false
5,912
cpp
#include "Level1.h" #include "Enemy1.h" #include "Enemy2.h" #include <iostream> Level1::Level1(float * plyrX, float * plyrY) : LevelBase(plyrX, plyrY) { CreateNextWave(); this->plyrX = plyrX; this->plyrY = plyrY; } Level1::~Level1() { } //Just like the drinking game // 1 2 3 4 5 6 7 (in order) //tap, top, tap, bottom, tap, left, tap, right, tap, top bottom, tap, left right, tap, top bottom-left right //8 9 10 //left top right, left bottom right, all directions! WaveInfo Level1::CreateNextWave() { //currentWaveNum [1, MAX_WAVES] or [1, 10] int levelToLoad = currentWaveNum % MAX_WAVES; switch (levelToLoad) { case 1: currentWave = Wave1(); break; case 2: currentWave = Wave2(); break; case 3: currentWave = Wave3(); break; case 4: currentWave = Wave4(); break; case 5: currentWave = Wave5(); break; case 6: currentWave = Wave6(); break; case 7: currentWave = Wave7(); break; case 8: currentWave = Wave8(); break; case 9: currentWave = Wave9(); break; case 10: currentWave = Wave10(); break; default: currentWave = Wave10(); break; } return currentWave; } WaveInfo Level1::Wave1() { const int ENEMY1_COUNT = 1; currentWave = InitialiseWave(); //spawn from top for ( int i = 0; i < ENEMY1_COUNT; ++i ) { CreateEnemy(ENEMY1, TOP, i * spawnInterval); } CreatePowerUp(POWER_UP_FIRE_RATE, TOP, (ENEMY1_COUNT/2) * spawnInterval); return currentWave; } WaveInfo Level1::Wave2() { const int ENEMY1_COUNT = 20; currentWave = InitialiseWave(); //spawn from top for ( int i = 0; i < ENEMY1_COUNT; ++i ) { CreateEnemy(ENEMY1, BOTTOM, i * spawnInterval); } CreateEnemy(ENEMY2, LEFT_OR_RIGHT, ENEMY1_COUNT * (spawnInterval / 2) ); CreatePowerUp(POWER_UP_FIRE_RATE, TOP, (ENEMY1_COUNT/2) * spawnInterval); return currentWave; } WaveInfo Level1::Wave3() { const int ENEMY1_COUNT = 30; const int ENEMY2_COUNT = 2; currentWave = InitialiseWave(); //Do Enemy1 Spawn for ( int i = 0; i < ENEMY1_COUNT; ++i ) { CreateEnemy(ENEMY1, LEFT, i * spawnInterval); } //Do Enemy2 Spawn for ( int i = 0; i < ENEMY2_COUNT; ++i ) { CreateEnemy(ENEMY2, RANDOM_OFF_SCREEN, i * (spawnInterval * 12.f) ); } CreatePowerUp(POWER_UP_FIRE_RATE, TOP, (ENEMY1_COUNT/2) * spawnInterval); return currentWave; } WaveInfo Level1::Wave4() { const int ENEMY1_COUNT = 40; const int ENEMY2_COUNT = 4; currentWave = InitialiseWave(); //Do Enemy1 Spawn for ( int i = 0; i < ENEMY1_COUNT; ++i ) { CreateEnemy(ENEMY1, RIGHT, i * spawnInterval); } //Do Enemy2 Spawn for ( int i = 0; i < ENEMY2_COUNT; ++i ) { CreateEnemy(ENEMY2, LEFT, i * (spawnInterval * 6.f) ); } CreatePowerUp(POWER_UP_FIRE_RATE, TOP, (ENEMY1_COUNT/2) * spawnInterval); return currentWave; } WaveInfo Level1::Wave5() { const int ENEMY1_COUNT = 50; const int ENEMY2_COUNT = 8; currentWave = InitialiseWave(); //Do Enemy1 Spawn for ( int i = 0; i < ENEMY1_COUNT; ++i ) { CreateEnemy(ENEMY1, TOP_OR_BOTTOM, i * spawnInterval); } //Do Enemy2 Spawn for ( int i = 0; i < ENEMY2_COUNT; ++i ) { CreateEnemy(ENEMY2, LEFT_OR_RIGHT, i * (spawnInterval * 3.f) ); } CreatePowerUp(POWER_UP_FIRE_RATE, TOP, (ENEMY1_COUNT/2) * spawnInterval); return currentWave; } WaveInfo Level1::Wave6() { const int ENEMY1_COUNT = 60; const int ENEMY2_COUNT = 10; currentWave = InitialiseWave(); //Do Enemy1 Spawn for ( int i = 0; i < ENEMY1_COUNT; ++i ) { CreateEnemy(ENEMY1, LEFT_OR_RIGHT, i * spawnInterval); } //Do Enemy2 Spawn for ( int i = 0; i < ENEMY2_COUNT; ++i ) { CreateEnemy(ENEMY2, LEFT_OR_RIGHT, i * (ENEMY1_COUNT*0.1f) * spawnInterval ); } CreatePowerUp(POWER_UP_FIRE_RATE, TOP, (ENEMY1_COUNT/2) * spawnInterval); return currentWave; } WaveInfo Level1::Wave7() { const int ENEMY1_COUNT = 70; const int ENEMY2_COUNT = 16; currentWave = InitialiseWave(); //Do Enemy1 Spawn for ( int i = 0; i < ENEMY1_COUNT/2; ++i ) { CreateEnemy(ENEMY1, TOP_OR_BOTTOM, i * spawnInterval); } //Do Enemy1 Spawn for ( int i = ENEMY1_COUNT/2; i < ENEMY1_COUNT; ++i ) { CreateEnemy(ENEMY1, LEFT_OR_RIGHT, i * spawnInterval); } //Do Enemy2 Spawn for ( int i = 0; i < ENEMY2_COUNT; ++i ) { CreateEnemy(ENEMY2, TOP, i * (spawnInterval * 3.f) ); } CreatePowerUp(POWER_UP_FIRE_RATE, TOP, (ENEMY1_COUNT/2) * spawnInterval); return currentWave; } WaveInfo Level1::Wave8() { const int ENEMY1_COUNT = 80; const int ENEMY2_COUNT = 20; currentWave = InitialiseWave(); //Do Enemy1 Spawn for ( int i = 0; i < ENEMY1_COUNT; ++i ) { CreateEnemy(ENEMY1, LEFT_OR_RIGHT, i * spawnInterval); } //Do Enemy2 Spawn for ( int i = 0; i < ENEMY2_COUNT; ++i ) { CreateEnemy(ENEMY2, TOP_OR_BOTTOM, i * (spawnInterval * 3.f) ); } CreatePowerUp(POWER_UP_FIRE_RATE, TOP, 0); return currentWave; } WaveInfo Level1::Wave9() { const int ENEMY1_COUNT = 90; const int ENEMY2_COUNT = 24; currentWave = InitialiseWave(); //Do Enemy1 Spawn for ( int i = 0; i < ENEMY1_COUNT; ++i ) { CreateEnemy(ENEMY1, RANDOM_OFF_SCREEN, i * spawnInterval); } //Do Enemy2 Spawn for ( int i = 0; i < ENEMY2_COUNT; ++i ) { CreateEnemy(ENEMY2, RANDOM_OFF_SCREEN, i * (spawnInterval * 3.f) ); } CreatePowerUp(POWER_UP_FIRE_RATE, TOP, (ENEMY1_COUNT/2) * spawnInterval); return currentWave; } WaveInfo Level1::Wave10() { const int ENEMY1_COUNT = 100; const int ENEMY2_COUNT = 30; currentWave = InitialiseWave(); //Do Enemy1 Spawn for ( int i = 0; i < ENEMY1_COUNT; ++i ) { CreateEnemy(ENEMY1, RANDOM_OFF_SCREEN, i * spawnInterval); } //Do Enemy2 Spawn for ( int i = 0; i < ENEMY2_COUNT; ++i ) { CreateEnemy(ENEMY2, RANDOM_OFF_SCREEN, i * (spawnInterval * 3.f) ); } CreatePowerUp(POWER_UP_FIRE_RATE, TOP, (ENEMY1_COUNT/2) * spawnInterval); return currentWave; }
[ "hulbert.adam@gmail.com" ]
hulbert.adam@gmail.com
86f88f6570bd1483e95e7f86be44e64dce7e823f
c724f0be56a2c45d523d47924b78ba635cb742d9
/lab2/src/fifo-queue.h
bb17ca0b8a56c1a49ade71710dda967e419e2d45
[]
no_license
warejc/CSE274b
9a5a203f8165d0246ca58b9ece9ac58d43de48e9
e826099b98d64d45976d3fd3b0e8490b382c3663
refs/heads/master
2021-01-24T20:02:21.753475
2014-12-05T00:20:21
2014-12-05T00:20:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
736
h
/* * fifo-queue.h * * Created on: Sep 2, 2014 * Author: warejc2 */ #ifndef FIFO_QUEUE_H_ #define FIFO_QUEUE_H_ class FifoQueue { private: char array[50]; public: FifoQueue(); bool Enqueue(char item); char Dequeue(); }; FifoQueue::FifoQueue(){ //Complexity is o^n for(int i = 0; i < sizeof(array); i++){ array[i] = 0; } } bool FifoQueue::Enqueue(char item){ for(int i = 0; i < sizeof(array); i++){ if(array[i] == 0){ array[i] = item; return true; } } return false; } char FifoQueue::Dequeue(){ char result = array[0]; for(int i = 0; i < sizeof(array) - 1; i++){ array[i] = array[i+1]; } array[sizeof(array)-1] = 0; return result; } #endif /* FIFO_QUEUE_H_ */
[ "jcware8@gmail.com" ]
jcware8@gmail.com
c6ac300b2cffad3e6e1ed5103589dd3ff8a625d1
df6ddd4c08f8714f018cfa4b151e914284add7cb
/zipf.cpp
7e0e73db951c3b1bd63548311fc69c7c9b34ebdd
[]
no_license
Yuya-Nakata/Zipf_make
08bf7d829b41e14f5241ab8cc6b3f88f8a41cfcc
fe32fc6b03bb01d7443523f7a1dae19a9d78758f
refs/heads/master
2020-04-29T21:53:22.239017
2019-04-17T02:17:05
2019-04-17T02:17:05
176,428,425
0
0
null
null
null
null
UTF-8
C++
false
false
1,165
cpp
/* zip.h created on: 2019/2/1 Author Yuya Nakata */ #include <iostream> #include <vector> #include<cmath> using namespace std; int main(){ double alpha = 0.7; double numerator = 0; int Ncontnets = 100; //int trycount = 10000; //試行回数 // vector <int> A(100); /// for(int i=0; i<100; i++){ // A[i]=0; // } int number; //もし関数にするのであれば返り値にもちいる for(int i=1; i<=Ncontents; i++){ numerator += 1/(pow(i,alpha)); } // for(int i=0; i<trycount; i++){ bool finish =true; while(finish == true){ for(int j=1; j<=Ncontents; j++){ double R; R=(double)(rand()) /RAND_MAX; //0~1のランダムな値を生成 double zz; zz=(1/(pow(j,alpha)) ) / numerator; R=R-zz; if(R < 0){ number = j-1; finish = false; // A[j-1] +=1; break; } if(j == Ncontents) number = j-1; } } //} //zipf則の基づいた数値生成になっているか確認 //for(int i=0; i<100; i++){ //cout<<i<<"が生成された回数は" << A[i] << endl; //} // getchar(); return 0; //関数でつかうなら return number; }
[ "noreply@github.com" ]
noreply@github.com
29c9388b4891fd932fb46f02d09673e3905e61a2
ff6ee3069abb0a04410c4c625bc47d85ca5a7b12
/CL15/CL15.cpp
0c8a89451c35e6457d1f9afe6a075c6bce6e371b
[]
no_license
bsnow3/CS200
8f900a798c86ccce7ae3b6ffa6f890e65d7932be
a7b9ec9bfc1fd74d5ed8894e69278b71c28039f8
refs/heads/master
2021-01-11T18:10:40.467184
2017-04-28T01:17:07
2017-04-28T01:17:07
79,510,476
0
0
null
null
null
null
UTF-8
C++
false
false
3,110
cpp
#include <iostream> #include <fstream> #include <string> using namespace std; class Room { private : string m_title; int m_width; int m_length; public : int GetWidth() { return m_width; } int GetLength() { return m_length; } int GetArea() { return m_length * m_width; } string GetTitle() { return m_title; } void SetTitle(string newTitle) { m_title = newTitle; } void SetDimensions(int newWidth, int newLength) { if (newWidth <= 0) { } else { m_width = newWidth; } if (newLength <= 0) { } else { m_length = newLength; } } }; class Building { private : Room* m_rooms; int m_roomCount = 0; public : Building(int roomCount) { m_rooms = nullptr; if (roomCount > 0) { m_roomCount = roomCount; m_rooms = new Room[roomCount]; } } ~Building() { if (m_rooms != nullptr) { delete m_rooms; } } void SetRoomTitle(int room, string title) { if (m_roomCount > room && room >= 0) { m_rooms[room].SetTitle(title); } } void SetRoomDimensions(int room, int newWidth, int newLength) { if (m_roomCount > room && room >= 0) { m_rooms[room].SetDimensions(newWidth, newLength); } } int GetTotalArea() { int sum = 0; int i = 0; while (i < m_roomCount) { sum = sum + m_rooms[i].GetArea(); i++; } return sum; } void PrintBuildingInformation(string filename) { ofstream output(filename); output << "BUILDING Dimensions: " << GetTotalArea() << " sqft" << endl << endl; for (int i = 0; i < m_roomCount; i++) { output << endl << "ROOM " << (i + 1) << " (" << m_rooms[i].GetTitle() << "):" << "\n\t * Dimensions: " << m_rooms[i].GetWidth() << " x " << m_rooms[i].GetLength() << "\n\t * Area: " << m_rooms[i].GetArea() << " sqft" << endl; } output.close(); } }; void RoomProgram() { // This function works with the Room object Room room; room.SetDimensions( 5, 4 ); cout << "Room area is: " << room.GetArea() << endl; room.SetTitle( "closet" ); cout << "Room name is: " << room.GetTitle() << endl; } void BuildingProgram() { // This function works with the Building object Building building( 5 ); building.SetRoomTitle( 0, "Entryway" ); building.SetRoomTitle( 1, "Living Room" ); building.SetRoomTitle( 2, "Kitchen" ); building.SetRoomTitle( 3, "Bedroom" ); building.SetRoomTitle( 4, "Bathroom" ); building.SetRoomDimensions( 0, 5, 10 ); building.SetRoomDimensions( 1, 5, 10 ); building.SetRoomDimensions( 2, 5, 10 ); building.SetRoomDimensions( 3, 5, 10 ); building.SetRoomDimensions( 4, 5, 10 ); building.PrintBuildingInformation( "building.txt" ); } int main() { RoomProgram(); BuildingProgram(); return 0; } /* BUILDING Dimensions: 250 sqft ROOM 1 (Entryway): * Dimensions: 5 x 10 * Area: 50 sqft ROOM 2 (Living Room): * Dimensions: 5 x 10 * Area: 50 sqft ROOM 3 (Kitchen): * Dimensions: 5 x 10 * Area: 50 sqft ROOM 4 (Bedroom): * Dimensions: 5 x 10 * Area: 50 sqft ROOM 5 (Bathroom): * Dimensions: 5 x 10 * Area: 50 sqft */
[ "noreply@github.com" ]
noreply@github.com
9fdda35c9416c75dd139581ae9f7462584fa4f38
9e8dd3691b77b3739f670f1cbf5df887a54d96f6
/Plataforma.cpp
158353f47cb8b5722e56da2c501d5915f0e984e2
[]
no_license
antoniorv6/JoustGame
d8ef0be7767f80fae8cdb1577dd501ce40703cbd
3b8a43b416bc2158695aafac9d028af6f93da759
refs/heads/master
2020-03-09T10:36:10.519155
2018-04-13T08:47:18
2018-04-13T08:47:18
128,740,810
1
0
null
null
null
null
UTF-8
C++
false
false
3,954
cpp
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: Plataforma.cpp * Author: antonio * * Created on 16 de febrero de 2018, 17:12 */ #include "Plataforma.hpp" namespace Anto { Plataforma::Plataforma(EstructuraJuegoData datos): _datos(datos) { sf::Sprite _principal(_datos->g_assets.GetTextura("Plataformas")); sf::Sprite _plana(_datos->g_assets.GetTextura("Plataforma_lisa")); _principal.setTextureRect(sf::IntRect(38, 157, 149, 30)); _principal.setPosition(_datos->ventana.getSize().x/2 - _principal.getGlobalBounds().width/10, _datos->ventana.getSize().y - _principal.getGlobalBounds().height ); _principal.setOrigin(_principal.getGlobalBounds().width/2, _principal.getGlobalBounds().height/2); _principal.scale(3,3); _platformSprites.push_back(_principal); sf::Sprite _1 = _principal; _1.setTextureRect(sf::IntRect(64, 40, 70, 9)); _1.setOrigin(_1.getGlobalBounds().width/2, _1.getGlobalBounds().height/2); _1.setPosition(800, 250); _1.scale(1.2,1.2); _platformSprites.push_back(_1); sf::Sprite _2 = _principal; _2.setTextureRect(sf::IntRect(80, 114, 51, 7)); _2.setOrigin(_2.getGlobalBounds().width/2, _2.getGlobalBounds().height/2); _2.setPosition(890, 500); _2.scale(1.2,1.2); _platformSprites.push_back(_2); sf::Sprite _3 = _principal; _3.setTextureRect(sf::IntRect(0, 91, 48, 7)); _3.setOrigin(_3.getGlobalBounds().width/2, _3.getGlobalBounds().height/2); _3.setPosition(_3.getGlobalBounds().width+115, 450); _3.scale(1.2,1.2); _platformSprites.push_back(_3); sf::Sprite _4 = _principal; _4.setTextureRect(sf::IntRect(197, 29, 37, 6)); _4.setOrigin(_4.getGlobalBounds().width/2, _4.getGlobalBounds().height/2); _4.scale(1.2,1.2); _4.setPosition(1395, 150); _platformSprites.push_back(_4); sf::Sprite _5 = _principal; _5.setTextureRect(sf::IntRect(0, 29, 23, 6)); _5.setOrigin(_5.getGlobalBounds().width/2, _5.getGlobalBounds().height/2); _5.scale(1.2,1.2); _5.setPosition(125, 160); _platformSprites.push_back(_5); sf::Sprite _6 = _principal; _6.setTextureRect(sf::IntRect(200, 91, 34, 6)); _6.setOrigin(_6.getGlobalBounds().width/2, _5.getGlobalBounds().height/2); _6.scale(1.2,1.2); _6.setPosition(1350, 450); _platformSprites.push_back(_6); sf::Sprite _7 = _principal; _7.setTextureRect(sf::IntRect(157, 83, 50, 8)); _7.setOrigin(_7.getGlobalBounds().width/2, _5.getGlobalBounds().height/2); _7.scale(1.2,1.2); _7.setPosition(1200, 400); _platformSprites.push_back(_7); _plana.setOrigin(_plana.getGlobalBounds().width/2, _plana.getGlobalBounds().height/2); _plana.setPosition(209, 649); _plana.scale(-2.5,2); _platformSprites.push_back(_plana); sf::Sprite _plana2 = _plana; _plana2.setPosition(1050, 649); _plana2.scale(-1,1); _platformSprites.push_back(_plana2); } void Plataforma::Draw() { for(int i=0; i<_platformSprites.size(); i++) { _datos->ventana.draw(_platformSprites.at(i)); } } const std::vector<sf::Sprite> &Plataforma::GetSprite() const { return _platformSprites; } }
[ "antoniorv6@gmail.com" ]
antoniorv6@gmail.com
0d0ade11442b9a35b5eac43ece72ac5788fbfc50
d1fdf0102b11ea19c06e482b07b093d6c28e01b6
/orbit/master_server/slavedata_collector.cc
97c96cad1f01e0c1a06c4d221a0564ab425e7453
[]
no_license
romange/StreamOperation
ef1af6a12b3ed035476e8c6234af235103e21918
7c9baf3f06255708bc20506123efa75edb0f46c0
refs/heads/master
2021-05-03T05:55:42.169016
2017-07-09T16:01:36
2017-07-09T16:01:36
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,617
cc
/* * Copyright (C) 2016 Orangelab Inc. All Rights Reserved. * Author: zhihan@orangelab.cn (Zhihan He) * * slavedata_collector.cc * --------------------------------------------------------------------------- * Defines the exporte_var for the variables exported to /varz handler. * --------------------------------------------------------------------------- */ #include "slavedata_collector.h" // For Gflags and Glog #include "gflags/gflags.h" #include "glog/logging.h" #include "leveldb/db.h" DEFINE_string(slave_data_db_path, "/tmp/slavedatadb", "save slave data folder path"); namespace orbit { SlaveDataCollector::SlaveDataCollector() { leveldb::Options options; options.create_if_missing = true; //options.create_if_missing = false; leveldb::Status status; status = leveldb::DB::Open(options, FLAGS_slave_data_db_path, &db_); if(!status.ok()) { LOG(ERROR) << "Open levelDB failed"; db_ = NULL; } } SlaveDataCollector::~SlaveDataCollector() { if (db_ != NULL) { delete db_; db_ = NULL; } } bool SlaveDataCollector::Add(string key, health::HealthStatus stat) { // Like ip:port_time (192.168.1.126:10001_1465033376) VLOG(2) << "save to level db key:" << key << ";"; //LOG(INFO) << "save to level db value:" << stat.jsonData(); if(db_ == NULL) { LOG(ERROR) << "save slave data error at " << key << " failed;db is null"; return false; } string buffer; stat.SerializeToString(&buffer); leveldb::Status status = db_->Put(leveldb::WriteOptions(), key, buffer); if(!status.ok()) { LOG(ERROR) << "save slave data error at " << key << " failed when save data"; return false; } return true; } std::vector<health::HealthStatus> SlaveDataCollector::Find(std::string start,std::string limit) { vector<health::HealthStatus> return_vector; if(db_ == NULL) { LOG(ERROR) << "search error;db is NULL"; return return_vector; } leveldb::Iterator* it = db_->NewIterator(leveldb::ReadOptions()); // string start = "192.168.1.126:10001_1465033376"; // string limit = "192.168.1.126:10001_1465033400"; for (it->Seek(start); it->Valid() && it->key().ToString() <= limit; it->Next()) { //LOG(INFO) << "find data:" << it->key().ToString() << " : " << it->value().ToString(); health::HealthStatus health_status; health_status.ParseFromString(it->value().ToString()); return_vector.push_back(health_status); } if(it->status().ok()) { delete it; } return return_vector; } }
[ "jluluqu@163.com" ]
jluluqu@163.com
486b0043447597440d90781e7656cba41da74cf5
fea08e89058a927d341447a28bf716ef05db4038
/libraries/I2CKeyPad/I2CKeyPad.h
9aa22683eca5fc43af539859ce52e560012037a9
[ "MIT" ]
permissive
hendog993/Arduino
774e48deab0fb3e417613a2d3b9953043c68a8e3
0ebb451644154fbe63b42c32f933a9ba2a476283
refs/heads/master
2022-11-11T02:49:39.998758
2022-11-07T14:28:23
2022-11-07T14:28:23
169,162,653
0
0
MIT
2019-02-04T22:54:56
2019-02-04T22:54:56
null
UTF-8
C++
false
false
1,466
h
#pragma once // // FILE: I2CKeyPad.h // AUTHOR: Rob Tillaart // VERSION: 0.3.2 // PURPOSE: Arduino library for 4x4 KeyPad connected to an I2C PCF8574 // URL: https://github.com/RobTillaart/I2CKeyPad #include "Arduino.h" #include "Wire.h" #define I2C_KEYPAD_LIB_VERSION (F("0.3.2")) #define I2C_KEYPAD_NOKEY 16 #define I2C_KEYPAD_FAIL 17 // experimental #define I2C_KEYPAD_4x4 44 #define I2C_KEYPAD_5x3 53 #define I2C_KEYPAD_6x2 62 #define I2C_KEYPAD_8x1 81 class I2CKeyPad { public: I2CKeyPad(const uint8_t deviceAddress, TwoWire *wire = &Wire); #if defined(ESP8266) || defined(ESP32) bool begin(uint8_t sda, uint8_t scl); #endif bool begin(); // get raw key's 0..15 uint8_t getKey(); uint8_t getLastKey(); bool isPressed(); bool isConnected(); // get 'translated' keys // user must load KeyMap, there is no check. uint8_t getChar(); uint8_t getLastChar(); void loadKeyMap(char * keyMap); // char[19] // mode functions - experimental void setKeyPadMode(uint8_t mode = I2C_KEYPAD_4x4); uint8_t getKeyPadMode(); protected: uint8_t _address; uint8_t _lastKey; uint8_t _mode; uint8_t _read(uint8_t mask); uint8_t _getKey4x4(); // experimental - could be public ?! uint8_t _getKey5x3(); uint8_t _getKey6x2(); uint8_t _getKey8x1(); TwoWire* _wire; char * _keyMap = NULL; }; // -- END OF FILE --
[ "rob.tillaart@gmail.com" ]
rob.tillaart@gmail.com
f1b81a0bdc78b502db708c05dce11a422ad5aec6
ee9d6a53eb2f4f506f02b553cf397e0570a37540
/src/wallet/rpcdump.cpp
7fc8c3463bde1de31e7812e4df0efddfae3c8bf3
[ "MIT" ]
permissive
adcoin-project/AdCoin-old
399f7091810defd742f0370435dea60a559feefe
ab202457b17ec7014e0afc862edfc3f6da88fb67
refs/heads/master
2021-09-26T11:02:02.943144
2018-10-29T20:04:13
2018-10-29T20:04:13
97,236,000
3
0
MIT
2019-02-18T00:09:45
2017-07-14T13:21:52
C++
UTF-8
C++
false
false
45,951
cpp
// Copyright (c) 2009-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "base58.h" #include "chain.h" #include "rpc/server.h" #include "init.h" #include "validation.h" #include "script/script.h" #include "script/standard.h" #include "sync.h" #include "util.h" #include "utiltime.h" #include "wallet.h" #include "merkleblock.h" #include "core_io.h" #include <fstream> #include <stdint.h> #include <boost/algorithm/string.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <univalue.h> #include <boost/assign/list_of.hpp> #include <boost/foreach.hpp> using namespace std; void EnsureWalletIsUnlocked(); bool EnsureWalletIsAvailable(bool avoidException); std::string static EncodeDumpTime(int64_t nTime) { return DateTimeStrFormat("%Y-%m-%dT%H:%M:%SZ", nTime); } int64_t static DecodeDumpTime(const std::string &str) { static const boost::posix_time::ptime epoch = boost::posix_time::from_time_t(0); static const std::locale loc(std::locale::classic(), new boost::posix_time::time_input_facet("%Y-%m-%dT%H:%M:%SZ")); std::istringstream iss(str); iss.imbue(loc); boost::posix_time::ptime ptime(boost::date_time::not_a_date_time); iss >> ptime; if (ptime.is_not_a_date_time()) return 0; return (ptime - epoch).total_seconds(); } std::string static EncodeDumpString(const std::string &str) { std::stringstream ret; BOOST_FOREACH(unsigned char c, str) { if (c <= 32 || c >= 128 || c == '%') { ret << '%' << HexStr(&c, &c + 1); } else { ret << c; } } return ret.str(); } std::string DecodeDumpString(const std::string &str) { std::stringstream ret; for (unsigned int pos = 0; pos < str.length(); pos++) { unsigned char c = str[pos]; if (c == '%' && pos+2 < str.length()) { c = (((str[pos+1]>>6)*9+((str[pos+1]-'0')&15)) << 4) | ((str[pos+2]>>6)*9+((str[pos+2]-'0')&15)); pos += 2; } ret << c; } return ret.str(); } UniValue importprivkey(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() < 1 || request.params.size() > 3) throw runtime_error( "importprivkey \"adcoinprivkey\" ( \"label\" ) ( rescan )\n" "\nAdds a private key (as returned by dumpprivkey) to your wallet.\n" "\nArguments:\n" "1. \"adcoinprivkey\" (string, required) The private key (see dumpprivkey)\n" "2. \"label\" (string, optional, default=\"\") An optional label\n" "3. rescan (boolean, optional, default=true) Rescan the wallet for transactions\n" "\nNote: This call can take minutes to complete if rescan is true.\n" "\nExamples:\n" "\nDump a private key\n" + HelpExampleCli("dumpprivkey", "\"myaddress\"") + "\nImport the private key with rescan\n" + HelpExampleCli("importprivkey", "\"mykey\"") + "\nImport using a label and without rescan\n" + HelpExampleCli("importprivkey", "\"mykey\" \"testing\" false") + "\nImport using default blank label and without rescan\n" + HelpExampleCli("importprivkey", "\"mykey\" \"\" false") + "\nAs a JSON-RPC call\n" + HelpExampleRpc("importprivkey", "\"mykey\", \"testing\", false") ); LOCK2(cs_main, pwalletMain->cs_wallet); EnsureWalletIsUnlocked(); string strSecret = request.params[0].get_str(); string strLabel = ""; if (request.params.size() > 1) strLabel = request.params[1].get_str(); // Whether to perform rescan after import bool fRescan = true; if (request.params.size() > 2) fRescan = request.params[2].get_bool(); if (fRescan && fPruneMode) throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode"); CBitcoinSecret vchSecret; bool fGood = vchSecret.SetString(strSecret); if (!fGood) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key encoding"); CKey key = vchSecret.GetKey(); if (!key.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Private key outside allowed range"); CPubKey pubkey = key.GetPubKey(); assert(key.VerifyPubKey(pubkey)); CKeyID vchAddress = pubkey.GetID(); { pwalletMain->MarkDirty(); pwalletMain->SetAddressBook(vchAddress, strLabel, "receive"); // Don't throw error in case a key is already there if (pwalletMain->HaveKey(vchAddress)) return NullUniValue; pwalletMain->mapKeyMetadata[vchAddress].nCreateTime = 1; if (!pwalletMain->AddKeyPubKey(key, pubkey)) throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet"); // whenever a key is imported, we need to scan the whole chain pwalletMain->UpdateTimeFirstKey(1); if (fRescan) { pwalletMain->ScanForWalletTransactions(chainActive.Genesis(), true); } } return NullUniValue; } void ImportAddress(const CBitcoinAddress& address, const string& strLabel); void ImportScript(const CScript& script, const string& strLabel, bool isRedeemScript) { if (!isRedeemScript && ::IsMine(*pwalletMain, script) == ISMINE_SPENDABLE) throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the private key for this address or script"); pwalletMain->MarkDirty(); if (!pwalletMain->HaveWatchOnly(script) && !pwalletMain->AddWatchOnly(script, 0 /* nCreateTime */)) throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet"); if (isRedeemScript) { if (!pwalletMain->HaveCScript(script) && !pwalletMain->AddCScript(script)) throw JSONRPCError(RPC_WALLET_ERROR, "Error adding p2sh redeemScript to wallet"); ImportAddress(CBitcoinAddress(CScriptID(script)), strLabel); } else { CTxDestination destination; if (ExtractDestination(script, destination)) { pwalletMain->SetAddressBook(destination, strLabel, "receive"); } } } void ImportAddress(const CBitcoinAddress& address, const string& strLabel) { CScript script = GetScriptForDestination(address.Get()); ImportScript(script, strLabel, false); // add to address book or update label if (address.IsValid()) pwalletMain->SetAddressBook(address.Get(), strLabel, "receive"); } UniValue importaddress(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() < 1 || request.params.size() > 4) throw runtime_error( "importaddress \"address\" ( \"label\" rescan p2sh )\n" "\nAdds a script (in hex) or address that can be watched as if it were in your wallet but cannot be used to spend.\n" "\nArguments:\n" "1. \"script\" (string, required) The hex-encoded script (or address)\n" "2. \"label\" (string, optional, default=\"\") An optional label\n" "3. rescan (boolean, optional, default=true) Rescan the wallet for transactions\n" "4. p2sh (boolean, optional, default=false) Add the P2SH version of the script as well\n" "\nNote: This call can take minutes to complete if rescan is true.\n" "If you have the full public key, you should call importpubkey instead of this.\n" "\nNote: If you import a non-standard raw script in hex form, outputs sending to it will be treated\n" "as change, and not show up in many RPCs.\n" "\nExamples:\n" "\nImport a script with rescan\n" + HelpExampleCli("importaddress", "\"myscript\"") + "\nImport using a label without rescan\n" + HelpExampleCli("importaddress", "\"myscript\" \"testing\" false") + "\nAs a JSON-RPC call\n" + HelpExampleRpc("importaddress", "\"myscript\", \"testing\", false") ); string strLabel = ""; if (request.params.size() > 1) strLabel = request.params[1].get_str(); // Whether to perform rescan after import bool fRescan = true; if (request.params.size() > 2) fRescan = request.params[2].get_bool(); if (fRescan && fPruneMode) throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode"); // Whether to import a p2sh version, too bool fP2SH = false; if (request.params.size() > 3) fP2SH = request.params[3].get_bool(); LOCK2(cs_main, pwalletMain->cs_wallet); CBitcoinAddress address(request.params[0].get_str()); if (address.IsValid()) { if (fP2SH) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Cannot use the p2sh flag with an address - use a script instead"); ImportAddress(address, strLabel); } else if (IsHex(request.params[0].get_str())) { std::vector<unsigned char> data(ParseHex(request.params[0].get_str())); ImportScript(CScript(data.begin(), data.end()), strLabel, fP2SH); } else { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid AdCoin address or script"); } if (fRescan) { pwalletMain->ScanForWalletTransactions(chainActive.Genesis(), true); pwalletMain->ReacceptWalletTransactions(); } return NullUniValue; } UniValue importprunedfunds(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() != 2) throw runtime_error( "importprunedfunds\n" "\nImports funds without rescan. Corresponding address or script must previously be included in wallet. Aimed towards pruned wallets. The end-user is responsible to import additional transactions that subsequently spend the imported outputs or rescan after the point in the blockchain the transaction is included.\n" "\nArguments:\n" "1. \"rawtransaction\" (string, required) A raw transaction in hex funding an already-existing address in wallet\n" "2. \"txoutproof\" (string, required) The hex output from gettxoutproof that contains the transaction\n" ); CMutableTransaction tx; if (!DecodeHexTx(tx, request.params[0].get_str())) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); uint256 hashTx = tx.GetHash(); CWalletTx wtx(pwalletMain, MakeTransactionRef(std::move(tx))); CDataStream ssMB(ParseHexV(request.params[1], "proof"), SER_NETWORK, PROTOCOL_VERSION); CMerkleBlock merkleBlock; ssMB >> merkleBlock; //Search partial merkle tree in proof for our transaction and index in valid block vector<uint256> vMatch; vector<unsigned int> vIndex; unsigned int txnIndex = 0; if (merkleBlock.txn.ExtractMatches(vMatch, vIndex) == merkleBlock.header.hashMerkleRoot) { LOCK(cs_main); if (!mapBlockIndex.count(merkleBlock.header.GetHash()) || !chainActive.Contains(mapBlockIndex[merkleBlock.header.GetHash()])) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found in chain"); vector<uint256>::const_iterator it; if ((it = std::find(vMatch.begin(), vMatch.end(), hashTx))==vMatch.end()) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction given doesn't exist in proof"); } txnIndex = vIndex[it - vMatch.begin()]; } else { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Something wrong with merkleblock"); } wtx.nIndex = txnIndex; wtx.hashBlock = merkleBlock.header.GetHash(); LOCK2(cs_main, pwalletMain->cs_wallet); if (pwalletMain->IsMine(wtx)) { pwalletMain->AddToWallet(wtx, false); return NullUniValue; } throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "No addresses in wallet correspond to included transaction"); } UniValue removeprunedfunds(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() != 1) throw runtime_error( "removeprunedfunds \"txid\"\n" "\nDeletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will effect wallet balances.\n" "\nArguments:\n" "1. \"txid\" (string, required) The hex-encoded id of the transaction you are deleting\n" "\nExamples:\n" + HelpExampleCli("removeprunedfunds", "\"c54357a1ff9f4e792198e75c01fc633acc6d093abd67ec1849596637c3457bf2\"") + "\nAs a JSON-RPC call\n" + HelpExampleRpc("removprunedfunds", "\"c54357a1ff9f4e792198e75c01fc633acc6d093abd67ec1849596637c3457bf2\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); uint256 hash; hash.SetHex(request.params[0].get_str()); vector<uint256> vHash; vHash.push_back(hash); vector<uint256> vHashOut; if(pwalletMain->ZapSelectTx(vHash, vHashOut) != DB_LOAD_OK) { throw JSONRPCError(RPC_INTERNAL_ERROR, "Could not properly delete the transaction."); } if(vHashOut.empty()) { throw JSONRPCError(RPC_INTERNAL_ERROR, "Transaction does not exist in wallet."); } return NullUniValue; } UniValue importpubkey(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() < 1 || request.params.size() > 4) throw runtime_error( "importpubkey \"pubkey\" ( \"label\" rescan )\n" "\nAdds a public key (in hex) that can be watched as if it were in your wallet but cannot be used to spend.\n" "\nArguments:\n" "1. \"pubkey\" (string, required) The hex-encoded public key\n" "2. \"label\" (string, optional, default=\"\") An optional label\n" "3. rescan (boolean, optional, default=true) Rescan the wallet for transactions\n" "\nNote: This call can take minutes to complete if rescan is true.\n" "\nExamples:\n" "\nImport a public key with rescan\n" + HelpExampleCli("importpubkey", "\"mypubkey\"") + "\nImport using a label without rescan\n" + HelpExampleCli("importpubkey", "\"mypubkey\" \"testing\" false") + "\nAs a JSON-RPC call\n" + HelpExampleRpc("importpubkey", "\"mypubkey\", \"testing\", false") ); string strLabel = ""; if (request.params.size() > 1) strLabel = request.params[1].get_str(); // Whether to perform rescan after import bool fRescan = true; if (request.params.size() > 2) fRescan = request.params[2].get_bool(); if (fRescan && fPruneMode) throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode"); if (!IsHex(request.params[0].get_str())) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pubkey must be a hex string"); std::vector<unsigned char> data(ParseHex(request.params[0].get_str())); CPubKey pubKey(data.begin(), data.end()); if (!pubKey.IsFullyValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pubkey is not a valid public key"); LOCK2(cs_main, pwalletMain->cs_wallet); ImportAddress(CBitcoinAddress(pubKey.GetID()), strLabel); ImportScript(GetScriptForRawPubKey(pubKey), strLabel, false); if (fRescan) { pwalletMain->ScanForWalletTransactions(chainActive.Genesis(), true); pwalletMain->ReacceptWalletTransactions(); } return NullUniValue; } UniValue importwallet(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() != 1) throw runtime_error( "importwallet \"filename\"\n" "\nImports keys from a wallet dump file (see dumpwallet).\n" "\nArguments:\n" "1. \"filename\" (string, required) The wallet file\n" "\nExamples:\n" "\nDump the wallet\n" + HelpExampleCli("dumpwallet", "\"test\"") + "\nImport the wallet\n" + HelpExampleCli("importwallet", "\"test\"") + "\nImport using the json rpc call\n" + HelpExampleRpc("importwallet", "\"test\"") ); if (fPruneMode) throw JSONRPCError(RPC_WALLET_ERROR, "Importing wallets is disabled in pruned mode"); LOCK2(cs_main, pwalletMain->cs_wallet); EnsureWalletIsUnlocked(); ifstream file; file.open(request.params[0].get_str().c_str(), std::ios::in | std::ios::ate); if (!file.is_open()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot open wallet dump file"); int64_t nTimeBegin = chainActive.Tip()->GetBlockTime(); bool fGood = true; int64_t nFilesize = std::max((int64_t)1, (int64_t)file.tellg()); file.seekg(0, file.beg); pwalletMain->ShowProgress(_("Importing..."), 0); // show progress dialog in GUI while (file.good()) { pwalletMain->ShowProgress("", std::max(1, std::min(99, (int)(((double)file.tellg() / (double)nFilesize) * 100)))); std::string line; std::getline(file, line); if (line.empty() || line[0] == '#') continue; std::vector<std::string> vstr; boost::split(vstr, line, boost::is_any_of(" ")); if (vstr.size() < 2) continue; CBitcoinSecret vchSecret; if (!vchSecret.SetString(vstr[0])) continue; CKey key = vchSecret.GetKey(); CPubKey pubkey = key.GetPubKey(); assert(key.VerifyPubKey(pubkey)); CKeyID keyid = pubkey.GetID(); if (pwalletMain->HaveKey(keyid)) { LogPrintf("Skipping import of %s (key already present)\n", CBitcoinAddress(keyid).ToString()); continue; } int64_t nTime = DecodeDumpTime(vstr[1]); std::string strLabel; bool fLabel = true; for (unsigned int nStr = 2; nStr < vstr.size(); nStr++) { if (boost::algorithm::starts_with(vstr[nStr], "#")) break; if (vstr[nStr] == "change=1") fLabel = false; if (vstr[nStr] == "reserve=1") fLabel = false; if (boost::algorithm::starts_with(vstr[nStr], "label=")) { strLabel = DecodeDumpString(vstr[nStr].substr(6)); fLabel = true; } } LogPrintf("Importing %s...\n", CBitcoinAddress(keyid).ToString()); if (!pwalletMain->AddKeyPubKey(key, pubkey)) { fGood = false; continue; } pwalletMain->mapKeyMetadata[keyid].nCreateTime = nTime; if (fLabel) pwalletMain->SetAddressBook(keyid, strLabel, "receive"); nTimeBegin = std::min(nTimeBegin, nTime); } file.close(); pwalletMain->ShowProgress("", 100); // hide progress dialog in GUI pwalletMain->UpdateTimeFirstKey(nTimeBegin); CBlockIndex *pindex = chainActive.FindEarliestAtLeast(nTimeBegin - 7200); LogPrintf("Rescanning last %i blocks\n", pindex ? chainActive.Height() - pindex->nHeight + 1 : 0); pwalletMain->ScanForWalletTransactions(pindex); pwalletMain->MarkDirty(); if (!fGood) throw JSONRPCError(RPC_WALLET_ERROR, "Error adding some keys to wallet"); return NullUniValue; } UniValue dumpprivkey(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() != 1) throw runtime_error( "dumpprivkey \"address\"\n" "\nReveals the private key corresponding to 'address'.\n" "Then the importprivkey can be used with this output\n" "\nArguments:\n" "1. \"address\" (string, required) The adcoin address for the private key\n" "\nResult:\n" "\"key\" (string) The private key\n" "\nExamples:\n" + HelpExampleCli("dumpprivkey", "\"myaddress\"") + HelpExampleCli("importprivkey", "\"mykey\"") + HelpExampleRpc("dumpprivkey", "\"myaddress\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); EnsureWalletIsUnlocked(); string strAddress = request.params[0].get_str(); CBitcoinAddress address; if (!address.SetString(strAddress)) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid AdCoin address"); CKeyID keyID; if (!address.GetKeyID(keyID)) throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to a key"); CKey vchSecret; if (!pwalletMain->GetKey(keyID, vchSecret)) throw JSONRPCError(RPC_WALLET_ERROR, "Private key for address " + strAddress + " is not known"); return CBitcoinSecret(vchSecret).ToString(); } UniValue dumpwallet(const JSONRPCRequest& request) { if (!EnsureWalletIsAvailable(request.fHelp)) return NullUniValue; if (request.fHelp || request.params.size() != 1) throw runtime_error( "dumpwallet \"filename\"\n" "\nDumps all wallet keys in a human-readable format.\n" "\nArguments:\n" "1. \"filename\" (string, required) The filename\n" "\nExamples:\n" + HelpExampleCli("dumpwallet", "\"test\"") + HelpExampleRpc("dumpwallet", "\"test\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); EnsureWalletIsUnlocked(); ofstream file; file.open(request.params[0].get_str().c_str()); if (!file.is_open()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot open wallet dump file"); std::map<CTxDestination, int64_t> mapKeyBirth; std::set<CKeyID> setKeyPool; pwalletMain->GetKeyBirthTimes(mapKeyBirth); pwalletMain->GetAllReserveKeys(setKeyPool); // sort time/key pairs std::vector<std::pair<int64_t, CKeyID> > vKeyBirth; for (const auto& entry : mapKeyBirth) { if (const CKeyID* keyID = boost::get<CKeyID>(&entry.first)) { // set and test vKeyBirth.push_back(std::make_pair(entry.second, *keyID)); } } mapKeyBirth.clear(); std::sort(vKeyBirth.begin(), vKeyBirth.end()); // produce output file << strprintf("# Wallet dump created by AdCoin %s\n", CLIENT_BUILD); file << strprintf("# * Created on %s\n", EncodeDumpTime(GetTime())); file << strprintf("# * Best block at time of backup was %i (%s),\n", chainActive.Height(), chainActive.Tip()->GetBlockHash().ToString()); file << strprintf("# mined on %s\n", EncodeDumpTime(chainActive.Tip()->GetBlockTime())); file << "\n"; // add the base58check encoded extended master if the wallet uses HD CKeyID masterKeyID = pwalletMain->GetHDChain().masterKeyID; if (!masterKeyID.IsNull()) { CKey key; if (pwalletMain->GetKey(masterKeyID, key)) { CExtKey masterKey; masterKey.SetMaster(key.begin(), key.size()); CBitcoinExtKey b58extkey; b58extkey.SetKey(masterKey); file << "# extended private masterkey: " << b58extkey.ToString() << "\n\n"; } } for (std::vector<std::pair<int64_t, CKeyID> >::const_iterator it = vKeyBirth.begin(); it != vKeyBirth.end(); it++) { const CKeyID &keyid = it->second; std::string strTime = EncodeDumpTime(it->first); std::string strAddr = CBitcoinAddress(keyid).ToString(); CKey key; if (pwalletMain->GetKey(keyid, key)) { file << strprintf("%s %s ", CBitcoinSecret(key).ToString(), strTime); if (pwalletMain->mapAddressBook.count(keyid)) { file << strprintf("label=%s", EncodeDumpString(pwalletMain->mapAddressBook[keyid].name)); } else if (keyid == masterKeyID) { file << "hdmaster=1"; } else if (setKeyPool.count(keyid)) { file << "reserve=1"; } else if (pwalletMain->mapKeyMetadata[keyid].hdKeypath == "m") { file << "inactivehdmaster=1"; } else { file << "change=1"; } file << strprintf(" # addr=%s%s\n", strAddr, (pwalletMain->mapKeyMetadata[keyid].hdKeypath.size() > 0 ? " hdkeypath="+pwalletMain->mapKeyMetadata[keyid].hdKeypath : "")); } } file << "\n"; file << "# End of dump\n"; file.close(); return NullUniValue; } UniValue ProcessImport(const UniValue& data, const int64_t timestamp) { try { bool success = false; // Required fields. const UniValue& scriptPubKey = data["scriptPubKey"]; // Should have script or JSON with "address". if (!(scriptPubKey.getType() == UniValue::VOBJ && scriptPubKey.exists("address")) && !(scriptPubKey.getType() == UniValue::VSTR)) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid scriptPubKey"); } // Optional fields. const string& strRedeemScript = data.exists("redeemscript") ? data["redeemscript"].get_str() : ""; const UniValue& pubKeys = data.exists("pubkeys") ? data["pubkeys"].get_array() : UniValue(); const UniValue& keys = data.exists("keys") ? data["keys"].get_array() : UniValue(); const bool& internal = data.exists("internal") ? data["internal"].get_bool() : false; const bool& watchOnly = data.exists("watchonly") ? data["watchonly"].get_bool() : false; const string& label = data.exists("label") && !internal ? data["label"].get_str() : ""; bool isScript = scriptPubKey.getType() == UniValue::VSTR; bool isP2SH = strRedeemScript.length() > 0; const string& output = isScript ? scriptPubKey.get_str() : scriptPubKey["address"].get_str(); // Parse the output. CScript script; CBitcoinAddress address; if (!isScript) { address = CBitcoinAddress(output); if (!address.IsValid()) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address"); } script = GetScriptForDestination(address.Get()); } else { if (!IsHex(output)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid scriptPubKey"); } std::vector<unsigned char> vData(ParseHex(output)); script = CScript(vData.begin(), vData.end()); } // Watchonly and private keys if (watchOnly && keys.size()) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Incompatibility found between watchonly and keys"); } // Internal + Label if (internal && data.exists("label")) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Incompatibility found between internal and label"); } // Not having Internal + Script if (!internal && isScript) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Internal must be set for hex scriptPubKey"); } // Keys / PubKeys size check. if (!isP2SH && (keys.size() > 1 || pubKeys.size() > 1)) { // Address / scriptPubKey throw JSONRPCError(RPC_INVALID_PARAMETER, "More than private key given for one address"); } // Invalid P2SH redeemScript if (isP2SH && !IsHex(strRedeemScript)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid redeem script"); } // Process. // // P2SH if (isP2SH) { // Import redeem script. std::vector<unsigned char> vData(ParseHex(strRedeemScript)); CScript redeemScript = CScript(vData.begin(), vData.end()); // Invalid P2SH address if (!script.IsPayToScriptHash()) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid P2SH address / script"); } pwalletMain->MarkDirty(); if (!pwalletMain->HaveWatchOnly(redeemScript) && !pwalletMain->AddWatchOnly(redeemScript, timestamp)) { throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet"); } if (!pwalletMain->HaveCScript(redeemScript) && !pwalletMain->AddCScript(redeemScript)) { throw JSONRPCError(RPC_WALLET_ERROR, "Error adding p2sh redeemScript to wallet"); } CBitcoinAddress redeemAddress = CBitcoinAddress(CScriptID(redeemScript)); CScript redeemDestination = GetScriptForDestination(redeemAddress.Get()); if (::IsMine(*pwalletMain, redeemDestination) == ISMINE_SPENDABLE) { throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the private key for this address or script"); } pwalletMain->MarkDirty(); if (!pwalletMain->HaveWatchOnly(redeemDestination) && !pwalletMain->AddWatchOnly(redeemDestination, timestamp)) { throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet"); } // add to address book or update label if (address.IsValid()) { pwalletMain->SetAddressBook(address.Get(), label, "receive"); } // Import private keys. if (keys.size()) { for (size_t i = 0; i < keys.size(); i++) { const string& privkey = keys[i].get_str(); CBitcoinSecret vchSecret; bool fGood = vchSecret.SetString(privkey); if (!fGood) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key encoding"); } CKey key = vchSecret.GetKey(); if (!key.IsValid()) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Private key outside allowed range"); } CPubKey pubkey = key.GetPubKey(); assert(key.VerifyPubKey(pubkey)); CKeyID vchAddress = pubkey.GetID(); pwalletMain->MarkDirty(); pwalletMain->SetAddressBook(vchAddress, label, "receive"); if (pwalletMain->HaveKey(vchAddress)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Already have this key"); } pwalletMain->mapKeyMetadata[vchAddress].nCreateTime = timestamp; if (!pwalletMain->AddKeyPubKey(key, pubkey)) { throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet"); } pwalletMain->UpdateTimeFirstKey(timestamp); } } success = true; } else { // Import public keys. if (pubKeys.size() && keys.size() == 0) { const string& strPubKey = pubKeys[0].get_str(); if (!IsHex(strPubKey)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pubkey must be a hex string"); } std::vector<unsigned char> vData(ParseHex(strPubKey)); CPubKey pubKey(vData.begin(), vData.end()); if (!pubKey.IsFullyValid()) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pubkey is not a valid public key"); } CBitcoinAddress pubKeyAddress = CBitcoinAddress(pubKey.GetID()); // Consistency check. if (!isScript && !(pubKeyAddress.Get() == address.Get())) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Consistency check failed"); } // Consistency check. if (isScript) { CBitcoinAddress scriptAddress; CTxDestination destination; if (ExtractDestination(script, destination)) { scriptAddress = CBitcoinAddress(destination); if (!(scriptAddress.Get() == pubKeyAddress.Get())) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Consistency check failed"); } } } CScript pubKeyScript = GetScriptForDestination(pubKeyAddress.Get()); if (::IsMine(*pwalletMain, pubKeyScript) == ISMINE_SPENDABLE) { throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the private key for this address or script"); } pwalletMain->MarkDirty(); if (!pwalletMain->HaveWatchOnly(pubKeyScript) && !pwalletMain->AddWatchOnly(pubKeyScript, timestamp)) { throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet"); } // add to address book or update label if (pubKeyAddress.IsValid()) { pwalletMain->SetAddressBook(pubKeyAddress.Get(), label, "receive"); } // TODO Is this necessary? CScript scriptRawPubKey = GetScriptForRawPubKey(pubKey); if (::IsMine(*pwalletMain, scriptRawPubKey) == ISMINE_SPENDABLE) { throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the private key for this address or script"); } pwalletMain->MarkDirty(); if (!pwalletMain->HaveWatchOnly(scriptRawPubKey) && !pwalletMain->AddWatchOnly(scriptRawPubKey, timestamp)) { throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet"); } success = true; } // Import private keys. if (keys.size()) { const string& strPrivkey = keys[0].get_str(); // Checks. CBitcoinSecret vchSecret; bool fGood = vchSecret.SetString(strPrivkey); if (!fGood) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key encoding"); } CKey key = vchSecret.GetKey(); if (!key.IsValid()) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Private key outside allowed range"); } CPubKey pubKey = key.GetPubKey(); assert(key.VerifyPubKey(pubKey)); CBitcoinAddress pubKeyAddress = CBitcoinAddress(pubKey.GetID()); // Consistency check. if (!isScript && !(pubKeyAddress.Get() == address.Get())) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Consistency check failed"); } // Consistency check. if (isScript) { CBitcoinAddress scriptAddress; CTxDestination destination; if (ExtractDestination(script, destination)) { scriptAddress = CBitcoinAddress(destination); if (!(scriptAddress.Get() == pubKeyAddress.Get())) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Consistency check failed"); } } } CKeyID vchAddress = pubKey.GetID(); pwalletMain->MarkDirty(); pwalletMain->SetAddressBook(vchAddress, label, "receive"); if (pwalletMain->HaveKey(vchAddress)) { return false; } pwalletMain->mapKeyMetadata[vchAddress].nCreateTime = timestamp; if (!pwalletMain->AddKeyPubKey(key, pubKey)) { throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet"); } pwalletMain->UpdateTimeFirstKey(timestamp); success = true; } // Import scriptPubKey only. if (pubKeys.size() == 0 && keys.size() == 0) { if (::IsMine(*pwalletMain, script) == ISMINE_SPENDABLE) { throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the private key for this address or script"); } pwalletMain->MarkDirty(); if (!pwalletMain->HaveWatchOnly(script) && !pwalletMain->AddWatchOnly(script, timestamp)) { throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet"); } if (scriptPubKey.getType() == UniValue::VOBJ) { // add to address book or update label if (address.IsValid()) { pwalletMain->SetAddressBook(address.Get(), label, "receive"); } } success = true; } } UniValue result = UniValue(UniValue::VOBJ); result.pushKV("success", UniValue(success)); return result; } catch (const UniValue& e) { UniValue result = UniValue(UniValue::VOBJ); result.pushKV("success", UniValue(false)); result.pushKV("error", e); return result; } catch (...) { UniValue result = UniValue(UniValue::VOBJ); result.pushKV("success", UniValue(false)); result.pushKV("error", JSONRPCError(RPC_MISC_ERROR, "Missing required fields")); return result; } } int64_t GetImportTimestamp(const UniValue& data, int64_t now) { if (data.exists("timestamp")) { const UniValue& timestamp = data["timestamp"]; if (timestamp.isNum()) { return timestamp.get_int64(); } else if (timestamp.isStr() && timestamp.get_str() == "now") { return now; } throw JSONRPCError(RPC_TYPE_ERROR, strprintf("Expected number or \"now\" timestamp value for key. got type %s", uvTypeName(timestamp.type()))); } throw JSONRPCError(RPC_TYPE_ERROR, "Missing required timestamp field for key"); } UniValue importmulti(const JSONRPCRequest& mainRequest) { // clang-format off if (mainRequest.fHelp || mainRequest.params.size() < 1 || mainRequest.params.size() > 2) throw runtime_error( "importmulti \"requests\" \"options\"\n\n" "Import addresses/scripts (with private or public keys, redeem script (P2SH)), rescanning all addresses in one-shot-only (rescan can be disabled via options).\n\n" "Arguments:\n" "1. requests (array, required) Data to be imported\n" " [ (array of json objects)\n" " {\n" " \"scriptPubKey\": \"<script>\" | { \"address\":\"<address>\" }, (string / json, required) Type of scriptPubKey (string for script, json for address)\n" " \"timestamp\": timestamp | \"now\" , (integer / string, required) Creation time of the key in seconds since epoch (Jan 1 1970 GMT),\n" " or the string \"now\" to substitute the current synced blockchain time. The timestamp of the oldest\n" " key will determine how far back blockchain rescans need to begin for missing wallet transactions.\n" " \"now\" can be specified to bypass scanning, for keys which are known to never have been used, and\n" " 0 can be specified to scan the entire blockchain. Blocks up to 2 hours before the earliest key\n" " creation time of all keys being imported by the importmulti call will be scanned.\n" " \"redeemscript\": \"<script>\" , (string, optional) Allowed only if the scriptPubKey is a P2SH address or a P2SH scriptPubKey\n" " \"pubkeys\": [\"<pubKey>\", ... ] , (array, optional) Array of strings giving pubkeys that must occur in the output or redeemscript\n" " \"keys\": [\"<key>\", ... ] , (array, optional) Array of strings giving private keys whose corresponding public keys must occur in the output or redeemscript\n" " \"internal\": <true> , (boolean, optional, default: false) Stating whether matching outputs should be be treated as not incoming payments\n" " \"watchonly\": <true> , (boolean, optional, default: false) Stating whether matching outputs should be considered watched even when they're not spendable, only allowed if keys are empty\n" " \"label\": <label> , (string, optional, default: '') Label to assign to the address (aka account name, for now), only allowed with internal=false\n" " }\n" " ,...\n" " ]\n" "2. options (json, optional)\n" " {\n" " \"rescan\": <false>, (boolean, optional, default: true) Stating if should rescan the blockchain after all imports\n" " }\n" "\nExamples:\n" + HelpExampleCli("importmulti", "'[{ \"scriptPubKey\": { \"address\": \"<my address>\" }, \"timestamp\":1455191478 }, " "{ \"scriptPubKey\": { \"address\": \"<my 2nd address>\" }, \"label\": \"example 2\", \"timestamp\": 1455191480 }]'") + HelpExampleCli("importmulti", "'[{ \"scriptPubKey\": { \"address\": \"<my address>\" }, \"timestamp\":1455191478 }]' '{ \"rescan\": false}'") + "\nResponse is an array with the same size as the input that has the execution result :\n" " [{ \"success\": true } , { \"success\": false, \"error\": { \"code\": -1, \"message\": \"Internal Server Error\"} }, ... ]\n"); // clang-format on if (!EnsureWalletIsAvailable(mainRequest.fHelp)) { return NullUniValue; } RPCTypeCheck(mainRequest.params, boost::assign::list_of(UniValue::VARR)(UniValue::VOBJ)); const UniValue& requests = mainRequest.params[0]; //Default options bool fRescan = true; if (mainRequest.params.size() > 1) { const UniValue& options = mainRequest.params[1]; if (options.exists("rescan")) { fRescan = options["rescan"].get_bool(); } } LOCK2(cs_main, pwalletMain->cs_wallet); EnsureWalletIsUnlocked(); // Verify all timestamps are present before importing any keys. const int64_t now = chainActive.Tip() ? chainActive.Tip()->GetMedianTimePast() : 0; for (const UniValue& data : requests.getValues()) { GetImportTimestamp(data, now); } bool fRunScan = false; const int64_t minimumTimestamp = 1; int64_t nLowestTimestamp = 0; if (fRescan && chainActive.Tip()) { nLowestTimestamp = chainActive.Tip()->GetBlockTime(); } else { fRescan = false; } UniValue response(UniValue::VARR); BOOST_FOREACH (const UniValue& data, requests.getValues()) { const int64_t timestamp = std::max(GetImportTimestamp(data, now), minimumTimestamp); const UniValue result = ProcessImport(data, timestamp); response.push_back(result); if (!fRescan) { continue; } // If at least one request was successful then allow rescan. if (result["success"].get_bool()) { fRunScan = true; } // Get the lowest timestamp. if (timestamp < nLowestTimestamp) { nLowestTimestamp = timestamp; } } if (fRescan && fRunScan && requests.size()) { CBlockIndex* pindex = nLowestTimestamp > minimumTimestamp ? chainActive.FindEarliestAtLeast(std::max<int64_t>(nLowestTimestamp - 7200, 0)) : chainActive.Genesis(); CBlockIndex* scannedRange = nullptr; if (pindex) { scannedRange = pwalletMain->ScanForWalletTransactions(pindex, true); pwalletMain->ReacceptWalletTransactions(); } if (!scannedRange || scannedRange->nHeight > pindex->nHeight) { std::vector<UniValue> results = response.getValues(); response.clear(); response.setArray(); size_t i = 0; for (const UniValue& request : requests.getValues()) { // If key creation date is within the successfully scanned // range, or if the import result already has an error set, let // the result stand unmodified. Otherwise replace the result // with an error message. if (GetImportTimestamp(request, now) - 7200 >= scannedRange->GetBlockTimeMax() || results.at(i).exists("error")) { response.push_back(results.at(i)); } else { UniValue result = UniValue(UniValue::VOBJ); result.pushKV("success", UniValue(false)); result.pushKV("error", JSONRPCError(RPC_MISC_ERROR, strprintf("Failed to rescan before time %d, transactions may be missing.", scannedRange->GetBlockTimeMax()))); response.push_back(std::move(result)); } ++i; } } } return response; }
[ "peter@codebuffet.co" ]
peter@codebuffet.co
155a32397bfda5306e9c98e9a45f57f1f7991d61
029d1fe4fde9ee2d066304476cec46b451f046fa
/unicode_far/UCD/nsSJISProber.h
b63bb5d64e5d4082277e18bb6dd483ff36fbb41a
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
shmuz/Spring
a6a38a3cb53e2ed424c4b6012d5a1dfbb416ae2b
2b604a3dad5d19af85d0713c655c770dcaa69a73
refs/heads/master
2021-01-22T03:01:37.293701
2014-04-26T17:56:23
2014-04-26T17:56:23
4,823,343
1
0
null
null
null
null
UTF-8
C++
false
false
2,934
h
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // for S-JIS encoding, obeserve characteristic: // 1, kana character (or hankaku?) often have hight frequency of appereance // 2, kana character often exist in group // 3, certain combination of kana is never used in japanese language #ifndef nsSJISProber_h__ #define nsSJISProber_h__ #include "nsCharSetProber.h" #include "nsCodingStateMachine.h" #include "JpCntx.h" #include "CharDistribution.h" class nsSJISProber: public nsCharSetProber { public: nsSJISProber(void){mCodingSM = new nsCodingStateMachine(&SJISSMModel); Reset();} virtual ~nsSJISProber(void){delete mCodingSM;} nsProbingState HandleData(const char* aBuf, PRUint32 aLen); const char* GetCharSetName() {return "Shift_JIS";} nsProbingState GetState(void) {return mState;} void Reset(void); float GetConfidence(void); void SetOpion() {} protected: nsCodingStateMachine* mCodingSM; nsProbingState mState; SJISContextAnalysis mContextAnalyser; SJISDistributionAnalysis mDistributionAnalyser; char mLastChar[2]; }; #endif /* nsSJISProber_h__ */
[ "zg@bmg.lv" ]
zg@bmg.lv
a29d869754963b7b8a92b35df0de53fbe393e6f9
99249e222a2f35ac11a7fd93bff10a3a13f6f948
/ros2_mod_ws/install/include/robobo_msgs/srv/talk__request.hpp
c56822dbfcce63dd101586884868a2003b1e4cb1
[ "Apache-2.0" ]
permissive
mintforpeople/robobo-ros2-ios-port
87aec17a0c89c3fc5a42411822a18f08af8a5b0f
1a5650304bd41060925ebba41d6c861d5062bfae
refs/heads/master
2020-08-31T19:41:01.124753
2019-10-31T16:01:11
2019-10-31T16:01:11
218,764,551
1
0
null
null
null
null
UTF-8
C++
false
false
360
hpp
// generated from rosidl_generator_cpp/resource/msg.hpp.em // generated code does not contain a copyright notice #ifndef ROBOBO_MSGS__SRV__TALK__REQUEST_HPP_ #define ROBOBO_MSGS__SRV__TALK__REQUEST_HPP_ #include "robobo_msgs/srv/talk__request__struct.hpp" #include "robobo_msgs/srv/talk__request__traits.hpp" #endif // ROBOBO_MSGS__SRV__TALK__REQUEST_HPP_
[ "lfllamas93@gmail.com" ]
lfllamas93@gmail.com
1078e50023397609fa9563f73725c9db2f791033
c7ec53823bda5e3ea2998a608313fae8c42c633c
/cpp/oneapi/dal/detail/array_compat.hpp
6f4cc862a64aebaa5e32f997e7526c6c3a37c02e
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "Intel", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "MIT", "Zlib" ]
permissive
orazve/oneDAL
837c202e1e229a3740f8f79efbfc97c9917fd8aa
0ef858641a7d2e81bd73b7b75ce8fefa7cc0e87b
refs/heads/master
2022-01-30T07:29:22.311883
2022-01-03T14:53:59
2022-01-03T14:53:59
253,419,713
0
0
Apache-2.0
2021-05-25T16:29:13
2020-04-06T07:00:34
C++
UTF-8
C++
false
false
11,280
hpp
/******************************************************************************* * Copyright 2020-2021 Intel Corporation * * 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. *******************************************************************************/ #pragma once #include "oneapi/dal/array.hpp" namespace oneapi::dal { namespace v1 { // This class is needed for compatibility with the oneDAL 2021.1. // This should be removed in 2022.1. template <typename T> class array { static_assert(!std::is_const_v<T>, "array class cannot have const-qualified type of data"); template <typename U> friend class array; using impl_t = detail::v1::array_impl<T>; public: using data_t = T; static array<T> empty(std::int64_t count) { return array<T>{ impl_t::empty(detail::default_host_policy{}, count, detail::host_allocator<T>()) }; } #ifdef ONEDAL_DATA_PARALLEL static array<T> empty(const sycl::queue& queue, std::int64_t count, const sycl::usm::alloc& alloc = sycl::usm::alloc::shared) { return array<T>{ impl_t::empty(detail::data_parallel_policy{ queue }, count, detail::data_parallel_allocator<T>(queue, alloc)) }; } #endif template <typename K> static array<T> full(std::int64_t count, K&& element) { return array<T>{ impl_t::full(detail::default_host_policy{}, count, std::forward<K>(element), detail::host_allocator<T>()) }; } #ifdef ONEDAL_DATA_PARALLEL template <typename K> static array<T> full(sycl::queue& queue, std::int64_t count, K&& element, const sycl::usm::alloc& alloc = sycl::usm::alloc::shared) { return array<T>{ impl_t::full(detail::data_parallel_policy{ queue }, count, std::forward<K>(element), detail::data_parallel_allocator<T>(queue, alloc)) }; } #endif static array<T> zeros(std::int64_t count) { // TODO: can be optimized in future return array<T>{ impl_t::full(detail::default_host_policy{}, count, T{}, detail::host_allocator<T>()) }; } #ifdef ONEDAL_DATA_PARALLEL static array<T> zeros(sycl::queue& queue, std::int64_t count, const sycl::usm::alloc& alloc = sycl::usm::alloc::shared) { return array<T>{ impl_t::full(dal::detail::data_parallel_policy{ queue }, count, T{}, detail::data_parallel_allocator<T>(queue, alloc)) }; } #endif template <typename Y> static array<T> wrap(Y* data, std::int64_t count) { return array<T>{ data, count, dal::detail::empty_delete<const T>{} }; } #ifdef ONEDAL_DATA_PARALLEL template <typename Y> static array<T> wrap(Y* data, std::int64_t count, const std::vector<sycl::event>& dependencies) { return array<T>{ data, count, dal::detail::empty_delete<const T>{}, dependencies }; } #endif array() : impl_(new impl_t()) { reset_data(); } array(const array<T>& other) : impl_(new impl_t(*other.impl_)) { update_data(impl_.get()); } array(array<T>&& other) : impl_(std::move(other.impl_)) { update_data(impl_.get()); other.reset_data(); } template <typename Deleter> explicit array(T* data, std::int64_t count, Deleter&& deleter) : impl_(new impl_t(data, count, std::forward<Deleter>(deleter))) { update_data(data, count); } template <typename ConstDeleter> explicit array(const T* data, std::int64_t count, ConstDeleter&& deleter) : impl_(new impl_t(data, count, std::forward<ConstDeleter>(deleter))) { update_data(data, count); } explicit array(const std::shared_ptr<T>& data, std::int64_t count) : impl_(new impl_t(data, count)) { update_data(data.get(), count); } explicit array(const std::shared_ptr<const T>& data, std::int64_t count) : impl_(new impl_t(data, count)) { update_data(data.get(), count); } #ifdef ONEDAL_DATA_PARALLEL template <typename Deleter> explicit array(const sycl::queue& queue, T* data, std::int64_t count, Deleter&& deleter, const std::vector<sycl::event>& dependencies = {}) : impl_(new impl_t(data, count, std::forward<Deleter>(deleter))) { update_data(impl_.get()); sycl::event::wait_and_throw(dependencies); } template <typename ConstDeleter> explicit array(const sycl::queue& queue, const T* data, std::int64_t count, ConstDeleter&& deleter, const std::vector<sycl::event>& dependencies = {}) : impl_(new impl_t(data, count, std::forward<ConstDeleter>(deleter))) { update_data(impl_.get()); sycl::event::wait_and_throw(dependencies); } #endif template <typename Y, typename K> explicit array(const array<Y>& ref, K* data, std::int64_t count) : impl_(new impl_t(*ref.impl_, data, count)) { update_data(impl_.get()); } array<T> operator=(const array<T>& other) { array<T> tmp{ other }; swap(*this, tmp); return *this; } array<T> operator=(array<T>&& other) { swap(*this, other); return *this; } T* get_mutable_data() const { if (!has_mutable_data()) { throw domain_error(dal::detail::error_messages::array_does_not_contain_mutable_data()); } return mutable_data_ptr_; } const T* get_data() const noexcept { return data_ptr_; } bool has_mutable_data() const noexcept { return mutable_data_ptr_ != nullptr; } array& need_mutable_data() { impl_->need_mutable_data(detail::default_host_policy{}, detail::host_allocator<data_t>{}); update_data(impl_->get_mutable_data(), impl_->get_count()); return *this; } #ifdef ONEDAL_DATA_PARALLEL array& need_mutable_data(sycl::queue& queue, const sycl::usm::alloc& alloc = sycl::usm::alloc::shared) { impl_->need_mutable_data(detail::data_parallel_policy{ queue }, detail::data_parallel_allocator<T>(queue, alloc)); update_data(impl_->get_mutable_data(), impl_->get_count()); return *this; } #endif std::int64_t get_count() const noexcept { return count_; } std::int64_t get_size() const noexcept { return count_ * sizeof(T); } void reset() { impl_->reset(); reset_data(); } void reset(std::int64_t count) { impl_->reset(detail::default_host_policy{}, count, detail::host_allocator<data_t>{}); update_data(impl_->get_mutable_data(), count); } #ifdef ONEDAL_DATA_PARALLEL void reset(const sycl::queue& queue, std::int64_t count, const sycl::usm::alloc& alloc = sycl::usm::alloc::shared) { impl_->reset(detail::data_parallel_policy{ queue }, count, detail::data_parallel_allocator<T>(queue, alloc)); update_data(impl_->get_mutable_data(), count); } #endif template <typename Deleter> void reset(T* data, std::int64_t count, Deleter&& deleter) { impl_->reset(data, count, std::forward<Deleter>(deleter)); update_data(data, count); } template <typename ConstDeleter> void reset(const T* data, std::int64_t count, ConstDeleter&& deleter) { impl_->reset(data, count, std::forward<ConstDeleter>(deleter)); update_data(data, count); } #ifdef ONEDAL_DATA_PARALLEL template <typename Y, typename YDeleter> void reset(Y* data, std::int64_t count, YDeleter&& deleter, const std::vector<sycl::event>& dependencies) { sycl::event::wait_and_throw(dependencies); reset(data, count, std::forward<YDeleter>(deleter)); } #endif template <typename Y> void reset(const array<Y>& ref, T* data, std::int64_t count) { impl_->reset(*ref.impl_, data, count); update_data(data, count); } template <typename Y> void reset(const array<Y>& ref, const T* data, std::int64_t count) { impl_->reset(*ref.impl_, data, count); update_data(data, count); } const T& operator[](std::int64_t index) const noexcept { return data_ptr_[index]; } template <typename Y> void reset(const v2::array<Y>& ref) { auto& impl_v2 = detail::get_impl(ref); if (ref.has_mutable_data()) { impl_->reset(impl_v2.get_shared(), ref.get_count()); } else { impl_->reset(impl_v2.get_cshared(), ref.get_count()); } update_data(impl_.get()); } v2::array<T> v2() const { if (has_mutable_data()) { return v2::array<T>{ impl_->get_shared(), count_ }; } else { return v2::array<T>{ impl_->get_cshared(), count_ }; } } private: static void swap(array<T>& a, array<T>& b) { std::swap(a.impl_, b.impl_); std::swap(a.data_ptr_, b.data_ptr_); std::swap(a.mutable_data_ptr_, b.mutable_data_ptr_); std::swap(a.count_, b.count_); } array(impl_t* impl) : impl_(impl) { update_data(impl_.get()); } void update_data(impl_t* impl) { if (impl->has_mutable_data()) { update_data(impl->get_mutable_data(), impl->get_count()); } else { update_data(impl->get_data(), impl->get_count()); } } void update_data(const T* data, std::int64_t count) noexcept { data_ptr_ = data; mutable_data_ptr_ = nullptr; count_ = count; } void update_data(T* data, std::int64_t count) noexcept { data_ptr_ = data; mutable_data_ptr_ = data; count_ = count; } void reset_data() noexcept { data_ptr_ = nullptr; mutable_data_ptr_ = nullptr; count_ = 0; } private: detail::unique<impl_t> impl_; const T* data_ptr_; T* mutable_data_ptr_; std::int64_t count_; }; } // namespace v1 } // namespace oneapi::dal
[ "noreply@github.com" ]
noreply@github.com
ae2fb18f15e35456ec6bd729ad96c7aafc059a76
e4625e88354a5a5964441bdfe474ff20a04b34c9
/Source/Common/HyContainerImpl.h
b329bca339a8034bd5aa653cb4ca33832e912693
[]
no_license
frostazy/VoxelGame
0d46d63587ee76b34a6384295d60583a43bb6206
6ab76fd001fc601ba30ebab4b4be3f6b52ed63e6
refs/heads/master
2020-12-03T09:15:01.697059
2016-09-19T03:11:06
2016-09-19T03:11:06
68,564,067
1
0
null
null
null
null
UTF-8
C++
false
false
774
h
#pragma once #include <vector> namespace HyVoxel { template<typename T> class hyvector : public std::vector<T> { public: int Find(const T& val) const { const_iterator findRes = std::find(begin(), end(), val); if (findRes != end()) return (int)(findRes - begin()); else return -1; } hyvector& operator+=(const hyvector& other) { insert(end(), other.begin(), other.end()); return *this; } void Append(const T* arr, int length) { insert(end(), arr, arr + length); } }; template<typename T> class OutVectorImpl : public OutVector<T>, public hyvector<T> { public: virtual void Release() { delete this; } void SetOutVectorValues() { length = (int)this->size(); pdata = length > 0 ? this->data() : NULL; } }; }
[ "Zhou Yun" ]
Zhou Yun
911d9bca9c411e8b2dbfc6e0fb6f7bd4aca53424
bdf425c54f5a42eb3fa4d4b14cad76486aa761b0
/algorithm/1026_보물.cpp
b71e7f6e319e6385e3a61e9655fb076624ecd1f3
[]
no_license
SoHyunJiiiiiii/myCode
130332fde96fc86e008efcce5386a37dde74d832
3df247a1a32daef6333c39b6dfe5336589babe31
refs/heads/master
2020-12-30T15:53:52.630922
2017-10-09T01:36:31
2017-10-09T01:36:31
91,177,182
0
0
null
null
null
null
UTF-8
C++
false
false
652
cpp
// // main.cpp // 1026_보물 // // Created by 지소현 on 2017. 9. 2.. // Copyright © 2017년 지소현. All rights reserved. // #include <iostream> #include <algorithm> using namespace std; int main(int argc, const char * argv[]) { // insert code here... int N,result=0; int a[51]={0,},b[51]={0,}; scanf("%d",&N); for(int i=0; i<N; i++) { scanf("%d",&a[i]); } for(int i=0; i<N; i++) { scanf("%d",&b[i]); } sort(a,a+N); sort(b,b+N); for(int i=0; i<N; i++) { result += a[i]*b[N-i-1]; } printf("%d\n",result); return 0; }
[ "thgus4545@daum.net" ]
thgus4545@daum.net
eb444b2c7ecc962c8c934013cc3d9304b613d8d0
a3d6556180e74af7b555f8d47d3fea55b94bcbda
/chrome/browser/ash/borealis/testing/features.h
4f700b43e94d79d2df2c6494c873e39fc1d21239
[ "BSD-3-Clause" ]
permissive
chromium/chromium
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
refs/heads/main
2023-08-24T00:35:12.585945
2023-08-23T22:01:11
2023-08-23T22:01:11
120,360,765
17,408
7,102
BSD-3-Clause
2023-09-10T23:44:27
2018-02-05T20:55:32
null
UTF-8
C++
false
false
1,034
h
// Copyright 2021 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_ASH_BOREALIS_TESTING_FEATURES_H_ #define CHROME_BROWSER_ASH_BOREALIS_TESTING_FEATURES_H_ #include "base/memory/raw_ptr.h" #include "base/test/scoped_feature_list.h" #include "components/user_manager/scoped_user_manager.h" namespace ash { class FakeChromeUserManager; } class Profile; namespace borealis { void AllowBorealis(Profile* profile, base::test::ScopedFeatureList* features, ash::FakeChromeUserManager* user_manager, bool also_enable); class ScopedAllowBorealis { public: ScopedAllowBorealis(Profile* profile, bool also_enable); ~ScopedAllowBorealis(); private: raw_ptr<Profile, ExperimentalAsh> profile_; base::test::ScopedFeatureList features_; user_manager::ScopedUserManager user_manager_; }; } // namespace borealis #endif // CHROME_BROWSER_ASH_BOREALIS_TESTING_FEATURES_H_
[ "chromium-scoped@luci-project-accounts.iam.gserviceaccount.com" ]
chromium-scoped@luci-project-accounts.iam.gserviceaccount.com
b68200775bd04b2cfb286dbfd74fe70f07866337
23d61d61262946c7a6078b890367aa8fb85a0399
/include/snake.h
3501602983fb290401f3e33572f8a9a6e1b92f71
[]
no_license
Alakeel/CppND-Capstone-Snake-Game
f83d180f4f5e0eef3ada96d7a1b3afc443b09393
f75f30dd0f7ac3b65a41e7f3061d8328a80e1305
refs/heads/master
2022-11-19T08:04:26.620056
2020-07-19T13:48:52
2020-07-19T13:48:52
279,513,513
0
0
null
2020-07-14T07:25:22
2020-07-14T07:25:21
null
UTF-8
C++
false
false
1,153
h
#ifndef SNAKE_H #define SNAKE_H #include "SDL.h" #include <vector> class Snake { public: enum class Direction { kUp, kDown, kLeft, kRight }; Snake(int grid_width, int grid_height); ~Snake() = default; Snake(const Snake &source); Snake& operator=(const Snake &source); Snake(Snake &&source); Snake& operator=(Snake &&source); Direction direction = Direction::kUp; void Update(); void GrowBody(); bool SnakeCell(int x, int y); void SetSpeed(float aSpeed); void SetAccelerationRate(float aAccRate); void SetAlive(bool aAlive); float Speed() const; float AccelerationRate() const; float Alive() const; int Size() const; float HeadY() const; float HeadX() const; std::vector<SDL_Point> Body() const; private: void UpdateHead(); void UpdateBody(SDL_Point &current_cell, SDL_Point &prev_cell); std::vector<SDL_Point> body; bool growing{false}; int size{1}; int grid_width; int grid_height; float head_x; float head_y; float speed{0.1f}; float accelerationRate{0.02}; bool alive{true}; }; #endif
[ "Abdul.Alakeel@gmail.com" ]
Abdul.Alakeel@gmail.com
a5925ce80ba389ae3327771ed0963fb1f868b23a
25c877d5e922fa46cad1a7781cd15ada6fad2ce6
/Dev_class11_handout2_homework/Dev_class11_handout2/Motor2D/Window.h
df956e3d22c8c6b0caa5680c76b4cdbd5a39ffcb
[]
no_license
RustikTie/GameDev_Handouts
b43be92cec0c23ea7fb2b42c3442b9b7f9f84769
6c4a308b72bbad58c4b47f229bf571102f37841a
refs/heads/master
2021-08-23T10:54:14.106457
2017-12-04T15:54:29
2017-12-04T15:54:29
104,047,513
0
0
null
null
null
null
UTF-8
C++
false
false
371
h
#ifndef __WINDOW_H__ #define __WINDOW_H__ #include "Element.h" #include "p2List.h" class Window : public Element { public: Window(int x, int y, ElementType type, SDL_Rect rec); void LinkElement(Element* elem); void Draw(); ~Window(); private: SDL_Rect rec; SDL_Texture* tex = nullptr; p2List<Element*>* linked_elements = nullptr; }; #endif // !__WINDOW_H__
[ "rustiktie@gmail.com" ]
rustiktie@gmail.com
3eb8595f78ecc1016b3337e167ef74f77ccc2867
b02e73154282b30c64a119c8008dc1a14c1c45e9
/cxnumlib.cpp
e4ccad9433c8d91fcc0b118ea141c88da1a962d5
[]
no_license
tyllukasz/Math_Complex_Numbers_Library
36ae037788abcb3f8defe5d0f759acf128da75d4
e19a4e4855ab6441af4a485201dfe806d16c3b65
refs/heads/main
2023-06-20T21:57:33.843386
2021-08-01T13:55:29
2021-08-01T13:55:29
391,400,459
0
0
null
null
null
null
UTF-8
C++
false
false
3,420
cpp
#include <iostream> #include <cstdlib> #include <cmath> #include "cxnumlib.hpp" //constructor ComplexNumber::ComplexNumber(double in_re, double in_im): re(in_re), im(in_im) {} //destructor ComplexNumber::~ComplexNumber() {} //methods //display number void ComplexNumber::display() { if (im > 0 ) { std::cout << re << " + " << im << "i"; } else if (im < 0) { std::cout << re << " - " << abs(im) << "i"; } else if (re == 0 && im != 0) { std::cout << im <<"i"; } else if (im == 0) { std::cout << re; } } //get real part value double ComplexNumber::getRe() { return re; } //get imaginary part value double ComplexNumber::getIm() { return im; } //get modulus double ComplexNumber::getMod() { return sqrt(re*re + im*im); } //get argument double ComplexNumber::getArg() { double out = 0; try { if (re > 0 || im != 0) { out = 2 * atan( im / (re + getMod()) ); } else if (re < 0 && im == 0) { out = M_PI; } else if (re == 0 && im == 0) { throw "Undefined value!"; } } catch (const char* msg) { std::cerr << msg << std::endl; out = 0; //to be improved } return out; } //conjugate - returns complex conjugate ComplexNumber ComplexNumber::con() const { ComplexNumber temp; temp.re = re; temp.im = -im; return temp; } //operators overloading //operator << overloading std::ostream &operator << (std::ostream &out, const ComplexNumber &object) { if (object.im > 0 && object.re != 0) { out << object.re << " + " << object.im << "i"; } else if (object.im < 0 && object.re != 0) { out << object.re << " - " << abs(object.im) << "i"; } else if (object.re == 0 && object.im != 0) { out << object.im <<"i"; } else if (object.im == 0) { out << object.re; } return out; } //addition - operator "+" overloading ComplexNumber ComplexNumber::operator+ (const ComplexNumber &object) { ComplexNumber temp; temp.re = re + object.re; temp.im = im + object.im; return temp; } //substraction - operator "-" overloading ComplexNumber ComplexNumber::operator- (const ComplexNumber &object) { ComplexNumber temp; temp.re = re - object.re; temp.im = im - object.im; return temp; } //multiplication - operator "*" overloading ComplexNumber ComplexNumber::operator* (const ComplexNumber &object) { ComplexNumber temp; temp.re = re * object.re - im * object.im; temp.im = re * object.im + im * object.re; return temp; } //division - operator "/" overloading ComplexNumber ComplexNumber::operator/ (const ComplexNumber &object) { ComplexNumber temp; double denominator; temp = *this * object.con(); denominator = object.re * object.re + object.im * object.im; temp.re = temp.getRe() / denominator; temp.im = temp.getIm() / denominator; return temp; }
[ "tyl.lukasz@protonmail.com" ]
tyl.lukasz@protonmail.com
9f3148e4d4829d1b6273d995537aaf5328bedf36
9d9fed4fa45e3a02ff403e5249042989871f6454
/KWResearchWork/trunk/KWResearchWork/ControlPanel/CPExtrusion.cpp
021fdee37a670f604827ac174e2725f7ee12c3cc
[]
no_license
kaiwangntu/surface-reconstruction
688c247283f2a661428bfda4e00abee9b52aec22
b3672155181ad2aaced1bb94207b9b8a42e26041
refs/heads/master
2021-05-29T20:31:28.038057
2013-05-25T09:44:43
2013-05-25T09:44:43
40,125,371
3
0
null
null
null
null
UTF-8
C++
false
false
1,376
cpp
// CPExtrusion.cpp : implementation file // #include "stdafx.h" #include "../KWResearchWork.h" #include "CPExtrusion.h" // CCPExtrusion dialog IMPLEMENT_DYNAMIC(CCPExtrusion, CDialog) CCPExtrusion::CCPExtrusion(CWnd* pParent /*=NULL*/) : CDialog(CCPExtrusion::IDD, pParent) { } CCPExtrusion::~CCPExtrusion() { } CCPExtrusion::CCPExtrusion(CKWResearchWorkDoc * docDataIn,CControlPanel * cpDataIn) { this->pDoc=docDataIn; this->pCP=cpDataIn; } void CCPExtrusion::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CCPExtrusion, CDialog) ON_BN_CLICKED(IDC_EX_Extrude, &CCPExtrusion::OnBnClickedExExtrude) END_MESSAGE_MAP() // CCPExtrusion message handlers void CCPExtrusion::Init() { } void CCPExtrusion::OnBnClickedExExtrude() { // TODO: Add your control notification handler code here CWnd* pButton=this->GetDlgItem(IDC_EX_Extrude); pButton->EnableWindow(FALSE); BeginWaitCursor(); if (!pDoc->GetMeshExtrusion().ExtrudeMesh(pDoc->GetMesh(),pDoc->GettestvecvecNewEdgeVertexPos())) { return; } pDoc->GettestvecvecNewEdgeVertexPos().clear(); CString strTitle=pDoc->GetTitle(); strTitle=strTitle+"*"; pDoc->SetTitle(strTitle); pDoc->SetModifiedFlag(TRUE); EndWaitCursor(); pDoc->UpdateAllViews((CView*)pCP); pButton->EnableWindow(TRUE); }
[ "wangk0705@2731d4dc-b63b-3451-c659-d6235836ed29" ]
wangk0705@2731d4dc-b63b-3451-c659-d6235836ed29
dd7a3d5a1fbab4aca532966b1c88647e340546ff
58d35c7cb0d26524f1910976f2a3326862098c00
/src/arith_uint256.cpp
62b4fb7286092097085bffc55b54c823230b8865
[ "MIT" ]
permissive
TMRO2020/LeefCoin
e0a53110e1d0e39f1fb489450cc6bec30a015c43
97a54171f6a7207338d8a8b904cfb087de53c361
refs/heads/main
2023-06-16T09:16:58.109520
2021-07-08T06:10:02
2021-07-08T06:10:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,507
cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2018 The Bitcoin Core developers // Copyright (c) 2021 The LeefCoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <arith_uint256.h> #include <uint256.h> #include <util/strencodings.h> #include <crypto/common.h> #include <stdio.h> #include <string.h> template <unsigned int BITS> base_uint<BITS>::base_uint(const std::string& str) { static_assert(BITS/32 > 0 && BITS%32 == 0, "Template parameter BITS must be a positive multiple of 32."); SetHex(str); } template <unsigned int BITS> base_uint<BITS>& base_uint<BITS>::operator<<=(unsigned int shift) { base_uint<BITS> a(*this); for (int i = 0; i < WIDTH; i++) pn[i] = 0; int k = shift / 32; shift = shift % 32; for (int i = 0; i < WIDTH; i++) { if (i + k + 1 < WIDTH && shift != 0) pn[i + k + 1] |= (a.pn[i] >> (32 - shift)); if (i + k < WIDTH) pn[i + k] |= (a.pn[i] << shift); } return *this; } template <unsigned int BITS> base_uint<BITS>& base_uint<BITS>::operator>>=(unsigned int shift) { base_uint<BITS> a(*this); for (int i = 0; i < WIDTH; i++) pn[i] = 0; int k = shift / 32; shift = shift % 32; for (int i = 0; i < WIDTH; i++) { if (i - k - 1 >= 0 && shift != 0) pn[i - k - 1] |= (a.pn[i] << (32 - shift)); if (i - k >= 0) pn[i - k] |= (a.pn[i] >> shift); } return *this; } template <unsigned int BITS> base_uint<BITS>& base_uint<BITS>::operator*=(uint32_t b32) { uint64_t carry = 0; for (int i = 0; i < WIDTH; i++) { uint64_t n = carry + (uint64_t)b32 * pn[i]; pn[i] = n & 0xffffffff; carry = n >> 32; } return *this; } template <unsigned int BITS> base_uint<BITS>& base_uint<BITS>::operator*=(const base_uint& b) { base_uint<BITS> a; for (int j = 0; j < WIDTH; j++) { uint64_t carry = 0; for (int i = 0; i + j < WIDTH; i++) { uint64_t n = carry + a.pn[i + j] + (uint64_t)pn[j] * b.pn[i]; a.pn[i + j] = n & 0xffffffff; carry = n >> 32; } } *this = a; return *this; } template <unsigned int BITS> base_uint<BITS>& base_uint<BITS>::operator/=(const base_uint& b) { base_uint<BITS> div = b; // make a copy, so we can shift. base_uint<BITS> num = *this; // make a copy, so we can subtract. *this = 0; // the quotient. int num_bits = num.bits(); int div_bits = div.bits(); if (div_bits == 0) throw uint_error("Division by zero"); if (div_bits > num_bits) // the result is certainly 0. return *this; int shift = num_bits - div_bits; div <<= shift; // shift so that div and num align. while (shift >= 0) { if (num >= div) { num -= div; pn[shift / 32] |= (1 << (shift & 31)); // set a bit of the result. } div >>= 1; // shift back. shift--; } // num now contains the remainder of the division. return *this; } template <unsigned int BITS> int base_uint<BITS>::CompareTo(const base_uint<BITS>& b) const { for (int i = WIDTH - 1; i >= 0; i--) { if (pn[i] < b.pn[i]) return -1; if (pn[i] > b.pn[i]) return 1; } return 0; } template <unsigned int BITS> bool base_uint<BITS>::EqualTo(uint64_t b) const { for (int i = WIDTH - 1; i >= 2; i--) { if (pn[i]) return false; } if (pn[1] != (b >> 32)) return false; if (pn[0] != (b & 0xfffffffful)) return false; return true; } template <unsigned int BITS> double base_uint<BITS>::getdouble() const { double ret = 0.0; double fact = 1.0; for (int i = 0; i < WIDTH; i++) { ret += fact * pn[i]; fact *= 4294967296.0; } return ret; } template <unsigned int BITS> std::string base_uint<BITS>::GetHex() const { return ArithToUint256(*this).GetHex(); } template <unsigned int BITS> void base_uint<BITS>::SetHex(const char* psz) { *this = UintToArith256(uint256S(psz)); } template <unsigned int BITS> void base_uint<BITS>::SetHex(const std::string& str) { SetHex(str.c_str()); } template <unsigned int BITS> std::string base_uint<BITS>::ToString() const { return (GetHex()); } template <unsigned int BITS> unsigned int base_uint<BITS>::bits() const { for (int pos = WIDTH - 1; pos >= 0; pos--) { if (pn[pos]) { for (int nbits = 31; nbits > 0; nbits--) { if (pn[pos] & 1U << nbits) return 32 * pos + nbits + 1; } return 32 * pos + 1; } } return 0; } // Explicit instantiations for base_uint<256> template base_uint<256>::base_uint(const std::string&); template base_uint<256>& base_uint<256>::operator<<=(unsigned int); template base_uint<256>& base_uint<256>::operator>>=(unsigned int); template base_uint<256>& base_uint<256>::operator*=(uint32_t b32); template base_uint<256>& base_uint<256>::operator*=(const base_uint<256>& b); template base_uint<256>& base_uint<256>::operator/=(const base_uint<256>& b); template int base_uint<256>::CompareTo(const base_uint<256>&) const; template bool base_uint<256>::EqualTo(uint64_t) const; template double base_uint<256>::getdouble() const; template std::string base_uint<256>::GetHex() const; template std::string base_uint<256>::ToString() const; template void base_uint<256>::SetHex(const char*); template void base_uint<256>::SetHex(const std::string&); template unsigned int base_uint<256>::bits() const; // This implementation directly uses shifts instead of going // through an intermediate MPI representation. arith_uint256& arith_uint256::SetCompact(uint32_t nCompact, bool* pfNegative, bool* pfOverflow) { int nSize = nCompact >> 24; uint32_t nWord = nCompact & 0x007fffff; if (nSize <= 3) { nWord >>= 8 * (3 - nSize); *this = nWord; } else { *this = nWord; *this <<= 8 * (nSize - 3); } if (pfNegative) *pfNegative = nWord != 0 && (nCompact & 0x00800000) != 0; if (pfOverflow) *pfOverflow = nWord != 0 && ((nSize > 34) || (nWord > 0xff && nSize > 33) || (nWord > 0xffff && nSize > 32)); return *this; } uint32_t arith_uint256::GetCompact(bool fNegative) const { int nSize = (bits() + 7) / 8; uint32_t nCompact = 0; if (nSize <= 3) { nCompact = GetLow64() << 8 * (3 - nSize); } else { arith_uint256 bn = *this >> 8 * (nSize - 3); nCompact = bn.GetLow64(); } // The 0x00800000 bit denotes the sign. // Thus, if it is already set, divide the mantissa by 256 and increase the exponent. if (nCompact & 0x00800000) { nCompact >>= 8; nSize++; } assert((nCompact & ~0x007fffff) == 0); assert(nSize < 256); nCompact |= nSize << 24; nCompact |= (fNegative && (nCompact & 0x007fffff) ? 0x00800000 : 0); return nCompact; } uint256 ArithToUint256(const arith_uint256 &a) { uint256 b; for(int x=0; x<a.WIDTH; ++x) WriteLE32(b.begin() + x*4, a.pn[x]); return b; } arith_uint256 UintToArith256(const uint256 &a) { arith_uint256 b; for(int x=0; x<b.WIDTH; ++x) b.pn[x] = ReadLE32(a.begin() + x*4); return b; }
[ "gilad.leef@gmail.com" ]
gilad.leef@gmail.com
6f4de19634c27b6ccb1e070b52a4260d2843a059
f739df1f252d7c961ed881be3b8babaf62ff4170
/softs/SCADAsoft/5.3.2/inc/hisltserver_i.h
b8045b0c67dceabbbe5e0df3f16acd1631557a73
[]
no_license
billpwchan/SCADA-nsl
739484691c95181b262041daa90669d108c54234
1287edcd38b2685a675f1261884f1035f7f288db
refs/heads/master
2023-04-30T09:15:49.104944
2021-01-10T21:53:10
2021-01-10T21:53:10
328,486,982
0
0
null
2023-04-22T07:10:56
2021-01-10T21:53:19
C++
ISO-8859-1
C++
false
false
7,448
h
//-*-c++-*- /******************************************************************************/ /* */ /* FILE : hisltserver_i.h */ /* FULL NAME : */ /*----------------------------------------------------------------------------*/ /* AUTHOR : M. HEYBERGER */ /* COMPANY : THALES-IS */ /* CREATION DATE : Wed May 14 15:00:59 2003 */ /* LANGUAGE : C++ */ /*............................................................................*/ /* OVERVIEW */ /* Definition of the LT historisation server */ /*............................................................................*/ /* CONTENTS */ /* */ /******************************************************************************/ // IDENTIFICATION: // $Id: $ // // HISTORY: // $Log: $ // // Revision 4.3.0 18/08/2004 KLL // FFT SCS 509 - Traitement de données suite à un changement de VDC // #ifndef _SCS_HISLTSERVER_I_H_ #define _SCS_HISLTSERVER_I_H_ #include "scs.h" #include "hislt.h" class HisLTServerIdl_i; class HLT_API HisLTServer_i { public : HisLTServer_i(const char* p_inEnvName, const char* p_inProcessName, const char* p_storagePath); virtual ~HisLTServer_i(); /** writeSnapshot is called by LT generic part on online to manage application specific snapshot. You have to return 0 for success or an error code in case of problem. */ virtual int writeSnapshot(const char* snapdir) { return 0; } /** readSnapshot is called by LT generic part on standby, so you can retrieve application specific data stored by writeSnapshot. You have to return 0 for success or an error code in case of problem. */ virtual int readSnapshot(const char* snapdir) { return 0; } /** \par Description: this function deactivates the embedded CORBA services. \par Parameters: none. \return \li \c ScsValid : success. \li \c ScsError : error. */ ScsStatus deactivate(); typedef void (*getHistFilesCallback)(char** p_copiedFilesList, unsigned int p_count, ScsAny p_arg, const ScsStatus& p_returnStatus); typedef void (*getDBVStructureCallback)(char** p_copiedFilesList, unsigned int p_count, ScsAny p_arg, const ScsStatus& p_returnStatus); // ---- putDBVStructure (2003/07/29) ---- // --- Memorisation au LT des fichiers correspondant à la structure Statique de la DBV // IDE: // p_DBV : Structure contenant : Identifiant de la DBV et la Date de Debut de la DBV // p_StructDirPath: Path du directory contenant les fichiers statiques de la Structure DBV // que le serveur LT doit memoriser // --------------------------------------------------------------------------------------------- virtual ScsStatus putDBVStructure(HisLTDBVInfo *p_DBV, const char* p_StructDirPath); // ---- putHistFiles (2003/07/29) ---- // --- Memorisation au LT des fichiers d'historiques de la DBV // et eventuellement des fichiers de la structure statique de la DBV // IDE: // p_HistDirPath : Path du directory contenant les fichiers d'historiques à memoriser sur le LT serveur // p_dbvId : Identifiant de la DBV (Peut etre vide, dans ce cas prendre l'identifiant de la courant DBV) // ------------------------------------------------------------------------------------------------------- virtual ScsStatus putHistFiles(const char* p_HistDirPath, const char* p_dbvId, const short p_type); // ---- getAllDBVInfos ---- // --- Recuperation du LT server toutes les DBV et leurs dates associées (start et End Time) // IDE: // out p_count : out Nombre de toutes les DBVs passees // out p_DBVInfos : List de toutes les DBV et dates associees // Pas de callback associees , ni de treads car fait en Init // ---------------------------------------------------------------------------------------------------- virtual ScsStatus getAllDBVInfos ( unsigned int *p_Count, HisLTDBVInfo **p_DBVInfos); // ---- getDBVStructure (2003/07/29) ---- // --- Recuperation du LT des fichiers correspondant à la structure statique de la DBV // IDE: // p_requestId : Identifiant de la requete // p_dbvId : Identifiant de la DBV // p_StructDirPath: Path ou le LT server doit copier les fichiers STATIQUES de la Structure DBV // ...... // ---------------------------------------------------------------------------------------------------- virtual ScsStatus getDBVStructure(const unsigned int p_requestId, const char* p_dbvId, const char* p_StructDirPath, getDBVStructureCallback p_callback, ScsAny p_arg); // ---- getHistFiles (2003/07/29) ---- // --- Recuperation du LT des fichiers d'historiques // ==> OPTIMISATION possible : Recupere les fichiers d'historiques en meme temps que la Structure DBV // IDE: // p_requestId : Identifiant de la requete // p_dbvId : Identifiant de la DBV (A mettre a NULL: Ne sert pas pour l'instant , en vue d'optimisation) // p_histFileNames : Liste des fichiers d'historiques à recupérer // p_count : Nombre de fichiers d'historiques à récuperer // p_DestHistPath: Path ou recopier les fichiers d'historiques // p_DestStructPath: Path ou recopier les fichiers de Structure statique de la DBV // (A mettre à NULL: Ne sert pas pour l'instant, en vue d'optimisation // ...... // ---------------------------------------------------------------------------------------------------- virtual ScsStatus getHistFiles(const unsigned int p_requestId, const char* p_dbvId, char** p_histFileNames, const unsigned int p_count, const char* p_DestHistPath, const char* p_DestStructPath, getHistFilesCallback p_callback, ScsAny p_arg); // ---- purgeFiles (2004/08/19) ---- // ---- Effacer les fichiers sur le disque dont la date de création est inférieure à p_startTime // On appelle la deuxième méthode purgeFiles qui prend comme paramètre une liste de fichiers // Lorsque le client désire effacer des fichiers du disque, il doit obligatoirement passer // par cette méthode et non par celle qui en protected // ...... // ------------------------------------------------------------------------------------------------ virtual ScsStatus getSubDirListForInterval(unsigned long p_startTime, unsigned long p_endTime, const char * p_dbvId, short p_type, char **& p_filesList, int& p_nbElement) const; private: HisLTServerIdl_i * _LTServer; }; #endif
[ "billpwchan@hotmail.com" ]
billpwchan@hotmail.com
8c5e97d995863cd53a32b94e4991eba067fb19b3
03ae9e574fc4005da14c2692d9c359e2d40cb593
/765.cpp
5cf83510801886da7485f32352aed6c92052110b
[]
no_license
rum2mojito/Leetcode
addfb30375780d509841bf9b84365f745e21c94d
89eaf6d78622205d6606694147998ce98be40b00
refs/heads/master
2022-11-10T01:30:57.660130
2022-10-02T12:44:03
2022-10-02T12:44:03
121,218,790
1
0
null
null
null
null
UTF-8
C++
false
false
681
cpp
// 765. Couples Holding Hands class Solution { public: int minSwapsCouples(vector<int>& row) { vector<int> pos(row.size(), 0); for(int i=0; i<row.size(); i++) pos[row[i]] = i; int res = 0; for(int i=0; i<row.size(); i+=2) { if(row[i]/2 == row[i+1]/2) continue; int huswhere = 0; if(row[i]%2 == 0) huswhere = pos[row[i]/2*2+1]; else huswhere = pos[row[i]/2*2]; res++; pos[row[i+1]] = huswhere; swap(row[i+1], row[huswhere]); } return res; } };
[ "noreply@github.com" ]
noreply@github.com
8d347fd3614943bb58117ffbdfede052b6db5b11
4c571269e54c892a0b9fa75be0cbe680e0a393a7
/dotNetNumerical/NumericalComputation/NumericalComputation.cpp
4836c56e4a59efef0e6ced4883168c62cd0bc750
[]
no_license
umbersar/cpp
08546d2dc210dfe8b406c248eee12d0176bde74c
14d29c91fab8dd59166a63854a36018af45d8cfa
refs/heads/master
2023-07-08T05:49:27.130173
2021-08-16T06:17:03
2021-08-16T06:17:03
286,211,494
0
0
null
null
null
null
UTF-8
C++
false
false
13,130
cpp
// NumericalComputation.cpp : Defines the entry point for the console application. // #include "stdafx.h" std::map<double(*)(double), std::string> function_map; #define REGISTER_FUNCTION(f) function_map[f] = BOOST_PP_STRINGIZE(f); //4sinx-e^x=0 //solve for x=sin^-1(e^x/4) //for iterative solver using successive approximation we have to rewrite the equation to get x on the LHS double FourSinxMinusexRestructured(double x) { return asin(exp(x) / 4); } //4sinx-e^x=0 //for Newton Raphson method we DO NOT HAVE TO RESTRUCTURE the equation to x on the LHS. //FourSinxMinusexRestructured solved by successive approximation iterative solver should give same result as FourSinxMinusex solved by Newton Raphson iterative solver double FourSinxMinusex(double x) { return 4 * sin(x) - exp(x); } //x^3+12.1x^2+13.1x+22.2=0 //for Newton Raphson method we DO NOT HAVE TO RESTRUCTURE the equation to x on the LHS. //FourSinxMinusexRestructured solved by successive approximation iterative solver should give same result as FourSinxMinusex solved by Newton Raphson iterative solver double xCubeEquation(double x) { return pow(x, 3) + 12.1*pow(x, 2) + 13.1*x + 22.2; } double negativeExp(double x) { return exp(-x); } //y=(1-x^2)^.5 double OneMinusXSq(double x) { return pow((1 - pow(x, 2)), .5); } //y=1/(1+x)^.5 double OnePlusXSqrt(double x) { return 1 / pow(1 + x, .5); } //polynomial f(x) = 3x ^ 3 + 2x ^ 2 + x - 2 double polynomialFunc(double x) { return 3 * pow(x, 3) + 2 * pow(x, 2) + x - 2; } int main() { /*REGISTER_FUNCTION(negativeExp); printf("\nFunction name is: %s", function_map[negativeExp].c_str());*/ //Get the machine precision GetMachinePrecision(); printf("\n"); //initial value is a guess and generally it is safe to use 0 as initial value //this is a iterative solver using successive approximation //more efficient iterative solvers also exist like the newton-raphson method double initialValue = 0; REGISTER_FUNCTION(FourSinxMinusex); IterativeRoot(FourSinxMinusex, initialValue); printf("\n"); //calculate sin(x) where x =.25 using maclaurin series REGISTER_FUNCTION(sin); MaclaurinSeriesUsingNumericalDerivatives(sin, .25); sinxMaclaurinSeriesUsingDerivativesFromTigrometry(.25); printf("\n"); MaclaurinSeriesUsingNumericalDerivatives(sin, .45); sinxMaclaurinSeriesUsingDerivativesFromTigrometry(.45); printf("\n"); //now try maclaurin series for other functions //todo: i get correct result when i set the "Solution Platforms" to mixed platforms but start getting wrong results //when i set to x64 REGISTER_FUNCTION(negativeExp); MaclaurinSeriesUsingNumericalDerivatives(negativeExp, .2); printf("\n"); //taylor series where x0=1, f(x) is log x and we have to solve for f(x) where x is 2 REGISTER_FUNCTION(log); TaylorSeriesUsingNumericalDerivatives(log, 1, 2); printf("\n"); //todo: i get correct result when i set the "Solution Platforms" to mixed platforms but start getting wrong results //when i set to x64 REGISTER_FUNCTION(OneMinusXSq); MaclaurinSeriesUsingNumericalDerivatives(OneMinusXSq, .5); printf("\n"); //todo: i get correct result when i set the "Solution Platforms" to mixed platforms but start getting wrong results //when i set to x64 REGISTER_FUNCTION(OnePlusXSqrt); MaclaurinSeriesUsingNumericalDerivatives(OnePlusXSqrt, 1 / pow(1.4, .5)); printf("\n"); //todo: i get correct result when i set the "Solution Platforms" to mixed platforms but start getting wrong results //when i set to x64 REGISTER_FUNCTION(cos); MaclaurinSeriesUsingNumericalDerivatives(cos, 1.5); printf("\n"); //synthetic substitution can be used for solving polynomials. See the 'computational science' word doc. here we are passing the orderOfDerivative parameter set to 0. //that means just calculate the polynomial. std::vector<double> polynomialCoefficients = { 3,2,1,-2 }; double dsynsub0 = derivativeDividedByFactorialUsingSyntheticSubstitution(polynomialCoefficients, 2, 0); printf("The solution of polynomial calculated using synthetic substitution is %lf\n", dsynsub0); dsynsub0 = derivativeDividedByFactorialUsingSyntheticSubstitution(polynomialCoefficients, 3, 0); printf("The solution of polynomial calculated using synthetic substitution is %lf\n", dsynsub0); //if the function is a polynomial, then instead of numerical derivaltives, we can also use Synthetic Substitution Derivatives //this catually gives us the derivative/factorial. So to get the exact derivative value, you need to, multiply with factorial value double dsynsub1 = derivativeDividedByFactorialUsingSyntheticSubstitution(polynomialCoefficients, 2, 1) * factorial(1); double dsynsub2 = derivativeDividedByFactorialUsingSyntheticSubstitution(polynomialCoefficients, 2, 2) * factorial(2); double dsynsub3 = derivativeDividedByFactorialUsingSyntheticSubstitution(polynomialCoefficients, 2, 3) * factorial(3); //double dnum0 = derivative(polynomialFunc, 2, 0); double dnum1 = derivative(polynomialFunc, 2, 1); double dnum2 = derivative(polynomialFunc, 2, 2); double dnum3 = derivative(polynomialFunc, 2, 3); printf("The derivatives calculated using synthetic substitution are %lf, %lf and %lf\n", dsynsub1, dsynsub2, dsynsub3); printf("The derivatives calculated using numerical methods are %lf, %lf and %lf\n", dnum1, dnum2, dnum3); //taylor series where x0=2, f(x) is a polynomial f(x) = 3x^3 + 2x^2 + x - 2 and we have to solve for f(x) where x is 3 TaylorSeriesUsingSyntheticSubstitutionDerivatives(polynomialCoefficients, 2, 3); //taylor series where x0=2, f(x) is a polynomial f(x) = 3x^3 + 2x^2 + x - 2 and we have to solve for f(x) where x is 3 //polynomialFunc and polynomialCoefficients denote same polynomial REGISTER_FUNCTION(polynomialFunc); TaylorSeriesUsingNumericalDerivatives(polynomialFunc, 2, 3); printf("\n"); //similarly calculate MaclaurinSeriesUsingNumericalDerivatives and MaclaurinSeriesUsingSyntheticSubstitution //difference table. This looks something that can be used to check stability . Not sure though. //the calculation of difference table can be coded though. //for Newton Raphson method we DO NOT HAVE TO RESTRUCTURE the equation to x on the LHS. //FourSinxMinusexRestructured solved by successive approximation iterative solver should give same result as FourSinxMinusex solved by Newton Raphson iterative solver //note that the difference between Newton Raphson methods and successive approximation is that for successive approximation we restructure the function equation itself to get x on LHS //whereas for Newton Raphson method, we modify the taylor series for the function to get x on the LHS IterativeRoot(FourSinxMinusexRestructured, initialValue); IterativeRootNewtonRaphson(FourSinxMinusex, initialValue); printf("\n"); //0 as the initial guess wont each time. So here for x^3+12.1x^2+13.1x+22.2=0, iterative root could not be found using initial value 0 //but using -11, we found the root. There are ways to make educated guesses for initial values. page 299 of C.Xavier book on numerical methods explains that. IterativeRootNewtonRaphson(xCubeEquation, initialValue); IterativeRootNewtonRaphson(xCubeEquation, -11); initialValue = initialGuess(xCubeEquation); IterativeRootNewtonRaphson(xCubeEquation, initialValue); printf("\n"); //Get some code timings cpu_timer timer; initialValue = initialGuess(xCubeEquation); IterativeRootNewtonRaphson(xCubeEquation, initialValue); timer.stop(); cpu_times times = timer.elapsed(); printf("Timings for evaluating IterativeRootNewtonRaphson %s\n", timer.format().c_str()); printf("\n"); //eigen library MatrixXd m(2, 2); m(0, 0) = 3; m(1, 0) = 2.5; m(0, 1) = -1; m(1, 1) = m(1, 0) + m(0, 1); printf("The determinant using Eigen library is %lf\n", m.determinant()); std::cout << m << std::endl; printf("\n"); //matrix manipulation //case 1 int matrixRows = 3; int matrixColumns = 3; double seed = 0; double **matA; matA = Create2DimensionalMatrix(matrixRows, matrixColumns); Init2DimensionalMatrix(matA, matrixRows, matrixColumns, seed); printf("The input matrix for evaluating determinant is:\n"); printMatrix(matA, matrixRows, matrixColumns); double det = Determinant(matA, matrixRows, matrixColumns); printf("The determinant of the matrix using naive determinant method is: %lf\n", det); for (int i = 0; i < matrixRows; i++) free(matA[i]); free(matA); printf("\n"); matrixRows = 2; matrixColumns = 2; seed = 0; matA = Create2DimensionalMatrix(matrixRows, matrixColumns); Init2DimensionalMatrix(matA, matrixRows, matrixColumns, seed); printf("The input matrix for evaluating determinant is:\n"); printMatrix(matA, matrixRows, matrixColumns); det = Determinant(matA, matrixRows, matrixColumns); printf("The determinant of the matrix using naive determinant method is: %lf\n", det); for (int i = 0; i < matrixRows; i++) free(matA[i]); free(matA); printf("\n"); //do some runtime comparions between my code and eigen code for big matrix determinant calculations matrixRows = 10; matrixColumns = 10; seed = 0; matA = Create2DimensionalMatrix(matrixRows, matrixColumns); Init2DimensionalMatrix(matA, matrixRows, matrixColumns, seed); /*printf("The input matrix for evaluating determinant is:\n"); printMatrix(matA, matrixRows, matrixColumns);*/ timer.start(); printf("The determinant of the matrix using naive determinant method is: %lf\n", Determinant(matA, matrixRows, matrixColumns)); timer.stop(); times = timer.elapsed(); printf("Timings for evaluating determinant of the matrix using my code %s\n", timer.format().c_str()); for (int i = 0; i < matrixRows; i++) free(matA[i]); free(matA); printf("\n"); //eigen library //Matrix<double, 10, 10> matE; MatrixXd matE(matrixRows, matrixColumns); for (size_t i = 0; i < matrixRows; i++) { for (size_t j = 0; j < matrixColumns; j++) { matE(i, j) = matrixColumns*i + j; } } /*printf("The input matrix for evaluating determinant is:\n"); std::cout << matE << std::endl;*/ timer.start(); printf("The determinant using Eigen library is: %lf\n", matE.determinant()); timer.stop(); times = timer.elapsed(); printf("Timings for evaluating determinant of the matrix using eigen library is %s\n", timer.format().c_str()); printf("\n"); //Determinant of the matrix using pivotal condensation method. matrixRows = 3; matrixColumns = 3; seed = 1; matA = Create2DimensionalMatrix(matrixRows, matrixColumns); Init2DimensionalMatrix(matA, matrixRows, matrixColumns, seed); printf("The input matrix for evaluating determinant using pivotal condensation method is:\n"); printMatrix(matA, matrixRows, matrixColumns); det = PivotalCondensationMethod(matA, matrixRows, matrixColumns); printf("And the determinant of the matrix using pivotal condensation method is: %lf\n", det); for (int i = 0; i < matrixRows; i++) free(matA[i]); free(matA); printf("\n"); //another example of pivotal condenstion determinant evaluation matrixRows = 4; matrixColumns = 4; matA = Create2DimensionalMatrix(matrixRows, matrixColumns); double initArr[16] = { 2,4,6,8,3,1,2,1,1,2,-1,2,2,3,4,1 }; Init2DimensionalMatrix(matA, matrixRows, matrixColumns, initArr, sizeof(initArr) / sizeof(double)); printf("The input matrix for evaluating determinant using pivotal condensation method is:\n"); printMatrix(matA, matrixRows, matrixColumns); det = PivotalCondensationMethod(matA, matrixRows, matrixColumns); printf("And the determinant of the matrix using pivotal condensation method is: %lf\n", det); for (int i = 0; i < matrixRows; i++) free(matA[i]); free(matA); printf("\n"); //timing comparisonsbetween pivotal condensation determinant evaluation and my naive determinant method matrixRows = 10; matrixColumns = 10; seed = 1; matA = Create2DimensionalMatrix(matrixRows, matrixColumns); Init2DimensionalMatrix(matA, matrixRows, matrixColumns, seed); //printf("The input matrix for evaluating determinant using pivotal condensation method is:\n"); //printMatrix(matA, matrixRows, matrixColumns); timer.start(); det = PivotalCondensationMethod(matA, matrixRows, matrixColumns); timer.stop(); times = timer.elapsed(); printf("Timings for evaluating determinant of the matrix using pivotal condensation method is %s", timer.format().c_str()); printf("And the determinant of the matrix using pivotal condensation method is: %lf\n", det); printf("\n"); //reset the matrix as pivotal condensation method reduces/manipulates the matrix Init2DimensionalMatrix(matA, matrixRows, matrixColumns, seed); /*printf("The input matrix for evaluating determinant using naive determinant method is:\n"); printMatrix(matA, matrixRows, matrixColumns);*/ timer.start(); det = Determinant(matA, matrixRows, matrixColumns); timer.stop(); times = timer.elapsed(); printf("Timings for evaluating determinant of the matrix using my code %s", timer.format().c_str()); printf("And the determinant of the matrix using naive determinant method is: %lf\n", det); for (int i = 0; i < matrixRows; i++) free(matA[i]); free(matA); printf("\n"); getchar(); return 0; }
[ "ramneek.singh@csiro.au" ]
ramneek.singh@csiro.au
e3def6f0334d378434d837c58147400c4fe6b395
a66456f188ddd320615e2d6d88054f566c94069e
/src/exceptions/runtime_exception.h
58e0f36ea11cfcda7248eb02226a18c7cee38f96
[ "MIT" ]
permissive
joakimthun/stereo
a7f3198bfacea97abe6f11b8279663304047b54f
fcebb352bf0b0eb5314ad429de1abbccb43fb392
refs/heads/master
2020-04-18T00:13:48.996492
2016-10-03T20:46:11
2016-10-03T20:46:11
67,899,483
0
0
null
null
null
null
UTF-8
C++
false
false
289
h
#pragma once #include "stereo_exception.h" namespace stereo { namespace exceptions { class RuntimeException : public StereoException { public: inline RuntimeException(const std::wstring& message) : StereoException(message) {} }; } }
[ "joakimthun@gmail.com" ]
joakimthun@gmail.com
eb300bdd58e16a2a16d7211f07a5d4d2b11d19eb
eee6c9efb7ee2767188ce958b41e4a049eee19ba
/calc__relaxation__1000.h
71387ee9dcf0d8466c01282f7d75d2b3caf3f774
[]
no_license
cjfullerton/MC_glass
e618e7ed8336925911dc3f2b9a04fd44a538ed46
d554b3dcdb989bcac62cdc76f34e1e53f3736436
refs/heads/main
2023-08-10T20:17:33.480354
2021-09-24T15:26:22
2021-09-24T15:26:22
370,006,667
1
0
null
null
null
null
UTF-8
C++
false
false
759
h
#include "poly_sphere.h" #include "part_hard_spheres.h" #include "no_field.h" #include "no_boundary.h" #include "JRand_dyn.h" #include "box__neighbour_list__cell_list__HS.h" #include "box__neighbour_list__cell_list.h" #include "integrator_MC_NPT_HS.h" #include "sys_info__mean_squared_displacement.h" #include "sys_info__scattering_functions.h" #include <iostream> #include <sstream> #include <cstring> #include <string> #include <cstdlib> #include <cstdio> #include <vector> #include <unistd.h> #include <sys/stat.h> #include <sys/types.h> #define DIM 3 #define NUMBER_PARTICLES 1000 #define TEMPERATURE 1.0 #define BOX_SIZE_X 8.5 #define BOX_SIZE_Y 8.5 #define BOX_SIZE_Z 8.5 #define PB_X 1 #define PB_Y 1 #define PB_Z 1 #define DR 0.1 #define DV 0.1
[ "3920981+cjfullerton@users.noreply.github.com" ]
3920981+cjfullerton@users.noreply.github.com
12525e7e536e6c1bc4c3caa6f04e5ce496c5b90c
018f773f7165b8d9ef95a39b385ebd0cd9318448
/sycl/test-e2e/ESIMD/ext_math.cpp
47a9e7b251532166d5505606a6eb88e65989e682
[ "NCSA", "LLVM-exception", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
dm-vodopyanov/llvm
70c1a915188ef04aed03a5d248ab8d401fcbd8ae
8e0cc4b7a845df9389a1313a3e680babc4d87782
refs/heads/sycl
2023-08-30T20:55:11.736361
2023-08-04T22:42:35
2023-08-04T22:44:40
353,722,444
0
1
NOASSERTION
2023-06-19T11:10:19
2021-04-01T14:12:45
null
UTF-8
C++
false
false
17,479
cpp
//==---------------- ext_math.cpp - DPC++ ESIMD extended math test --------==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // DEFINE: %{mathflags} = %if cl_options %{/clang:-fno-fast-math%} %else %{-fno-fast-math%} // RUN: %{build} -fsycl-device-code-split=per_kernel %{mathflags} -o %t.out // RUN: %{run} %t.out // This test checks extended math operations. Combinations of // - argument type - half, float // - math function - sin, cos, ..., div_ieee, pow // - SYCL vs ESIMD APIs #include "esimd_test_utils.hpp" #include <sycl/builtins_esimd.hpp> #include <sycl/ext/intel/esimd.hpp> #include <sycl/sycl.hpp> #include <cmath> #include <iostream> using namespace sycl; using namespace sycl::ext::intel; // --- Data initialization functions // Initialization data for trigonometric functions' input. // H/w supports only limited range of sin/cos arguments with decent accuracy: // absolute error <= 0.0008 for the range of +/- 32767*pi (+/- 102941). constexpr int accuracy_limit = 32767 * 3.14 - 1; template <class T> struct InitTrig { void operator()(T *In, T *Out, size_t Size) const { for (auto I = 0; I < Size; ++I) { In[I] = (I + 1) % accuracy_limit; Out[I] = (T)0; } } }; template <class T> struct InitWide { void operator()(T *In, T *Out, size_t Size) const { for (auto I = 0; I < Size; ++I) { In[I] = I + 1.0; Out[I] = (T)0; } } }; template <class T> struct InitNarrow { void operator()(T *In, T *Out, size_t Size) const { for (auto I = 0; I < Size; ++I) { In[I] = 2.0f + 16.0f * ((T)I / (T)(Size - 1)); // in [2..18] range Out[I] = (T)0; } } }; template <class T> struct InitInRange0_5 { void operator()(T *In, T *Out, size_t Size) const { for (auto I = 0; I < Size; ++I) { In[I] = 5.0f * ((T)I / (T)(Size - 1)); // in [0..5] range Out[I] = (T)0; } } }; template <class T> struct InitBin { void operator()(T *In1, T *In2, T *Out, size_t Size) const { for (auto I = 0; I < Size; ++I) { In1[I] = I % 17 + 1; In2[I] = 4.0f * ((T)I / (T)(Size - 1)); // in [0..4] range Out[I] = (T)0; } } }; // --- Math operation identification enum class MathOp { sin, cos, exp, sqrt, sqrt_ieee, inv, log, rsqrt, floor, ceil, trunc, exp2, log2, div_ieee, pow }; // --- Template functions calculating given math operation on host and device enum ArgKind { AllVec, AllSca, Sca1Vec2, Sca2Vec1 }; template <class T, int N, MathOp Op, int Args=AllVec> struct ESIMDf; template <class T, int N, MathOp Op, int Args=AllVec> struct BinESIMDf; template <class T, int N, MathOp Op, int Args=AllVec> struct SYCLf; template <class T, MathOp Op> struct HostFunc; #define DEFINE_HOST_OP(Op, HostOp) \ template <class T> struct HostFunc<T, MathOp::Op> { \ T operator()(T X) { return HostOp; } \ }; DEFINE_HOST_OP(sin, std::sin(X)); DEFINE_HOST_OP(cos, std::cos(X)); DEFINE_HOST_OP(exp, std::exp(X)); DEFINE_HOST_OP(log, std::log(X)); DEFINE_HOST_OP(inv, 1.0f / X); DEFINE_HOST_OP(sqrt, std::sqrt(X)); DEFINE_HOST_OP(sqrt_ieee, std::sqrt(X)); DEFINE_HOST_OP(rsqrt, 1.0f / std::sqrt(X)); DEFINE_HOST_OP(floor, std::floor(X)); DEFINE_HOST_OP(ceil, std::ceil(X)); DEFINE_HOST_OP(trunc, std::trunc(X)); DEFINE_HOST_OP(exp2, std::exp2(X)); DEFINE_HOST_OP(log2, std::log2(X)); #define DEFINE_HOST_BIN_OP(Op, HostOp) \ template <class T> struct HostFunc<T, MathOp::Op> { \ T operator()(T X, T Y) { return HostOp; } \ }; DEFINE_HOST_BIN_OP(div_ieee, X / Y); DEFINE_HOST_BIN_OP(pow, std::pow(X, Y)); // --- Specializations per each extended math operation #define DEFINE_ESIMD_DEVICE_OP(Op) \ template <class T, int N> struct ESIMDf<T, N, MathOp::Op, AllVec> { \ esimd::simd<T, N> \ operator()(esimd::simd<T, N> X) const SYCL_ESIMD_FUNCTION { \ return esimd::Op<T, N>(X); \ } \ }; \ template <class T, int N> struct ESIMDf<T, N, MathOp::Op, AllSca> { \ esimd::simd<T, N> operator()(T X) const SYCL_ESIMD_FUNCTION { \ return esimd::Op<T, N>(X); \ } \ }; DEFINE_ESIMD_DEVICE_OP(sin); DEFINE_ESIMD_DEVICE_OP(cos); DEFINE_ESIMD_DEVICE_OP(exp); DEFINE_ESIMD_DEVICE_OP(log); DEFINE_ESIMD_DEVICE_OP(inv); DEFINE_ESIMD_DEVICE_OP(sqrt); DEFINE_ESIMD_DEVICE_OP(sqrt_ieee); DEFINE_ESIMD_DEVICE_OP(rsqrt); DEFINE_ESIMD_DEVICE_OP(floor); DEFINE_ESIMD_DEVICE_OP(ceil); DEFINE_ESIMD_DEVICE_OP(trunc); DEFINE_ESIMD_DEVICE_OP(exp2); DEFINE_ESIMD_DEVICE_OP(log2); #define DEFINE_ESIMD_DEVICE_BIN_OP(Op) \ template <class T, int N> struct BinESIMDf<T, N, MathOp::Op, AllSca> { \ esimd::simd<T, N> operator()(T X, T Y) const SYCL_ESIMD_FUNCTION { \ return esimd::Op<T, N>(X, Y); \ } \ }; \ template <class T, int N> struct BinESIMDf<T, N, MathOp::Op, AllVec> { \ esimd::simd<T, N> \ operator()(esimd::simd<T, N> X, \ esimd::simd<T, N> Y) const SYCL_ESIMD_FUNCTION { \ return esimd::Op<T, N>(X, Y); \ } \ }; \ template <class T, int N> struct BinESIMDf<T, N, MathOp::Op, Sca1Vec2> { \ esimd::simd<T, N> \ operator()(T X, esimd::simd<T, N> Y) const SYCL_ESIMD_FUNCTION { \ return esimd::Op<T, N>(X, Y); \ } \ }; \ template <class T, int N> struct BinESIMDf<T, N, MathOp::Op, Sca2Vec1> { \ esimd::simd<T, N> operator()(esimd::simd<T, N> X, \ T Y) const SYCL_ESIMD_FUNCTION { \ return esimd::Op<T, N>(X, Y); \ } \ }; DEFINE_ESIMD_DEVICE_BIN_OP(div_ieee); DEFINE_ESIMD_DEVICE_BIN_OP(pow); #define DEFINE_SYCL_DEVICE_OP(Op) \ template <class T, int N> struct SYCLf<T, N, MathOp::Op, AllVec> { \ esimd::simd<T, N> \ operator()(esimd::simd<T, N> X) const SYCL_ESIMD_FUNCTION { \ /* T must be float for SYCL, so not a template parameter for sycl::Op*/ \ return sycl::Op<N>(X); \ } \ }; \ template <class T, int N> struct SYCLf<T, N, MathOp::Op, AllSca> { \ esimd::simd<T, N> operator()(T X) const SYCL_ESIMD_FUNCTION { \ return sycl::Op<N>(X); \ } \ }; DEFINE_SYCL_DEVICE_OP(sin); DEFINE_SYCL_DEVICE_OP(cos); DEFINE_SYCL_DEVICE_OP(exp); DEFINE_SYCL_DEVICE_OP(log); // --- Generic kernel calculating an extended math operation on array elements template <class T, int N, MathOp Op, template <class, int, MathOp, int> class Kernel, typename AccIn, typename AccOut> struct UnaryDeviceFunc { AccIn In; AccOut Out; UnaryDeviceFunc(AccIn &In, AccOut &Out) : In(In), Out(Out) {} void operator()(id<1> I) const SYCL_ESIMD_KERNEL { unsigned int Offset = I * N * sizeof(T); esimd::simd<T, N> Vx; Vx.copy_from(In, Offset); if (I.get(0) % 2 == 0) { for (int J = 0; J < N; J++) { Kernel<T, N, Op, AllSca> DevF{}; T Val = Vx[J]; esimd::simd<T, N> V = DevF(Val); // scalar arg Vx[J] = V[J]; } } else { Kernel<T, N, Op, AllVec> DevF{}; Vx = DevF(Vx); // vector arg } Vx.copy_to(Out, Offset); }; }; template <class T, int N, MathOp Op, template <class, int, MathOp, int> class Kernel, typename AccIn, typename AccOut> struct BinaryDeviceFunc { AccIn In1; AccIn In2; AccOut Out; BinaryDeviceFunc(AccIn &In1, AccIn &In2, AccOut &Out) : In1(In1), In2(In2), Out(Out) {} void operator()(id<1> I) const SYCL_ESIMD_KERNEL { unsigned int Offset = I * N * sizeof(T); esimd::simd<T, N> V1(In1, Offset); esimd::simd<T, N> V2(In2, Offset); esimd::simd<T, N> V; if (I.get(0) % 2 == 0) { int Ind = 0; { Kernel<T, N, Op, AllSca> DevF{}; T Val2 = V2[Ind]; esimd::simd<T, N> Vv = DevF(V1[Ind], Val2); // both arguments are scalar V[Ind] = Vv[Ind]; } Ind++; { Kernel<T, N, Op, Sca1Vec2> DevF{}; T Val1 = V1[Ind]; esimd::simd<T, N> Vv = DevF(Val1, V2); // scalar, vector V[Ind] = Vv[Ind]; } Ind++; { for (int J = Ind; J < N; ++J) { Kernel<T, N, Op, Sca2Vec1> DevF{}; T Val2 = V2[J]; esimd::simd<T, N> Vv = DevF(V1, Val2); // scalar 2nd arg V[J] = Vv[J]; } } } else { Kernel<T, N, Op, AllVec> DevF{}; V = DevF(V1, V2); // vec 2nd arg } V.copy_to(Out, Offset); }; }; // --- Generic test function for an extended math operation template <class T, int N, MathOp Op, template <class, int, MathOp, int> class Kernel, typename InitF = InitNarrow<T>> bool test(queue &Q, const std::string &Name, InitF Init = InitNarrow<T>{}, float delta = 0.0f) { constexpr size_t Size = 1024 * 128; constexpr bool IsBinOp = (Op == MathOp::div_ieee) || (Op == MathOp::pow); T *A = new T[Size]; T *B = new T[Size]; T *C = new T[Size]; if constexpr (IsBinOp) { Init(A, B, C, Size); } else { Init(A, B, Size); } const char *kind = std::is_same_v<Kernel<T, N, Op, AllVec>, ESIMDf<T, N, Op, AllVec>> ? "ESIMD" : "SYCL"; std::cout << " " << Name << " test, kind=" << kind << "...\n"; try { buffer<T, 1> BufA(A, range<1>(Size)); buffer<T, 1> BufB(B, range<1>(Size)); buffer<T, 1> BufC(C, range<1>(Size)); // number of workgroups sycl::range<1> GlobalRange{Size / N}; // threads (workitems) in each workgroup sycl::range<1> LocalRange{1}; auto E = Q.submit([&](handler &CGH) { auto PA = BufA.template get_access<access::mode::read>(CGH); auto PC = BufC.template get_access<access::mode::write>(CGH); if constexpr (IsBinOp) { auto PB = BufB.template get_access<access::mode::read>(CGH); BinaryDeviceFunc<T, N, Op, Kernel, decltype(PA), decltype(PC)> F( PA, PB, PC); CGH.parallel_for(nd_range<1>{GlobalRange, LocalRange}, F); } else { UnaryDeviceFunc<T, N, Op, Kernel, decltype(PA), decltype(PC)> F(PA, PC); CGH.parallel_for(nd_range<1>{GlobalRange, LocalRange}, F); } }); E.wait(); } catch (sycl::exception &Exc) { std::cout << " *** ERROR. SYCL exception caught: << " << Exc.what() << "\n"; return false; } int ErrCnt = 0; for (unsigned I = 0; I < Size; ++I) { // functions like std::isinf/isfinite/isnan do not work correctly with // sycl::half, thus we'll use 'float' instead. using CheckT = std::conditional_t<std::is_same_v<T, sycl::half>, float, T>; CheckT Gold; if constexpr (IsBinOp) { Gold = HostFunc<T, Op>{}((T)A[I], (T)B[I]); } else { Gold = HostFunc<T, Op>{}((T)A[I]); } CheckT Test = C[I]; if (delta == 0.0f) { delta = sizeof(T) > 2 ? 0.0001 : 0.01; } bool BothFinite = std::isfinite(Test) && std::isfinite(Gold); if (BothFinite && std::abs(Test - Gold) > delta) { if (++ErrCnt < 10) { std::cout << " failed at index " << I << ", " << Test << " != " << Gold << " (gold)\n"; } } } delete[] A; delete[] B; delete[] C; if (ErrCnt > 0) { std::cout << " pass rate: " << ((float)(Size - ErrCnt) / (float)Size) * 100.0f << "% (" << (Size - ErrCnt) << "/" << Size << ")\n"; } std::cout << (ErrCnt > 0 ? " FAILED\n" : " Passed\n"); return ErrCnt == 0; } // --- Tests all extended math operations with given vector length template <class T, int N> bool testESIMD(queue &Q) { bool Pass = true; std::cout << "--- TESTING ESIMD functions, T=" << typeid(T).name() << ", N = " << N << "...\n"; Pass &= test<T, N, MathOp::sqrt, ESIMDf>(Q, "sqrt", InitWide<T>{}); Pass &= test<T, N, MathOp::inv, ESIMDf>(Q, "inv"); Pass &= test<T, N, MathOp::rsqrt, ESIMDf>(Q, "rsqrt"); Pass &= test<T, N, MathOp::sin, ESIMDf>(Q, "sin", InitTrig<T>{}); Pass &= test<T, N, MathOp::cos, ESIMDf>(Q, "cos", InitTrig<T>{}); Pass &= test<T, N, MathOp::exp, ESIMDf>(Q, "exp", InitInRange0_5<T>{}); Pass &= test<T, N, MathOp::log, ESIMDf>(Q, "log", InitWide<T>{}); Pass &= test<T, N, MathOp::exp2, ESIMDf>(Q, "exp2", InitInRange0_5<T>{}); Pass &= test<T, N, MathOp::log2, ESIMDf>(Q, "log2", InitWide<T>{}); Pass &= test<T, N, MathOp::floor, ESIMDf>(Q, "floor", InitWide<T>{}); Pass &= test<T, N, MathOp::ceil, ESIMDf>(Q, "ceil", InitWide<T>{}); Pass &= test<T, N, MathOp::trunc, ESIMDf>(Q, "trunc", InitWide<T>{}); return Pass; } template <class T, int N> bool testESIMDSqrtIEEE(queue &Q) { bool Pass = true; std::cout << "--- TESTING ESIMD sqrt_ieee, T=" << typeid(T).name() << ", N = " << N << "...\n"; Pass &= test<T, N, MathOp::sqrt_ieee, ESIMDf>(Q, "sqrt_ieee", InitWide<T>{}); return Pass; } template <class T, int N> bool testESIMDDivIEEE(queue &Q) { bool Pass = true; std::cout << "--- TESTING ESIMD div_ieee, T=" << typeid(T).name() << ", N = " << N << "...\n"; Pass &= test<T, N, MathOp::div_ieee, BinESIMDf>(Q, "div_ieee", InitBin<T>{}); return Pass; } template <class T, int N> bool testESIMDPow(queue &Q) { bool Pass = true; std::cout << "--- TESTING ESIMD pow, T=" << typeid(T).name() << ", N = " << N << "...\n"; Pass &= test<T, N, MathOp::pow, BinESIMDf>( Q, "pow", InitBin<T>{}, 0.1); return Pass; } template <class T, int N> bool testSYCL(queue &Q) { bool Pass = true; // TODO SYCL currently supports only these 4 functions, extend the test when // more are available. std::cout << "--- TESTING SYCL functions, T=" << typeid(T).name() << ", N = " << N << "...\n"; // SYCL functions will have good accuracy for any argument, unlike bare h/w // ESIMD versions, so init with "wide" data set. Pass &= test<T, N, MathOp::sin, SYCLf>(Q, "sin", InitWide<T>{}); Pass &= test<T, N, MathOp::cos, SYCLf>(Q, "cos", InitWide<T>{}); Pass &= test<T, N, MathOp::exp, SYCLf>(Q, "exp", InitInRange0_5<T>{}); Pass &= test<T, N, MathOp::log, SYCLf>(Q, "log", InitWide<T>{}); return Pass; } // --- The entry point int main(void) { queue Q(esimd_test::ESIMDSelector, esimd_test::createExceptionHandler()); auto Dev = Q.get_device(); std::cout << "Running on " << Dev.get_info<sycl::info::device::name>() << "\n"; bool Pass = true; #ifdef TEST_IEEE_DIV_REM Pass &= testESIMDSqrtIEEE<float, 16>(Q); Pass &= testESIMDDivIEEE<float, 8>(Q); if (Dev.has(sycl::aspect::fp64)) { Pass &= testESIMDSqrtIEEE<double, 32>(Q); Pass &= testESIMDDivIEEE<double, 32>(Q); } #else // !TEST_IEEE_DIV_REM Pass &= testESIMD<half, 8>(Q); Pass &= testESIMD<float, 16>(Q); Pass &= testESIMD<float, 32>(Q); if (Q.get_backend() != sycl::backend::ext_intel_esimd_emulator) { // ESIMD_EMULATOR supports only ESIMD API #ifndef TEST_FAST_MATH // TODO: GPU Driver does not yet support ffast-math versions of tested APIs. Pass &= testSYCL<float, 8>(Q); Pass &= testSYCL<float, 32>(Q); #endif } Pass &= testESIMDPow<float, 8>(Q); Pass &= testESIMDPow<half, 32>(Q); #endif // !TEST_IEEE_DIV_REM std::cout << (Pass ? "Test Passed\n" : "Test FAILED\n"); return Pass ? 0 : 1; }
[ "noreply@github.com" ]
noreply@github.com
2ad45487fc9039e9411c50a3fa4693a801e47605
86368e5fc2ca6ab93267675689c85c06540cd1dd
/CODE/LL/classic/0general.cpp
e965ed77537d3481240b693f3e6656fb8fa361cf
[]
no_license
alenthankz/Master_DSA
471e091720fff6e3b8c1e38965af73e566728ddf
131fc45211e1fe08c958f8d34674faa90c16fc8c
refs/heads/main
2023-07-28T00:01:46.291091
2021-09-08T05:39:43
2021-09-08T05:39:43
404,223,486
0
0
null
null
null
null
UTF-8
C++
false
false
1,578
cpp
#include<bits/stdc++.h> using namespace std; // push pop insert delete class Node { public: Node* next; int data; Node(int dat){ next=NULL; data=dat; } }; void push(Node ** head,int dat){ Node * tNode =new Node(dat); if((*head)==NULL){ *head =tNode; return; } tNode->next=(*head); (*head) =tNode; } void insert(Node **head,int dat){ Node *newNode =new Node(dat); if((*head)==NULL || (*head)->data<dat){ newNode->next=(*head); (*head)=newNode; return; } Node * tNode =(*head); while(tNode && tNode->next->data>dat){ tNode=tNode->next; } newNode->next=tNode->next; tNode->next=newNode; } void pop(Node **head){ Node * tNode =(*head); (*head)=(*head)->next; free (tNode); } void delette(Node * head,int dat){ if(head->data==dat){ head->data=head->next->data; Node * tNode =head->next; head->next=head->next->next; free(tNode); return ; } Node * tNode =head; while(tNode && tNode->next->data!=dat){ tNode=tNode->next; } Node * n =tNode->next; tNode->next=tNode->next->next; free(n); } void printL(Node *tNode){ while(tNode!=NULL){ cout<<tNode->data<<" "; tNode=tNode->next; } } int main(){ Node *head =NULL; push(&head,4); push(&head,6); push(&head,7); push(&head,8); push(&head,10); insert(&head,9); insert(&head,11); pop(&head); delette(head,4); printL(head); return 0; }
[ "alenthankz@gmail.com" ]
alenthankz@gmail.com
82c9cf50119c80e8bdbd24728e466a9934b0fb54
0b68953d7f9feace080fb4d80a3ab271e025852b
/problem_solving/leetcode/1905_countSubIslands_medium.cc
eaf3ddfc153c759972de6788dbaa259286ef6b80
[]
no_license
xlpiao/code
465f6b606f377919f195db2c596639ec9ccc856d
0a929107c0d145f53ec511e2f73b90d4f8cdf749
refs/heads/master
2023-06-22T19:06:24.622423
2023-06-08T13:46:34
2023-06-12T02:13:11
38,992,963
2
1
null
null
null
null
UTF-8
C++
false
false
1,593
cc
#include <iostream> #include <vector> using namespace std; class Solution { public: void dfs(vector<vector<int>>& grid1, vector<vector<int>>& grid2, int r, int c, int row, int col, int& check) { if (r < 0 || c < 0 || r >= row || c >= col || grid2[r][c] == 0) return; if (grid1[r][c] != grid2[r][c]) { check = 0; return; } grid1[r][c] = 0; grid2[r][c] = 0; dfs(grid1, grid2, r + 1, c, row, col, check); dfs(grid1, grid2, r, c + 1, row, col, check); dfs(grid1, grid2, r - 1, c, row, col, check); dfs(grid1, grid2, r, c - 1, row, col, check); } int countSubIslands(vector<vector<int>>& grid1, vector<vector<int>>& grid2) { int row = grid1.size(); int col = grid1[0].size(); int ans = 0; for (int r = 0; r < row; r++) { for (int c = 0; c < col; c++) { if (grid2[r][c] == 1) { int check = 1; dfs(grid1, grid2, r, c, row, col, check); ans += check; } } } return ans; } }; int main(void) { vector<vector<int>> grid1{{1, 1, 1, 0, 0}, {0, 1, 1, 1, 1}, {0, 0, 0, 0, 0}, {1, 0, 0, 0, 0}, {1, 1, 0, 1, 1}}; vector<vector<int>> grid2{{1, 1, 1, 0, 0}, {0, 0, 1, 1, 1}, {0, 1, 0, 0, 0}, {1, 0, 1, 1, 0}, {0, 1, 0, 1, 0}}; Solution s; auto ans = s.countSubIslands(grid1, grid2); cout << ans << endl; return 0; }
[ "lanxlpiao@gmail.com" ]
lanxlpiao@gmail.com
f2f2a3fbd11617ca259c80ea31c9cc6f89c0c5bb
e2b0fa9f1ef3db511d8044bea80e7b98448b0b7b
/Source/WinWaker/SplashDlg.h
61bcda10d21ee942397d951bfced641445d76e22
[ "Apache-2.0", "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-unknown-license-reference" ]
permissive
bingart/WinWaker
7d4f18501d31189103699e300380837a4d227921
dc3f6c067a5f215c17aa2e0c3386f92f158ec941
refs/heads/master
2021-01-21T12:46:11.053176
2017-09-26T03:41:35
2017-09-26T03:41:35
102,094,327
0
0
null
null
null
null
UTF-8
C++
false
false
506
h
#pragma once #include "pictureex.h" // CSplashDlg dialog class CSplashDlg : public CDialogEx { DECLARE_DYNAMIC(CSplashDlg) public: CSplashDlg(CWnd* pParent = NULL); // standard constructor virtual ~CSplashDlg(); // Dialog Data enum { IDD = IDD_SPLASH_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support DECLARE_MESSAGE_MAP() int m_iCount; CPictureEx m_PictureGIF; public: virtual BOOL OnInitDialog(); afx_msg void OnTimer(UINT_PTR nIDEvent); };
[ "feisun@westwin.com" ]
feisun@westwin.com
f1ff3dd2ef5d88b01fab354d66a894262d9c4a6d
4fb6ac5060727f05abd056cf9f3ee830a0734aee
/codeforces/1113C.cpp
cdc62e1c016dd70c5781a106a658ad19ad443f69
[]
no_license
booneng/competitive_programming
6141c1ab60e49ffd1ae1cf4ede018622b122ed6b
b6a39e1574c4b8b513945d6fa6e9075a4f458370
refs/heads/master
2021-04-15T12:50:59.351207
2019-07-23T08:01:06
2019-07-23T08:01:06
126,816,788
0
0
null
null
null
null
UTF-8
C++
false
false
583
cpp
#include <iostream> #include <map> #include <vector> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; map<int, long long> seen_odd; map<int, long long> seen_even; seen_odd[0]++; int x = 0; long long cnt = 0; for (int i = 0; i < n; i++) { int a; cin >> a; x ^= a; if (i % 2) { cnt += seen_odd[x]; seen_odd[x]++; } else { cnt += seen_even[x]; seen_even[x]++; } } cout << cnt; }
[ "ohbooneng@gmail.com" ]
ohbooneng@gmail.com
eda4edce9a85e2aaa8b309545fdb0f3c23b08533
385cfbb27ee3bcc219ec2ac60fa22c2aa92ed8a0
/ThirdParty/bullet-2.75/Extras/COLLADA_DOM/include/1.4/dom/domCommon_newparam_type.h
70da2346e71687a7a17b2068fc8e12e753c0935c
[ "Zlib", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-unknown", "MIT" ]
permissive
palestar/medusa
edbddf368979be774e99f74124b9c3bc7bebb2a8
7f8dc717425b5cac2315e304982993354f7cb27e
refs/heads/develop
2023-05-09T19:12:42.957288
2023-05-05T12:43:35
2023-05-05T12:43:35
59,434,337
35
18
MIT
2018-01-21T01:34:01
2016-05-22T21:05:17
C++
UTF-8
C++
false
false
15,682
h
/* * Copyright 2006 Sony Computer Entertainment Inc. * * Licensed under the SCEA Shared Source License, Version 1.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://research.scea.com/scea_shared_source_license.html * * 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 __domCommon_newparam_type_h__ #define __domCommon_newparam_type_h__ #include <dom/domTypes.h> #include <dom/domElements.h> #include <dom/domFx_surface_common.h> #include <dom/domFx_sampler2D_common.h> class domCommon_newparam_type_complexType { public: class domSemantic; typedef daeSmartRef<domSemantic> domSemanticRef; typedef daeTArray<domSemanticRef> domSemantic_Array; class domSemantic : public daeElement { public: COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::SEMANTIC; } protected: // Value /** * The xsNCName value of the text data of this element. */ xsNCName _value; public: //Accessors and Mutators /** * Gets the value of this element. * @return Returns a xsNCName of the value. */ xsNCName getValue() const { return _value; } /** * Sets the _value of this element. * @param val The new value for this element. */ void setValue( xsNCName val ) { *(daeStringRef*)&_value = val; } protected: /** * Constructor */ domSemantic() : _value() {} /** * Destructor */ virtual ~domSemantic() {} /** * Copy Constructor */ domSemantic( const domSemantic &cpy ) : daeElement() { (void)cpy; } /** * Overloaded assignment operator */ virtual domSemantic &operator=( const domSemantic &cpy ) { (void)cpy; return *this; } public: // STATIC METHODS /** * Creates an instance of this class and returns a daeElementRef referencing it. * @param bytes The size allocated for this instance. * @return a daeElementRef referencing an instance of this object. */ static DLLSPEC daeElementRef create(daeInt bytes); /** * Creates a daeMetaElement object that describes this element in the meta object reflection framework. * If a daeMetaElement already exists it will return that instead of creating a new one. * @return A daeMetaElement describing this COLLADA element. */ static DLLSPEC daeMetaElement* registerElement(); public: // STATIC MEMBERS /** * The daeMetaElement that describes this element in the meta object reflection framework. */ static DLLSPEC daeMetaElement* _Meta; }; class domFloat; typedef daeSmartRef<domFloat> domFloatRef; typedef daeTArray<domFloatRef> domFloat_Array; class domFloat : public daeElement { public: COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::FLOAT; } protected: // Value /** * The ::domFloat value of the text data of this element. */ ::domFloat _value; public: //Accessors and Mutators /** * Gets the value of this element. * @return a ::domFloat of the value. */ ::domFloat getValue() const { return _value; } /** * Sets the _value of this element. * @param val The new value for this element. */ void setValue( ::domFloat val ) { _value = val; } protected: /** * Constructor */ domFloat() : _value() {} /** * Destructor */ virtual ~domFloat() {} /** * Copy Constructor */ domFloat( const domFloat &cpy ) : daeElement() { (void)cpy; } /** * Overloaded assignment operator */ virtual domFloat &operator=( const domFloat &cpy ) { (void)cpy; return *this; } public: // STATIC METHODS /** * Creates an instance of this class and returns a daeElementRef referencing it. * @param bytes The size allocated for this instance. * @return a daeElementRef referencing an instance of this object. */ static DLLSPEC daeElementRef create(daeInt bytes); /** * Creates a daeMetaElement object that describes this element in the meta object reflection framework. * If a daeMetaElement already exists it will return that instead of creating a new one. * @return A daeMetaElement describing this COLLADA element. */ static DLLSPEC daeMetaElement* registerElement(); public: // STATIC MEMBERS /** * The daeMetaElement that describes this element in the meta object reflection framework. */ static DLLSPEC daeMetaElement* _Meta; }; class domFloat2; typedef daeSmartRef<domFloat2> domFloat2Ref; typedef daeTArray<domFloat2Ref> domFloat2_Array; class domFloat2 : public daeElement { public: COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::FLOAT2; } protected: // Value /** * The ::domFloat2 value of the text data of this element. */ ::domFloat2 _value; public: //Accessors and Mutators /** * Gets the _value array. * @return Returns a ::domFloat2 reference of the _value array. */ ::domFloat2 &getValue() { return _value; } /** * Gets the _value array. * @return Returns a constant ::domFloat2 reference of the _value array. */ const ::domFloat2 &getValue() const { return _value; } /** * Sets the _value array. * @param val The new value for the _value array. */ void setValue( const ::domFloat2 &val ) { _value = val; } protected: /** * Constructor */ domFloat2() : _value() {} /** * Destructor */ virtual ~domFloat2() {} /** * Copy Constructor */ domFloat2( const domFloat2 &cpy ) : daeElement() { (void)cpy; } /** * Overloaded assignment operator */ virtual domFloat2 &operator=( const domFloat2 &cpy ) { (void)cpy; return *this; } public: // STATIC METHODS /** * Creates an instance of this class and returns a daeElementRef referencing it. * @param bytes The size allocated for this instance. * @return a daeElementRef referencing an instance of this object. */ static DLLSPEC daeElementRef create(daeInt bytes); /** * Creates a daeMetaElement object that describes this element in the meta object reflection framework. * If a daeMetaElement already exists it will return that instead of creating a new one. * @return A daeMetaElement describing this COLLADA element. */ static DLLSPEC daeMetaElement* registerElement(); public: // STATIC MEMBERS /** * The daeMetaElement that describes this element in the meta object reflection framework. */ static DLLSPEC daeMetaElement* _Meta; }; class domFloat3; typedef daeSmartRef<domFloat3> domFloat3Ref; typedef daeTArray<domFloat3Ref> domFloat3_Array; class domFloat3 : public daeElement { public: COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::FLOAT3; } protected: // Value /** * The ::domFloat3 value of the text data of this element. */ ::domFloat3 _value; public: //Accessors and Mutators /** * Gets the _value array. * @return Returns a ::domFloat3 reference of the _value array. */ ::domFloat3 &getValue() { return _value; } /** * Gets the _value array. * @return Returns a constant ::domFloat3 reference of the _value array. */ const ::domFloat3 &getValue() const { return _value; } /** * Sets the _value array. * @param val The new value for the _value array. */ void setValue( const ::domFloat3 &val ) { _value = val; } protected: /** * Constructor */ domFloat3() : _value() {} /** * Destructor */ virtual ~domFloat3() {} /** * Copy Constructor */ domFloat3( const domFloat3 &cpy ) : daeElement() { (void)cpy; } /** * Overloaded assignment operator */ virtual domFloat3 &operator=( const domFloat3 &cpy ) { (void)cpy; return *this; } public: // STATIC METHODS /** * Creates an instance of this class and returns a daeElementRef referencing it. * @param bytes The size allocated for this instance. * @return a daeElementRef referencing an instance of this object. */ static DLLSPEC daeElementRef create(daeInt bytes); /** * Creates a daeMetaElement object that describes this element in the meta object reflection framework. * If a daeMetaElement already exists it will return that instead of creating a new one. * @return A daeMetaElement describing this COLLADA element. */ static DLLSPEC daeMetaElement* registerElement(); public: // STATIC MEMBERS /** * The daeMetaElement that describes this element in the meta object reflection framework. */ static DLLSPEC daeMetaElement* _Meta; }; class domFloat4; typedef daeSmartRef<domFloat4> domFloat4Ref; typedef daeTArray<domFloat4Ref> domFloat4_Array; class domFloat4 : public daeElement { public: COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::FLOAT4; } protected: // Value /** * The ::domFloat4 value of the text data of this element. */ ::domFloat4 _value; public: //Accessors and Mutators /** * Gets the _value array. * @return Returns a ::domFloat4 reference of the _value array. */ ::domFloat4 &getValue() { return _value; } /** * Gets the _value array. * @return Returns a constant ::domFloat4 reference of the _value array. */ const ::domFloat4 &getValue() const { return _value; } /** * Sets the _value array. * @param val The new value for the _value array. */ void setValue( const ::domFloat4 &val ) { _value = val; } protected: /** * Constructor */ domFloat4() : _value() {} /** * Destructor */ virtual ~domFloat4() {} /** * Copy Constructor */ domFloat4( const domFloat4 &cpy ) : daeElement() { (void)cpy; } /** * Overloaded assignment operator */ virtual domFloat4 &operator=( const domFloat4 &cpy ) { (void)cpy; return *this; } public: // STATIC METHODS /** * Creates an instance of this class and returns a daeElementRef referencing it. * @param bytes The size allocated for this instance. * @return a daeElementRef referencing an instance of this object. */ static DLLSPEC daeElementRef create(daeInt bytes); /** * Creates a daeMetaElement object that describes this element in the meta object reflection framework. * If a daeMetaElement already exists it will return that instead of creating a new one. * @return A daeMetaElement describing this COLLADA element. */ static DLLSPEC daeMetaElement* registerElement(); public: // STATIC MEMBERS /** * The daeMetaElement that describes this element in the meta object reflection framework. */ static DLLSPEC daeMetaElement* _Meta; }; protected: // Attribute /** * The sid attribute is a text string value containing the sub-identifier * of this element. This value must be unique within the scope of the parent * element. Optional attribute. */ xsNCName attrSid; protected: // Elements domSemanticRef elemSemantic; domFloatRef elemFloat; domFloat2Ref elemFloat2; domFloat3Ref elemFloat3; domFloat4Ref elemFloat4; domFx_surface_commonRef elemSurface; domFx_sampler2D_commonRef elemSampler2D; /** * Used to preserve order in elements that do not specify strict sequencing of sub-elements. */ daeElementRefArray _contents; /** * Used to preserve order in elements that have a complex content model. */ daeUIntArray _contentsOrder; public: //Accessors and Mutators /** * Gets the sid attribute. * @return Returns a xsNCName of the sid attribute. */ xsNCName getSid() const { return attrSid; } /** * Sets the sid attribute. * @param atSid The new value for the sid attribute. */ void setSid( xsNCName atSid ) { *(daeStringRef*)&attrSid = atSid; } /** * Gets the semantic element. * @return a daeSmartRef to the semantic element. */ const domSemanticRef getSemantic() const { return elemSemantic; } /** * Gets the float element. * @return a daeSmartRef to the float element. */ const domFloatRef getFloat() const { return elemFloat; } /** * Gets the float2 element. * @return a daeSmartRef to the float2 element. */ const domFloat2Ref getFloat2() const { return elemFloat2; } /** * Gets the float3 element. * @return a daeSmartRef to the float3 element. */ const domFloat3Ref getFloat3() const { return elemFloat3; } /** * Gets the float4 element. * @return a daeSmartRef to the float4 element. */ const domFloat4Ref getFloat4() const { return elemFloat4; } /** * Gets the surface element. * @return a daeSmartRef to the surface element. */ const domFx_surface_commonRef getSurface() const { return elemSurface; } /** * Gets the sampler2D element. * @return a daeSmartRef to the sampler2D element. */ const domFx_sampler2D_commonRef getSampler2D() const { return elemSampler2D; } /** * Gets the _contents array. * @return Returns a reference to the _contents element array. */ daeElementRefArray &getContents() { return _contents; } /** * Gets the _contents array. * @return Returns a constant reference to the _contents element array. */ const daeElementRefArray &getContents() const { return _contents; } protected: /** * Constructor */ domCommon_newparam_type_complexType() : attrSid(), elemSemantic(), elemFloat(), elemFloat2(), elemFloat3(), elemFloat4(), elemSurface(), elemSampler2D() {} /** * Destructor */ virtual ~domCommon_newparam_type_complexType() {} /** * Copy Constructor */ domCommon_newparam_type_complexType( const domCommon_newparam_type_complexType &cpy ) { (void)cpy; } /** * Overloaded assignment operator */ virtual domCommon_newparam_type_complexType &operator=( const domCommon_newparam_type_complexType &cpy ) { (void)cpy; return *this; } }; /** * An element of type domCommon_newparam_type_complexType. */ class domCommon_newparam_type : public daeElement, public domCommon_newparam_type_complexType { public: COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::COMMON_NEWPARAM_TYPE; } public: //Accessors and Mutators /** * Gets the sid attribute. * @return Returns a xsNCName of the sid attribute. */ xsNCName getSid() const { return attrSid; } /** * Sets the sid attribute. * @param atSid The new value for the sid attribute. */ void setSid( xsNCName atSid ) { *(daeStringRef*)&attrSid = atSid; _validAttributeArray[0] = true; } protected: /** * Constructor */ domCommon_newparam_type() {} /** * Destructor */ virtual ~domCommon_newparam_type() {} /** * Copy Constructor */ domCommon_newparam_type( const domCommon_newparam_type &cpy ) : daeElement(), domCommon_newparam_type_complexType() { (void)cpy; } /** * Overloaded assignment operator */ virtual domCommon_newparam_type &operator=( const domCommon_newparam_type &cpy ) { (void)cpy; return *this; } public: // STATIC METHODS /** * Creates an instance of this class and returns a daeElementRef referencing it. * @param bytes The size allocated for this instance. * @return a daeElementRef referencing an instance of this object. */ static DLLSPEC daeElementRef create(daeInt bytes); /** * Creates a daeMetaElement object that describes this element in the meta object reflection framework. * If a daeMetaElement already exists it will return that instead of creating a new one. * @return A daeMetaElement describing this COLLADA element. */ static DLLSPEC daeMetaElement* registerElement(); public: // STATIC MEMBERS /** * The daeMetaElement that describes this element in the meta object reflection framework. */ static DLLSPEC daeMetaElement* _Meta; }; #endif
[ "rlyle@palestar.com" ]
rlyle@palestar.com
75e86a5931dad6fd222b21da6cd07d9c24df8708
ec521fca9985e18b09a0403cca88b1c8baba2deb
/Sandbox/src/Sandbox2D.cpp
20c2444c975d902d77e63a7742ddbaac8b3e48f1
[]
no_license
clemb01/ClemEngine
bd2ccd383a6d1a5408a6e59e17c1ff929b997ec8
de2d9a7f4593fc9aefba5cedb2cff16d5a663169
refs/heads/master
2023-04-04T04:00:19.709581
2021-04-20T06:57:38
2021-04-20T06:57:38
313,054,965
1
0
null
null
null
null
UTF-8
C++
false
false
2,396
cpp
#include "Sandbox2D.h" #include "imgui/imgui.h" #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> Sandbox2D::Sandbox2D() : Layer("Sandbox2D"), m_CameraController(1280.0f / 720.0f) { } void Sandbox2D::OnAttach() { CE_PROFILE_FUNCTION(); m_CheckerboardTexture = ClemEngine::Texture2D::Create("assets/textures/Checkerboard.png"); } void Sandbox2D::OnDetach() { CE_PROFILE_FUNCTION(); } void Sandbox2D::OnUpdate(ClemEngine::Timestep ts) { CE_PROFILE_FUNCTION(); m_CameraController.OnUpdate(ts); ClemEngine::Renderer2D::ResetStats(); { CE_PROFILE_SCOPE("Renderer Prep"); ClemEngine::RenderCommand::SetClearColor({ 0.1f, 0.1f, 0.1f, 1 }); ClemEngine::RenderCommand::Clear(); } { static float rotation = 0.0f; rotation += ts * 50.0f; CE_PROFILE_SCOPE("Renderer Draw"); ClemEngine::Renderer2D::BeginScene(m_CameraController.GetCamera()); ClemEngine::Renderer2D::DrawRotatedQuad({ 1.0f, 0.0f }, { 0.8f, 0.8f }, glm::radians(rotation), { 0.8f, 0.2f, 0.3f, 1.0f }); ClemEngine::Renderer2D::DrawQuad({ -1.0f, 0.0f }, { 0.8f, 0.8f }, { 0.8f, 0.2f, 0.3f, 1.0f }); ClemEngine::Renderer2D::DrawQuad({ 0.5f, -0.5f }, { 0.5f, 0.75f }, m_TintColor); ClemEngine::Renderer2D::DrawQuad({ 0.0f, 0.0f, -0.1f }, { 20.0f, 20.0f }, m_CheckerboardTexture, 10.0f); ClemEngine::Renderer2D::DrawRotatedQuad({ -2.0f, 0.0f, 0.0f }, { 1.0f, 1.0f }, glm::radians(rotation), m_CheckerboardTexture, 10.0f); ClemEngine::Renderer2D::EndScene(); ClemEngine::Renderer2D::BeginScene(m_CameraController.GetCamera()); for (float y = -5.0f; y <= 5.0f; y += 0.5f) { for (float x = -5.0f; x <= 5.0f; x += 0.5f) { glm::vec4 color = { (x + 5.0f) / 10.0f, 0.4f, (y + 5.0f) / 10.0f, 0.7f }; ClemEngine::Renderer2D::DrawQuad({ x, y }, { 0.45f, 0.45f }, color); } } ClemEngine::Renderer2D::EndScene(); } } void Sandbox2D::OnImGuiRender() { CE_PROFILE_FUNCTION(); ImGui::Begin("Settings"); auto stats = ClemEngine::Renderer2D::GetStats(); ImGui::Text("Renderer2D Stats:"); ImGui::Text("Draw Calls %d", stats.DrawCalls); ImGui::Text("Quads %d", stats.QuadCount); ImGui::Text("Vertices %d", stats.GetTotalVertexCount()); ImGui::Text("Indices %d", stats.GetTotalIndexCount()); ImGui::ColorEdit4("Square Color", glm::value_ptr(m_TintColor)); ImGui::End(); } void Sandbox2D::OnEvent(ClemEngine::Event& e) { m_CameraController.OnEvent(e); }
[ "coladaitp19-bcl@ccicampus.fr" ]
coladaitp19-bcl@ccicampus.fr
3582e8f3cd5f13c516a877be58e71eb05cd54690
57d1d62e1a10282e8d4faa42e937c486102ebf04
/judges/codeforces/done/1294a.cpp
64773b28c9041947499355d538924ef84ee84d40
[]
no_license
diegoximenes/icpc
91a32a599824241247a8cc57a2618563f433d6ea
8c7ee69cc4a1f3514dddc0e7ae37e9fba0be8401
refs/heads/master
2022-10-12T11:47:10.706794
2022-09-24T04:03:31
2022-09-24T04:03:31
178,573,955
0
0
null
null
null
null
UTF-8
C++
false
false
832
cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fast_io ios::sync_with_stdio(false) #define pb push_back #define mp make_pair #define fi first #define se second const int INF = 0x3f3f3f3f; const ll INFLL = 0x3f3f3f3f3f3f3f3fLL; const double PI = acos(-1); const double EPS = 1e-9; inline int cmp_double(double x, double y, double tol = EPS) { // (x < y): -1, (x == y): 0, (x > y): 1 return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1; } int main() { int t; scanf("%d", &t); while (t--) { int a, b, c, n; scanf("%d %d %d %d", &a, &b, &c, &n); int div = (a + b + c + n) / 3; if ((a + b + c + n) % 3 == 0 && a <= div && b <= div && c <= div) { printf("YES\n"); } else { printf("NO\n"); } } return 0; }
[ "dxmendes1@gmail.com" ]
dxmendes1@gmail.com
5aa490de866368ef5ccedb36e939857ed6818c01
a74af4b480bf2962dc8ec6e4bca793fed7c7a2ab
/Remove-Specify-Items-master/Svn/Server/game/src/char.h
644c8552186b878191dd2cc08ac1cbc971ac56d2
[]
no_license
Bobo199/Metin2
50c372d0f99fe37741e1c8826342898451f10ae7
43e90898df54ad201011b3bd8a6fec63cdb6a842
refs/heads/master
2022-11-14T21:20:04.196159
2020-06-28T15:39:14
2020-06-28T15:39:14
275,601,572
2
0
null
2020-06-28T15:34:35
2020-06-28T14:27:03
C++
UTF-8
C++
false
false
140
h
//Find void RemoveSpecifyItem(DWORD vnum, DWORD count = 1); ///Add bool RemoveSpecifyItems(std::set<DWORD> _ilist, int count);
[ "noreply@github.com" ]
noreply@github.com
4a2925e6e113daba8cac3429341642f62f109e30
3fedacdc9a43f35609cafa4715c0b098c609c325
/HackerRank/DownToZeroII/DownToZeroII.cpp
d2e4c08d822ad71c556110aeb47b24a9fc0a759c
[]
no_license
codecameo/ProblemSolved
7f7fc5ce9829cde4bcb239da6c0893852e370d2c
77fe538c76276319bc40ad98f77b59072d6368a0
refs/heads/master
2020-03-14T22:03:30.851199
2018-07-13T14:16:19
2018-07-13T14:16:19
131,319,185
0
0
null
null
null
null
UTF-8
C++
false
false
1,080
cpp
#include <iostream> #include <queue> #include <stdio.h> #include <algorithm> #include <math.h> using namespace std; /* * Complete the downToZero function below. */ vector<int> divisor[1000001]; int steps[1000001] = {0}; void getPrimes(){ divisor[0].push_back(0); divisor[1].push_back(1); for(int i=2;i<=1000000;i++){ for(int j=i; j<=1000000; j+=i){ divisor[j].push_back(i); } } } void getSteps(){ steps[0] = 0; steps[1] = 1; steps[2] = 2; steps[3] = 3; for(int i=4;i<1000001;i++){ int x = 1000001; for(int j=0;j<divisor[i].size()-1;j++){ if((long int)divisor[i][j]*divisor[i][j]>(long int)i) break; int y = steps[i/divisor[i][j]]; x = min(x, y); } x = min(x, steps[i-1]); steps[i]=x+1; } } int main(){ getPrimes(); getSteps(); int q; cin >> q; for (int q_itr = 0; q_itr < q; q_itr++) { int n; cin >> n; int result = steps[n]; cout << result << "\n"; } return 0; }
[ "codecameo92@gmail.com" ]
codecameo92@gmail.com
2e2a02580d40e9fe178cf12d77f8fcfe68fb090a
c67cbd22f9bc3c465fd763fdf87172f2c8ec77d4
/Desktop/Please Work/build/Android/Preview/app/src/main/include/Fuse.Physics.Spring.h
909f31cf557df9014049256743ca09697efa378e
[]
no_license
AzazelMoreno/Soteria-project
7c58896d6bf5a9ad919bde6ddc2a30f4a07fa0d4
04fdb71065941176867fb9007ecf38bbf851ad47
refs/heads/master
2020-03-11T16:33:22.153713
2018-04-19T19:47:55
2018-04-19T19:47:55
130,120,337
0
0
null
null
null
null
UTF-8
C++
false
false
2,097
h
// This file was generated based on C:/Users/rudy0/AppData/Local/Fusetools/Packages/Fuse.Physics/1.8.1/Spring.uno. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Fuse.Behavior.h> #include <Fuse.Binding.h> #include <Fuse.INotifyUnrooted.h> #include <Fuse.IProperties.h> #include <Fuse.Physics.IRule.h> #include <Fuse.Scripting.IScriptObject.h> #include <Uno.Collections.ICollection-1.h> #include <Uno.Collections.IEnumerable-1.h> #include <Uno.Collections.IList-1.h> namespace g{namespace Fuse{namespace Physics{struct Body;}}} namespace g{namespace Fuse{namespace Physics{struct Spring;}}} namespace g{namespace Fuse{namespace Physics{struct World;}}} namespace g{namespace Fuse{struct Visual;}} namespace g{ namespace Fuse{ namespace Physics{ // public sealed class Spring :7 // { struct Spring_type : ::g::Fuse::Node_type { ::g::Fuse::Physics::IRule interface6; }; Spring_type* Spring_typeof(); void Spring__ctor_3_fn(Spring* __this); void Spring__FusePhysicsIRuleUpdate_fn(Spring* __this, double* deltaTime, ::g::Fuse::Physics::World* world); void Spring__get_Length_fn(Spring* __this, float* __retval); void Spring__set_Length_fn(Spring* __this, float* value); void Spring__New2_fn(Spring** __retval); void Spring__OnRooted_fn(Spring* __this); void Spring__OnUnrooted_fn(Spring* __this); void Spring__get_Stiffness_fn(Spring* __this, float* __retval); void Spring__set_Stiffness_fn(Spring* __this, float* value); void Spring__get_Target_fn(Spring* __this, ::g::Fuse::Visual** __retval); void Spring__set_Target_fn(Spring* __this, ::g::Fuse::Visual* value); struct Spring : ::g::Fuse::Behavior { uStrong< ::g::Fuse::Visual*> _target; uStrong< ::g::Fuse::Physics::Body*> _targetBody; float _length; float _stiffness; uStrong< ::g::Fuse::Physics::Body*> _body; void ctor_3(); float Length(); void Length(float value); float Stiffness(); void Stiffness(float value); ::g::Fuse::Visual* Target(); void Target(::g::Fuse::Visual* value); static Spring* New2(); }; // } }}} // ::g::Fuse::Physics
[ "rudy0604594@gmail.com" ]
rudy0604594@gmail.com
6262c1e99fa666abce66afbdd47b24ce0819f76d
c776476e9d06b3779d744641e758ac3a2c15cddc
/examples/litmus/c/run-scripts/tmp_5/MP+dmb.sy+ctrl-addr-[fr-rf]-addr-rfi.c.cbmc_out.cpp
07fa5ff4e90bd2e7e310838cc26fa7cae2c945cf
[]
no_license
ashutosh0gupta/llvm_bmc
aaac7961c723ba6f7ffd77a39559e0e52432eade
0287c4fb180244e6b3c599a9902507f05c8a7234
refs/heads/master
2023-08-02T17:14:06.178723
2023-07-31T10:46:53
2023-07-31T10:46:53
143,100,825
3
4
null
2023-05-25T05:50:55
2018-08-01T03:47:00
C++
UTF-8
C++
false
false
64,001
cpp
// Global variabls: // 0:vars:4 // 7:atom_1_X11_1:1 // 4:atom_1_X0_1:1 // 5:atom_1_X5_0:1 // 6:atom_1_X7_1:1 // Local global variabls: // 0:thr0:1 // 1:thr1:1 // 2:thr2:1 #define ADDRSIZE 8 #define LOCALADDRSIZE 3 #define NTHREAD 4 #define NCONTEXT 5 #define ASSUME(stmt) __CPROVER_assume(stmt) #define ASSERT(stmt) __CPROVER_assert(stmt, "error") #define max(a,b) (a>b?a:b) char __get_rng(); char get_rng( char from, char to ) { char ret = __get_rng(); ASSUME(ret >= from && ret <= to); return ret; } char get_rng_th( char from, char to ) { char ret = __get_rng(); ASSUME(ret >= from && ret <= to); return ret; } int main(int argc, char **argv) { // Declare arrays for intial value version in contexts int local_mem[LOCALADDRSIZE]; // Dumping initializations local_mem[0+0] = 0; local_mem[1+0] = 0; local_mem[2+0] = 0; int cstart[NTHREAD]; int creturn[NTHREAD]; // declare arrays for contexts activity int active[NCONTEXT]; int ctx_used[NCONTEXT]; // declare arrays for intial value version in contexts int meminit_[ADDRSIZE*NCONTEXT]; #define meminit(x,k) meminit_[(x)*NCONTEXT+k] int coinit_[ADDRSIZE*NCONTEXT]; #define coinit(x,k) coinit_[(x)*NCONTEXT+k] int deltainit_[ADDRSIZE*NCONTEXT]; #define deltainit(x,k) deltainit_[(x)*NCONTEXT+k] // declare arrays for running value version in contexts int mem_[ADDRSIZE*NCONTEXT]; #define mem(x,k) mem_[(x)*NCONTEXT+k] int co_[ADDRSIZE*NCONTEXT]; #define co(x,k) co_[(x)*NCONTEXT+k] int delta_[ADDRSIZE*NCONTEXT]; #define delta(x,k) delta_[(x)*NCONTEXT+k] // declare arrays for local buffer and observed writes int buff_[NTHREAD*ADDRSIZE]; #define buff(x,k) buff_[(x)*ADDRSIZE+k] int pw_[NTHREAD*ADDRSIZE]; #define pw(x,k) pw_[(x)*ADDRSIZE+k] // declare arrays for context stamps char cr_[NTHREAD*ADDRSIZE]; #define cr(x,k) cr_[(x)*ADDRSIZE+k] char iw_[NTHREAD*ADDRSIZE]; #define iw(x,k) iw_[(x)*ADDRSIZE+k] char cw_[NTHREAD*ADDRSIZE]; #define cw(x,k) cw_[(x)*ADDRSIZE+k] char cx_[NTHREAD*ADDRSIZE]; #define cx(x,k) cx_[(x)*ADDRSIZE+k] char is_[NTHREAD*ADDRSIZE]; #define is(x,k) is_[(x)*ADDRSIZE+k] char cs_[NTHREAD*ADDRSIZE]; #define cs(x,k) cs_[(x)*ADDRSIZE+k] char crmax_[NTHREAD*ADDRSIZE]; #define crmax(x,k) crmax_[(x)*ADDRSIZE+k] char sforbid_[ADDRSIZE*NCONTEXT]; #define sforbid(x,k) sforbid_[(x)*NCONTEXT+k] // declare arrays for synchronizations int cl[NTHREAD]; int cdy[NTHREAD]; int cds[NTHREAD]; int cdl[NTHREAD]; int cisb[NTHREAD]; int caddr[NTHREAD]; int cctrl[NTHREAD]; int r0= 0; char creg_r0; char creg__r0__0_; int r1= 0; char creg_r1; int r2= 0; char creg_r2; int r3= 0; char creg_r3; int r4= 0; char creg_r4; int r5= 0; char creg_r5; int r6= 0; char creg_r6; int r7= 0; char creg_r7; int r8= 0; char creg_r8; int r9= 0; char creg_r9; int r10= 0; char creg_r10; char creg__r0__1_; char creg__r5__0_; char creg__r6__1_; char creg__r10__1_; int r11= 0; char creg_r11; int r12= 0; char creg_r12; int r13= 0; char creg_r13; int r14= 0; char creg_r14; int r15= 0; char creg_r15; char creg__r15__1_; int r16= 0; char creg_r16; char creg__r16__2_; int r17= 0; char creg_r17; char creg__r17__1_; int r18= 0; char creg_r18; int r19= 0; char creg_r19; int r20= 0; char creg_r20; int r21= 0; char creg_r21; int r22= 0; char creg_r22; int r23= 0; char creg_r23; int r24= 0; char creg_r24; int r25= 0; char creg_r25; int r26= 0; char creg_r26; int r27= 0; char creg_r27; char creg__r27__1_; int r28= 0; char creg_r28; char old_cctrl= 0; char old_cr= 0; char old_cdy= 0; char old_cw= 0; char new_creg= 0; buff(0,0) = 0; pw(0,0) = 0; cr(0,0) = 0; iw(0,0) = 0; cw(0,0) = 0; cx(0,0) = 0; is(0,0) = 0; cs(0,0) = 0; crmax(0,0) = 0; buff(0,1) = 0; pw(0,1) = 0; cr(0,1) = 0; iw(0,1) = 0; cw(0,1) = 0; cx(0,1) = 0; is(0,1) = 0; cs(0,1) = 0; crmax(0,1) = 0; buff(0,2) = 0; pw(0,2) = 0; cr(0,2) = 0; iw(0,2) = 0; cw(0,2) = 0; cx(0,2) = 0; is(0,2) = 0; cs(0,2) = 0; crmax(0,2) = 0; buff(0,3) = 0; pw(0,3) = 0; cr(0,3) = 0; iw(0,3) = 0; cw(0,3) = 0; cx(0,3) = 0; is(0,3) = 0; cs(0,3) = 0; crmax(0,3) = 0; buff(0,4) = 0; pw(0,4) = 0; cr(0,4) = 0; iw(0,4) = 0; cw(0,4) = 0; cx(0,4) = 0; is(0,4) = 0; cs(0,4) = 0; crmax(0,4) = 0; buff(0,5) = 0; pw(0,5) = 0; cr(0,5) = 0; iw(0,5) = 0; cw(0,5) = 0; cx(0,5) = 0; is(0,5) = 0; cs(0,5) = 0; crmax(0,5) = 0; buff(0,6) = 0; pw(0,6) = 0; cr(0,6) = 0; iw(0,6) = 0; cw(0,6) = 0; cx(0,6) = 0; is(0,6) = 0; cs(0,6) = 0; crmax(0,6) = 0; buff(0,7) = 0; pw(0,7) = 0; cr(0,7) = 0; iw(0,7) = 0; cw(0,7) = 0; cx(0,7) = 0; is(0,7) = 0; cs(0,7) = 0; crmax(0,7) = 0; cl[0] = 0; cdy[0] = 0; cds[0] = 0; cdl[0] = 0; cisb[0] = 0; caddr[0] = 0; cctrl[0] = 0; cstart[0] = get_rng(0,NCONTEXT-1); creturn[0] = get_rng(0,NCONTEXT-1); buff(1,0) = 0; pw(1,0) = 0; cr(1,0) = 0; iw(1,0) = 0; cw(1,0) = 0; cx(1,0) = 0; is(1,0) = 0; cs(1,0) = 0; crmax(1,0) = 0; buff(1,1) = 0; pw(1,1) = 0; cr(1,1) = 0; iw(1,1) = 0; cw(1,1) = 0; cx(1,1) = 0; is(1,1) = 0; cs(1,1) = 0; crmax(1,1) = 0; buff(1,2) = 0; pw(1,2) = 0; cr(1,2) = 0; iw(1,2) = 0; cw(1,2) = 0; cx(1,2) = 0; is(1,2) = 0; cs(1,2) = 0; crmax(1,2) = 0; buff(1,3) = 0; pw(1,3) = 0; cr(1,3) = 0; iw(1,3) = 0; cw(1,3) = 0; cx(1,3) = 0; is(1,3) = 0; cs(1,3) = 0; crmax(1,3) = 0; buff(1,4) = 0; pw(1,4) = 0; cr(1,4) = 0; iw(1,4) = 0; cw(1,4) = 0; cx(1,4) = 0; is(1,4) = 0; cs(1,4) = 0; crmax(1,4) = 0; buff(1,5) = 0; pw(1,5) = 0; cr(1,5) = 0; iw(1,5) = 0; cw(1,5) = 0; cx(1,5) = 0; is(1,5) = 0; cs(1,5) = 0; crmax(1,5) = 0; buff(1,6) = 0; pw(1,6) = 0; cr(1,6) = 0; iw(1,6) = 0; cw(1,6) = 0; cx(1,6) = 0; is(1,6) = 0; cs(1,6) = 0; crmax(1,6) = 0; buff(1,7) = 0; pw(1,7) = 0; cr(1,7) = 0; iw(1,7) = 0; cw(1,7) = 0; cx(1,7) = 0; is(1,7) = 0; cs(1,7) = 0; crmax(1,7) = 0; cl[1] = 0; cdy[1] = 0; cds[1] = 0; cdl[1] = 0; cisb[1] = 0; caddr[1] = 0; cctrl[1] = 0; cstart[1] = get_rng(0,NCONTEXT-1); creturn[1] = get_rng(0,NCONTEXT-1); buff(2,0) = 0; pw(2,0) = 0; cr(2,0) = 0; iw(2,0) = 0; cw(2,0) = 0; cx(2,0) = 0; is(2,0) = 0; cs(2,0) = 0; crmax(2,0) = 0; buff(2,1) = 0; pw(2,1) = 0; cr(2,1) = 0; iw(2,1) = 0; cw(2,1) = 0; cx(2,1) = 0; is(2,1) = 0; cs(2,1) = 0; crmax(2,1) = 0; buff(2,2) = 0; pw(2,2) = 0; cr(2,2) = 0; iw(2,2) = 0; cw(2,2) = 0; cx(2,2) = 0; is(2,2) = 0; cs(2,2) = 0; crmax(2,2) = 0; buff(2,3) = 0; pw(2,3) = 0; cr(2,3) = 0; iw(2,3) = 0; cw(2,3) = 0; cx(2,3) = 0; is(2,3) = 0; cs(2,3) = 0; crmax(2,3) = 0; buff(2,4) = 0; pw(2,4) = 0; cr(2,4) = 0; iw(2,4) = 0; cw(2,4) = 0; cx(2,4) = 0; is(2,4) = 0; cs(2,4) = 0; crmax(2,4) = 0; buff(2,5) = 0; pw(2,5) = 0; cr(2,5) = 0; iw(2,5) = 0; cw(2,5) = 0; cx(2,5) = 0; is(2,5) = 0; cs(2,5) = 0; crmax(2,5) = 0; buff(2,6) = 0; pw(2,6) = 0; cr(2,6) = 0; iw(2,6) = 0; cw(2,6) = 0; cx(2,6) = 0; is(2,6) = 0; cs(2,6) = 0; crmax(2,6) = 0; buff(2,7) = 0; pw(2,7) = 0; cr(2,7) = 0; iw(2,7) = 0; cw(2,7) = 0; cx(2,7) = 0; is(2,7) = 0; cs(2,7) = 0; crmax(2,7) = 0; cl[2] = 0; cdy[2] = 0; cds[2] = 0; cdl[2] = 0; cisb[2] = 0; caddr[2] = 0; cctrl[2] = 0; cstart[2] = get_rng(0,NCONTEXT-1); creturn[2] = get_rng(0,NCONTEXT-1); buff(3,0) = 0; pw(3,0) = 0; cr(3,0) = 0; iw(3,0) = 0; cw(3,0) = 0; cx(3,0) = 0; is(3,0) = 0; cs(3,0) = 0; crmax(3,0) = 0; buff(3,1) = 0; pw(3,1) = 0; cr(3,1) = 0; iw(3,1) = 0; cw(3,1) = 0; cx(3,1) = 0; is(3,1) = 0; cs(3,1) = 0; crmax(3,1) = 0; buff(3,2) = 0; pw(3,2) = 0; cr(3,2) = 0; iw(3,2) = 0; cw(3,2) = 0; cx(3,2) = 0; is(3,2) = 0; cs(3,2) = 0; crmax(3,2) = 0; buff(3,3) = 0; pw(3,3) = 0; cr(3,3) = 0; iw(3,3) = 0; cw(3,3) = 0; cx(3,3) = 0; is(3,3) = 0; cs(3,3) = 0; crmax(3,3) = 0; buff(3,4) = 0; pw(3,4) = 0; cr(3,4) = 0; iw(3,4) = 0; cw(3,4) = 0; cx(3,4) = 0; is(3,4) = 0; cs(3,4) = 0; crmax(3,4) = 0; buff(3,5) = 0; pw(3,5) = 0; cr(3,5) = 0; iw(3,5) = 0; cw(3,5) = 0; cx(3,5) = 0; is(3,5) = 0; cs(3,5) = 0; crmax(3,5) = 0; buff(3,6) = 0; pw(3,6) = 0; cr(3,6) = 0; iw(3,6) = 0; cw(3,6) = 0; cx(3,6) = 0; is(3,6) = 0; cs(3,6) = 0; crmax(3,6) = 0; buff(3,7) = 0; pw(3,7) = 0; cr(3,7) = 0; iw(3,7) = 0; cw(3,7) = 0; cx(3,7) = 0; is(3,7) = 0; cs(3,7) = 0; crmax(3,7) = 0; cl[3] = 0; cdy[3] = 0; cds[3] = 0; cdl[3] = 0; cisb[3] = 0; caddr[3] = 0; cctrl[3] = 0; cstart[3] = get_rng(0,NCONTEXT-1); creturn[3] = get_rng(0,NCONTEXT-1); // Dumping initializations mem(0+0,0) = 0; mem(0+1,0) = 0; mem(0+2,0) = 0; mem(0+3,0) = 0; mem(7+0,0) = 0; mem(4+0,0) = 0; mem(5+0,0) = 0; mem(6+0,0) = 0; // Dumping context matching equalities co(0,0) = 0; delta(0,0) = -1; mem(0,1) = meminit(0,1); co(0,1) = coinit(0,1); delta(0,1) = deltainit(0,1); mem(0,2) = meminit(0,2); co(0,2) = coinit(0,2); delta(0,2) = deltainit(0,2); mem(0,3) = meminit(0,3); co(0,3) = coinit(0,3); delta(0,3) = deltainit(0,3); mem(0,4) = meminit(0,4); co(0,4) = coinit(0,4); delta(0,4) = deltainit(0,4); co(1,0) = 0; delta(1,0) = -1; mem(1,1) = meminit(1,1); co(1,1) = coinit(1,1); delta(1,1) = deltainit(1,1); mem(1,2) = meminit(1,2); co(1,2) = coinit(1,2); delta(1,2) = deltainit(1,2); mem(1,3) = meminit(1,3); co(1,3) = coinit(1,3); delta(1,3) = deltainit(1,3); mem(1,4) = meminit(1,4); co(1,4) = coinit(1,4); delta(1,4) = deltainit(1,4); co(2,0) = 0; delta(2,0) = -1; mem(2,1) = meminit(2,1); co(2,1) = coinit(2,1); delta(2,1) = deltainit(2,1); mem(2,2) = meminit(2,2); co(2,2) = coinit(2,2); delta(2,2) = deltainit(2,2); mem(2,3) = meminit(2,3); co(2,3) = coinit(2,3); delta(2,3) = deltainit(2,3); mem(2,4) = meminit(2,4); co(2,4) = coinit(2,4); delta(2,4) = deltainit(2,4); co(3,0) = 0; delta(3,0) = -1; mem(3,1) = meminit(3,1); co(3,1) = coinit(3,1); delta(3,1) = deltainit(3,1); mem(3,2) = meminit(3,2); co(3,2) = coinit(3,2); delta(3,2) = deltainit(3,2); mem(3,3) = meminit(3,3); co(3,3) = coinit(3,3); delta(3,3) = deltainit(3,3); mem(3,4) = meminit(3,4); co(3,4) = coinit(3,4); delta(3,4) = deltainit(3,4); co(4,0) = 0; delta(4,0) = -1; mem(4,1) = meminit(4,1); co(4,1) = coinit(4,1); delta(4,1) = deltainit(4,1); mem(4,2) = meminit(4,2); co(4,2) = coinit(4,2); delta(4,2) = deltainit(4,2); mem(4,3) = meminit(4,3); co(4,3) = coinit(4,3); delta(4,3) = deltainit(4,3); mem(4,4) = meminit(4,4); co(4,4) = coinit(4,4); delta(4,4) = deltainit(4,4); co(5,0) = 0; delta(5,0) = -1; mem(5,1) = meminit(5,1); co(5,1) = coinit(5,1); delta(5,1) = deltainit(5,1); mem(5,2) = meminit(5,2); co(5,2) = coinit(5,2); delta(5,2) = deltainit(5,2); mem(5,3) = meminit(5,3); co(5,3) = coinit(5,3); delta(5,3) = deltainit(5,3); mem(5,4) = meminit(5,4); co(5,4) = coinit(5,4); delta(5,4) = deltainit(5,4); co(6,0) = 0; delta(6,0) = -1; mem(6,1) = meminit(6,1); co(6,1) = coinit(6,1); delta(6,1) = deltainit(6,1); mem(6,2) = meminit(6,2); co(6,2) = coinit(6,2); delta(6,2) = deltainit(6,2); mem(6,3) = meminit(6,3); co(6,3) = coinit(6,3); delta(6,3) = deltainit(6,3); mem(6,4) = meminit(6,4); co(6,4) = coinit(6,4); delta(6,4) = deltainit(6,4); co(7,0) = 0; delta(7,0) = -1; mem(7,1) = meminit(7,1); co(7,1) = coinit(7,1); delta(7,1) = deltainit(7,1); mem(7,2) = meminit(7,2); co(7,2) = coinit(7,2); delta(7,2) = deltainit(7,2); mem(7,3) = meminit(7,3); co(7,3) = coinit(7,3); delta(7,3) = deltainit(7,3); mem(7,4) = meminit(7,4); co(7,4) = coinit(7,4); delta(7,4) = deltainit(7,4); // Dumping thread 1 int ret_thread_1 = 0; cdy[1] = get_rng(0,NCONTEXT-1); ASSUME(cdy[1] >= cstart[1]); T1BLOCK0: // call void @llvm.dbg.value(metadata i8* %arg, metadata !40, metadata !DIExpression()), !dbg !49 // br label %label_1, !dbg !50 goto T1BLOCK1; T1BLOCK1: // call void @llvm.dbg.label(metadata !48), !dbg !51 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0), metadata !41, metadata !DIExpression()), !dbg !52 // call void @llvm.dbg.value(metadata i64 2, metadata !44, metadata !DIExpression()), !dbg !52 // store atomic i64 2, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !53 // ST: Guess iw(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW _l22_c3 old_cw = cw(1,0); cw(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM _l22_c3 // Check ASSUME(active[iw(1,0)] == 1); ASSUME(active[cw(1,0)] == 1); ASSUME(sforbid(0,cw(1,0))== 0); ASSUME(iw(1,0) >= 0); ASSUME(iw(1,0) >= 0); ASSUME(cw(1,0) >= iw(1,0)); ASSUME(cw(1,0) >= old_cw); ASSUME(cw(1,0) >= cr(1,0)); ASSUME(cw(1,0) >= cl[1]); ASSUME(cw(1,0) >= cisb[1]); ASSUME(cw(1,0) >= cdy[1]); ASSUME(cw(1,0) >= cdl[1]); ASSUME(cw(1,0) >= cds[1]); ASSUME(cw(1,0) >= cctrl[1]); ASSUME(cw(1,0) >= caddr[1]); // Update caddr[1] = max(caddr[1],0); buff(1,0) = 2; mem(0,cw(1,0)) = 2; co(0,cw(1,0))+=1; delta(0,cw(1,0)) = -1; ASSUME(creturn[1] >= cw(1,0)); // call void (...) @dmbsy(), !dbg !54 // dumbsy: Guess old_cdy = cdy[1]; cdy[1] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[1] >= old_cdy); ASSUME(cdy[1] >= cisb[1]); ASSUME(cdy[1] >= cdl[1]); ASSUME(cdy[1] >= cds[1]); ASSUME(cdy[1] >= cctrl[1]); ASSUME(cdy[1] >= cw(1,0+0)); ASSUME(cdy[1] >= cw(1,0+1)); ASSUME(cdy[1] >= cw(1,0+2)); ASSUME(cdy[1] >= cw(1,0+3)); ASSUME(cdy[1] >= cw(1,7+0)); ASSUME(cdy[1] >= cw(1,4+0)); ASSUME(cdy[1] >= cw(1,5+0)); ASSUME(cdy[1] >= cw(1,6+0)); ASSUME(cdy[1] >= cr(1,0+0)); ASSUME(cdy[1] >= cr(1,0+1)); ASSUME(cdy[1] >= cr(1,0+2)); ASSUME(cdy[1] >= cr(1,0+3)); ASSUME(cdy[1] >= cr(1,7+0)); ASSUME(cdy[1] >= cr(1,4+0)); ASSUME(cdy[1] >= cr(1,5+0)); ASSUME(cdy[1] >= cr(1,6+0)); ASSUME(creturn[1] >= cdy[1]); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1), metadata !45, metadata !DIExpression()), !dbg !55 // call void @llvm.dbg.value(metadata i64 1, metadata !47, metadata !DIExpression()), !dbg !55 // store atomic i64 1, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !56 // ST: Guess iw(1,0+1*1) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW _l24_c3 old_cw = cw(1,0+1*1); cw(1,0+1*1) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM _l24_c3 // Check ASSUME(active[iw(1,0+1*1)] == 1); ASSUME(active[cw(1,0+1*1)] == 1); ASSUME(sforbid(0+1*1,cw(1,0+1*1))== 0); ASSUME(iw(1,0+1*1) >= 0); ASSUME(iw(1,0+1*1) >= 0); ASSUME(cw(1,0+1*1) >= iw(1,0+1*1)); ASSUME(cw(1,0+1*1) >= old_cw); ASSUME(cw(1,0+1*1) >= cr(1,0+1*1)); ASSUME(cw(1,0+1*1) >= cl[1]); ASSUME(cw(1,0+1*1) >= cisb[1]); ASSUME(cw(1,0+1*1) >= cdy[1]); ASSUME(cw(1,0+1*1) >= cdl[1]); ASSUME(cw(1,0+1*1) >= cds[1]); ASSUME(cw(1,0+1*1) >= cctrl[1]); ASSUME(cw(1,0+1*1) >= caddr[1]); // Update caddr[1] = max(caddr[1],0); buff(1,0+1*1) = 1; mem(0+1*1,cw(1,0+1*1)) = 1; co(0+1*1,cw(1,0+1*1))+=1; delta(0+1*1,cw(1,0+1*1)) = -1; ASSUME(creturn[1] >= cw(1,0+1*1)); // ret i8* null, !dbg !57 ret_thread_1 = (- 1); goto T1BLOCK_END; T1BLOCK_END: // Dumping thread 2 int ret_thread_2 = 0; cdy[2] = get_rng(0,NCONTEXT-1); ASSUME(cdy[2] >= cstart[2]); T2BLOCK0: // call void @llvm.dbg.value(metadata i8* %arg, metadata !60, metadata !DIExpression()), !dbg !92 // br label %label_2, !dbg !74 goto T2BLOCK1; T2BLOCK1: // call void @llvm.dbg.label(metadata !90), !dbg !94 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1), metadata !62, metadata !DIExpression()), !dbg !95 // %0 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !77 // LD: Guess old_cr = cr(2,0+1*1); cr(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM _l30_c15 // Check ASSUME(active[cr(2,0+1*1)] == 2); ASSUME(cr(2,0+1*1) >= iw(2,0+1*1)); ASSUME(cr(2,0+1*1) >= 0); ASSUME(cr(2,0+1*1) >= cdy[2]); ASSUME(cr(2,0+1*1) >= cisb[2]); ASSUME(cr(2,0+1*1) >= cdl[2]); ASSUME(cr(2,0+1*1) >= cl[2]); // Update creg_r0 = cr(2,0+1*1); crmax(2,0+1*1) = max(crmax(2,0+1*1),cr(2,0+1*1)); caddr[2] = max(caddr[2],0); if(cr(2,0+1*1) < cw(2,0+1*1)) { r0 = buff(2,0+1*1); ASSUME((!(( (cw(2,0+1*1) < 1) && (1 < crmax(2,0+1*1)) )))||(sforbid(0+1*1,1)> 0)); ASSUME((!(( (cw(2,0+1*1) < 2) && (2 < crmax(2,0+1*1)) )))||(sforbid(0+1*1,2)> 0)); ASSUME((!(( (cw(2,0+1*1) < 3) && (3 < crmax(2,0+1*1)) )))||(sforbid(0+1*1,3)> 0)); ASSUME((!(( (cw(2,0+1*1) < 4) && (4 < crmax(2,0+1*1)) )))||(sforbid(0+1*1,4)> 0)); } else { if(pw(2,0+1*1) != co(0+1*1,cr(2,0+1*1))) { ASSUME(cr(2,0+1*1) >= old_cr); } pw(2,0+1*1) = co(0+1*1,cr(2,0+1*1)); r0 = mem(0+1*1,cr(2,0+1*1)); } ASSUME(creturn[2] >= cr(2,0+1*1)); // call void @llvm.dbg.value(metadata i64 %0, metadata !64, metadata !DIExpression()), !dbg !95 // %conv = trunc i64 %0 to i32, !dbg !78 // call void @llvm.dbg.value(metadata i32 %conv, metadata !61, metadata !DIExpression()), !dbg !92 // %tobool = icmp ne i32 %conv, 0, !dbg !79 creg__r0__0_ = max(0,creg_r0); // br i1 %tobool, label %if.then, label %if.else, !dbg !81 old_cctrl = cctrl[2]; cctrl[2] = get_rng(0,NCONTEXT-1); ASSUME(cctrl[2] >= old_cctrl); ASSUME(cctrl[2] >= creg__r0__0_); if((r0!=0)) { goto T2BLOCK2; } else { goto T2BLOCK3; } T2BLOCK2: // br label %lbl_LC00, !dbg !82 goto T2BLOCK4; T2BLOCK3: // br label %lbl_LC00, !dbg !83 goto T2BLOCK4; T2BLOCK4: // call void @llvm.dbg.label(metadata !91), !dbg !103 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 2), metadata !66, metadata !DIExpression()), !dbg !104 // %1 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 2) monotonic, align 8, !dbg !86 // LD: Guess old_cr = cr(2,0+2*1); cr(2,0+2*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM _l33_c15 // Check ASSUME(active[cr(2,0+2*1)] == 2); ASSUME(cr(2,0+2*1) >= iw(2,0+2*1)); ASSUME(cr(2,0+2*1) >= 0); ASSUME(cr(2,0+2*1) >= cdy[2]); ASSUME(cr(2,0+2*1) >= cisb[2]); ASSUME(cr(2,0+2*1) >= cdl[2]); ASSUME(cr(2,0+2*1) >= cl[2]); // Update creg_r1 = cr(2,0+2*1); crmax(2,0+2*1) = max(crmax(2,0+2*1),cr(2,0+2*1)); caddr[2] = max(caddr[2],0); if(cr(2,0+2*1) < cw(2,0+2*1)) { r1 = buff(2,0+2*1); ASSUME((!(( (cw(2,0+2*1) < 1) && (1 < crmax(2,0+2*1)) )))||(sforbid(0+2*1,1)> 0)); ASSUME((!(( (cw(2,0+2*1) < 2) && (2 < crmax(2,0+2*1)) )))||(sforbid(0+2*1,2)> 0)); ASSUME((!(( (cw(2,0+2*1) < 3) && (3 < crmax(2,0+2*1)) )))||(sforbid(0+2*1,3)> 0)); ASSUME((!(( (cw(2,0+2*1) < 4) && (4 < crmax(2,0+2*1)) )))||(sforbid(0+2*1,4)> 0)); } else { if(pw(2,0+2*1) != co(0+2*1,cr(2,0+2*1))) { ASSUME(cr(2,0+2*1) >= old_cr); } pw(2,0+2*1) = co(0+2*1,cr(2,0+2*1)); r1 = mem(0+2*1,cr(2,0+2*1)); } ASSUME(creturn[2] >= cr(2,0+2*1)); // call void @llvm.dbg.value(metadata i64 %1, metadata !68, metadata !DIExpression()), !dbg !104 // %conv4 = trunc i64 %1 to i32, !dbg !87 // call void @llvm.dbg.value(metadata i32 %conv4, metadata !65, metadata !DIExpression()), !dbg !92 // %xor = xor i32 %conv4, %conv4, !dbg !88 creg_r2 = creg_r1; r2 = r1 ^ r1; // call void @llvm.dbg.value(metadata i32 %xor, metadata !69, metadata !DIExpression()), !dbg !92 // %add = add nsw i32 3, %xor, !dbg !89 creg_r3 = max(0,creg_r2); r3 = 3 + r2; // %idxprom = sext i32 %add to i64, !dbg !89 // %arrayidx = getelementptr inbounds [4 x i64], [4 x i64]* @vars, i64 0, i64 %idxprom, !dbg !89 r4 = 0+r3*1; creg_r4 = creg_r3; // call void @llvm.dbg.value(metadata i64* %arrayidx, metadata !71, metadata !DIExpression()), !dbg !109 // %2 = load atomic i64, i64* %arrayidx monotonic, align 8, !dbg !89 // LD: Guess old_cr = cr(2,r4); cr(2,r4) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM _l35_c16 // Check ASSUME(active[cr(2,r4)] == 2); ASSUME(cr(2,r4) >= iw(2,r4)); ASSUME(cr(2,r4) >= creg_r4); ASSUME(cr(2,r4) >= cdy[2]); ASSUME(cr(2,r4) >= cisb[2]); ASSUME(cr(2,r4) >= cdl[2]); ASSUME(cr(2,r4) >= cl[2]); // Update creg_r5 = cr(2,r4); crmax(2,r4) = max(crmax(2,r4),cr(2,r4)); caddr[2] = max(caddr[2],creg_r4); if(cr(2,r4) < cw(2,r4)) { r5 = buff(2,r4); ASSUME((!(( (cw(2,r4) < 1) && (1 < crmax(2,r4)) )))||(sforbid(r4,1)> 0)); ASSUME((!(( (cw(2,r4) < 2) && (2 < crmax(2,r4)) )))||(sforbid(r4,2)> 0)); ASSUME((!(( (cw(2,r4) < 3) && (3 < crmax(2,r4)) )))||(sforbid(r4,3)> 0)); ASSUME((!(( (cw(2,r4) < 4) && (4 < crmax(2,r4)) )))||(sforbid(r4,4)> 0)); } else { if(pw(2,r4) != co(r4,cr(2,r4))) { ASSUME(cr(2,r4) >= old_cr); } pw(2,r4) = co(r4,cr(2,r4)); r5 = mem(r4,cr(2,r4)); } ASSUME(creturn[2] >= cr(2,r4)); // call void @llvm.dbg.value(metadata i64 %2, metadata !73, metadata !DIExpression()), !dbg !109 // %conv8 = trunc i64 %2 to i32, !dbg !91 // call void @llvm.dbg.value(metadata i32 %conv8, metadata !70, metadata !DIExpression()), !dbg !92 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 3), metadata !75, metadata !DIExpression()), !dbg !111 // %3 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 3) monotonic, align 8, !dbg !93 // LD: Guess old_cr = cr(2,0+3*1); cr(2,0+3*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM _l36_c16 // Check ASSUME(active[cr(2,0+3*1)] == 2); ASSUME(cr(2,0+3*1) >= iw(2,0+3*1)); ASSUME(cr(2,0+3*1) >= 0); ASSUME(cr(2,0+3*1) >= cdy[2]); ASSUME(cr(2,0+3*1) >= cisb[2]); ASSUME(cr(2,0+3*1) >= cdl[2]); ASSUME(cr(2,0+3*1) >= cl[2]); // Update creg_r6 = cr(2,0+3*1); crmax(2,0+3*1) = max(crmax(2,0+3*1),cr(2,0+3*1)); caddr[2] = max(caddr[2],0); if(cr(2,0+3*1) < cw(2,0+3*1)) { r6 = buff(2,0+3*1); ASSUME((!(( (cw(2,0+3*1) < 1) && (1 < crmax(2,0+3*1)) )))||(sforbid(0+3*1,1)> 0)); ASSUME((!(( (cw(2,0+3*1) < 2) && (2 < crmax(2,0+3*1)) )))||(sforbid(0+3*1,2)> 0)); ASSUME((!(( (cw(2,0+3*1) < 3) && (3 < crmax(2,0+3*1)) )))||(sforbid(0+3*1,3)> 0)); ASSUME((!(( (cw(2,0+3*1) < 4) && (4 < crmax(2,0+3*1)) )))||(sforbid(0+3*1,4)> 0)); } else { if(pw(2,0+3*1) != co(0+3*1,cr(2,0+3*1))) { ASSUME(cr(2,0+3*1) >= old_cr); } pw(2,0+3*1) = co(0+3*1,cr(2,0+3*1)); r6 = mem(0+3*1,cr(2,0+3*1)); } ASSUME(creturn[2] >= cr(2,0+3*1)); // call void @llvm.dbg.value(metadata i64 %3, metadata !77, metadata !DIExpression()), !dbg !111 // %conv12 = trunc i64 %3 to i32, !dbg !94 // call void @llvm.dbg.value(metadata i32 %conv12, metadata !74, metadata !DIExpression()), !dbg !92 // %xor13 = xor i32 %conv12, %conv12, !dbg !95 creg_r7 = creg_r6; r7 = r6 ^ r6; // call void @llvm.dbg.value(metadata i32 %xor13, metadata !78, metadata !DIExpression()), !dbg !92 // %add14 = add nsw i32 0, %xor13, !dbg !96 creg_r8 = max(0,creg_r7); r8 = 0 + r7; // %idxprom15 = sext i32 %add14 to i64, !dbg !96 // %arrayidx16 = getelementptr inbounds [4 x i64], [4 x i64]* @vars, i64 0, i64 %idxprom15, !dbg !96 r9 = 0+r8*1; creg_r9 = creg_r8; // call void @llvm.dbg.value(metadata i64* %arrayidx16, metadata !79, metadata !DIExpression()), !dbg !116 // call void @llvm.dbg.value(metadata i64 1, metadata !81, metadata !DIExpression()), !dbg !116 // store atomic i64 1, i64* %arrayidx16 monotonic, align 8, !dbg !96 // ST: Guess iw(2,r9) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW _l38_c3 old_cw = cw(2,r9); cw(2,r9) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM _l38_c3 // Check ASSUME(active[iw(2,r9)] == 2); ASSUME(active[cw(2,r9)] == 2); ASSUME(sforbid(r9,cw(2,r9))== 0); ASSUME(iw(2,r9) >= 0); ASSUME(iw(2,r9) >= creg_r9); ASSUME(cw(2,r9) >= iw(2,r9)); ASSUME(cw(2,r9) >= old_cw); ASSUME(cw(2,r9) >= cr(2,r9)); ASSUME(cw(2,r9) >= cl[2]); ASSUME(cw(2,r9) >= cisb[2]); ASSUME(cw(2,r9) >= cdy[2]); ASSUME(cw(2,r9) >= cdl[2]); ASSUME(cw(2,r9) >= cds[2]); ASSUME(cw(2,r9) >= cctrl[2]); ASSUME(cw(2,r9) >= caddr[2]); // Update caddr[2] = max(caddr[2],creg_r9); buff(2,r9) = 1; mem(r9,cw(2,r9)) = 1; co(r9,cw(2,r9))+=1; delta(r9,cw(2,r9)) = -1; ASSUME(creturn[2] >= cw(2,r9)); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0), metadata !83, metadata !DIExpression()), !dbg !117 // %4 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !99 // LD: Guess old_cr = cr(2,0); cr(2,0) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM _l39_c17 // Check ASSUME(active[cr(2,0)] == 2); ASSUME(cr(2,0) >= iw(2,0)); ASSUME(cr(2,0) >= 0); ASSUME(cr(2,0) >= cdy[2]); ASSUME(cr(2,0) >= cisb[2]); ASSUME(cr(2,0) >= cdl[2]); ASSUME(cr(2,0) >= cl[2]); // Update creg_r10 = cr(2,0); crmax(2,0) = max(crmax(2,0),cr(2,0)); caddr[2] = max(caddr[2],0); if(cr(2,0) < cw(2,0)) { r10 = buff(2,0); ASSUME((!(( (cw(2,0) < 1) && (1 < crmax(2,0)) )))||(sforbid(0,1)> 0)); ASSUME((!(( (cw(2,0) < 2) && (2 < crmax(2,0)) )))||(sforbid(0,2)> 0)); ASSUME((!(( (cw(2,0) < 3) && (3 < crmax(2,0)) )))||(sforbid(0,3)> 0)); ASSUME((!(( (cw(2,0) < 4) && (4 < crmax(2,0)) )))||(sforbid(0,4)> 0)); } else { if(pw(2,0) != co(0,cr(2,0))) { ASSUME(cr(2,0) >= old_cr); } pw(2,0) = co(0,cr(2,0)); r10 = mem(0,cr(2,0)); } ASSUME(creturn[2] >= cr(2,0)); // call void @llvm.dbg.value(metadata i64 %4, metadata !85, metadata !DIExpression()), !dbg !117 // %conv20 = trunc i64 %4 to i32, !dbg !100 // call void @llvm.dbg.value(metadata i32 %conv20, metadata !82, metadata !DIExpression()), !dbg !92 // %cmp = icmp eq i32 %conv, 1, !dbg !101 creg__r0__1_ = max(0,creg_r0); // %conv21 = zext i1 %cmp to i32, !dbg !101 // call void @llvm.dbg.value(metadata i32 %conv21, metadata !86, metadata !DIExpression()), !dbg !92 // store i32 %conv21, i32* @atom_1_X0_1, align 4, !dbg !102, !tbaa !103 // ST: Guess iw(2,4) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW _l41_c15 old_cw = cw(2,4); cw(2,4) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM _l41_c15 // Check ASSUME(active[iw(2,4)] == 2); ASSUME(active[cw(2,4)] == 2); ASSUME(sforbid(4,cw(2,4))== 0); ASSUME(iw(2,4) >= creg__r0__1_); ASSUME(iw(2,4) >= 0); ASSUME(cw(2,4) >= iw(2,4)); ASSUME(cw(2,4) >= old_cw); ASSUME(cw(2,4) >= cr(2,4)); ASSUME(cw(2,4) >= cl[2]); ASSUME(cw(2,4) >= cisb[2]); ASSUME(cw(2,4) >= cdy[2]); ASSUME(cw(2,4) >= cdl[2]); ASSUME(cw(2,4) >= cds[2]); ASSUME(cw(2,4) >= cctrl[2]); ASSUME(cw(2,4) >= caddr[2]); // Update caddr[2] = max(caddr[2],0); buff(2,4) = (r0==1); mem(4,cw(2,4)) = (r0==1); co(4,cw(2,4))+=1; delta(4,cw(2,4)) = -1; ASSUME(creturn[2] >= cw(2,4)); // %cmp22 = icmp eq i32 %conv8, 0, !dbg !107 creg__r5__0_ = max(0,creg_r5); // %conv23 = zext i1 %cmp22 to i32, !dbg !107 // call void @llvm.dbg.value(metadata i32 %conv23, metadata !87, metadata !DIExpression()), !dbg !92 // store i32 %conv23, i32* @atom_1_X5_0, align 4, !dbg !108, !tbaa !103 // ST: Guess iw(2,5) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW _l43_c15 old_cw = cw(2,5); cw(2,5) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM _l43_c15 // Check ASSUME(active[iw(2,5)] == 2); ASSUME(active[cw(2,5)] == 2); ASSUME(sforbid(5,cw(2,5))== 0); ASSUME(iw(2,5) >= creg__r5__0_); ASSUME(iw(2,5) >= 0); ASSUME(cw(2,5) >= iw(2,5)); ASSUME(cw(2,5) >= old_cw); ASSUME(cw(2,5) >= cr(2,5)); ASSUME(cw(2,5) >= cl[2]); ASSUME(cw(2,5) >= cisb[2]); ASSUME(cw(2,5) >= cdy[2]); ASSUME(cw(2,5) >= cdl[2]); ASSUME(cw(2,5) >= cds[2]); ASSUME(cw(2,5) >= cctrl[2]); ASSUME(cw(2,5) >= caddr[2]); // Update caddr[2] = max(caddr[2],0); buff(2,5) = (r5==0); mem(5,cw(2,5)) = (r5==0); co(5,cw(2,5))+=1; delta(5,cw(2,5)) = -1; ASSUME(creturn[2] >= cw(2,5)); // %cmp24 = icmp eq i32 %conv12, 1, !dbg !109 creg__r6__1_ = max(0,creg_r6); // %conv25 = zext i1 %cmp24 to i32, !dbg !109 // call void @llvm.dbg.value(metadata i32 %conv25, metadata !88, metadata !DIExpression()), !dbg !92 // store i32 %conv25, i32* @atom_1_X7_1, align 4, !dbg !110, !tbaa !103 // ST: Guess iw(2,6) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW _l45_c15 old_cw = cw(2,6); cw(2,6) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM _l45_c15 // Check ASSUME(active[iw(2,6)] == 2); ASSUME(active[cw(2,6)] == 2); ASSUME(sforbid(6,cw(2,6))== 0); ASSUME(iw(2,6) >= creg__r6__1_); ASSUME(iw(2,6) >= 0); ASSUME(cw(2,6) >= iw(2,6)); ASSUME(cw(2,6) >= old_cw); ASSUME(cw(2,6) >= cr(2,6)); ASSUME(cw(2,6) >= cl[2]); ASSUME(cw(2,6) >= cisb[2]); ASSUME(cw(2,6) >= cdy[2]); ASSUME(cw(2,6) >= cdl[2]); ASSUME(cw(2,6) >= cds[2]); ASSUME(cw(2,6) >= cctrl[2]); ASSUME(cw(2,6) >= caddr[2]); // Update caddr[2] = max(caddr[2],0); buff(2,6) = (r6==1); mem(6,cw(2,6)) = (r6==1); co(6,cw(2,6))+=1; delta(6,cw(2,6)) = -1; ASSUME(creturn[2] >= cw(2,6)); // %cmp26 = icmp eq i32 %conv20, 1, !dbg !111 creg__r10__1_ = max(0,creg_r10); // %conv27 = zext i1 %cmp26 to i32, !dbg !111 // call void @llvm.dbg.value(metadata i32 %conv27, metadata !89, metadata !DIExpression()), !dbg !92 // store i32 %conv27, i32* @atom_1_X11_1, align 4, !dbg !112, !tbaa !103 // ST: Guess iw(2,7) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW _l47_c16 old_cw = cw(2,7); cw(2,7) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM _l47_c16 // Check ASSUME(active[iw(2,7)] == 2); ASSUME(active[cw(2,7)] == 2); ASSUME(sforbid(7,cw(2,7))== 0); ASSUME(iw(2,7) >= creg__r10__1_); ASSUME(iw(2,7) >= 0); ASSUME(cw(2,7) >= iw(2,7)); ASSUME(cw(2,7) >= old_cw); ASSUME(cw(2,7) >= cr(2,7)); ASSUME(cw(2,7) >= cl[2]); ASSUME(cw(2,7) >= cisb[2]); ASSUME(cw(2,7) >= cdy[2]); ASSUME(cw(2,7) >= cdl[2]); ASSUME(cw(2,7) >= cds[2]); ASSUME(cw(2,7) >= cctrl[2]); ASSUME(cw(2,7) >= caddr[2]); // Update caddr[2] = max(caddr[2],0); buff(2,7) = (r10==1); mem(7,cw(2,7)) = (r10==1); co(7,cw(2,7))+=1; delta(7,cw(2,7)) = -1; ASSUME(creturn[2] >= cw(2,7)); // ret i8* null, !dbg !113 ret_thread_2 = (- 1); goto T2BLOCK_END; T2BLOCK_END: // Dumping thread 3 int ret_thread_3 = 0; cdy[3] = get_rng(0,NCONTEXT-1); ASSUME(cdy[3] >= cstart[3]); T3BLOCK0: // call void @llvm.dbg.value(metadata i8* %arg, metadata !135, metadata !DIExpression()), !dbg !140 // br label %label_3, !dbg !47 goto T3BLOCK1; T3BLOCK1: // call void @llvm.dbg.label(metadata !139), !dbg !142 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 3), metadata !136, metadata !DIExpression()), !dbg !143 // call void @llvm.dbg.value(metadata i64 1, metadata !138, metadata !DIExpression()), !dbg !143 // store atomic i64 1, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 3) monotonic, align 8, !dbg !50 // ST: Guess iw(3,0+3*1) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STIW _l53_c3 old_cw = cw(3,0+3*1); cw(3,0+3*1) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STCOM _l53_c3 // Check ASSUME(active[iw(3,0+3*1)] == 3); ASSUME(active[cw(3,0+3*1)] == 3); ASSUME(sforbid(0+3*1,cw(3,0+3*1))== 0); ASSUME(iw(3,0+3*1) >= 0); ASSUME(iw(3,0+3*1) >= 0); ASSUME(cw(3,0+3*1) >= iw(3,0+3*1)); ASSUME(cw(3,0+3*1) >= old_cw); ASSUME(cw(3,0+3*1) >= cr(3,0+3*1)); ASSUME(cw(3,0+3*1) >= cl[3]); ASSUME(cw(3,0+3*1) >= cisb[3]); ASSUME(cw(3,0+3*1) >= cdy[3]); ASSUME(cw(3,0+3*1) >= cdl[3]); ASSUME(cw(3,0+3*1) >= cds[3]); ASSUME(cw(3,0+3*1) >= cctrl[3]); ASSUME(cw(3,0+3*1) >= caddr[3]); // Update caddr[3] = max(caddr[3],0); buff(3,0+3*1) = 1; mem(0+3*1,cw(3,0+3*1)) = 1; co(0+3*1,cw(3,0+3*1))+=1; delta(0+3*1,cw(3,0+3*1)) = -1; ASSUME(creturn[3] >= cw(3,0+3*1)); // ret i8* null, !dbg !51 ret_thread_3 = (- 1); goto T3BLOCK_END; T3BLOCK_END: // Dumping thread 0 int ret_thread_0 = 0; cdy[0] = get_rng(0,NCONTEXT-1); ASSUME(cdy[0] >= cstart[0]); T0BLOCK0: // %thr0 = alloca i64, align 8 // %thr1 = alloca i64, align 8 // %thr2 = alloca i64, align 8 // call void @llvm.dbg.value(metadata i32 %argc, metadata !153, metadata !DIExpression()), !dbg !198 // call void @llvm.dbg.value(metadata i8** %argv, metadata !154, metadata !DIExpression()), !dbg !198 // %0 = bitcast i64* %thr0 to i8*, !dbg !90 // call void @llvm.lifetime.start.p0i8(i64 8, i8* %0) #7, !dbg !90 // call void @llvm.dbg.declare(metadata i64* %thr0, metadata !155, metadata !DIExpression()), !dbg !200 // %1 = bitcast i64* %thr1 to i8*, !dbg !92 // call void @llvm.lifetime.start.p0i8(i64 8, i8* %1) #7, !dbg !92 // call void @llvm.dbg.declare(metadata i64* %thr1, metadata !159, metadata !DIExpression()), !dbg !202 // %2 = bitcast i64* %thr2 to i8*, !dbg !94 // call void @llvm.lifetime.start.p0i8(i64 8, i8* %2) #7, !dbg !94 // call void @llvm.dbg.declare(metadata i64* %thr2, metadata !160, metadata !DIExpression()), !dbg !204 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 3), metadata !161, metadata !DIExpression()), !dbg !205 // call void @llvm.dbg.value(metadata i64 0, metadata !163, metadata !DIExpression()), !dbg !205 // store atomic i64 0, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 3) monotonic, align 8, !dbg !97 // ST: Guess iw(0,0+3*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l62_c3 old_cw = cw(0,0+3*1); cw(0,0+3*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l62_c3 // Check ASSUME(active[iw(0,0+3*1)] == 0); ASSUME(active[cw(0,0+3*1)] == 0); ASSUME(sforbid(0+3*1,cw(0,0+3*1))== 0); ASSUME(iw(0,0+3*1) >= 0); ASSUME(iw(0,0+3*1) >= 0); ASSUME(cw(0,0+3*1) >= iw(0,0+3*1)); ASSUME(cw(0,0+3*1) >= old_cw); ASSUME(cw(0,0+3*1) >= cr(0,0+3*1)); ASSUME(cw(0,0+3*1) >= cl[0]); ASSUME(cw(0,0+3*1) >= cisb[0]); ASSUME(cw(0,0+3*1) >= cdy[0]); ASSUME(cw(0,0+3*1) >= cdl[0]); ASSUME(cw(0,0+3*1) >= cds[0]); ASSUME(cw(0,0+3*1) >= cctrl[0]); ASSUME(cw(0,0+3*1) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,0+3*1) = 0; mem(0+3*1,cw(0,0+3*1)) = 0; co(0+3*1,cw(0,0+3*1))+=1; delta(0+3*1,cw(0,0+3*1)) = -1; ASSUME(creturn[0] >= cw(0,0+3*1)); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 2), metadata !164, metadata !DIExpression()), !dbg !207 // call void @llvm.dbg.value(metadata i64 0, metadata !166, metadata !DIExpression()), !dbg !207 // store atomic i64 0, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 2) monotonic, align 8, !dbg !99 // ST: Guess iw(0,0+2*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l63_c3 old_cw = cw(0,0+2*1); cw(0,0+2*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l63_c3 // Check ASSUME(active[iw(0,0+2*1)] == 0); ASSUME(active[cw(0,0+2*1)] == 0); ASSUME(sforbid(0+2*1,cw(0,0+2*1))== 0); ASSUME(iw(0,0+2*1) >= 0); ASSUME(iw(0,0+2*1) >= 0); ASSUME(cw(0,0+2*1) >= iw(0,0+2*1)); ASSUME(cw(0,0+2*1) >= old_cw); ASSUME(cw(0,0+2*1) >= cr(0,0+2*1)); ASSUME(cw(0,0+2*1) >= cl[0]); ASSUME(cw(0,0+2*1) >= cisb[0]); ASSUME(cw(0,0+2*1) >= cdy[0]); ASSUME(cw(0,0+2*1) >= cdl[0]); ASSUME(cw(0,0+2*1) >= cds[0]); ASSUME(cw(0,0+2*1) >= cctrl[0]); ASSUME(cw(0,0+2*1) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,0+2*1) = 0; mem(0+2*1,cw(0,0+2*1)) = 0; co(0+2*1,cw(0,0+2*1))+=1; delta(0+2*1,cw(0,0+2*1)) = -1; ASSUME(creturn[0] >= cw(0,0+2*1)); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1), metadata !167, metadata !DIExpression()), !dbg !209 // call void @llvm.dbg.value(metadata i64 0, metadata !169, metadata !DIExpression()), !dbg !209 // store atomic i64 0, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !101 // ST: Guess iw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l64_c3 old_cw = cw(0,0+1*1); cw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l64_c3 // Check ASSUME(active[iw(0,0+1*1)] == 0); ASSUME(active[cw(0,0+1*1)] == 0); ASSUME(sforbid(0+1*1,cw(0,0+1*1))== 0); ASSUME(iw(0,0+1*1) >= 0); ASSUME(iw(0,0+1*1) >= 0); ASSUME(cw(0,0+1*1) >= iw(0,0+1*1)); ASSUME(cw(0,0+1*1) >= old_cw); ASSUME(cw(0,0+1*1) >= cr(0,0+1*1)); ASSUME(cw(0,0+1*1) >= cl[0]); ASSUME(cw(0,0+1*1) >= cisb[0]); ASSUME(cw(0,0+1*1) >= cdy[0]); ASSUME(cw(0,0+1*1) >= cdl[0]); ASSUME(cw(0,0+1*1) >= cds[0]); ASSUME(cw(0,0+1*1) >= cctrl[0]); ASSUME(cw(0,0+1*1) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,0+1*1) = 0; mem(0+1*1,cw(0,0+1*1)) = 0; co(0+1*1,cw(0,0+1*1))+=1; delta(0+1*1,cw(0,0+1*1)) = -1; ASSUME(creturn[0] >= cw(0,0+1*1)); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0), metadata !170, metadata !DIExpression()), !dbg !211 // call void @llvm.dbg.value(metadata i64 0, metadata !172, metadata !DIExpression()), !dbg !211 // store atomic i64 0, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !103 // ST: Guess iw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l65_c3 old_cw = cw(0,0); cw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l65_c3 // Check ASSUME(active[iw(0,0)] == 0); ASSUME(active[cw(0,0)] == 0); ASSUME(sforbid(0,cw(0,0))== 0); ASSUME(iw(0,0) >= 0); ASSUME(iw(0,0) >= 0); ASSUME(cw(0,0) >= iw(0,0)); ASSUME(cw(0,0) >= old_cw); ASSUME(cw(0,0) >= cr(0,0)); ASSUME(cw(0,0) >= cl[0]); ASSUME(cw(0,0) >= cisb[0]); ASSUME(cw(0,0) >= cdy[0]); ASSUME(cw(0,0) >= cdl[0]); ASSUME(cw(0,0) >= cds[0]); ASSUME(cw(0,0) >= cctrl[0]); ASSUME(cw(0,0) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,0) = 0; mem(0,cw(0,0)) = 0; co(0,cw(0,0))+=1; delta(0,cw(0,0)) = -1; ASSUME(creturn[0] >= cw(0,0)); // store i32 0, i32* @atom_1_X0_1, align 4, !dbg !104, !tbaa !105 // ST: Guess iw(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l66_c15 old_cw = cw(0,4); cw(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l66_c15 // Check ASSUME(active[iw(0,4)] == 0); ASSUME(active[cw(0,4)] == 0); ASSUME(sforbid(4,cw(0,4))== 0); ASSUME(iw(0,4) >= 0); ASSUME(iw(0,4) >= 0); ASSUME(cw(0,4) >= iw(0,4)); ASSUME(cw(0,4) >= old_cw); ASSUME(cw(0,4) >= cr(0,4)); ASSUME(cw(0,4) >= cl[0]); ASSUME(cw(0,4) >= cisb[0]); ASSUME(cw(0,4) >= cdy[0]); ASSUME(cw(0,4) >= cdl[0]); ASSUME(cw(0,4) >= cds[0]); ASSUME(cw(0,4) >= cctrl[0]); ASSUME(cw(0,4) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,4) = 0; mem(4,cw(0,4)) = 0; co(4,cw(0,4))+=1; delta(4,cw(0,4)) = -1; ASSUME(creturn[0] >= cw(0,4)); // store i32 0, i32* @atom_1_X5_0, align 4, !dbg !109, !tbaa !105 // ST: Guess iw(0,5) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l67_c15 old_cw = cw(0,5); cw(0,5) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l67_c15 // Check ASSUME(active[iw(0,5)] == 0); ASSUME(active[cw(0,5)] == 0); ASSUME(sforbid(5,cw(0,5))== 0); ASSUME(iw(0,5) >= 0); ASSUME(iw(0,5) >= 0); ASSUME(cw(0,5) >= iw(0,5)); ASSUME(cw(0,5) >= old_cw); ASSUME(cw(0,5) >= cr(0,5)); ASSUME(cw(0,5) >= cl[0]); ASSUME(cw(0,5) >= cisb[0]); ASSUME(cw(0,5) >= cdy[0]); ASSUME(cw(0,5) >= cdl[0]); ASSUME(cw(0,5) >= cds[0]); ASSUME(cw(0,5) >= cctrl[0]); ASSUME(cw(0,5) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,5) = 0; mem(5,cw(0,5)) = 0; co(5,cw(0,5))+=1; delta(5,cw(0,5)) = -1; ASSUME(creturn[0] >= cw(0,5)); // store i32 0, i32* @atom_1_X7_1, align 4, !dbg !110, !tbaa !105 // ST: Guess iw(0,6) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l68_c15 old_cw = cw(0,6); cw(0,6) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l68_c15 // Check ASSUME(active[iw(0,6)] == 0); ASSUME(active[cw(0,6)] == 0); ASSUME(sforbid(6,cw(0,6))== 0); ASSUME(iw(0,6) >= 0); ASSUME(iw(0,6) >= 0); ASSUME(cw(0,6) >= iw(0,6)); ASSUME(cw(0,6) >= old_cw); ASSUME(cw(0,6) >= cr(0,6)); ASSUME(cw(0,6) >= cl[0]); ASSUME(cw(0,6) >= cisb[0]); ASSUME(cw(0,6) >= cdy[0]); ASSUME(cw(0,6) >= cdl[0]); ASSUME(cw(0,6) >= cds[0]); ASSUME(cw(0,6) >= cctrl[0]); ASSUME(cw(0,6) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,6) = 0; mem(6,cw(0,6)) = 0; co(6,cw(0,6))+=1; delta(6,cw(0,6)) = -1; ASSUME(creturn[0] >= cw(0,6)); // store i32 0, i32* @atom_1_X11_1, align 4, !dbg !111, !tbaa !105 // ST: Guess iw(0,7) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l69_c16 old_cw = cw(0,7); cw(0,7) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l69_c16 // Check ASSUME(active[iw(0,7)] == 0); ASSUME(active[cw(0,7)] == 0); ASSUME(sforbid(7,cw(0,7))== 0); ASSUME(iw(0,7) >= 0); ASSUME(iw(0,7) >= 0); ASSUME(cw(0,7) >= iw(0,7)); ASSUME(cw(0,7) >= old_cw); ASSUME(cw(0,7) >= cr(0,7)); ASSUME(cw(0,7) >= cl[0]); ASSUME(cw(0,7) >= cisb[0]); ASSUME(cw(0,7) >= cdy[0]); ASSUME(cw(0,7) >= cdl[0]); ASSUME(cw(0,7) >= cds[0]); ASSUME(cw(0,7) >= cctrl[0]); ASSUME(cw(0,7) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,7) = 0; mem(7,cw(0,7)) = 0; co(7,cw(0,7))+=1; delta(7,cw(0,7)) = -1; ASSUME(creturn[0] >= cw(0,7)); // %call = call i32 @pthread_create(i64* noundef %thr0, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t0, i8* noundef null) #7, !dbg !112 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,0+3)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,0+3)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cstart[1] >= cdy[0]); // %call7 = call i32 @pthread_create(i64* noundef %thr1, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t1, i8* noundef null) #7, !dbg !113 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,0+3)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,0+3)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cstart[2] >= cdy[0]); // %call8 = call i32 @pthread_create(i64* noundef %thr2, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t2, i8* noundef null) #7, !dbg !114 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,0+3)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,0+3)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cstart[3] >= cdy[0]); // %3 = load i64, i64* %thr0, align 8, !dbg !115, !tbaa !116 r12 = local_mem[0]; // %call9 = call i32 @pthread_join(i64 noundef %3, i8** noundef null), !dbg !118 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,0+3)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,0+3)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cdy[0] >= creturn[1]); // %4 = load i64, i64* %thr1, align 8, !dbg !119, !tbaa !116 r13 = local_mem[1]; // %call10 = call i32 @pthread_join(i64 noundef %4, i8** noundef null), !dbg !120 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,0+3)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,0+3)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cdy[0] >= creturn[2]); // %5 = load i64, i64* %thr2, align 8, !dbg !121, !tbaa !116 r14 = local_mem[2]; // %call11 = call i32 @pthread_join(i64 noundef %5, i8** noundef null), !dbg !122 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,0+3)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,0+3)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cdy[0] >= creturn[3]); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 3), metadata !174, metadata !DIExpression()), !dbg !228 // %6 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 3) monotonic, align 8, !dbg !124 // LD: Guess old_cr = cr(0,0+3*1); cr(0,0+3*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l79_c13 // Check ASSUME(active[cr(0,0+3*1)] == 0); ASSUME(cr(0,0+3*1) >= iw(0,0+3*1)); ASSUME(cr(0,0+3*1) >= 0); ASSUME(cr(0,0+3*1) >= cdy[0]); ASSUME(cr(0,0+3*1) >= cisb[0]); ASSUME(cr(0,0+3*1) >= cdl[0]); ASSUME(cr(0,0+3*1) >= cl[0]); // Update creg_r15 = cr(0,0+3*1); crmax(0,0+3*1) = max(crmax(0,0+3*1),cr(0,0+3*1)); caddr[0] = max(caddr[0],0); if(cr(0,0+3*1) < cw(0,0+3*1)) { r15 = buff(0,0+3*1); ASSUME((!(( (cw(0,0+3*1) < 1) && (1 < crmax(0,0+3*1)) )))||(sforbid(0+3*1,1)> 0)); ASSUME((!(( (cw(0,0+3*1) < 2) && (2 < crmax(0,0+3*1)) )))||(sforbid(0+3*1,2)> 0)); ASSUME((!(( (cw(0,0+3*1) < 3) && (3 < crmax(0,0+3*1)) )))||(sforbid(0+3*1,3)> 0)); ASSUME((!(( (cw(0,0+3*1) < 4) && (4 < crmax(0,0+3*1)) )))||(sforbid(0+3*1,4)> 0)); } else { if(pw(0,0+3*1) != co(0+3*1,cr(0,0+3*1))) { ASSUME(cr(0,0+3*1) >= old_cr); } pw(0,0+3*1) = co(0+3*1,cr(0,0+3*1)); r15 = mem(0+3*1,cr(0,0+3*1)); } ASSUME(creturn[0] >= cr(0,0+3*1)); // call void @llvm.dbg.value(metadata i64 %6, metadata !176, metadata !DIExpression()), !dbg !228 // %conv = trunc i64 %6 to i32, !dbg !125 // call void @llvm.dbg.value(metadata i32 %conv, metadata !173, metadata !DIExpression()), !dbg !198 // %cmp = icmp eq i32 %conv, 1, !dbg !126 creg__r15__1_ = max(0,creg_r15); // %conv12 = zext i1 %cmp to i32, !dbg !126 // call void @llvm.dbg.value(metadata i32 %conv12, metadata !177, metadata !DIExpression()), !dbg !198 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0), metadata !179, metadata !DIExpression()), !dbg !232 // %7 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !128 // LD: Guess old_cr = cr(0,0); cr(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l81_c13 // Check ASSUME(active[cr(0,0)] == 0); ASSUME(cr(0,0) >= iw(0,0)); ASSUME(cr(0,0) >= 0); ASSUME(cr(0,0) >= cdy[0]); ASSUME(cr(0,0) >= cisb[0]); ASSUME(cr(0,0) >= cdl[0]); ASSUME(cr(0,0) >= cl[0]); // Update creg_r16 = cr(0,0); crmax(0,0) = max(crmax(0,0),cr(0,0)); caddr[0] = max(caddr[0],0); if(cr(0,0) < cw(0,0)) { r16 = buff(0,0); ASSUME((!(( (cw(0,0) < 1) && (1 < crmax(0,0)) )))||(sforbid(0,1)> 0)); ASSUME((!(( (cw(0,0) < 2) && (2 < crmax(0,0)) )))||(sforbid(0,2)> 0)); ASSUME((!(( (cw(0,0) < 3) && (3 < crmax(0,0)) )))||(sforbid(0,3)> 0)); ASSUME((!(( (cw(0,0) < 4) && (4 < crmax(0,0)) )))||(sforbid(0,4)> 0)); } else { if(pw(0,0) != co(0,cr(0,0))) { ASSUME(cr(0,0) >= old_cr); } pw(0,0) = co(0,cr(0,0)); r16 = mem(0,cr(0,0)); } ASSUME(creturn[0] >= cr(0,0)); // call void @llvm.dbg.value(metadata i64 %7, metadata !181, metadata !DIExpression()), !dbg !232 // %conv16 = trunc i64 %7 to i32, !dbg !129 // call void @llvm.dbg.value(metadata i32 %conv16, metadata !178, metadata !DIExpression()), !dbg !198 // %cmp17 = icmp eq i32 %conv16, 2, !dbg !130 creg__r16__2_ = max(0,creg_r16); // %conv18 = zext i1 %cmp17 to i32, !dbg !130 // call void @llvm.dbg.value(metadata i32 %conv18, metadata !182, metadata !DIExpression()), !dbg !198 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1), metadata !184, metadata !DIExpression()), !dbg !236 // %8 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !132 // LD: Guess old_cr = cr(0,0+1*1); cr(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l83_c13 // Check ASSUME(active[cr(0,0+1*1)] == 0); ASSUME(cr(0,0+1*1) >= iw(0,0+1*1)); ASSUME(cr(0,0+1*1) >= 0); ASSUME(cr(0,0+1*1) >= cdy[0]); ASSUME(cr(0,0+1*1) >= cisb[0]); ASSUME(cr(0,0+1*1) >= cdl[0]); ASSUME(cr(0,0+1*1) >= cl[0]); // Update creg_r17 = cr(0,0+1*1); crmax(0,0+1*1) = max(crmax(0,0+1*1),cr(0,0+1*1)); caddr[0] = max(caddr[0],0); if(cr(0,0+1*1) < cw(0,0+1*1)) { r17 = buff(0,0+1*1); ASSUME((!(( (cw(0,0+1*1) < 1) && (1 < crmax(0,0+1*1)) )))||(sforbid(0+1*1,1)> 0)); ASSUME((!(( (cw(0,0+1*1) < 2) && (2 < crmax(0,0+1*1)) )))||(sforbid(0+1*1,2)> 0)); ASSUME((!(( (cw(0,0+1*1) < 3) && (3 < crmax(0,0+1*1)) )))||(sforbid(0+1*1,3)> 0)); ASSUME((!(( (cw(0,0+1*1) < 4) && (4 < crmax(0,0+1*1)) )))||(sforbid(0+1*1,4)> 0)); } else { if(pw(0,0+1*1) != co(0+1*1,cr(0,0+1*1))) { ASSUME(cr(0,0+1*1) >= old_cr); } pw(0,0+1*1) = co(0+1*1,cr(0,0+1*1)); r17 = mem(0+1*1,cr(0,0+1*1)); } ASSUME(creturn[0] >= cr(0,0+1*1)); // call void @llvm.dbg.value(metadata i64 %8, metadata !186, metadata !DIExpression()), !dbg !236 // %conv22 = trunc i64 %8 to i32, !dbg !133 // call void @llvm.dbg.value(metadata i32 %conv22, metadata !183, metadata !DIExpression()), !dbg !198 // %cmp23 = icmp eq i32 %conv22, 1, !dbg !134 creg__r17__1_ = max(0,creg_r17); // %conv24 = zext i1 %cmp23 to i32, !dbg !134 // call void @llvm.dbg.value(metadata i32 %conv24, metadata !187, metadata !DIExpression()), !dbg !198 // %9 = load i32, i32* @atom_1_X0_1, align 4, !dbg !135, !tbaa !105 // LD: Guess old_cr = cr(0,4); cr(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l85_c13 // Check ASSUME(active[cr(0,4)] == 0); ASSUME(cr(0,4) >= iw(0,4)); ASSUME(cr(0,4) >= 0); ASSUME(cr(0,4) >= cdy[0]); ASSUME(cr(0,4) >= cisb[0]); ASSUME(cr(0,4) >= cdl[0]); ASSUME(cr(0,4) >= cl[0]); // Update creg_r18 = cr(0,4); crmax(0,4) = max(crmax(0,4),cr(0,4)); caddr[0] = max(caddr[0],0); if(cr(0,4) < cw(0,4)) { r18 = buff(0,4); ASSUME((!(( (cw(0,4) < 1) && (1 < crmax(0,4)) )))||(sforbid(4,1)> 0)); ASSUME((!(( (cw(0,4) < 2) && (2 < crmax(0,4)) )))||(sforbid(4,2)> 0)); ASSUME((!(( (cw(0,4) < 3) && (3 < crmax(0,4)) )))||(sforbid(4,3)> 0)); ASSUME((!(( (cw(0,4) < 4) && (4 < crmax(0,4)) )))||(sforbid(4,4)> 0)); } else { if(pw(0,4) != co(4,cr(0,4))) { ASSUME(cr(0,4) >= old_cr); } pw(0,4) = co(4,cr(0,4)); r18 = mem(4,cr(0,4)); } ASSUME(creturn[0] >= cr(0,4)); // call void @llvm.dbg.value(metadata i32 %9, metadata !188, metadata !DIExpression()), !dbg !198 // %10 = load i32, i32* @atom_1_X5_0, align 4, !dbg !136, !tbaa !105 // LD: Guess old_cr = cr(0,5); cr(0,5) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l86_c13 // Check ASSUME(active[cr(0,5)] == 0); ASSUME(cr(0,5) >= iw(0,5)); ASSUME(cr(0,5) >= 0); ASSUME(cr(0,5) >= cdy[0]); ASSUME(cr(0,5) >= cisb[0]); ASSUME(cr(0,5) >= cdl[0]); ASSUME(cr(0,5) >= cl[0]); // Update creg_r19 = cr(0,5); crmax(0,5) = max(crmax(0,5),cr(0,5)); caddr[0] = max(caddr[0],0); if(cr(0,5) < cw(0,5)) { r19 = buff(0,5); ASSUME((!(( (cw(0,5) < 1) && (1 < crmax(0,5)) )))||(sforbid(5,1)> 0)); ASSUME((!(( (cw(0,5) < 2) && (2 < crmax(0,5)) )))||(sforbid(5,2)> 0)); ASSUME((!(( (cw(0,5) < 3) && (3 < crmax(0,5)) )))||(sforbid(5,3)> 0)); ASSUME((!(( (cw(0,5) < 4) && (4 < crmax(0,5)) )))||(sforbid(5,4)> 0)); } else { if(pw(0,5) != co(5,cr(0,5))) { ASSUME(cr(0,5) >= old_cr); } pw(0,5) = co(5,cr(0,5)); r19 = mem(5,cr(0,5)); } ASSUME(creturn[0] >= cr(0,5)); // call void @llvm.dbg.value(metadata i32 %10, metadata !189, metadata !DIExpression()), !dbg !198 // %11 = load i32, i32* @atom_1_X7_1, align 4, !dbg !137, !tbaa !105 // LD: Guess old_cr = cr(0,6); cr(0,6) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l87_c13 // Check ASSUME(active[cr(0,6)] == 0); ASSUME(cr(0,6) >= iw(0,6)); ASSUME(cr(0,6) >= 0); ASSUME(cr(0,6) >= cdy[0]); ASSUME(cr(0,6) >= cisb[0]); ASSUME(cr(0,6) >= cdl[0]); ASSUME(cr(0,6) >= cl[0]); // Update creg_r20 = cr(0,6); crmax(0,6) = max(crmax(0,6),cr(0,6)); caddr[0] = max(caddr[0],0); if(cr(0,6) < cw(0,6)) { r20 = buff(0,6); ASSUME((!(( (cw(0,6) < 1) && (1 < crmax(0,6)) )))||(sforbid(6,1)> 0)); ASSUME((!(( (cw(0,6) < 2) && (2 < crmax(0,6)) )))||(sforbid(6,2)> 0)); ASSUME((!(( (cw(0,6) < 3) && (3 < crmax(0,6)) )))||(sforbid(6,3)> 0)); ASSUME((!(( (cw(0,6) < 4) && (4 < crmax(0,6)) )))||(sforbid(6,4)> 0)); } else { if(pw(0,6) != co(6,cr(0,6))) { ASSUME(cr(0,6) >= old_cr); } pw(0,6) = co(6,cr(0,6)); r20 = mem(6,cr(0,6)); } ASSUME(creturn[0] >= cr(0,6)); // call void @llvm.dbg.value(metadata i32 %11, metadata !190, metadata !DIExpression()), !dbg !198 // %12 = load i32, i32* @atom_1_X11_1, align 4, !dbg !138, !tbaa !105 // LD: Guess old_cr = cr(0,7); cr(0,7) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l88_c13 // Check ASSUME(active[cr(0,7)] == 0); ASSUME(cr(0,7) >= iw(0,7)); ASSUME(cr(0,7) >= 0); ASSUME(cr(0,7) >= cdy[0]); ASSUME(cr(0,7) >= cisb[0]); ASSUME(cr(0,7) >= cdl[0]); ASSUME(cr(0,7) >= cl[0]); // Update creg_r21 = cr(0,7); crmax(0,7) = max(crmax(0,7),cr(0,7)); caddr[0] = max(caddr[0],0); if(cr(0,7) < cw(0,7)) { r21 = buff(0,7); ASSUME((!(( (cw(0,7) < 1) && (1 < crmax(0,7)) )))||(sforbid(7,1)> 0)); ASSUME((!(( (cw(0,7) < 2) && (2 < crmax(0,7)) )))||(sforbid(7,2)> 0)); ASSUME((!(( (cw(0,7) < 3) && (3 < crmax(0,7)) )))||(sforbid(7,3)> 0)); ASSUME((!(( (cw(0,7) < 4) && (4 < crmax(0,7)) )))||(sforbid(7,4)> 0)); } else { if(pw(0,7) != co(7,cr(0,7))) { ASSUME(cr(0,7) >= old_cr); } pw(0,7) = co(7,cr(0,7)); r21 = mem(7,cr(0,7)); } ASSUME(creturn[0] >= cr(0,7)); // call void @llvm.dbg.value(metadata i32 %12, metadata !191, metadata !DIExpression()), !dbg !198 // %and = and i32 %11, %12, !dbg !139 creg_r22 = max(creg_r20,creg_r21); r22 = r20 & r21; // call void @llvm.dbg.value(metadata i32 %and, metadata !192, metadata !DIExpression()), !dbg !198 // %and25 = and i32 %10, %and, !dbg !140 creg_r23 = max(creg_r19,creg_r22); r23 = r19 & r22; // call void @llvm.dbg.value(metadata i32 %and25, metadata !193, metadata !DIExpression()), !dbg !198 // %and26 = and i32 %9, %and25, !dbg !141 creg_r24 = max(creg_r18,creg_r23); r24 = r18 & r23; // call void @llvm.dbg.value(metadata i32 %and26, metadata !194, metadata !DIExpression()), !dbg !198 // %and27 = and i32 %conv24, %and26, !dbg !142 creg_r25 = max(creg__r17__1_,creg_r24); r25 = (r17==1) & r24; // call void @llvm.dbg.value(metadata i32 %and27, metadata !195, metadata !DIExpression()), !dbg !198 // %and28 = and i32 %conv18, %and27, !dbg !143 creg_r26 = max(creg__r16__2_,creg_r25); r26 = (r16==2) & r25; // call void @llvm.dbg.value(metadata i32 %and28, metadata !196, metadata !DIExpression()), !dbg !198 // %and29 = and i32 %conv12, %and28, !dbg !144 creg_r27 = max(creg__r15__1_,creg_r26); r27 = (r15==1) & r26; // call void @llvm.dbg.value(metadata i32 %and29, metadata !197, metadata !DIExpression()), !dbg !198 // %cmp30 = icmp eq i32 %and29, 1, !dbg !145 creg__r27__1_ = max(0,creg_r27); // br i1 %cmp30, label %if.then, label %if.end, !dbg !147 old_cctrl = cctrl[0]; cctrl[0] = get_rng(0,NCONTEXT-1); ASSUME(cctrl[0] >= old_cctrl); ASSUME(cctrl[0] >= creg__r27__1_); if((r27==1)) { goto T0BLOCK1; } else { goto T0BLOCK2; } T0BLOCK1: // call void @__assert_fail(i8* noundef getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* noundef getelementptr inbounds ([121 x i8], [121 x i8]* @.str.1, i64 0, i64 0), i32 noundef 95, i8* noundef getelementptr inbounds ([23 x i8], [23 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #8, !dbg !148 // unreachable, !dbg !148 r28 = 1; goto T0BLOCK_END; T0BLOCK2: // %13 = bitcast i64* %thr2 to i8*, !dbg !151 // call void @llvm.lifetime.end.p0i8(i64 8, i8* %13) #7, !dbg !151 // %14 = bitcast i64* %thr1 to i8*, !dbg !151 // call void @llvm.lifetime.end.p0i8(i64 8, i8* %14) #7, !dbg !151 // %15 = bitcast i64* %thr0 to i8*, !dbg !151 // call void @llvm.lifetime.end.p0i8(i64 8, i8* %15) #7, !dbg !151 // ret i32 0, !dbg !152 ret_thread_0 = 0; goto T0BLOCK_END; T0BLOCK_END: ASSUME(meminit(0,1) == mem(0,0)); ASSUME(coinit(0,1) == co(0,0)); ASSUME(deltainit(0,1) == delta(0,0)); ASSUME(meminit(0,2) == mem(0,1)); ASSUME(coinit(0,2) == co(0,1)); ASSUME(deltainit(0,2) == delta(0,1)); ASSUME(meminit(0,3) == mem(0,2)); ASSUME(coinit(0,3) == co(0,2)); ASSUME(deltainit(0,3) == delta(0,2)); ASSUME(meminit(0,4) == mem(0,3)); ASSUME(coinit(0,4) == co(0,3)); ASSUME(deltainit(0,4) == delta(0,3)); ASSUME(meminit(1,1) == mem(1,0)); ASSUME(coinit(1,1) == co(1,0)); ASSUME(deltainit(1,1) == delta(1,0)); ASSUME(meminit(1,2) == mem(1,1)); ASSUME(coinit(1,2) == co(1,1)); ASSUME(deltainit(1,2) == delta(1,1)); ASSUME(meminit(1,3) == mem(1,2)); ASSUME(coinit(1,3) == co(1,2)); ASSUME(deltainit(1,3) == delta(1,2)); ASSUME(meminit(1,4) == mem(1,3)); ASSUME(coinit(1,4) == co(1,3)); ASSUME(deltainit(1,4) == delta(1,3)); ASSUME(meminit(2,1) == mem(2,0)); ASSUME(coinit(2,1) == co(2,0)); ASSUME(deltainit(2,1) == delta(2,0)); ASSUME(meminit(2,2) == mem(2,1)); ASSUME(coinit(2,2) == co(2,1)); ASSUME(deltainit(2,2) == delta(2,1)); ASSUME(meminit(2,3) == mem(2,2)); ASSUME(coinit(2,3) == co(2,2)); ASSUME(deltainit(2,3) == delta(2,2)); ASSUME(meminit(2,4) == mem(2,3)); ASSUME(coinit(2,4) == co(2,3)); ASSUME(deltainit(2,4) == delta(2,3)); ASSUME(meminit(3,1) == mem(3,0)); ASSUME(coinit(3,1) == co(3,0)); ASSUME(deltainit(3,1) == delta(3,0)); ASSUME(meminit(3,2) == mem(3,1)); ASSUME(coinit(3,2) == co(3,1)); ASSUME(deltainit(3,2) == delta(3,1)); ASSUME(meminit(3,3) == mem(3,2)); ASSUME(coinit(3,3) == co(3,2)); ASSUME(deltainit(3,3) == delta(3,2)); ASSUME(meminit(3,4) == mem(3,3)); ASSUME(coinit(3,4) == co(3,3)); ASSUME(deltainit(3,4) == delta(3,3)); ASSUME(meminit(4,1) == mem(4,0)); ASSUME(coinit(4,1) == co(4,0)); ASSUME(deltainit(4,1) == delta(4,0)); ASSUME(meminit(4,2) == mem(4,1)); ASSUME(coinit(4,2) == co(4,1)); ASSUME(deltainit(4,2) == delta(4,1)); ASSUME(meminit(4,3) == mem(4,2)); ASSUME(coinit(4,3) == co(4,2)); ASSUME(deltainit(4,3) == delta(4,2)); ASSUME(meminit(4,4) == mem(4,3)); ASSUME(coinit(4,4) == co(4,3)); ASSUME(deltainit(4,4) == delta(4,3)); ASSUME(meminit(5,1) == mem(5,0)); ASSUME(coinit(5,1) == co(5,0)); ASSUME(deltainit(5,1) == delta(5,0)); ASSUME(meminit(5,2) == mem(5,1)); ASSUME(coinit(5,2) == co(5,1)); ASSUME(deltainit(5,2) == delta(5,1)); ASSUME(meminit(5,3) == mem(5,2)); ASSUME(coinit(5,3) == co(5,2)); ASSUME(deltainit(5,3) == delta(5,2)); ASSUME(meminit(5,4) == mem(5,3)); ASSUME(coinit(5,4) == co(5,3)); ASSUME(deltainit(5,4) == delta(5,3)); ASSUME(meminit(6,1) == mem(6,0)); ASSUME(coinit(6,1) == co(6,0)); ASSUME(deltainit(6,1) == delta(6,0)); ASSUME(meminit(6,2) == mem(6,1)); ASSUME(coinit(6,2) == co(6,1)); ASSUME(deltainit(6,2) == delta(6,1)); ASSUME(meminit(6,3) == mem(6,2)); ASSUME(coinit(6,3) == co(6,2)); ASSUME(deltainit(6,3) == delta(6,2)); ASSUME(meminit(6,4) == mem(6,3)); ASSUME(coinit(6,4) == co(6,3)); ASSUME(deltainit(6,4) == delta(6,3)); ASSUME(meminit(7,1) == mem(7,0)); ASSUME(coinit(7,1) == co(7,0)); ASSUME(deltainit(7,1) == delta(7,0)); ASSUME(meminit(7,2) == mem(7,1)); ASSUME(coinit(7,2) == co(7,1)); ASSUME(deltainit(7,2) == delta(7,1)); ASSUME(meminit(7,3) == mem(7,2)); ASSUME(coinit(7,3) == co(7,2)); ASSUME(deltainit(7,3) == delta(7,2)); ASSUME(meminit(7,4) == mem(7,3)); ASSUME(coinit(7,4) == co(7,3)); ASSUME(deltainit(7,4) == delta(7,3)); ASSERT(r28== 0); }
[ "tuan-phong.ngo@it.uu.se" ]
tuan-phong.ngo@it.uu.se
86cf8aabea0a7c534a697131e59253ead1fe9103
8dc84558f0058d90dfc4955e905dab1b22d12c08
/third_party/webrtc/rtc_base/strings/audio_format_to_string.h
de0ce16e66054a62749f25e92da3b534bfb643a9
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "LicenseRef-scancode-google-patent-license-webm", "LicenseRef-scancode-google-patent-license-webrtc", "GPL-1.0-or-later", "LicenseRef-scancode-takuya-ooura", "MIT", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown", ...
permissive
meniossin/src
42a95cc6c4a9c71d43d62bc4311224ca1fd61e03
44f73f7e76119e5ab415d4593ac66485e65d700a
refs/heads/master
2022-12-16T20:17:03.747113
2020-09-03T10:43:12
2020-09-03T10:43:12
263,710,168
1
0
BSD-3-Clause
2020-05-13T18:20:09
2020-05-13T18:20:08
null
UTF-8
C++
false
false
844
h
/* * Copyright 2018 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 RTC_BASE_STRINGS_AUDIO_FORMAT_TO_STRING_H_ #define RTC_BASE_STRINGS_AUDIO_FORMAT_TO_STRING_H_ #include <string> #include "api/audio_codecs/audio_format.h" namespace rtc { std::string ToString(const webrtc::SdpAudioFormat& saf); std::string ToString(const webrtc::AudioCodecInfo& saf); std::string ToString(const webrtc::AudioCodecSpec& acs); } // namespace rtc #endif // RTC_BASE_STRINGS_AUDIO_FORMAT_TO_STRING_H_
[ "arnaud@geometry.ee" ]
arnaud@geometry.ee
8c38a0245166db5042fc106a00e74016ca30a473
b401f3c964467a0f8dc857d4615bd2e3688ca2e4
/tests/ctypes/annotation_inout_tests.cpp
140c9dd48370c7b6aa93204d8cc19bf8ffccb60c
[ "MIT", "BSD-3-Clause", "JSON", "LicenseRef-scancode-unknown-license-reference" ]
permissive
mehrdad-shokri/ctypes
3eb3273fe633b614db89bb0bbc168efd44f77622
7d3d26adc7b6b09573de42410192d8133657684a
refs/heads/master
2021-08-28T23:09:09.855236
2017-12-13T07:59:26
2017-12-13T07:59:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,505
cpp
/** * @file tests/ctypes/annotation_inout_tests.cpp * @brief Tests for the @c annotation_inout module. * @copyright (c) 2017 Avast Software, licensed under the MIT license */ #include <memory> #include <gtest/gtest.h> #include "ctypes/annotation_inout.h" #include "ctypes/context.h" using namespace ::testing; namespace ctypes { namespace tests { class AnnotationInOutTests : public Test { public: AnnotationInOutTests(): context(std::make_shared<Context>()), in_outAnnot(AnnotationInOut::create(context, "_Inout_")) {} protected: std::shared_ptr<Context> context; std::shared_ptr<Annotation> in_outAnnot; }; TEST_F(AnnotationInOutTests, EveryUniqueAnnotationInOutIsCreatedOnlyOnce) { auto obj1 = AnnotationInOut::create(context, "_Inout_"); auto obj2 = AnnotationInOut::create(context, "_Inout_"); EXPECT_EQ(obj1, obj2); } TEST_F(AnnotationInOutTests, TwoAnnotationInOutsWithDifferentNamesDiffer) { auto obj1 = AnnotationInOut::create(context, "_Inout_"); auto obj2 = AnnotationInOut::create(context, "OUT"); EXPECT_NE(obj1, obj2); } TEST_F(AnnotationInOutTests, IsInReturnsAlwaysFalsee) { EXPECT_FALSE(in_outAnnot->isIn()); } TEST_F(AnnotationInOutTests, IsOutReturnsAlwaysTrue) { EXPECT_FALSE(in_outAnnot->isOut()); } TEST_F(AnnotationInOutTests, IsInOutReturnsAlwaysFalse) { EXPECT_TRUE(in_outAnnot->isInOut()); } TEST_F(AnnotationInOutTests, IsOptionalReturnsAlwaysFalse) { EXPECT_FALSE(in_outAnnot->isOptional()); } } // namespace tests } // namespace ctypes
[ "petr.zemek@avast.com" ]
petr.zemek@avast.com
94252def4a8b636224d42affcc1c1943b19b23aa
67f988dedfd8ae049d982d1a8213bb83233d90de
/external/chromium/chrome/browser/ui/fullscreen/fullscreen_controller.h
757774ef4753c6f35d4bde60b9f4fd8dbb70b147
[ "BSD-3-Clause" ]
permissive
opensourceyouthprogramming/h5vcc
94a668a9384cc3096a365396b5e4d1d3e02aacc4
d55d074539ba4555e69e9b9a41e5deb9b9d26c5b
refs/heads/master
2020-04-20T04:57:47.419922
2019-02-12T00:56:14
2019-02-12T00:56:14
168,643,719
1
1
null
2019-02-12T00:49:49
2019-02-01T04:47:32
C++
UTF-8
C++
false
false
7,174
h
// 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. #ifndef CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_H_ #define CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_H_ #include "base/basictypes.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" #include "chrome/common/content_settings.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" class Browser; class BrowserWindow; class GURL; class Profile; namespace content { class WebContents; } // There are two different kinds of fullscreen mode - "tab fullscreen" and // "browser fullscreen". "Tab fullscreen" refers to when a tab enters // fullscreen mode via the JS fullscreen API, and "browser fullscreen" refers // to the user putting the browser itself into fullscreen mode from the UI. The // difference is that tab fullscreen has implications for how the contents of // the tab render (eg: a video element may grow to consume the whole tab), // whereas browser fullscreen mode doesn't. Therefore if a user forces an exit // from tab fullscreen, we need to notify the tab so it can stop rendering in // its fullscreen mode. // This class implements fullscreen and mouselock behaviour. class FullscreenController : public content::NotificationObserver { public: explicit FullscreenController(Browser* browser); virtual ~FullscreenController(); // Browser/User Fullscreen /////////////////////////////////////////////////// // Returns true if the window is currently fullscreen and was initially // transitioned to fullscreen by a browser (vs tab) mode transition. bool IsFullscreenForBrowser() const; void ToggleFullscreenMode(); // Tab/HTML Fullscreen /////////////////////////////////////////////////////// // Returns true if fullscreen has been caused by a tab. // The window may still be transitioning, and window_->IsFullscreen() // may still return false. bool IsFullscreenForTabOrPending() const; bool IsFullscreenForTabOrPending( const content::WebContents* web_contents) const; void ToggleFullscreenModeForTab(content::WebContents* web_contents, bool enter_fullscreen); // Extension API implementation uses this method to toggle fullscreen mode. // The extension's name is displayed in the full screen bubble UI to attribute // the cause of the full screen state change. void ToggleFullscreenModeWithExtension(const GURL& extension_url); // Platform Fullscreen /////////////////////////////////////////////////////// // Returns whether we are currently in a Metro snap view. bool IsInMetroSnapMode(); #if defined(OS_WIN) // API that puts the window into a mode suitable for rendering when Chrome // is rendered in a 20% screen-width Metro snap view on Windows 8. void SetMetroSnapMode(bool enable); #endif #if defined(OS_MACOSX) void TogglePresentationMode(); #endif // Mouse Lock //////////////////////////////////////////////////////////////// bool IsMouseLockRequested() const; bool IsMouseLocked() const; void RequestToLockMouse(content::WebContents* web_contents, bool user_gesture, bool last_unlocked_by_target); // Callbacks ///////////////////////////////////////////////////////////////// // Called by Browser::TabDeactivated. void OnTabDeactivated(content::WebContents* web_contents); // Called by Browser::TabClosingAt. void OnTabClosing(content::WebContents* web_contents); // Called by Browser::WindowFullscreenStateChanged. void WindowFullscreenStateChanged(); // Called by Browser::PreHandleKeyboardEvent. bool HandleUserPressedEscape(); // Called by platform FullscreenExitBubble. void OnAcceptFullscreenPermission(const GURL& url, FullscreenExitBubbleType bubble_type); void OnDenyFullscreenPermission(FullscreenExitBubbleType bubble_type); // Called by Browser::LostMouseLock. void LostMouseLock(); // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; FullscreenExitBubbleType GetFullscreenExitBubbleType() const; private: enum MouseLockState { MOUSELOCK_NOT_REQUESTED, // The page requests to lock the mouse and the user hasn't responded to the // request. MOUSELOCK_REQUESTED, // Mouse lock has been allowed by the user. MOUSELOCK_ACCEPTED, // Mouse lock has been silently accepted, no notification to user. MOUSELOCK_ACCEPTED_SILENTLY }; void UpdateNotificationRegistrations(); // Posts a task to call NotifyFullscreenChange. void PostFullscreenChangeNotification(bool is_fullscreen); // Sends a NOTIFICATION_FULLSCREEN_CHANGED notification. void NotifyFullscreenChange(bool is_fullscreen); // Notifies the tab that it has been forced out of fullscreen and mouse lock // mode if necessary. void NotifyTabOfExitIfNecessary(); void NotifyMouseLockChange(); // TODO(koz): Change |for_tab| to an enum. void ToggleFullscreenModeInternal(bool for_tab); #if defined(OS_MACOSX) void TogglePresentationModeInternal(bool for_tab); #endif void SetFullscreenedTab(content::WebContents* tab); void SetMouseLockTab(content::WebContents* tab); // Make the current tab exit fullscreen mode or mouse lock if it is in it. void ExitTabFullscreenOrMouseLockIfNecessary(); void UpdateFullscreenExitBubbleContent(); ContentSetting GetFullscreenSetting(const GURL& url) const; ContentSetting GetMouseLockSetting(const GURL& url) const; base::WeakPtrFactory<FullscreenController> ptr_factory_; Browser* browser_; BrowserWindow* window_; Profile* profile_; // If there is currently a tab in fullscreen mode (entered via // webkitRequestFullScreen), this is its WebContents. // Assign using SetFullscreenedTab(). content::WebContents* fullscreened_tab_; // The URL of the extension which trigerred "browser fullscreen" mode. GURL extension_caused_fullscreen_; // True if the current tab entered fullscreen mode via webkitRequestFullScreen bool tab_caused_fullscreen_; // True if tab fullscreen has been allowed, either by settings or by user // clicking the allow button on the fullscreen infobar. bool tab_fullscreen_accepted_; // True if this controller has toggled into tab OR browser fullscreen. bool toggled_into_fullscreen_; // WebContents for current tab requesting or currently in mouse lock. // Assign using SetMouseLockTab(). content::WebContents* mouse_lock_tab_; MouseLockState mouse_lock_state_; content::NotificationRegistrar registrar_; // Used to verify that calls we expect to reenter by calling // WindowFullscreenStateChanged do so. bool reentrant_window_state_change_call_check_; DISALLOW_COPY_AND_ASSIGN(FullscreenController); }; #endif // CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_H_
[ "rjogrady@google.com" ]
rjogrady@google.com
ef6326a99aa6548c08198520972434881a0cf47d
242b28657a27c5761407195f4921189f0bfdb7d9
/tp04.cpp
e590dc8d8036628dd5e696d6afce7a22f429e63f
[]
no_license
TallerDeLenguajes1/tpn4-RoblesJP
b848e7d8ef440a2df3893db6ab2e1f5555a917be
884faf5493c06155fd7e1464b4970a7e23ac1152
refs/heads/master
2022-07-10T01:36:03.830090
2020-05-15T16:44:03
2020-05-15T16:44:03
261,266,851
0
0
null
null
null
null
UTF-8
C++
false
false
5,649
cpp
#include <cstring> #include <iostream> using namespace std; // estructuras typedef struct { int id; char* descripcion; int duracion; // [10, 100] } TAREA; struct NODO { TAREA* tarea; struct NODO* siguiente; }; typedef struct NODO* LISTA; // funciones LISTA crearLista(); TAREA* crearTarea(int, char*, int); struct NODO* crearNodo(TAREA*); void insertarNodo(LISTA*, struct NODO*); struct NODO* quitarNodo(LISTA*); void mostrarTarea(TAREA* tarea); void mostrar(LISTA L); TAREA* buscarPorPalabra(LISTA, char*); TAREA* buscarPorId(LISTA, int); int main() { int cantTareas; int buscarID; char buscarPalabra[100]; LISTA tareas = crearLista(); LISTA tareasPendientes = crearLista(); LISTA tareasRealizadas = crearLista(); // cantidad de tareas do { cout << ">> Ingrese la cantidad de tareas: "; cin >> cantTareas; if (cantTareas < 0) { cout << "!Error: cantidad incorrecta\n"; } } while(cantTareas < 0); // carga de tareas for (int i = 0; i < cantTareas; i++) { cout << "\n## TAREA #" << i + 1; int id = i + 1; char descripcion[50]; cout << "\n>> Descripcion: "; cin >> descripcion; int duracion; do { cout << ">> Duracion: "; cin >> duracion; if (duracion < 10 || duracion > 100) { cout << "!Error: la duracion suele puede ser entre 10 y 100\n"; } } while (duracion < 10 || duracion > 100); TAREA* nuevaTarea = crearTarea(id, descripcion, duracion); struct NODO* nuevoNodo = crearNodo(nuevaTarea); insertarNodo(&tareas, nuevoNodo); } cout << "\n"; // pregunta si la tarea fue realizada char respuesta; while (tareas != NULL) { do { cout << ">> La tarea #" << tareas->tarea->id << " fue realizada? SI[Y] NO[N]: "; cin >> respuesta; if (respuesta != 'Y' && respuesta != 'N') { cout << "!Error: respuesta incorrecta\n"; } } while (respuesta != 'Y' && respuesta != 'N'); if (respuesta == 'Y') { insertarNodo(&tareasRealizadas, quitarNodo(&tareas)); } else { insertarNodo(&tareasPendientes, quitarNodo(&tareas)); } } // muestra las tareas realizadas cout << "\n-- Mostrando tareas realizadas\n"; mostrar(tareasRealizadas); // muestra las tareas pendientes cout << "-- Mostrando tareas pendientes\n"; mostrar(tareasPendientes); // buscar tarea por palabra cout << ">> Buscar tarea por palabra: "; cin >> buscarPalabra; cout << "-- Buscando en tareas pendientes...\n"; if (buscarPorPalabra(tareasPendientes, buscarPalabra) != NULL) { mostrarTarea(buscarPorPalabra(tareasPendientes, buscarPalabra)); } else { cout << "No existe tarea con la palabra \"" << buscarPalabra << "\"" << " en la lista de tareas pendientes\n"; } cout << "-- Buscando en tareas realizadas...\n"; if (buscarPorPalabra(tareasRealizadas, buscarPalabra) != NULL) { mostrarTarea(buscarPorPalabra(tareasRealizadas, buscarPalabra)); } else { cout << "No existe tarea con la palabra \"" << buscarPalabra << "\"" << " en la lista de tareas realizadas"; } // buscar tarea por id cout << ">> Buscar tarea por id: "; cin >> buscarID; cout << "-- Buscando en tareas pendientes...\n"; if (buscarPorId(tareasPendientes, buscarID) != NULL) { mostrarTarea(buscarPorId(tareasPendientes, buscarID)); } else { cout << "No existe tarea con id " << buscarID << " en la lista de tareas pendientes\n\n"; } cout << "-- Buscando en tareas realizadas...\n"; if (buscarPorId(tareasRealizadas, buscarID) != NULL) { mostrarTarea(buscarPorId(tareasRealizadas, buscarID)); } else { cout << "No existe tarea con id " << buscarID << " en la lista de tareas realizadas"; } cout << "\n"; return 0; } LISTA crearLista() { return NULL; } TAREA* crearTarea(int id, char* descripcion, int duracion) { TAREA* nuevaTarea = new TAREA; nuevaTarea->id = id; nuevaTarea->descripcion = descripcion; nuevaTarea->duracion = duracion; return nuevaTarea; } struct NODO* crearNodo(TAREA* tarea) { struct NODO* nuevoNodo = new struct NODO; nuevoNodo->tarea = tarea; nuevoNodo->siguiente = NULL; return nuevoNodo; } void insertarNodo(LISTA* L, struct NODO* nodo) { nodo->siguiente = *L; *L = nodo; } struct NODO* quitarNodo(LISTA* L) { struct NODO* aux; aux = *L; *L = (*L)->siguiente; aux->siguiente = NULL; return aux; } void mostrarTarea(TAREA* tarea) { cout << "## TareaID: " << tarea->id; cout << "\n# Descripcion: " << tarea->descripcion; cout << "\n# Duracion: " << tarea->duracion << "\n"; cout << "\n"; } void mostrar(LISTA L) { while (L != NULL) { mostrarTarea(L->tarea); L = L->siguiente; } } TAREA* buscarPorPalabra(LISTA L, char* palabra) { while (L != NULL) { if (strstr(L->tarea->descripcion, palabra) != NULL) { return L->tarea; } L = L->siguiente; } return NULL; } TAREA* buscarPorId(LISTA L, int id) { while (L != NULL) { if (L->tarea->id == id) { return L->tarea; } L = L->siguiente; } return NULL; }
[ "juan.robles1417@gmail.com" ]
juan.robles1417@gmail.com
c456991bd308953ab819e71dae0c23bb6c4ed433
5e8db76679d5cf4d67a435858eee9c4a97ec75af
/4a.2.0/source/hitprocess/clas12/ftof_hitprocess.cc
4cbdbd7ec729a258feb41fe1f10c8eb6ebbfd1b7
[]
no_license
efrainsegarra/clas12Tags
94f5daa18a6640107953de733a98eeb4d5239368
ccf90c57d086554e930dd4119f901cd1ea6ad176
refs/heads/master
2023-01-09T20:36:53.053681
2020-11-10T20:52:19
2020-11-10T20:52:19
285,655,680
0
0
null
2020-08-06T19:35:40
2020-08-06T19:35:39
null
UTF-8
C++
false
false
11,943
cc
// G4 headers #include "G4Poisson.hh" #include "Randomize.hh" #include <CCDB/Calibration.h> #include <CCDB/Model/Assignment.h> #include <CCDB/CalibrationGenerator.h> using namespace ccdb; // gemc headers #include "ftof_hitprocess.h" // CLHEP units #include "CLHEP/Units/PhysicalConstants.h" using namespace CLHEP; static ftofConstants initializeFTOFConstants(int runno) { ftofConstants ftc; // do not initialize at the beginning, only after the end of the first event, // with the proper run number coming from options or run table if(runno == -1) return ftc; ftc.runNo = runno; ftc.date = "2015-11-29"; if(getenv ("CCDB_CONNECTION") != NULL) ftc.connection = (string) getenv("CCDB_CONNECTION"); else ftc.connection = "mysql://clas12reader@clasdb.jlab.org/clas12"; ftc.variation = "default"; ftc.npaddles[0] = 23; ftc.npaddles[1] = 62; ftc.npaddles[2] = 5; ftc.thick[0] = 5.0; ftc.thick[1] = 6.0; ftc.thick[2] = 5.0; ftc.dEdxMIP = 1.956; // muons in polyvinyltoluene ftc.pmtPEYld = 500; // ftc.tdcLSB = 42.5532;// counts per ns (23.5 ps LSB) cout<<"FTOF:Setting time resolution"<<endl; for(int p=0; p<3; p++) { for(int c=1; c<ftc.npaddles[p]+1;c++) { if(p==0) ftc.tres[p].push_back(1e-3*(c*5.45+74.55)); //ps to ns if(p==1) ftc.tres[p].push_back(1e-3*(c*0.90+29.10)); //ps to ns if(p==2) ftc.tres[p].push_back(1e-3*(c*5.00+145.0)); //ps to ns } } ftc.dEMIP[0] = ftc.thick[0]*ftc.dEdxMIP; ftc.dEMIP[1] = ftc.thick[1]*ftc.dEdxMIP; ftc.dEMIP[2] = ftc.thick[2]*ftc.dEdxMIP; int isec,ilay,istr; vector<vector<double> > data; auto_ptr<Calibration> calib(CalibrationGenerator::CreateCalibration(ftc.connection)); cout<<"Connecting to "<<ftc.connection<<"/calibration/ftof"<<endl; cout<<"FTOF:Getting attenuation"<<endl; sprintf(ftc.database,"/calibration/ftof/attenuation:%d",ftc.runNo); data.clear(); calib->GetCalib(data,ftc.database); for(unsigned row = 0; row < data.size(); row++) { isec = data[row][0]; ilay = data[row][1]; istr = data[row][2]; ftc.attlen[isec-1][ilay-1][0].push_back(data[row][3]); ftc.attlen[isec-1][ilay-1][1].push_back(data[row][4]); } cout<<"FTOF:Getting effective_velocity"<<endl; sprintf(ftc.database,"/calibration/ftof/effective_velocity:%d",ftc.runNo); data.clear(); calib->GetCalib(data,ftc.database); for(unsigned row = 0; row < data.size(); row++) { isec = data[row][0]; ilay = data[row][1]; istr = data[row][2]; ftc.veff[isec-1][ilay-1][0].push_back(data[row][3]); ftc.veff[isec-1][ilay-1][1].push_back(data[row][4]); } cout<<"FTOF:Getting status"<<endl; sprintf(ftc.database,"/calibration/ftof/status:%d",ftc.runNo); data.clear() ; calib->GetCalib(data,ftc.database); for(unsigned row = 0; row < data.size(); row++) { isec = data[row][0]; ilay = data[row][1]; istr = data[row][2]; ftc.status[isec-1][ilay-1][0].push_back(data[row][3]); ftc.status[isec-1][ilay-1][1].push_back(data[row][4]); } cout<<"FTOF:Getting gain_balance"<<endl; sprintf(ftc.database,"/calibration/ftof/gain_balance:%d",ftc.runNo); data.clear() ; calib->GetCalib(data,ftc.database); for(unsigned row = 0; row < data.size(); row++) { isec = data[row][0]; ilay = data[row][1]; istr = data[row][2]; ftc.countsForMIP[isec-1][ilay-1][0].push_back(data[row][3]); ftc.countsForMIP[isec-1][ilay-1][1].push_back(data[row][4]); } cout<<"FTOF:Getting time_walk"<<endl; sprintf(ftc.database,"/calibration/ftof/time_walk:%d",ftc.runNo); data.clear() ; calib->GetCalib(data,ftc.database); for(unsigned row = 0; row < data.size(); row++) { isec = data[row][0]; ilay = data[row][1]; istr = data[row][2]; ftc.twlk[isec-1][ilay-1][0].push_back(data[row][3]); ftc.twlk[isec-1][ilay-1][1].push_back(data[row][4]); ftc.twlk[isec-1][ilay-1][2].push_back(data[row][5]); ftc.twlk[isec-1][ilay-1][3].push_back(data[row][6]); ftc.twlk[isec-1][ilay-1][4].push_back(data[row][7]); ftc.twlk[isec-1][ilay-1][5].push_back(data[row][8]); } cout<<"FTOF:Getting time_offset"<<endl; sprintf(ftc.database,"/calibration/ftof/timing_offset:%d",ftc.runNo); data.clear() ; calib->GetCalib(data,ftc.database); for(unsigned row = 0; row < data.size(); row++) { isec = data[row][0]; ilay = data[row][1]; istr = data[row][2]; ftc.toff_LR[isec-1][ilay-1].push_back(data[row][3]); ftc.toff_P2P[isec-1][ilay-1].push_back(data[row][4]); } cout<<"FTOF:Getting tdc_conv"<<endl; sprintf(ftc.database,"/calibration/ftof/tdc_conv:%d",ftc.runNo); data.clear() ; calib->GetCalib(data,ftc.database); for(unsigned row = 0; row < data.size(); row++) { isec = data[row][0]; ilay = data[row][1]; istr = data[row][2]; ftc.tdcconv[isec-1][ilay-1][0].push_back(data[row][3]); ftc.tdcconv[isec-1][ilay-1][1].push_back(data[row][4]); } // setting voltage signal parameters ftc.vpar[0] = 50; // delay, ns ftc.vpar[1] = 10; // rise time, ns ftc.vpar[2] = 20; // fall time, ns ftc.vpar[3] = 1; // amplifier return ftc; } void ftof_HitProcess::initWithRunNumber(int runno) { if(ftc.runNo != runno) { cout << " > Initializing " << HCname << " digitization for run number " << runno << endl; ftc = initializeFTOFConstants(runno); ftc.runNo = runno; } } map<string, double> ftof_HitProcess :: integrateDgt(MHit* aHit, int hitn) { map<string, double> dgtz; vector<identifier> identity = aHit->GetId(); int sector = identity[0].id; int panel = identity[1].id; int paddle = identity[2].id; trueInfos tInfos(aHit); // Get the paddle half-length double length = aHit->GetDetector().dimensions[0]; // Distances from left, right double dLeft = length + tInfos.lx; double dRight = length - tInfos.lx; // attenuation length double attlenL = ftc.attlen[sector-1][panel-1][0][paddle-1]; double attlenR = ftc.attlen[sector-1][panel-1][1][paddle-1]; // attenuation factor double attLeft = exp(-dLeft/cm/attlenL); double attRight = exp(-dRight/cm/attlenR); // Gain factors to simulate FTOF PMT gain matching algorithm. // Each L,R PMT pair has HV adjusted so geometeric mean sqrt(L*R) // is independent of counter length, which compensates for // the factor exp(-L/2/attlen) where L=full length of bar. double gainLeft = sqrt(attLeft*attRight); double gainRight = gainLeft; // Attenuated light at PMT double eneL = tInfos.eTot*attLeft; double eneR = tInfos.eTot*attRight; // TDC conversion factors double tdcconvL = ftc.tdcconv[sector-1][panel-1][0][paddle-1]; double tdcconvR = ftc.tdcconv[sector-1][panel-1][1][paddle-1]; // giving geantinos some energies if(aHit->GetPID() == 0) { double gmomentum = aHit->GetMom().mag()/GeV; eneL = gmomentum*attLeft; eneR = gmomentum*attRight; } double adcl = 0; double adcr = 0; double adclu = 0; double adcru = 0; double tdcl = 0; double tdcr = 0; double tdclu = 0; double tdcru = 0; // Fluctuate the light measured by the PMT with // Poisson distribution for emitted photoelectrons // Treat L and R separately, in case nphe=0 if (eneL>0) adclu = eneL*ftc.countsForMIP[sector-1][panel-1][0][paddle-1]/ftc.dEMIP[panel-1]/gainLeft; if (eneR>0) adcru = eneR*ftc.countsForMIP[sector-1][panel-1][1][paddle-1]/ftc.dEMIP[panel-1]/gainRight; double npheL = G4Poisson(eneL*ftc.pmtPEYld); eneL = npheL/ftc.pmtPEYld; if (eneL>0) { adcl = eneL*ftc.countsForMIP[sector-1][panel-1][0][paddle-1]/ftc.dEMIP[panel-1]/gainLeft; double A = ftc.twlk[sector-1][panel-1][0][paddle-1]; double B = ftc.twlk[sector-1][panel-1][1][paddle-1]; //double C = ftc.twlk[sector-1][panel-1][2][paddle-1]; double timeWalkLeft = A/pow(adcl,B); double tLeftU = tInfos.time + dLeft/ftc.veff[sector-1][panel-1][0][paddle-1]/cm + ftc.toff_LR[sector-1][panel-1][paddle-1]/2. - ftc.toff_P2P[sector-1][panel-1][paddle-1] + timeWalkLeft; double tLeft = G4RandGauss::shoot(tLeftU, sqrt(2)*ftc.tres[panel-1][paddle-1]); tdclu = tLeftU/tdcconvL; tdcl = tLeft/tdcconvL; } double npheR = G4Poisson(eneR*ftc.pmtPEYld); eneR = npheR/ftc.pmtPEYld; if (eneR>0) { adcr = eneR*ftc.countsForMIP[sector-1][panel-1][1][paddle-1]/ftc.dEMIP[panel-1]/gainRight; double A = ftc.twlk[sector-1][panel-1][3][paddle-1]; double B = ftc.twlk[sector-1][panel-1][4][paddle-1]; //double C = ftc.twlk[sector-1][panel-1][5][paddle-1]; double timeWalkRight = A/pow(adcr,B); double tRightU = tInfos.time + dRight/ftc.veff[sector-1][panel-1][1][paddle-1]/cm - ftc.toff_LR[sector-1][panel-1][paddle-1]/2. - ftc.toff_P2P[sector-1][panel-1][paddle-1] + timeWalkRight; double tRight = G4RandGauss::shoot(tRightU, sqrt(2)*ftc.tres[panel-1][paddle-1]); tdcru = tRightU/tdcconvR; tdcr = tRight/tdcconvR; } // Status flags switch (ftc.status[sector-1][panel-1][0][paddle-1]) { case 0: break; case 1: adcl = 0; break; case 2: tdcl = 0; break; case 3: adcl = tdcl = 0; break; case 5: break; default: cout << " > Unknown FTOF status: " << ftc.status[sector-1][panel-1][0][paddle-1] << " for sector " << sector << ", panel " << panel << ", paddle " << paddle << " left " << endl; } switch (ftc.status[sector-1][panel-1][1][paddle-1]) { case 0: break; case 1: adcr = 0; break; case 2: tdcr = 0; break; case 3: adcr = tdcr = 0; break; case 5: break; default: cout << " > Unknown FTOF status: " << ftc.status[sector-1][panel-1][1][paddle-1] << " for sector " << sector << ", panel " << panel << ", paddle " << paddle << " right " << endl; } // cout << " > FTOF status: " << ftc.status[sector-1][panel-1][0][paddle-1] << " for sector " << sector << ", panel " << panel << ", paddle " << paddle << " left: " << adcl << endl; // cout << " > FTOF status: " << ftc.status[sector-1][panel-1][1][paddle-1] << " for sector " << sector << ", panel " << panel << ", paddle " << paddle << " right: " << adcr << endl; dgtz["hitn"] = hitn; dgtz["sector"] = sector; dgtz["layer"] = panel; dgtz["paddle"] = paddle; dgtz["ADCL"] = adcl; dgtz["ADCR"] = adcr; dgtz["TDCL"] = tdcl; dgtz["TDCR"] = tdcr; dgtz["ADCLu"] = adclu; dgtz["ADCRu"] = adcru; dgtz["TDCLu"] = tdclu; dgtz["TDCRu"] = tdcru; return dgtz; } vector<identifier> ftof_HitProcess :: processID(vector<identifier> id, G4Step* aStep, detector Detector) { id[id.size()-1].id_sharing = 1; return id; } // - electronicNoise: returns a vector of hits generated / by electronics. vector<MHit*> ftof_HitProcess :: electronicNoise() { vector<MHit*> noiseHits; // first, identify the cells that would have electronic noise // then instantiate hit with energy E, time T, identifier IDF: // // MHit* thisNoiseHit = new MHit(E, T, IDF, pid); // push to noiseHits collection: // noiseHits.push_back(thisNoiseHit) return noiseHits; } map< string, vector <int> > ftof_HitProcess :: multiDgt(MHit* aHit, int hitn) { map< string, vector <int> > MH; return MH; } // - charge: returns charge/time digitized information / step map< int, vector <double> > ftof_HitProcess :: chargeTime(MHit* aHit, int hitn) { map< int, vector <double> > CT; return CT; } // - voltage: returns a voltage value for a given time. The inputs are: // charge value (coming from chargeAtElectronics) // time (coming from timeAtElectronics) double ftof_HitProcess :: voltage(double charge, double time, double forTime) { // return 0.0; return DGauss(forTime, ftc.vpar, charge, time); } // this static function will be loaded first thing by the executable ftofConstants ftof_HitProcess::ftc = initializeFTOFConstants(-1);
[ "maurizio.ungaro@cnu.edu" ]
maurizio.ungaro@cnu.edu
566704fcb4bcce88f0827e6962a9d46c316a942c
6a4866cb714f35190cf3b661160ad66bf46a183c
/BOJ/15001-20000/17672(ugly ver).cpp
22fa08aadbf138805b85dcd4058c8895875faa5d
[]
no_license
dsstar-codes/Problem-Solving
152e298381fc2a4027a9af4623d8fdf7a0863202
5d55d103a7e727429f046322f6b9db0799a80ccb
refs/heads/master
2022-10-24T09:29:40.977070
2022-10-03T07:00:25
2022-10-03T07:00:25
241,553,243
7
0
null
null
null
null
UTF-8
C++
false
false
2,201
cpp
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #define fi first #define se second #define eb emplace_back #define all(V) (V).begin(), (V).end() using namespace std; typedef long long ll; typedef pair<int, ll> pil; const ll INF = 1ll<<60; ll F[1<<21], lz1[1<<21], lz2[1<<21]; inline void spread(int i) { F[i]=max(F[i]+lz1[i], lz2[i]); if (i<(1<<20)) for (auto &j:{i*2, i*2+1}) lz1[j]+=lz1[i], lz2[j]+=lz1[i], lz2[j]=max(lz2[j], lz2[i]); lz1[i]=0, lz2[i]=-INF; } inline void upd1(int i, int s, int e, int ts, int te, ll v) { spread(i); if (e<ts||te<s||te<ts) return ; if (ts<=s&&e<=te) { lz1[i]+=v, lz2[i]+=v; spread(i); return ; } int md=(s+e)/2; upd1(i*2, s, md, ts, te, v); upd1(i*2+1, md+1, e, ts, te, v); F[i]=max(F[i*2], F[i*2+1]); } inline void upd2(int i, int s, int e, int ts, int te, ll v) { spread(i); if (e<ts||te<s||te<ts) return ; if (ts<=s&&e<=te) { lz2[i]=v; spread(i); return ; } int md=(s+e)/2; upd2(i*2, s, md, ts, te, v); upd2(i*2+1, md+1, e, ts, te, v); F[i]=max(F[i*2], F[i*2+1]); } inline ll get(int i, int s, int e, int t) { spread(i); if (s==e) return F[i]; int md=(s+e)/2; if (t<=md) return get(i*2, s, md, t); else return get(i*2+1, md+1, e, t); } int N, M; ll A[1<<20], B[1<<20], S[1<<20], T[1<<20], P[1<<20], Q[1<<20]; vector<pair<int, pil> > qu; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin>>N>>M; for (register int i=1; i<=N; i++) cin>>A[i]>>S[i]>>P[i], A[i]+=A[i-1]; for (register int i=1; i<=M; i++) cin>>B[i]>>T[i]>>Q[i], B[i]+=B[i-1]; for (register int i=1; i<=N; i++) { int I=upper_bound(B, B+M+1, S[i]-A[i])-B-1; if (I>=0) qu.eb(i, pil(I, P[i])); }qu.eb(N+1, pil(M-1, -INF)); ll im=0; for (register int i=1; i<=M; i++) { int J=upper_bound(A, A+N+1, T[i]-B[i])-A-1; if (J>=0) qu.eb(J+1, pil(i-1, -Q[i])), im+=Q[i]; } sort(all(qu)); for (register int i=1, j=0; i<=N+1; i++) { for (register int k=j; k<qu.size()&&qu[k].fi==i; k++) { auto l=qu[k].se; upd1(1, 0, M, 0, l.fi, l.se); } for (; j<qu.size()&&qu[j].fi==i; j++) { auto l=qu[j].se; upd2(1, 0, M, l.fi+1, M, get(1, 0, M, l.fi)); } } cout<<get(1, 0, M, M)+im<<"\n"; cout.flush(); return 0; }
[ "dennisstar2003@gmail.com" ]
dennisstar2003@gmail.com
7ea1870edc5baa275c425ebb471a4445daa6db7b
4c5012252b205930be8de808d39739845778c4b9
/deviceworld/deviceworld.cpp
4fd6a20ad6366c379ced66515c2331c760d40467
[]
no_license
abdo5520/rlcpp
ca85b6541b6ee84c9e7d9c45ae4648db70df541d
fb06a01fdb07ab29907973d7d325b0430871ab8e
refs/heads/master
2021-01-12T05:16:36.706908
2015-09-30T09:17:18
2015-09-30T09:17:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,404
cpp
/* * Copyright (c) 2015 Vrije Universiteit Brussel * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include "deviceworld.h" DeviceWorld::DeviceWorld(AbstractWorld *world, unsigned int device_actions) : PostProcessWorld(world, world->numActions() + device_actions), _first_action(world->numActions()) { } void DeviceWorld::initialState(std::vector<float> &state) { // Store the initial unprocessed state in _last_state so that device actions // can immediately be issued, then postprocess that state. _world->initialState(state); _last_state = state; processState(state); } void DeviceWorld::step(unsigned int action, bool &finished, float &reward, std::vector<float> &state) { if (action < _first_action) { // Normal world action, let the world execute it _world->step(action, finished, reward, state); // Save the world state so that it can be used again if a device action // is performed _last_state = state; } else { // Perform the device action reward = performAction(action - _first_action); state = _last_state; finished = false; } // Post-process the state. This allows the device to add its observations // to the state. processState(state); }
[ "steckdenis@yahoo.fr" ]
steckdenis@yahoo.fr
4d355f9c18fd9d54e1409a1de885122b85916429
a1861705822bb503dcf4269ffe1122538b17c957
/day04/ex03/Ice.cpp
6c45efb06be51e731f8a98b352c4e703f7470a4b
[]
no_license
iliaselbadaoui/CPP_POOL
05230278a2f43307de62b0aa7f0d805badb37fd6
a2fdb35533a17272a9c460263036796c80b85a0e
refs/heads/main
2023-06-17T08:08:07.275547
2021-07-08T16:49:55
2021-07-08T16:49:55
376,026,999
0
0
null
null
null
null
UTF-8
C++
false
false
835
cpp
#include "Ice.hpp" /* ** ------------------------------- CONSTRUCTOR -------------------------------- */ Ice::Ice() : AMateria("ice") { } Ice::Ice( const Ice & src ) : AMateria(src) { } /* ** -------------------------------- DESTRUCTOR -------------------------------- */ Ice::~Ice() { } /* ** --------------------------------- OVERLOAD --------------------------------- */ /* ** --------------------------------- METHODS ---------------------------------- */ AMateria* Ice::clone() const { return (new Ice(*this)); } void Ice::use(ICharacter& target) { this->_xp += 10; std::cout << "* shoots an ice bolt at " << target.getName() << " *"<< std::endl; } /* ** --------------------------------- ACCESSOR --------------------------------- */ /* ************************************************************************** */
[ "iliassovich@outlook.com" ]
iliassovich@outlook.com
a59520525accb2e9b3dc4c2c2394be05cf2c5242
f9ef63d68b4a87836f8611e802828fcb1bb62656
/Intermediate/ParallaxBumpMap/OGLES2/Content/VertShader.cpp
f02578a17c9a3b326dca6575d25ae20ea1a1f686
[]
no_license
ThreeNG/Examples
557aecb1c126479c077c6a87f08b2508c50e2c23
28af63cf097cbe4389cfb3c151dc1bceec19ba24
refs/heads/master
2021-05-26T19:29:27.809842
2013-08-20T19:13:04
2013-08-20T19:13:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,514
cpp
// This file was created by Filewrap 1.1 // Little endian mode // DO NOT EDIT #include "../PVRTMemoryFileSystem.h" // using 32 bit to guarantee alignment. #ifndef A32BIT #define A32BIT static const unsigned int #endif // ******** Start: VertShader.vsh ******** // File data static const char _VertShader_vsh[] = "attribute highp vec3\tvertPos;\r\n" "attribute highp vec3\tvertNormal;\r\n" "attribute highp vec2\tvertUV;\r\n" "attribute highp vec3\tvertTangent;\r\n" "\r\n" "uniform highp mat4\tmModelView;\r\n" "uniform highp mat4\tmModelViewProj;\r\n" "uniform highp mat3\tmNormal;\r\n" "uniform highp vec3\tvLightEyeSpacePos;\r\n" "\r\n" "varying lowp vec3\tlightDir;\r\n" "varying lowp vec3\tviewDir;\r\n" "varying lowp vec2\ttexCoord;\r\n" "\r\n" "const lowp float fParallaxScale = 0.065;\r\n" "\r\n" "void main(void)\r\n" "{\t\r\n" "\t// Create a Matrix to transform from eye space to tangent space\r\n" "\t// Start by calculating the normal, tangent and binormal.\r\n" "\thighp vec3 n = normalize(mNormal * vertNormal);\r\n" "\thighp vec3 t = normalize(mNormal * vertTangent);\r\n" "\thighp vec3 b = cross(n,t);\r\n" "\r\n" "\t// Create the matrix from the above\r\n" "\thighp mat3 mEyeToTangent = mat3( t.x, b.x, n.x,\r\n" "\t\t\t\t\t\t\t t.y, b.y, n.y,\r\n" "\t\t\t\t\t\t\t t.z, b.z, n.z);\r\n" "\t\r\n" "\t// Write gl_pos\r\n" "\thighp vec4 tempPos = vec4(vertPos, 1.0);\t\t\t\t \r\n" "\tgl_Position = mModelViewProj * tempPos;\r\n" "\t\r\n" "\t// Translate the view direction into Tangent Space\r\n" "\t// Translate the position into eye space\r\n" "\ttempPos = mModelView * tempPos;\r\n" "\t// Get the vector from the eye to the surface, this is the inverse of tempPos\r\n" "\tviewDir = tempPos.xyz;\r\n" "\t// Then translate that into Tangent Space (multiplied by parallax scale as only has to\r\n" "\t// be done once per surface, not per fragment)\r\n" "\tviewDir = normalize(mEyeToTangent * viewDir) * fParallaxScale;\r\n" "\t\r\n" "\t// Translate the light dir from eye space into Tangent Space\r\n" "\tlightDir = normalize(vLightEyeSpacePos - tempPos.xyz);\r\n" "\t\r\n" "\t// Finally set the texture co-ords\r\n" "\ttexCoord = vertUV;\r\n" "}"; // Register VertShader.vsh in memory file system at application startup time static CPVRTMemoryFileSystem RegisterFile_VertShader_vsh("VertShader.vsh", _VertShader_vsh, 1564); // ******** End: VertShader.vsh ********
[ "0xb000@gmail.com" ]
0xb000@gmail.com
7390173fb62509e8c2809eb44a00cb7288881ce4
98157b3124db71ca0ffe4e77060f25503aa7617f
/tlx/troc-4/d.cpp
77c9356111f896220457513cc248f05833b2f6c5
[]
no_license
wiwitrifai/competitive-programming
c4130004cd32ae857a7a1e8d670484e236073741
f4b0044182f1d9280841c01e7eca4ad882875bca
refs/heads/master
2022-10-24T05:31:46.176752
2022-09-02T07:08:05
2022-09-02T07:08:35
59,357,984
37
4
null
null
null
null
UTF-8
C++
false
false
276
cpp
#include <bits/stdc++.h> using namespace std; int main() { int t; scanf("%d", &t); while (t--) { int n, k; scanf("%d %d", &n, &k); bool ans = 1; k *= 2; if ((n % k) == 0 && ((n/k) & 1)) ans = 0; puts(ans ? "YES" : "NO"); } return 0; }
[ "wiwitrifai@gmail.com" ]
wiwitrifai@gmail.com
785a9e1a0a2bbf2dd695cc49db291101222ce517
17dce91611fec0b02875d84c98a328cfed0ba8ce
/Observer/TestObserver.cpp
f64012c78b9912771225c338b485dbb301bbbf91
[]
no_license
EmbeddedSystemClass/DesignPatterns_cpp
e6156d7138e0961a8a2f7eb6634562140455d674
43991b58055efbf8f1b214a54fa7cfc034c6b3f7
refs/heads/master
2021-06-10T05:50:05.712062
2016-11-12T08:00:14
2016-11-12T08:00:14
null
0
0
null
null
null
null
UTF-8
C++
false
false
708
cpp
#include <iostream> #include <iomanip> #include <string> #include <list> #include "Investor.h" #include "Stock.h" using namespace std; /** * Story: * Create a stock, and 3 investors * 3 investors buy the stock * When the stock price changed, the investors get notification **/ void testObserver() { cout << endl << "<<Test Singleton>>" << endl; Stock ibm("Ibm", 10.12); Investor *alice = new Investor("Alice"); Investor *bob = new Investor("Bob"); Investor *charlie = new Investor("Charlie"); ibm.attach(alice); ibm.attach(bob); ibm.attach(charlie); ibm.setPrice(20); cout << endl; ibm.detach(bob); ibm.setPrice(40); cout << endl; delete alice; delete bob; delete charlie; }
[ "take.iwiw2222@gmail.com" ]
take.iwiw2222@gmail.com
421b8c1fb17185128978d71ceb45c8fe0ebfab87
a2111a80faf35749d74a533e123d9da9da108214
/raw/workshop12/workshop2012-data-20120906/trunk/.svn/pristine/42/421b8c1fb17185128978d71ceb45c8fe0ebfab87.svn-base
e2bd1756f2dcb3259d28196f0cb81c924dcd7f6f
[ "BSD-3-Clause", "MIT" ]
permissive
bkahlert/seqan-research
f2c550d539f511825842a60f6b994c1f0a3934c2
21945be863855077eec7cbdb51c3450afcf560a3
refs/heads/master
2022-12-24T13:05:48.828734
2015-07-01T01:56:22
2015-07-01T01:56:22
21,610,669
1
0
null
null
null
null
UTF-8
C++
false
false
12,982
// ========================================================================== // SeqAn - The Library for Sequence Analysis // ========================================================================== // Copyright (c) 2006-2012, Knut Reinert, FU Berlin // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of Knut Reinert or the FU Berlin nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN 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. // // ========================================================================== // Author: Andres Gogol-Döring <andreas.doering@mdc-berlin.de> // ========================================================================== // Pair base class. // ========================================================================== // TODO(holtgrew): What about move construction? Useful for pairs of strings and such. Tricky to implement since ints have no move constructor, for example. #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_PAIR_BASE_H_ #define SEQAN_CORE_INCLUDE_SEQAN_BASIC_PAIR_BASE_H_ namespace seqan { // ============================================================================ // Forwards // ============================================================================ // ============================================================================ // Tags, Classes, Enums // ============================================================================ /** .Class.Pair: ..cat:Aggregates ..concept:Concept.Aggregate ..summary:Stores two arbitrary objects. ..signature:Pair<T1[, T2[, TSpec]]> ..param.T1:The type of the first object. ..param.T2:The type of the second object. ...default:$T1$ ..param.TSpec:The specializing type. ...default:$void$, no compression (faster access). .Memfunc.Pair#Pair: ..class:Class.Pair ..summary:Constructor ..signature:Pair<T1, T2[, TSpec]> () ..signature:Pair<T1, T2[, TSpec]> (pair) ..signature:Pair<T1, T2[, TSpec]> (i1, i2) ..param.pair:Other Pair object. (copy constructor) ..param.i1:T1 object. ..param.i2:T2 object. .Memvar.Pair#i1: ..class:Class.Pair ..summary:T1 object .Memvar.Pair#i2: ..class:Class.Pair ..summary:T2 object ..include:seqan/basic.h */ // TODO(holtgrew): Should default specs be specialized with void or Default? // TODO(holtgrew): Move construction, will be a bit tricky, either with enable_if or with 4 base classes and all constructors are forwarded there. template <typename T1_, typename T2_ = T1_, typename TSpec = void> struct Pair { // TODO(holtgrew): T1 and T2 should not be public but have underscore postfix? typedef T1_ T1; typedef T2_ T2; // ------------------------------------------------------------------------ // Members // ------------------------------------------------------------------------ T1_ i1; T2_ i2; // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ Pair() : i1(T1_()), i2(T2_()) {} template <typename T3_, typename T4_> Pair(Pair<T3_, T4_> const & _p) : i1(_p.i1), i2(_p.i2) {} inline Pair(T1_ const & _i1, T2_ const & _i2) : i1(_i1), i2(_i2) {} template <typename T1__, typename T2__, typename TSpec__> // TODO(holtgrew): explicit? inline Pair(Pair<T1__, T2__, TSpec__> const &_p) : i1(getValueI1(_p)), i2(getValueI2(_p)) {} }; // ============================================================================ // Metafunctions // ============================================================================ // ----------------------------------------------------------------------- // Metafunction LENGTH // ----------------------------------------------------------------------- ///.Metafunction.LENGTH.param.T.type:Class.Pair ///.Metafunction.LENGTH.class:Class.Pair template <typename T1, typename T2, typename TSpec> struct LENGTH<Pair<T1, T2, TSpec> > { enum { VALUE = 2 }; }; // Const variant is mapped to non-const by default implementation. // ---------------------------------------------------------------------------- // Metafunction Value // ---------------------------------------------------------------------------- /** .Metafunction.Value ..class:Class.Pair ..class:Class.Triple ..class:Class.Tuple ..signature:Value<TTuple, POSITION>::Type ..param.TTuple:@Class.Pair@, @Class.Triple@, or @Class.Tuple@ to return value from. ...type:Class.Pair ...type:Class.Triple ...type:Class.Tuple ..param.POSITION:Position of the type to query. ...type:nolink:$int$ */ template <typename T1, typename T2, typename TSpec> struct Value<Pair<T1, T2, TSpec>, 1> { typedef T1 Type; }; template <typename T1, typename T2, typename TSpec> struct Value<Pair<T1, T2, TSpec>, 2> { typedef T2 Type; }; // ---------------------------------------------------------------------------- // Metafunction Spec // ---------------------------------------------------------------------------- ///.Metafunction.Spec.param.T.type:Class.Pair ///.Metafunction.Spec.class:Class.Pair template <typename T1, typename T2, typename TSpec> struct Spec<Pair<T1, T2, TSpec> > { typedef TSpec Type; }; // ============================================================================ // Functions // ============================================================================ // ---------------------------------------------------------------------------- // Function set(). // ---------------------------------------------------------------------------- template <typename T1_, typename T2_, typename TSpec> inline void set(Pair<T1_, T2_, TSpec> & p1, Pair<T1_, T2_, TSpec> & p2) { set(p1.i1, p2.i1); set(p1.i2, p2.i2); } // ---------------------------------------------------------------------------- // Function move(). // ---------------------------------------------------------------------------- template <typename T1_, typename T2_, typename TSpec> inline void move(Pair<T1_, T2_, TSpec> & p1, Pair<T1_, T2_, TSpec> & p2) { move(p1.i1, p2.i1); move(p1.i2, p2.i2); } // ---------------------------------------------------------------------------- // Function operator<<(); Stream Output. // ---------------------------------------------------------------------------- template <typename T1_, typename T2_, typename TSpec> inline std::ostream & operator<<(std::ostream & out, Pair<T1_, T2_, TSpec> const & p) { // TODO(holtgrew): Incorporate this into new stream concept? Adapt from stream module? out << "< " << getValueI1(p) << " , " << getValueI2(p) << " >"; return out; } // ----------------------------------------------------------------------- // Function getValueIX() // ----------------------------------------------------------------------- // There can be no getValue with index since T1 can be != T2. template <typename T1, typename T2, typename TSpec> inline T1 getValueI1(Pair<T1, T2, TSpec> const & pair) { return pair.i1; } template <typename T1, typename T2, typename TSpec> inline T2 getValueI2(Pair<T1, T2, TSpec> const & pair) { return pair.i2; } // ----------------------------------------------------------------------- // Function assignValueIX() // ----------------------------------------------------------------------- // Cannot be assignValue with index since T1 can be != T2. template <typename T1, typename T2, typename TSpec, typename T> inline void assignValueI1(Pair<T1, T2, TSpec> & pair, T const & _i) { pair.i1 = _i; } template <typename T1, typename T2, typename TSpec, typename T> inline void assignValueI2(Pair<T1, T2, TSpec> & pair, T const & _i) { pair.i2 = _i; } // ----------------------------------------------------------------------- // Function setValueIX() // ----------------------------------------------------------------------- // Cannot be setValue with index since T1 can be != T2. template <typename T1, typename T2, typename TSpec, typename T> inline void setValueI1(Pair<T1, T2, TSpec> & pair, T const & _i) { set(pair.i1, _i); } template <typename T1, typename T2, typename TSpec, typename T> inline void setValueI2(Pair<T1, T2, TSpec> & pair, T const & _i) { set(pair.i2, _i); } // ----------------------------------------------------------------------- // Function moveValueIX() // ----------------------------------------------------------------------- // Cannot be moveValue with index since T1 can be != T2. template <typename T1, typename T2, typename TSpec, typename T> inline void moveValueI1(Pair<T1, T2, TSpec> & pair, T & _i) { move(pair.i1, _i); } template <typename T1, typename T2, typename TSpec, typename T> inline void moveValueI2(Pair<T1, T2, TSpec> & pair, T & _i) { move(pair.i2, _i); } // ----------------------------------------------------------------------- // Function operator<() // ----------------------------------------------------------------------- template <typename L1, typename L2, typename LCompression, typename R1, typename R2, typename RCompression> inline bool operator<(Pair<L1, L2, LCompression> const & _left, Pair<R1, R2, RCompression> const & _right) { return (_left.i1 < _right.i1) || (_left.i1 == _right.i1 && _left.i2 < _right.i2); } // ----------------------------------------------------------------------- // Function operator>() // ----------------------------------------------------------------------- template <typename L1, typename L2, typename LCompression, typename R1, typename R2, typename RCompression> inline bool operator>(Pair<L1, L2, LCompression> const & _left, Pair<R1, R2, RCompression> const & _right) { return (_left.i1 > _right.i1) || (_left.i1 == _right.i1 && _left.i2 > _right.i2); } // ----------------------------------------------------------------------- // Function operator==() // ----------------------------------------------------------------------- template <typename L1, typename L2, typename LCompression, typename R1, typename R2, typename RCompression> inline bool operator==(Pair<L1, L2, LCompression> const & _left, Pair<R1, R2, RCompression> const & _right) { return _left.i1 == _right.i1 && _left.i2 == _right.i2; } // ----------------------------------------------------------------------- // Function operator<=() // ----------------------------------------------------------------------- template <typename L1, typename L2, typename LCompression, typename R1, typename R2, typename RCompression> inline bool operator<=(Pair<L1, L2, LCompression> const & _left, Pair<R1, R2, RCompression> const & _right) { return !operator>(_left, _right); } // ----------------------------------------------------------------------- // Function operator>=() // ----------------------------------------------------------------------- template <typename L1, typename L2, typename LCompression, typename R1, typename R2, typename RCompression> inline bool operator>=(Pair<L1, L2, LCompression> const & _left, Pair<R1, R2, RCompression> const & _right) { return !operator<(_left, _right); } // ----------------------------------------------------------------------- // Function operator!=() // ----------------------------------------------------------------------- template <typename L1, typename L2, typename LCompression, typename R1, typename R2, typename RCompression> inline bool operator!=(Pair<L1, L2, LCompression> const & _left, Pair<R1, R2, RCompression> const & _right) { return !operator==(_left, _right); } } // namespace seqan #endif // #ifndef SEQAN_CORE_INCLUDE_SEQAN_BASIC_PAIR_BASE_H_
[ "mail@bkahlert.com" ]
mail@bkahlert.com
0a45b0b76f652ed55a570d04029dcae5aeb9feb9
81ed1280eca8b7cab677bc0d42438bb590b71ae2
/src/test/fs_tests.cpp
27192bcd0ceab95ca3ca668dc4eb2daf6a80d94f
[ "MIT" ]
permissive
btcavenue/btcavenue
09d595d8cc3392890e4ceb1272569d41e059f7d8
63c135c40dbb1aef3078abb4dffefa04b8ef8217
refs/heads/master
2021-03-24T23:51:21.263328
2020-03-16T00:02:29
2020-03-16T00:02:29
247,573,014
0
0
null
null
null
null
UTF-8
C++
false
false
1,701
cpp
// Copyright (c) 2011-2019 The Btcavenue Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. // #include <fs.h> #include <test/util/setup_common.h> #include <util/system.h> #include <boost/test/unit_test.hpp> BOOST_FIXTURE_TEST_SUITE(fs_tests, BasicTestingSetup) BOOST_AUTO_TEST_CASE(fsbridge_fstream) { fs::path tmpfolder = GetDataDir(); // tmpfile1 should be the same as tmpfile2 fs::path tmpfile1 = tmpfolder / "fs_tests_₿_🏃"; fs::path tmpfile2 = tmpfolder / "fs_tests_₿_🏃"; { fsbridge::ofstream file(tmpfile1); file << "btcavenue"; } { fsbridge::ifstream file(tmpfile2); std::string input_buffer; file >> input_buffer; BOOST_CHECK_EQUAL(input_buffer, "btcavenue"); } { fsbridge::ifstream file(tmpfile1, std::ios_base::in | std::ios_base::ate); std::string input_buffer; file >> input_buffer; BOOST_CHECK_EQUAL(input_buffer, ""); } { fsbridge::ofstream file(tmpfile2, std::ios_base::out | std::ios_base::app); file << "tests"; } { fsbridge::ifstream file(tmpfile1); std::string input_buffer; file >> input_buffer; BOOST_CHECK_EQUAL(input_buffer, "btcavenuetests"); } { fsbridge::ofstream file(tmpfile2, std::ios_base::out | std::ios_base::trunc); file << "btcavenue"; } { fsbridge::ifstream file(tmpfile1); std::string input_buffer; file >> input_buffer; BOOST_CHECK_EQUAL(input_buffer, "btcavenue"); } } BOOST_AUTO_TEST_SUITE_END()
[ "root@ns349841.ip-188-165-202.eu" ]
root@ns349841.ip-188-165-202.eu
304f936e8ae1e4571107109d38cc2f89e45a6c32
94050a3c740d735a7b008f6a1e12fd7b5d56fafd
/moc_menu.cpp
f6746df084697deb3798bf757fa9e90d6bdddb95
[]
no_license
ProjectRobal/Punto_Navi
1bc929179a9d76014ac366518506c995cab9171a
12f2d8827459c1dd2be0425c0d3491cc1020e6de
refs/heads/main
2023-08-27T23:51:00.913271
2021-09-25T12:01:49
2021-09-25T12:01:49
397,277,568
1
0
null
null
null
null
UTF-8
C++
false
false
3,663
cpp
/**************************************************************************** ** Meta object code from reading C++ file 'menu.h' ** ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.8) ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include "menu.h" #include <QtCore/qbytearray.h> #include <QtCore/qmetatype.h> #if !defined(Q_MOC_OUTPUT_REVISION) #error "The header file 'menu.h' doesn't include <QObject>." #elif Q_MOC_OUTPUT_REVISION != 67 #error "This file was generated using the moc from 5.12.8. It" #error "cannot be used with the include files from this version of Qt." #error "(The moc has changed too much.)" #endif QT_BEGIN_MOC_NAMESPACE QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED struct qt_meta_stringdata_Menu_t { QByteArrayData data[5]; char stringdata0[63]; }; #define QT_MOC_LITERAL(idx, ofs, len) \ Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ qptrdiff(offsetof(qt_meta_stringdata_Menu_t, stringdata0) + ofs \ - idx * sizeof(QByteArrayData)) \ ) static const qt_meta_stringdata_Menu_t qt_meta_stringdata_Menu = { { QT_MOC_LITERAL(0, 0, 4), // "Menu" QT_MOC_LITERAL(1, 5, 18), // "on_android_clicked" QT_MOC_LITERAL(2, 24, 0), // "" QT_MOC_LITERAL(3, 25, 19), // "on_settings_clicked" QT_MOC_LITERAL(4, 45, 17) // "on_player_clicked" }, "Menu\0on_android_clicked\0\0on_settings_clicked\0" "on_player_clicked" }; #undef QT_MOC_LITERAL static const uint qt_meta_data_Menu[] = { // content: 8, // revision 0, // classname 0, 0, // classinfo 3, 14, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors 0, // flags 0, // signalCount // slots: name, argc, parameters, tag, flags 1, 0, 29, 2, 0x08 /* Private */, 3, 0, 30, 2, 0x08 /* Private */, 4, 0, 31, 2, 0x08 /* Private */, // slots: parameters QMetaType::Void, QMetaType::Void, QMetaType::Void, 0 // eod }; void Menu::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) { if (_c == QMetaObject::InvokeMetaMethod) { auto *_t = static_cast<Menu *>(_o); Q_UNUSED(_t) switch (_id) { case 0: _t->on_android_clicked(); break; case 1: _t->on_settings_clicked(); break; case 2: _t->on_player_clicked(); break; default: ; } } Q_UNUSED(_a); } QT_INIT_METAOBJECT const QMetaObject Menu::staticMetaObject = { { &MenuEntry::staticMetaObject, qt_meta_stringdata_Menu.data, qt_meta_data_Menu, qt_static_metacall, nullptr, nullptr } }; const QMetaObject *Menu::metaObject() const { return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; } void *Menu::qt_metacast(const char *_clname) { if (!_clname) return nullptr; if (!strcmp(_clname, qt_meta_stringdata_Menu.stringdata0)) return static_cast<void*>(this); return MenuEntry::qt_metacast(_clname); } int Menu::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = MenuEntry::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 3) qt_static_metacall(this, _c, _id, _a); _id -= 3; } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { if (_id < 3) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 3; } return _id; } QT_WARNING_POP QT_END_MOC_NAMESPACE
[ "patryk1-70@wp.pl" ]
patryk1-70@wp.pl
3234eab04794da72969a5e1a9b4438a0475b4574
958f8ce3496c86e229651e38ab28077f29f7baf5
/c++/sjexercise_Graph/Graph.h
240a8a141a0034adb1bb648ed18c8473a5f6daa9
[]
no_license
XingwenZhang/codeDemo
213542e5260b273dd929ad31c3bef94c78256aac
3ed6ff77826e69b6a974044adc203b20f0b04e0f
refs/heads/master
2021-01-11T07:57:27.741444
2016-10-27T18:26:48
2016-10-27T18:26:48
72,135,714
0
0
null
null
null
null
GB18030
C++
false
false
3,059
h
//#ifndef GRAPH_H //#define GRAPH_H //#include<> //class Graph //{ //private: // // //}; // // // // //int visited[MAX_VERTEX_NUM] ; //void dfs_trave(ALGraph alg) //{ // int i ; // for(i = 0; i < alg.vexnum; i++) // { // visited[i] = 0 ; // } // for(i=0; i < alg.vexnum; i++) // { // if(visited[i] = 0) // dfs(alg,i) ; // } //} // //void dfs(ALGraph alg, int i) //{ // visist(i) ; // visited[i] = i ; // ARCNODE *p = alg.vextices[i].firstarc ; // while(p!=NULL) // { // if(visited[p->adjvex] == 0) // { // dfs(alg,p->adjvex) ; // } // p = p->nextarc ; // } //} //#endif #ifndef GRAPH_H #define GRAPH_H #include<queue> #include<iostream> using namespace std ; template<class EdgeType> class Edge { public: int start, end ; EdgeType weight; Edge() ; Edge(int st, int en, int w) ; bool operator >(Edge oneEdge) ; bool operator < (Edge oneEdge) ; }; template<class EdgeType> class Graph { public: int vertexNum ; int edgeNum ; int *Mark ; Craph(int verticesNum) { vertexNum = verticesNum ; degeNum = 0 ; Mark = new int[vertexNum] ; for(int i = 0; i < vertexNum; i++) { Mark[i] = UNVISITED ; } } ~Graph() { delete [] mark ; delete [] Indegree ; } virtual Edge<EdgeType> FirstEdge(int oneVertex) = 0 ; virtual Edge<EdgeType> NextEdge(Edge<EdgeType> oneEdge) = 0 ; int VerticesNum() { return vertexNum ; } int EdgesNum() { return edgeNum; } bool IsEdge(Edge<EdgeType> oneEdge) { if(oneEdge.weight > 0 && oneEdge.weight < INFINITY && oneEdge.end >= 0) return true ; else return false ; } int StartVertex(Edge<EdgeType> oneEdge) { return oneEdge.start ; } int EndVertex(Edge<EdgeType> oneEdge) { return oneEdge.end ; } EdgeType Weight(Edge<EdgeType> oneEdge) { return oneEdge.weight ; } virtual void setEdge(int start, int end, int weight) = 0 ; virtual void delEdge(int start, int end) = 0 ; void BFS(int v) ; void BFSTraverse() ; void DFS(int v) ; void DFSTraverse() ; }; template<class EdgeType> void Graph<EdgeType>::BFS(int v) { queue<int> Q ; Mark[v] = VISITED ; visit(v) ; //该函数还未定义 Q.push(v) ; while(!Q.empty()) { u = Q.front() ; Q.pop() ; for(Edge<EdgeType> e = FirstEdge(v); IsEdge(e); e = NextEdge(e)) { int u = Mark[EndVertex(e)] ; if(u == UNVISITED) { visit(u) ; Mark[u] = VISITED ; Q.push(u) ; } } } } template<class EdgeType> void Graph<EdgeType>::BFSTraverse() { int v ; for(v = 0; i < VerticesNum(); i++) { Mark[v] = UNVISITED ; } for(v = 0; i < VerticesNum(); v++) { if(Mark[v] == UNVISITED) BFS(v); } } template<EdgeType> void Graph<EdgeType>::DFS(int v) { Mark[v] = VISITED ; visit(v) ; for(Edge e = FirstEdge(v); IsEdge(e); e = NextEdge(e)) { if(Mark[this->EndVertex(e)] == UNVISITED) //修改 DFS(EndVertex(e)) ; } } template<class EdgeType> void Graph<EdgeType>::DFSTraverse() { for(int i = 0; i < VerticesNum(); i++) { Mark[i] = UNVISITED ; } for(int i = 0; i < VerticesNum(); i++) { if(Mark[i] == UNVISITED) DFS(i) ; } } #endif
[ "zhangxingwen0428@gmail.com" ]
zhangxingwen0428@gmail.com