wow
parent
1430e2f9a8
commit
de853370be
242
.idea/editor.xml
242
.idea/editor.xml
|
@ -240,5 +240,247 @@
|
|||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSmartPointerVsMakeFunction/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCStyleCast/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionalStyleCast/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReinterpretCastFromVoidPtr/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConvertingConstructor/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConversionOperator/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDiscardedPostfixOperatorResult/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstValueFunctionReturnType/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeConst/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeStatic/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMayBeConst/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConst/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVariableCanBeMadeConstexpr/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConstPtrOrRef/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPassValueParameterByConstReference/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppThrowExpressionCanBeReplacedWithRethrow/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroConstantCanBeReplacedWithNullptr/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCompileTimeConstantCanBeReplacedWithBooleanConstant/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIfCanBeReplacedByConstexprIf/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConstevalIfIsAlwaysConstant/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStructuredBinding/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseTypeTraitAlias/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAlgorithmWithCount/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseRangeAlgorithm/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseElementsView/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStdSize/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForLoopCanBeReplacedWithWhile/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppJoinDeclarationAndAssignment/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceTieWithStructuredBinding/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceMemsetWithZeroInitialization/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAssociativeContains/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseEraseAlgorithm/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseFamiliarTemplateSyntaxForGenericLambdas/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScope/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScopeInitStatement/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantNamespaceDefinition/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineFunctionDefinitionInHeaderFile/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineVariableDefinitionInHeaderFile/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionIsNotImplemented/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrivateSpecialMemberFunctionIsNotImplemented/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHiddenFunction/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHidingFunction/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPolymorphicClassWithNonVirtualPublicDestructor/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractClassWithoutSpecifier/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompleteSwitchStatement/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultCaseNotHandledInSwitchStatement/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyErroneousEmptyStatements/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExpressionWithoutSideEffects/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNoDiscardExpression/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionResultShouldBeUsed/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingKeywordThrow/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTypeWithoutTypenameKeyword/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTemplateWithoutTemplateKeyword/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppImplicitDefaultConstructorNotAvailable/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeedsConstructorBecauseOfUninitializedMember/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedNonStaticDataMember/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRangeBasedForIncompatibleReference/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroValuedExpressionUsedAsNullPointer/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUnintendedObjectSlicing/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUninitializedMember/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorDisambiguatedAsFunction/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionInFinalClass/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMustBePublicVirtualToImplementInterface/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationSpecifierWithoutDeclarators/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEmptyDeclaration/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesLocal/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesUncapturedLocal/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMismatchedClassTags/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUsingResultOfAssignmentAsCondition/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIntegralToPointerConversion/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerToIntegralConversion/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompatiblePointerConversion/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerConversionDropsQualifiers/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStringLiteralToCharPointerConversion/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExceptionSafeResourceAcquisition/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionCallInsideCtor/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractVirtualFunctionCallInCtor/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInvalidLineContinuation/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfBadFormat/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfRiskyFormat/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfMissedArg/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfExtraArg/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatBadCode/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatLegacyCode/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatMixedArgs/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooFewArgs/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooManyArgs/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedEntity/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingIncludeGuard/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenSyntaxError/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUnresolvedReference/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUndocumentedParameter/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeletingVoidPointer/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBooleanIncrementExpression/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedRegisterStorageClassSpecifier/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIdenticalOperandsInBinaryExpression/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEqualOperandsInBinaryExpression/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedefinitionOfDefaultArgumentInOverrideFunction/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnamedNamespaceInHeaderFile/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNamesMismatch/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultedSpecialMemberFunctionIsImplicitlyDeleted/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNodiscardFunctionWithoutReturnValue/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantComplexityInComparison/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractFinalClass/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSpecialFunctionWithoutNoexceptSpecification/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnsignedZeroComparison/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterLiteral/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterWideLiteral/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifier/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantAccessSpecifier/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAccessSpecifierWithNoDeclarations/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTypenameKeyword/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateKeyword/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeyword/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeywordInsideCompoundStatement/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantControlFlowJump/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyStatement/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyDeclaration/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantParentheses/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantLambdaParameterList/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantCastExpression/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHeaderHasBeenAlreadyIncluded/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateArguments/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticSpecifierOnAnonymousNamespaceMember/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnMemberAllocationFunction/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnThreadLocalLocalVariable/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassAccessSpecifier/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantInlineSpecifier/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConstSpecifier/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBooleanExpressionArgument/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantVoidArgumentList/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantMemberInitializer/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassInitializer/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstParameterInDeclaration/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVolatileParameterInDeclaration/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalFunctionInFinalClass/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalNonOverridingVirtualFunction/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElaboratedTypeSpecifier/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantDereferencingAndTakingAddress/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConditionalExpression/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConditionalExpressionCanBeSimplified/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantExportKeyword/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantZeroInitializerInAggregateInitialization/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUserDefinedLiteralSuffixDoesNotStartWithUnderscore/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassIsIncomplete/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterShadowing/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMutableSpecifierOnReferenceMember/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultInitializationWithNoUserConstructor/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExplicitSpecializationInNonNamespaceScope/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnionMemberOfReferenceType/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedDependentBaseClass/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderIsNotIncluded/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderNotFound/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCoroutineCallResolveError/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAwaiterTypeIsNotClass/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOutParameterMustBeWritten/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWarningDirective/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticAssertFailure/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEvaluationFailure/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorNeverUsed/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTypeAliasNeverUsed/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConceptNeverUsed/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnumeratorNeverUsed/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLambdaCaptureNeverUsed/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableWithNonTrivialDtorIsNeverUsed/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNeverUsed/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterNeverUsed/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityAssignedButNoRead/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityUsedOnlyInUnevaluatedContext/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMightNotBeInitialized/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppObjectMemberMightNotBeInitialized/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSomeObjectMembersMightNotBeInitialized/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorUsedBeforeInitialization/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnusedIncludeDirective/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNotAllPathsReturnValue/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CDeclarationWithImplicitIntType/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionDoesntReturnValue/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReturnNoValueInNonVoidFunction/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDereferenceOperatorLimitExceeded/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForwardEnumDeclarationWithoutUnderlyingType/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaRegionDirective/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaEndRegionDirective/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticDataMemberInUnnamedStruct/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultIsUsedAsIdentifier/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLongFloat/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtReinterpretCastFromNullptr/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtBindingRValueToLvalueReference/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtAddressOfClassRValue/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtDoubleUserConversionInCopyInit/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtCopyElisionInCopyInitDeclarator/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtNotInitializedStaticConstLocalVar/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRemoveRedundantBraces/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceIfStatementBraces/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceForStatementBraces/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceWhileStatementBraces/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceDoStatementBraces/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongIncludesOrder/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongSlashesInIncludeDirective/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceNestedNamespacesStyle/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceTypeAliasCodeStyle/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceFunctionDeclarationStyle/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberInitializersOrder/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingFunctionStyle/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingDestructorStyle/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAuto/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAutoForNumeric/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersPlacement/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersOrder/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnecessaryWhitespace/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTabsAreDisallowed/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantConditions/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANullDereference/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANotInitializedField/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALoopConditionNotUpdated/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFADeletedPointer/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAMemoryLeak/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInvalidatedMemory/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesScope/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesFunction/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantParameter/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantFunctionResult/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAArrayIndexOutOfBounds/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableCode/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableFunctionCall/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAEndlessLoop/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInfiniteRecursion/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnusedValue/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreadVariable/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFATimeOver/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInconsistentNaming/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexRemoved" />
|
||||
<option name="/Default/CodeStyle/Generate/=CppDefinitions/@KeyIndexDefined" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/Generate/=CppDefinitions/Options/=GenerateInlineDefinitions/@EntryIndexedValue" value="False" type="string" />
|
||||
<option name="/Default/CodeStyle/Generate/=CppDefinitions/Options/=GenerateInlineDefinitions/@EntryIndexRemoved" />
|
||||
</component>
|
||||
</project>
|
|
@ -27,7 +27,7 @@ macro(compile_options target_name)
|
|||
sanitizers(${target_name})
|
||||
endmacro()
|
||||
|
||||
project(blt-gp VERSION 0.3.21)
|
||||
project(blt-gp VERSION 0.3.22)
|
||||
|
||||
include(CTest)
|
||||
|
||||
|
|
|
@ -133,8 +133,9 @@ namespace blt::gp
|
|||
bytes_stored += stack.bytes_stored;
|
||||
}
|
||||
|
||||
void copy_from(const stack_allocator& stack, blt::size_t bytes)
|
||||
void copy_from(const stack_allocator& stack, const size_t bytes)
|
||||
{
|
||||
// TODO: add debug checks to these functions! (check for out of bounds copy)
|
||||
if (bytes == 0)
|
||||
return;
|
||||
if (bytes + bytes_stored > size_)
|
||||
|
@ -143,6 +144,16 @@ namespace blt::gp
|
|||
bytes_stored += bytes;
|
||||
}
|
||||
|
||||
void copy_from(const stack_allocator& stack, const size_t bytes, const size_t offset)
|
||||
{
|
||||
if (bytes == 0)
|
||||
return;
|
||||
if (bytes + bytes_stored > size_)
|
||||
expand(bytes + size_);
|
||||
std::memcpy(data_ + bytes_stored, stack.data_ + (stack.bytes_stored - bytes - offset), bytes);
|
||||
bytes_stored += bytes;
|
||||
}
|
||||
|
||||
void copy_from(const u8* data, const size_t bytes)
|
||||
{
|
||||
if (bytes == 0 || data == nullptr)
|
||||
|
|
|
@ -65,8 +65,8 @@ namespace blt::gp
|
|||
};
|
||||
struct crossover_point_t
|
||||
{
|
||||
ptrdiff_t p1_crossover_point;
|
||||
ptrdiff_t p2_crossover_point;
|
||||
tree_t::subtree_point_t p1_crossover_point;
|
||||
tree_t::subtree_point_t p2_crossover_point;
|
||||
};
|
||||
struct config_t
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ namespace blt::gp
|
|||
// used by the traverse version of get_crossover_point
|
||||
// at each depth level, what chance do we have to exit with this as our point? or in other words what's the chance we continue traversing
|
||||
// this is what this option configures.
|
||||
f32 traverse_chance = 0.5;
|
||||
f32 depth_multiplier = 0.5;
|
||||
// how often should we select terminals over functions. By default, we only allow selection of terminals 10% of the time
|
||||
// this applies to both types of crossover point functions. Traversal will use the parent if it should not pick a terminal.
|
||||
f32 terminal_chance = 0.1;
|
||||
|
@ -98,11 +98,9 @@ namespace blt::gp
|
|||
return config;
|
||||
}
|
||||
|
||||
std::optional<crossover_point_t> get_crossover_point(gp_program& program, const tree_t& c1, const tree_t& c2) const;
|
||||
std::optional<crossover_point_t> get_crossover_point(const tree_t& c1, const tree_t& c2) const;
|
||||
|
||||
std::optional<crossover_point_t> get_crossover_point_traverse(gp_program& program, const tree_t& c1, const tree_t& c2) const;
|
||||
|
||||
std::optional<point_info_t> get_point_from_traverse_raw(gp_program& program, const tree_t& t, std::optional<type_id> type) const;
|
||||
std::optional<crossover_point_t> get_crossover_point_traverse(const tree_t& c1, const tree_t& c2) const;
|
||||
|
||||
/**
|
||||
* child1 and child2 are copies of the parents, the result of selecting a crossover point and performing standard subtree crossover.
|
||||
|
@ -117,7 +115,7 @@ namespace blt::gp
|
|||
virtual ~crossover_t() = default;
|
||||
|
||||
protected:
|
||||
std::optional<point_info_t> get_point_traverse_retry(gp_program& program, const tree_t& t, std::optional<type_id> type) const;
|
||||
[[nodiscard]] std::optional<tree_t::subtree_point_t> get_point_traverse_retry(const tree_t& t, std::optional<type_id> type) const;
|
||||
|
||||
config_t config;
|
||||
};
|
||||
|
@ -146,7 +144,7 @@ namespace blt::gp
|
|||
virtual bool apply(gp_program& program, const tree_t& p, tree_t& c);
|
||||
|
||||
// returns the point after the mutation
|
||||
blt::size_t mutate_point(gp_program& program, tree_t& c, blt::size_t node) const;
|
||||
size_t mutate_point(gp_program& program, tree_t& c, tree_t::subtree_point_t node) const;
|
||||
|
||||
virtual ~mutation_t() = default;
|
||||
|
||||
|
|
|
@ -188,6 +188,45 @@ namespace blt::gp
|
|||
{
|
||||
ptrdiff_t pos;
|
||||
type_id type;
|
||||
|
||||
explicit subtree_point_t(const ptrdiff_t pos): pos(pos), type(0)
|
||||
{
|
||||
}
|
||||
|
||||
subtree_point_t(const ptrdiff_t pos, const type_id type): pos(pos), type(type)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct after_bytes_data_t
|
||||
{
|
||||
after_bytes_data_t(tree_t& tree, u8* data, const size_t bytes): tree(tree), data(data), bytes(bytes)
|
||||
{
|
||||
}
|
||||
|
||||
after_bytes_data_t(const after_bytes_data_t& copy) = delete;
|
||||
after_bytes_data_t& operator=(const after_bytes_data_t& copy) = delete;
|
||||
|
||||
after_bytes_data_t(after_bytes_data_t&& move) noexcept: tree(move.tree), data(std::exchange(move.data, nullptr)),
|
||||
bytes(std::exchange(move.bytes, 0))
|
||||
{
|
||||
}
|
||||
|
||||
after_bytes_data_t& operator=(after_bytes_data_t&& move) noexcept = delete;
|
||||
|
||||
~after_bytes_data_t()
|
||||
{
|
||||
if (bytes > 0)
|
||||
{
|
||||
tree.values.copy_from(data, bytes);
|
||||
bytes = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
tree_t& tree;
|
||||
u8* data;
|
||||
size_t bytes;
|
||||
};
|
||||
|
||||
explicit tree_t(gp_program& program): m_program(&program)
|
||||
|
@ -288,26 +327,6 @@ namespace blt::gp
|
|||
handle_operator_inserted(operations.back());
|
||||
}
|
||||
|
||||
[[nodiscard]] tracked_vector<op_container_t>& get_operations()
|
||||
{
|
||||
return operations;
|
||||
}
|
||||
|
||||
[[nodiscard]] const tracked_vector<op_container_t>& get_operations() const
|
||||
{
|
||||
return operations;
|
||||
}
|
||||
|
||||
[[nodiscard]] stack_allocator& get_values()
|
||||
{
|
||||
return values;
|
||||
}
|
||||
|
||||
[[nodiscard]] const stack_allocator& get_values() const
|
||||
{
|
||||
return values;
|
||||
}
|
||||
|
||||
size_t get_depth(gp_program& program) const;
|
||||
|
||||
/**
|
||||
|
@ -356,6 +375,60 @@ namespace blt::gp
|
|||
*/
|
||||
void swap_subtrees(subtree_point_t our_subtree, tree_t& other_tree, subtree_point_t other_subtree);
|
||||
|
||||
/**
|
||||
* Replaces the point inside our tree with a new tree provided to this function.
|
||||
* Uses the extent instead of calculating it for removing the existing subtree
|
||||
* This can be used if you already have child tree information, such as when using @code find_child_extends@endcode
|
||||
* @param point point to replace at
|
||||
* @param extent extend of the subtree (child tree)
|
||||
* @param other_tree other tree to replace with
|
||||
*/
|
||||
void replace_subtree(subtree_point_t point, ptrdiff_t extent, tree_t& other_tree);
|
||||
|
||||
/**
|
||||
* Replaces the point inside our tree with a new tree provided to this function
|
||||
* @param point point to replace at
|
||||
* @param other_tree other tree to replace with
|
||||
*/
|
||||
void replace_subtree(const subtree_point_t point, tree_t& other_tree)
|
||||
{
|
||||
replace_subtree(point, find_endpoint(point.pos), other_tree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the subtree at a point, bounded by extent. This is useful if you already know the size of the child tree
|
||||
* Note: if you provide an incorrectly sized extent this will create UB within the GP program
|
||||
* extent must be one past the last element in the subtree, as returned by all helper functions here.
|
||||
* @param point point to delete from
|
||||
* @param extent end point of the tree
|
||||
*/
|
||||
void delete_subtree(subtree_point_t point, ptrdiff_t extent);
|
||||
|
||||
/**
|
||||
* Deletes the subtree at a point
|
||||
* @param point point of subtree to recursively delete
|
||||
*/
|
||||
void delete_subtree(const subtree_point_t point)
|
||||
{
|
||||
delete_subtree(point, find_endpoint(point.pos));
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a subtree before the specified point
|
||||
* @param point point to insert into
|
||||
* @param other_tree the tree to insert
|
||||
* @return point + other_tree.size()
|
||||
*/
|
||||
ptrdiff_t insert_subtree(subtree_point_t point, tree_t& other_tree);
|
||||
|
||||
/**
|
||||
* temporarily moves the last bytes amount of data from the current stack. this can be useful for if you are going to do a lot
|
||||
* of consecutive operations on the tree as this will avoid extra copy + reinsert.
|
||||
* The object returned by this function will automatically move the data back in when it goes out of scope.
|
||||
* @param bytes amount of bytes to remove.
|
||||
*/
|
||||
after_bytes_data_t temporary_move(size_t bytes);
|
||||
|
||||
/**
|
||||
* User function for evaluating this tree using a context reference. This function should only be used if the tree is expecting the context value
|
||||
* This function returns a copy of your value, if it is too large for the stack, or you otherwise need a reference, please use the corresponding
|
||||
|
@ -440,13 +513,13 @@ namespace blt::gp
|
|||
|
||||
[[nodiscard]] size_t total_value_bytes(const size_t begin, const size_t end) const
|
||||
{
|
||||
return total_value_bytes(operations.begin() + static_cast<blt::ptrdiff_t>(begin),
|
||||
operations.begin() + static_cast<blt::ptrdiff_t>(end));
|
||||
return total_value_bytes(operations.begin() + static_cast<ptrdiff_t>(begin),
|
||||
operations.begin() + static_cast<ptrdiff_t>(end));
|
||||
}
|
||||
|
||||
[[nodiscard]] size_t total_value_bytes(const size_t begin) const
|
||||
{
|
||||
return total_value_bytes(operations.begin() + static_cast<blt::ptrdiff_t>(begin), operations.end());
|
||||
return total_value_bytes(operations.begin() + static_cast<ptrdiff_t>(begin), operations.end());
|
||||
}
|
||||
|
||||
[[nodiscard]] size_t total_value_bytes() const
|
||||
|
@ -454,6 +527,20 @@ namespace blt::gp
|
|||
return total_value_bytes(operations.begin(), operations.end());
|
||||
}
|
||||
|
||||
[[nodiscard]] size_t size() const
|
||||
{
|
||||
return operations.size();
|
||||
}
|
||||
|
||||
[[nodiscard]] const op_container_t& get_operator(const size_t point) const
|
||||
{
|
||||
return operations[point];
|
||||
}
|
||||
|
||||
void modify_operator(size_t point, operator_id new_id, std::optional<type_id> return_type = {});
|
||||
|
||||
[[nodiscard]] subtree_point_t subtree_from_point(ptrdiff_t point) const;
|
||||
|
||||
template <typename Context, typename... Operators>
|
||||
static auto make_execution_lambda(size_t call_reserve_size, Operators&... operators)
|
||||
{
|
||||
|
@ -490,21 +577,23 @@ namespace blt::gp
|
|||
private:
|
||||
void handle_operator_inserted(const op_container_t& op);
|
||||
|
||||
template<typename Iter>
|
||||
template <typename Iter>
|
||||
void handle_refcount_decrement(const Iter iter, const size_t forward_bytes) const
|
||||
{
|
||||
if (iter->get_flags().is_ephemeral() && iter->has_ephemeral_drop())
|
||||
{
|
||||
// TODO
|
||||
auto& ptr = values.access_pointer_forward(forward_bytes, iter->type_size());
|
||||
--*ptr;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Iter>
|
||||
template <typename Iter>
|
||||
void handle_refcount_increment(const Iter iter, const size_t forward_bytes) const
|
||||
{
|
||||
if (iter->get_flags().is_ephemeral() && iter->has_ephemeral_drop())
|
||||
{
|
||||
// TODO
|
||||
auto& ptr = values.access_pointer_forward(forward_bytes, iter->type_size());
|
||||
--*ptr;
|
||||
}
|
||||
|
|
|
@ -51,15 +51,15 @@ namespace blt::gp
|
|||
|
||||
bool crossover_t::apply(gp_program& program, const tree_t& p1, const tree_t& p2, tree_t& c1, tree_t& c2) // NOLINT
|
||||
{
|
||||
if (p1.get_operations().size() < config.min_tree_size || p2.get_operations().size() < config.min_tree_size)
|
||||
if (p1.size() < config.min_tree_size || p2.size() < config.min_tree_size)
|
||||
return false;
|
||||
|
||||
std::optional<crossover_point_t> point;
|
||||
|
||||
if (config.traverse)
|
||||
point = get_crossover_point_traverse(program, p1, p2);
|
||||
point = get_crossover_point_traverse(p1, p2);
|
||||
else
|
||||
point = get_crossover_point(program, p1, p2);
|
||||
point = get_crossover_point(p1, p2);
|
||||
|
||||
if (!point)
|
||||
return false;
|
||||
|
@ -69,8 +69,7 @@ namespace blt::gp
|
|||
{
|
||||
case 0:
|
||||
case 1:
|
||||
// TODO: use the tree's selector methods!
|
||||
c1.swap_subtrees({point->p1_crossover_point, 0}, c2, {point->p2_crossover_point, 0});
|
||||
c1.swap_subtrees(point->p1_crossover_point, c2, point->p2_crossover_point);
|
||||
break;
|
||||
default:
|
||||
#if BLT_DEBUG_LEVEL > 0
|
||||
|
@ -110,153 +109,50 @@ namespace blt::gp
|
|||
return true;
|
||||
}
|
||||
|
||||
std::optional<crossover_t::crossover_point_t> crossover_t::get_crossover_point(gp_program& program, const tree_t& c1,
|
||||
std::optional<crossover_t::crossover_point_t> crossover_t::get_crossover_point(const tree_t& c1,
|
||||
const tree_t& c2) const
|
||||
{
|
||||
auto& c1_ops = c1.get_operations();
|
||||
auto& c2_ops = c2.get_operations();
|
||||
auto first = c1.select_subtree(config.terminal_chance);
|
||||
auto second = c2.select_subtree(first.type, config.max_crossover_tries, config.terminal_chance);
|
||||
|
||||
size_t crossover_point = program.get_random().get_size_t(1ul, c1_ops.size());
|
||||
if (!second)
|
||||
return {};
|
||||
|
||||
const bool allow_terminal_selection = program.get_random().choice(config.terminal_chance);
|
||||
|
||||
blt::size_t counter = 0;
|
||||
while (!allow_terminal_selection && program.get_operator_info(c1_ops[crossover_point].id()).argc.is_terminal())
|
||||
{
|
||||
if (counter >= config.max_crossover_tries)
|
||||
return {};
|
||||
crossover_point = program.get_random().get_size_t(1ul, c1_ops.size());
|
||||
counter++;
|
||||
}
|
||||
|
||||
size_t attempted_point = 0;
|
||||
|
||||
const auto& crossover_point_type = program.get_operator_info(c1_ops[crossover_point].id());
|
||||
const operator_info_t* attempted_point_type = nullptr;
|
||||
|
||||
for (counter = 0; counter < config.max_crossover_tries; counter++)
|
||||
{
|
||||
attempted_point = program.get_random().get_size_t(1ul, c2_ops.size());
|
||||
attempted_point_type = &program.get_operator_info(c2_ops[attempted_point].id());
|
||||
if (!allow_terminal_selection && attempted_point_type->argc.is_terminal())
|
||||
continue;
|
||||
if (crossover_point_type.return_type == attempted_point_type->return_type)
|
||||
return crossover_point_t{static_cast<blt::ptrdiff_t>(crossover_point), static_cast<blt::ptrdiff_t>(attempted_point)};
|
||||
}
|
||||
return {};
|
||||
return {{first, *second}};
|
||||
}
|
||||
|
||||
std::optional<crossover_t::crossover_point_t> crossover_t::get_crossover_point_traverse(gp_program& program, const tree_t& c1,
|
||||
std::optional<crossover_t::crossover_point_t> crossover_t::get_crossover_point_traverse(const tree_t& c1,
|
||||
const tree_t& c2) const
|
||||
{
|
||||
const auto c1_point_o = get_point_traverse_retry(program, c1, {});
|
||||
auto c1_point_o = get_point_traverse_retry(c1, {});
|
||||
if (!c1_point_o)
|
||||
return {};
|
||||
const auto c2_point_o = get_point_traverse_retry(program, c2, c1_point_o->type_operator_info.return_type);
|
||||
auto c2_point_o = get_point_traverse_retry(c2, c1_point_o->type);
|
||||
if (!c2_point_o)
|
||||
return {};
|
||||
return {{c1_point_o->point, c2_point_o->point}};
|
||||
return {{*c1_point_o, *c2_point_o}};
|
||||
}
|
||||
|
||||
std::optional<crossover_t::point_info_t> crossover_t::get_point_from_traverse_raw(gp_program& program, const tree_t& t,
|
||||
std::optional<type_id> type) const
|
||||
std::optional<tree_t::subtree_point_t> crossover_t::get_point_traverse_retry(const tree_t& t, const std::optional<type_id> type) const
|
||||
{
|
||||
auto& random = program.get_random();
|
||||
|
||||
bool should_select_terminal = program.get_random().choice(config.terminal_chance);
|
||||
|
||||
ptrdiff_t parent = -1;
|
||||
ptrdiff_t point = 0;
|
||||
while (true)
|
||||
{
|
||||
auto& current_op_type = program.get_operator_info(t.get_operations()[point].id());
|
||||
if (current_op_type.argc.is_terminal())
|
||||
{
|
||||
if (!should_select_terminal)
|
||||
{
|
||||
if (parent == -1)
|
||||
return {};
|
||||
auto& parent_type = program.get_operator_info(t.get_operations()[parent].id());
|
||||
if (type && *type != parent_type.return_type)
|
||||
return {};
|
||||
return {{parent, parent_type}};
|
||||
}
|
||||
if (type && *type != current_op_type.return_type)
|
||||
return {};
|
||||
return {{point, current_op_type}};
|
||||
}
|
||||
// traverse to a child
|
||||
if (random.choice(config.traverse_chance))
|
||||
{
|
||||
const auto args = current_op_type.argc.argc;
|
||||
const auto argument = random.get_size_t(0, args);
|
||||
|
||||
parent = point;
|
||||
// move to the first child
|
||||
point += 1;
|
||||
// loop through all the children we wish to skip. The result will be the first node of the next child, becoming the new parent
|
||||
for (size_t i = 0; i < argument; i++)
|
||||
point = t.find_endpoint(point);
|
||||
|
||||
continue;
|
||||
}
|
||||
if (!type || (type && *type == current_op_type.return_type))
|
||||
return {{point, current_op_type}};
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<crossover_t::point_info_t> crossover_t::get_point_traverse_retry(gp_program& program, const tree_t& t,
|
||||
std::optional<type_id> type) const
|
||||
{
|
||||
for (size_t i = 0; i < config.max_crossover_tries; i++)
|
||||
{
|
||||
if (auto found = get_point_from_traverse_raw(program, t, type))
|
||||
return found;
|
||||
}
|
||||
return {};
|
||||
if (type)
|
||||
return t.select_subtree_traverse(*type, config.max_crossover_tries, config.terminal_chance, config.depth_multiplier);
|
||||
return t.select_subtree_traverse(config.terminal_chance, config.depth_multiplier);
|
||||
}
|
||||
|
||||
bool mutation_t::apply(gp_program& program, const tree_t&, tree_t& c)
|
||||
{
|
||||
mutate_point(program, c, program.get_random().get_size_t(0ul, c.get_operations().size()));
|
||||
// TODO: options for this?
|
||||
mutate_point(program, c, c.select_subtree());
|
||||
return true;
|
||||
}
|
||||
|
||||
blt::size_t mutation_t::mutate_point(gp_program& program, tree_t& c, blt::size_t node) const
|
||||
size_t mutation_t::mutate_point(gp_program& program, tree_t& c, const tree_t::subtree_point_t node) const
|
||||
{
|
||||
auto& ops_r = c.get_operations();
|
||||
auto& vals_r = c.get_values();
|
||||
|
||||
auto begin_point = static_cast<blt::ptrdiff_t>(node);
|
||||
auto end_point = c.find_endpoint(begin_point);
|
||||
auto begin_operator_id = ops_r[begin_point].id();
|
||||
const auto& type_info = program.get_operator_info(begin_operator_id);
|
||||
|
||||
auto begin_itr = ops_r.begin() + begin_point;
|
||||
auto end_itr = ops_r.begin() + end_point;
|
||||
|
||||
auto& new_tree = get_static_tree_tl(program);
|
||||
config.generator.get().generate(new_tree, {program, type_info.return_type, config.replacement_min_depth, config.replacement_max_depth});
|
||||
config.generator.get().generate(new_tree, {program, node.type, config.replacement_min_depth, config.replacement_max_depth});
|
||||
|
||||
auto& new_ops_r = new_tree.get_operations();
|
||||
auto& new_vals_r = new_tree.get_values();
|
||||
|
||||
blt::size_t total_bytes_after = accumulate_type_sizes(end_itr, ops_r.end());
|
||||
auto* stack_after_data = get_thread_pointer_for_size<struct mutation>(total_bytes_after);
|
||||
|
||||
// make a copy of any stack data after the mutation point / children.
|
||||
vals_r.copy_to(stack_after_data, total_bytes_after);
|
||||
|
||||
// remove the bytes of the data after the mutation point and the data for the children of the mutation node.
|
||||
vals_r.pop_bytes(static_cast<blt::ptrdiff_t>(total_bytes_after + accumulate_type_sizes(begin_itr, end_itr)));
|
||||
|
||||
// insert the new tree then move back the data from after the original mutation point.
|
||||
vals_r.insert(new_vals_r);
|
||||
vals_r.copy_from(stack_after_data, total_bytes_after);
|
||||
|
||||
auto before = begin_itr - 1;
|
||||
ops_r.erase(begin_itr, end_itr);
|
||||
ops_r.insert(++before, new_ops_r.begin(), new_ops_r.end());
|
||||
c.replace_subtree(node, new_tree);
|
||||
|
||||
// this will check to make sure that the tree is in a correct and executable state. it requires that the evaluation is context free!
|
||||
#if BLT_DEBUG_LEVEL >= 2
|
||||
|
@ -306,19 +202,14 @@ namespace blt::gp
|
|||
throw std::exception();
|
||||
}
|
||||
#endif
|
||||
return begin_point + new_ops_r.size();
|
||||
return node.pos + new_tree.size();
|
||||
}
|
||||
|
||||
bool advanced_mutation_t::apply(gp_program& program, const tree_t& p, tree_t& c)
|
||||
bool advanced_mutation_t::apply(gp_program& program, [[maybe_unused]] const tree_t& p, tree_t& c)
|
||||
{
|
||||
(void)p;
|
||||
auto& ops = c.get_operations();
|
||||
auto& vals = c.get_values();
|
||||
|
||||
for (blt::size_t c_node = 0; c_node < ops.size(); c_node++)
|
||||
for (size_t c_node = 0; c_node < c.size(); c_node++)
|
||||
{
|
||||
double node_mutation_chance = per_node_mutation_chance / static_cast<double>(ops.size());
|
||||
if (!program.get_random().choice(node_mutation_chance))
|
||||
if (!program.get_random().choice(per_node_mutation_chance / static_cast<double>(c.size())))
|
||||
continue;
|
||||
|
||||
#if BLT_DEBUG_LEVEL >= 2
|
||||
|
@ -326,7 +217,7 @@ namespace blt::gp
|
|||
#endif
|
||||
|
||||
// select an operator to apply
|
||||
auto selected_point = static_cast<blt::i32>(mutation_operator::COPY);
|
||||
auto selected_point = static_cast<i32>(mutation_operator::COPY);
|
||||
auto choice = program.get_random().get_double();
|
||||
for (const auto& [index, value] : blt::enumerate(mutation_operator_chances))
|
||||
{
|
||||
|
@ -351,21 +242,21 @@ namespace blt::gp
|
|||
switch (static_cast<mutation_operator>(selected_point))
|
||||
{
|
||||
case mutation_operator::EXPRESSION:
|
||||
c_node += mutate_point(program, c, c_node);
|
||||
c_node += mutate_point(program, c, c.subtree_from_point(static_cast<ptrdiff_t>(c_node)));
|
||||
break;
|
||||
case mutation_operator::ADJUST:
|
||||
{
|
||||
// this is going to be evil >:3
|
||||
const auto& node = ops[c_node];
|
||||
const auto& node = c.get_operator(c_node);
|
||||
if (!node.is_value())
|
||||
{
|
||||
auto& current_func_info = program.get_operator_info(ops[c_node].id());
|
||||
auto& current_func_info = program.get_operator_info(node.id());
|
||||
operator_id random_replacement = program.get_random().select(
|
||||
program.get_type_non_terminals(current_func_info.return_type.id));
|
||||
auto& replacement_func_info = program.get_operator_info(random_replacement);
|
||||
|
||||
// cache memory used for offset data.
|
||||
thread_local static tracked_vector<tree_t::child_t> children_data;
|
||||
thread_local tracked_vector<tree_t::child_t> children_data;
|
||||
children_data.clear();
|
||||
|
||||
c.find_child_extends(children_data, c_node, current_func_info.argument_types.size());
|
||||
|
@ -380,38 +271,25 @@ namespace blt::gp
|
|||
config.generator.get().generate(tree,
|
||||
{program, val.id, config.replacement_min_depth, config.replacement_max_depth});
|
||||
|
||||
auto& child = children_data[children_data.size() - 1 - index];
|
||||
blt::size_t total_bytes_for = c.total_value_bytes(child.start, child.end);
|
||||
blt::size_t total_bytes_after = c.total_value_bytes(child.end);
|
||||
|
||||
auto after_ptr = get_thread_pointer_for_size<struct mutation_func>(total_bytes_after);
|
||||
vals.copy_to(after_ptr, total_bytes_after);
|
||||
vals.pop_bytes(static_cast<blt::ptrdiff_t>(total_bytes_after + total_bytes_for));
|
||||
|
||||
blt::size_t total_child_bytes = tree.total_value_bytes();
|
||||
|
||||
vals.copy_from(tree.get_values(), total_child_bytes);
|
||||
vals.copy_from(after_ptr, total_bytes_after);
|
||||
|
||||
ops.erase(ops.begin() + child.start, ops.begin() + child.end);
|
||||
ops.insert(ops.begin() + child.start, tree.get_operations().begin(), tree.get_operations().end());
|
||||
auto& [child_start, child_end] = children_data[children_data.size() - 1 - index];
|
||||
c.replace_subtree(c.subtree_from_point(child_start), child_end, tree);
|
||||
|
||||
// shift over everybody after.
|
||||
if (index > 0)
|
||||
{
|
||||
// don't need to update if the index is the last
|
||||
for (auto& new_child : blt::iterate(children_data.end() - static_cast<blt::ptrdiff_t>(index),
|
||||
for (auto& new_child : iterate(children_data.end() - static_cast<ptrdiff_t>(index),
|
||||
children_data.end()))
|
||||
{
|
||||
// remove the old tree size, then add the new tree size to get the correct positions.
|
||||
new_child.start =
|
||||
new_child.start - (child.end - child.start) +
|
||||
static_cast<blt::ptrdiff_t>(tree.get_operations().size());
|
||||
new_child.start - (child_end - child_start) +
|
||||
static_cast<ptrdiff_t>(tree.size());
|
||||
new_child.end =
|
||||
new_child.end - (child.end - child.start) + static_cast<blt::ptrdiff_t>(tree.get_operations().size());
|
||||
new_child.end - (child_end - child_start) + static_cast<ptrdiff_t>(tree.size());
|
||||
}
|
||||
}
|
||||
child.end = static_cast<blt::ptrdiff_t>(child.start + tree.get_operations().size());
|
||||
child_end = static_cast<ptrdiff_t>(child_start + tree.size());
|
||||
|
||||
#if BLT_DEBUG_LEVEL >= 2
|
||||
blt::size_t found_bytes = vals.size().total_used_bytes;
|
||||
|
@ -434,15 +312,9 @@ namespace blt::gp
|
|||
|
||||
if (current_func_info.argc.argc > replacement_func_info.argc.argc)
|
||||
{
|
||||
blt::size_t end_index = children_data[(current_func_info.argc.argc - replacement_func_info.argc.argc) - 1].end;
|
||||
blt::size_t start_index = children_data.begin()->start;
|
||||
blt::size_t total_bytes_for = c.total_value_bytes(start_index, end_index);
|
||||
blt::size_t total_bytes_after = c.total_value_bytes(end_index);
|
||||
auto* data = get_thread_pointer_for_size<struct mutation_func>(total_bytes_after);
|
||||
vals.copy_to(data, total_bytes_after);
|
||||
vals.pop_bytes(static_cast<blt::ptrdiff_t>(total_bytes_after + total_bytes_for));
|
||||
vals.copy_from(data, total_bytes_after);
|
||||
ops.erase(ops.begin() + static_cast<blt::ptrdiff_t>(start_index), ops.begin() + static_cast<blt::ptrdiff_t>(end_index));
|
||||
auto end_index = children_data[(current_func_info.argc.argc - replacement_func_info.argc.argc) - 1].end;
|
||||
auto start_index = children_data.begin()->start;
|
||||
c.delete_subtree(tree_t::subtree_point_t(start_index), end_index);
|
||||
}
|
||||
else if (current_func_info.argc.argc == replacement_func_info.argc.argc)
|
||||
{
|
||||
|
@ -452,11 +324,9 @@ namespace blt::gp
|
|||
else
|
||||
{
|
||||
// not enough args
|
||||
blt::size_t start_index = c_node + 1;
|
||||
blt::size_t total_bytes_after = c.total_value_bytes(start_index);
|
||||
auto* data = get_thread_pointer_for_size<struct mutation_func>(total_bytes_after);
|
||||
vals.copy_to(data, total_bytes_after);
|
||||
vals.pop_bytes(static_cast<blt::ptrdiff_t>(total_bytes_after));
|
||||
size_t start_index = c_node + 1;
|
||||
size_t total_bytes_after = c.total_value_bytes(start_index);
|
||||
auto move = c.temporary_move(total_bytes_after);
|
||||
|
||||
for (ptrdiff_t i = static_cast<ptrdiff_t>(replacement_func_info.argc.argc) - 1;
|
||||
i >= current_func_info.argc.argc; i--)
|
||||
|
@ -467,20 +337,11 @@ namespace blt::gp
|
|||
program, replacement_func_info.argument_types[i].id, config.replacement_min_depth,
|
||||
config.replacement_max_depth
|
||||
});
|
||||
vals.insert(tree.get_values());
|
||||
ops.insert(ops.begin() + static_cast<blt::ptrdiff_t>(start_index), tree.get_operations().begin(),
|
||||
tree.get_operations().end());
|
||||
start_index += tree.get_operations().size();
|
||||
start_index = c.insert_subtree(tree_t::subtree_point_t(static_cast<ptrdiff_t>(start_index)), tree);
|
||||
}
|
||||
vals.copy_from(data, total_bytes_after);
|
||||
}
|
||||
// now finally update the type.
|
||||
ops[c_node] = {
|
||||
program.get_typesystem().get_type(replacement_func_info.return_type).size(),
|
||||
random_replacement,
|
||||
program.is_operator_ephemeral(random_replacement),
|
||||
program.get_operator_flags(random_replacement)
|
||||
};
|
||||
c.modify_operator(c_node, random_replacement, replacement_func_info.return_type);
|
||||
}
|
||||
#if BLT_DEBUG_LEVEL >= 2
|
||||
if (!c.check(detail::debug::context_ptr))
|
||||
|
@ -497,7 +358,7 @@ namespace blt::gp
|
|||
break;
|
||||
case mutation_operator::SUB_FUNC:
|
||||
{
|
||||
auto& current_func_info = program.get_operator_info(ops[c_node].id());
|
||||
auto& current_func_info = program.get_operator_info(c.get_operator(c_node).id());
|
||||
|
||||
// need to:
|
||||
// mutate the current function.
|
||||
|
@ -509,7 +370,7 @@ namespace blt::gp
|
|||
if (non_terminals.empty())
|
||||
continue;
|
||||
operator_id random_replacement = program.get_random().select(non_terminals);
|
||||
blt::size_t arg_position = 0;
|
||||
size_t arg_position = 0;
|
||||
do
|
||||
{
|
||||
auto& replacement_func_info = program.get_operator_info(random_replacement);
|
||||
|
|
148
src/tree.cpp
148
src/tree.cpp
|
@ -258,27 +258,21 @@ namespace blt::gp
|
|||
|
||||
operators.reserve(operators.size() + std::distance(point_begin_itr, point_end_itr));
|
||||
size_t for_bytes = 0;
|
||||
for (auto& it : iterate(point_begin_itr, point_end_itr))
|
||||
for (auto& it : iterate(point_begin_itr, point_end_itr).rev())
|
||||
{
|
||||
if (it.is_value())
|
||||
{
|
||||
for_bytes += it.type_size();
|
||||
if (it.get_flags().is_ephemeral() && it.has_ephemeral_drop())
|
||||
{
|
||||
auto& ptr = values.access_pointer_forward(for_bytes, it.type_size());
|
||||
auto& ptr = values.access_pointer(for_bytes + after_bytes, it.type_size());
|
||||
++*ptr;
|
||||
}
|
||||
for_bytes += it.type_size();
|
||||
}
|
||||
operators.emplace_back(it);
|
||||
}
|
||||
|
||||
auto* after_ptr = get_thread_pointer_for_size<struct copy_subtree>(after_bytes);
|
||||
|
||||
// TODO: this is inefficient, make a copy range function in stack
|
||||
values.copy_to(after_ptr, after_bytes);
|
||||
values.pop_bytes(after_bytes);
|
||||
stack.copy_from(values, for_bytes);
|
||||
values.copy_from(after_ptr, after_bytes);
|
||||
stack.copy_from(values, for_bytes, after_bytes);
|
||||
}
|
||||
|
||||
void tree_t::swap_subtrees(const subtree_point_t our_subtree, tree_t& other_tree, const subtree_point_t other_subtree)
|
||||
|
@ -364,6 +358,120 @@ namespace blt::gp
|
|||
other_tree.operations.insert(++insert_point_c2, c1_operators.begin(), c1_operators.end());
|
||||
}
|
||||
|
||||
void tree_t::replace_subtree(const subtree_point_t point, const ptrdiff_t extent, tree_t& other_tree)
|
||||
{
|
||||
const auto point_begin_itr = operations.begin() + point.pos;
|
||||
const auto point_end_itr = operations.begin() + extent;
|
||||
|
||||
const size_t after_bytes = accumulate_type_sizes(point_end_itr, operations.end());
|
||||
|
||||
size_t for_bytes = 0;
|
||||
for (auto& it : iterate(point_begin_itr, point_end_itr).rev())
|
||||
{
|
||||
if (it.is_value())
|
||||
{
|
||||
for_bytes += it.type_size();
|
||||
if (it.get_flags().is_ephemeral() && it.has_ephemeral_drop())
|
||||
{
|
||||
auto& ptr = values.access_pointer(for_bytes + after_bytes, it.type_size());
|
||||
--*ptr;
|
||||
if (*ptr == 0)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
auto insert = operations.erase(point_begin_itr, point_end_itr);
|
||||
|
||||
const auto ptr = get_thread_pointer_for_size<struct replace>(after_bytes);
|
||||
values.copy_to(ptr, after_bytes);
|
||||
values.pop_bytes(after_bytes + for_bytes);
|
||||
|
||||
size_t copy_bytes = 0;
|
||||
for (const auto& v : other_tree.operations)
|
||||
{
|
||||
if (v.is_value())
|
||||
{
|
||||
if (v.get_flags().is_ephemeral() && v.has_ephemeral_drop())
|
||||
{
|
||||
auto& pointer = other_tree.values.access_pointer(copy_bytes, v.type_size());
|
||||
--*pointer;
|
||||
}
|
||||
copy_bytes += v.type_size();
|
||||
}
|
||||
insert = ++operations.emplace(insert, v);
|
||||
}
|
||||
|
||||
values.insert(other_tree.values);
|
||||
values.copy_from(ptr, after_bytes);
|
||||
}
|
||||
|
||||
void tree_t::delete_subtree(const subtree_point_t point, const ptrdiff_t extent)
|
||||
{
|
||||
const auto point_begin_itr = operations.begin() + point.pos;
|
||||
const auto point_end_itr = operations.begin() + extent;
|
||||
|
||||
const size_t after_bytes = accumulate_type_sizes(point_end_itr, operations.end());
|
||||
|
||||
size_t for_bytes = 0;
|
||||
for (auto& it : iterate(point_begin_itr, point_end_itr).rev())
|
||||
{
|
||||
if (it.is_value())
|
||||
{
|
||||
for_bytes += it.type_size();
|
||||
if (it.get_flags().is_ephemeral() && it.has_ephemeral_drop())
|
||||
{
|
||||
auto& ptr = values.access_pointer(for_bytes + after_bytes, it.type_size());
|
||||
--*ptr;
|
||||
if (*ptr == 0)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
operations.erase(point_begin_itr, point_end_itr);
|
||||
|
||||
const auto ptr = get_thread_pointer_for_size<struct replace>(after_bytes);
|
||||
values.copy_to(ptr, after_bytes);
|
||||
values.pop_bytes(after_bytes + for_bytes);
|
||||
values.copy_from(ptr, after_bytes);
|
||||
}
|
||||
|
||||
ptrdiff_t tree_t::insert_subtree(const subtree_point_t point, tree_t& other_tree)
|
||||
{
|
||||
const size_t after_bytes = accumulate_type_sizes(operations.begin() + point.pos, operations.end());
|
||||
auto move = temporary_move(after_bytes);
|
||||
|
||||
auto insert = operations.begin() + point.pos;
|
||||
size_t bytes = 0;
|
||||
for (auto& it : iterate(other_tree.operations).rev())
|
||||
{
|
||||
if (it.is_value())
|
||||
{
|
||||
bytes += it.type_size();
|
||||
if (it.get_flags().is_ephemeral() && it.has_ephemeral_drop())
|
||||
{
|
||||
auto& ptr = other_tree.values.access_pointer(bytes, it.type_size());
|
||||
++*ptr;
|
||||
}
|
||||
}
|
||||
insert = operations.insert(insert, it);
|
||||
}
|
||||
values.insert(other_tree.values);
|
||||
|
||||
return static_cast<ptrdiff_t>(point.pos + other_tree.size());
|
||||
}
|
||||
|
||||
tree_t::after_bytes_data_t tree_t::temporary_move(const size_t bytes)
|
||||
{
|
||||
const auto data = get_thread_pointer_for_size<struct temporary_move>(bytes);
|
||||
values.copy_to(data, bytes);
|
||||
values.pop_bytes(bytes);
|
||||
return after_bytes_data_t{*this, data, bytes};
|
||||
}
|
||||
|
||||
|
||||
ptrdiff_t tree_t::find_endpoint(ptrdiff_t start) const
|
||||
{
|
||||
|
@ -409,7 +517,7 @@ namespace blt::gp
|
|||
blt::size_t bytes_expected = 0;
|
||||
const auto bytes_size = values.size().total_used_bytes;
|
||||
|
||||
for (const auto& op : get_operations())
|
||||
for (const auto& op : operations)
|
||||
{
|
||||
if (op.is_value())
|
||||
bytes_expected += op.type_size();
|
||||
|
@ -499,6 +607,7 @@ namespace blt::gp
|
|||
{
|
||||
auto& ptr = values.access_pointer_forward(total_bytes, op.type_size());
|
||||
--*ptr;
|
||||
// TODO
|
||||
// BLT_TRACE(ptr->load());
|
||||
// if (*ptr == 0)
|
||||
// {
|
||||
|
@ -512,4 +621,21 @@ namespace blt::gp
|
|||
operations.clear();
|
||||
values.reset();
|
||||
}
|
||||
|
||||
tree_t::subtree_point_t tree_t::subtree_from_point(ptrdiff_t point) const
|
||||
{
|
||||
return {point, m_program->get_operator_info(operations[point].id()).return_type};
|
||||
}
|
||||
|
||||
void tree_t::modify_operator(const size_t point, operator_id new_id, std::optional<type_id> return_type)
|
||||
{
|
||||
if (!return_type)
|
||||
return_type = m_program->get_operator_info(new_id).return_type;
|
||||
operations[point] = {
|
||||
m_program->get_typesystem().get_type(*return_type).size(),
|
||||
new_id,
|
||||
m_program->is_operator_ephemeral(new_id),
|
||||
m_program->get_operator_flags(new_id)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue