Skip to content

Commit

Permalink
[Java, C#, C++] Rename flags to enable field access order checking.
Browse files Browse the repository at this point in the history
The aim of this change is to avoid naming collisions with other flags,
particularly in financial domains where "order" is used frequently.
  • Loading branch information
ZachBray committed Oct 20, 2023
1 parent dab9ae2 commit 558df22
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 190 deletions.
4 changes: 2 additions & 2 deletions csharp/sbe-generated/sbe-generated.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DefineConstants>TRACE,ENABLE_ACCESS_ORDER_CHECKS</DefineConstants>
<DefineConstants>TRACE,SBE_ENABLE_SEQUENCING_CHECKS</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>TRACE,ENABLE_ACCESS_ORDER_CHECKS</DefineConstants>
<DefineConstants>TRACE,SBE_ENABLE_SEQUENCING_CHECKS</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private static CharSequence generateFullyEncodedCheck(final AccessOrderModel acc

sb.append(indent).append("void checkEncodingIsComplete()\n")
.append(indent).append("{\n")
.append("#if defined(ENABLE_ACCESS_ORDER_CHECKS)\n")
.append("#if defined(SBE_ENABLE_SEQUENCING_CHECKS)\n")
.append(indent).append(INDENT).append("switch (m_codecState)\n")
.append(indent).append(INDENT).append("{\n");

Expand Down Expand Up @@ -321,7 +321,7 @@ private static CharSequence generateAccessOrderListenerCall(
}

final StringBuilder sb = new StringBuilder();
sb.append("#if defined(ENABLE_ACCESS_ORDER_CHECKS)\n")
sb.append("#if defined(SBE_ENABLE_SEQUENCING_CHECKS)\n")
.append(indent).append(methodName).append("(");

for (int i = 0; i < arguments.length; i++)
Expand Down Expand Up @@ -3083,7 +3083,7 @@ private CharSequence generateDecoderWrapListenerCall(final AccessOrderModel acce
if (accessOrderModel.versionCount() == 1)
{
final StringBuilder sb = new StringBuilder();
sb.append("#if defined(ENABLE_ACCESS_ORDER_CHECKS)\n")
sb.append("#if defined(SBE_ENABLE_SEQUENCING_CHECKS)\n")
.append(TWO_INDENT).append("codecState(")
.append(qualifiedStateCase(accessOrderModel.latestVersionWrappedState())).append(");\n")
.append("#endif\n");
Expand All @@ -3101,7 +3101,7 @@ private CharSequence generateEncoderWrapListener(final AccessOrderModel accessOr
}

final StringBuilder sb = new StringBuilder();
sb.append("#if defined(ENABLE_ACCESS_ORDER_CHECKS)\n")
sb.append("#if defined(SBE_ENABLE_SEQUENCING_CHECKS)\n")
.append(TWO_INDENT).append("codecState(")
.append(qualifiedStateCase(accessOrderModel.latestVersionWrappedState()))
.append(");\n")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@ private static CharSequence generateFullyEncodedCheck(

sb.append(indent).append("public void CheckEncodingIsComplete()\n")
.append(indent).append("{\n")
.append("#if ENABLE_ACCESS_ORDER_CHECKS\n")
.append("#if SBE_ENABLE_SEQUENCING_CHECKS\n")
.append(indent).append(INDENT).append("switch (_codecState)\n")
.append(indent).append(INDENT).append("{\n");

Expand Down Expand Up @@ -1670,7 +1670,7 @@ private static CharSequence generateAccessOrderListenerCall(
}

final StringBuilder sb = new StringBuilder();
sb.append("#if ENABLE_ACCESS_ORDER_CHECKS\n")
sb.append("#if SBE_ENABLE_SEQUENCING_CHECKS\n")
.append(indent).append(methodName).append("(");

for (int i = 0; i < arguments.length; i++)
Expand Down Expand Up @@ -1936,7 +1936,7 @@ private CharSequence generateEncoderWrapListener(
}

final StringBuilder sb = new StringBuilder();
sb.append("#if ENABLE_ACCESS_ORDER_CHECKS\n")
sb.append("#if SBE_ENABLE_SEQUENCING_CHECKS\n")
.append(indent).append("codecState(")
.append(qualifiedStateCase(accessOrderModel.latestVersionWrappedState()))
.append(");\n")
Expand Down Expand Up @@ -2556,7 +2556,7 @@ private CharSequence generateDisplay(
append(sb, TWO_INDENT, " int originalLimit = this.Limit;");
if (null != accessOrderModel)
{
sb.append("#if ENABLE_ACCESS_ORDER_CHECKS\n");
sb.append("#if SBE_ENABLE_SEQUENCING_CHECKS\n");
append(sb, TWO_INDENT, " CodecState originalState = _codecState;");
sb.append(THREE_INDENT).append("_codecState = ")
.append(qualifiedStateCase(accessOrderModel.notWrappedState())).append(";\n");
Expand Down Expand Up @@ -2588,7 +2588,7 @@ private CharSequence generateDisplay(
sb.append('\n');
if (null != accessOrderModel)
{
sb.append("#if ENABLE_ACCESS_ORDER_CHECKS\n");
sb.append("#if SBE_ENABLE_SEQUENCING_CHECKS\n");
append(sb, TWO_INDENT, " _codecState = originalState;");
sb.append("#endif\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ private static CharSequence generateFieldOrderStates(final AccessOrderModel acce

sb.append(" private static final boolean ENABLE_BOUNDS_CHECKS = ")
.append("!Boolean.getBoolean(\"agrona.disable.bounds.checks\");\n\n");
sb.append(" private static final boolean ENABLE_ACCESS_ORDER_CHECKS = ")
sb.append(" private static final boolean SBE_ENABLE_SEQUENCING_CHECKS = ")
.append("Boolean.parseBoolean(System.getProperty(\n")
.append(" \"sbe.enable.access.order.checks\",\n")
.append(" \"sbe.enable.sequencing.checks\",\n")
.append(" Boolean.toString(ENABLE_BOUNDS_CHECKS)));\n\n");

sb.append(" /**\n");
Expand Down Expand Up @@ -410,7 +410,7 @@ private static void generateFullyEncodedCheck(

sb.append(" public void checkEncodingIsComplete()\n")
.append(" {\n")
.append(" if (ENABLE_ACCESS_ORDER_CHECKS)\n")
.append(" if (SBE_ENABLE_SEQUENCING_CHECKS)\n")
.append(" {\n")
.append(" switch (codecState)\n")
.append(" {\n");
Expand Down Expand Up @@ -493,7 +493,7 @@ private static CharSequence generateAccessOrderListenerCall(
}

final StringBuilder sb = new StringBuilder();
sb.append(indent).append("if (ENABLE_ACCESS_ORDER_CHECKS)\n")
sb.append(indent).append("if (SBE_ENABLE_SEQUENCING_CHECKS)\n")
.append(indent).append("{\n")
.append(indent).append(" ").append(methodName).append("(");

Expand Down Expand Up @@ -755,7 +755,7 @@ private CharSequence generateEncoderWrapListener(
}

final StringBuilder sb = new StringBuilder();
sb.append(indent).append("if (ENABLE_ACCESS_ORDER_CHECKS)")
sb.append(indent).append("if (SBE_ENABLE_SEQUENCING_CHECKS)")
.append("\n").append(indent).append("{\n")
.append(indent).append(" codecState(")
.append(qualifiedStateCase(accessOrderModel.latestVersionWrappedState()))
Expand Down Expand Up @@ -3424,7 +3424,7 @@ private CharSequence generateDecoderFlyweightCode(

if (null != accessOrderModel)
{
methods.append(" if (ENABLE_ACCESS_ORDER_CHECKS)\n")
methods.append(" if (SBE_ENABLE_SEQUENCING_CHECKS)\n")
.append(" {\n")
.append(" codecState(currentCodecState);\n")
.append(" }\n\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public final class FrameCodecDecoder
{
private static final boolean ENABLE_BOUNDS_CHECKS = !Boolean.getBoolean("agrona.disable.bounds.checks");

private static final boolean ENABLE_ACCESS_ORDER_CHECKS = Boolean.parseBoolean(System.getProperty(
"sbe.enable.access.order.checks",
private static final boolean SBE_ENABLE_SEQUENCING_CHECKS = Boolean.parseBoolean(System.getProperty(
"sbe.enable.sequencing.checks",
Boolean.toString(ENABLE_BOUNDS_CHECKS)));

/**
Expand Down Expand Up @@ -172,7 +172,7 @@ public FrameCodecDecoder wrap(
this.actingVersion = actingVersion;
limit(offset + actingBlockLength);

if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onWrap(actingVersion);
}
Expand Down Expand Up @@ -213,7 +213,7 @@ public int sbeDecodedLength()
final int decodedLength = encodedLength();
limit(currentLimit);

if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
codecState(currentCodecState);
}
Expand Down Expand Up @@ -299,7 +299,7 @@ public static int irIdMaxValue()

public int irId()
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onIrIdAccessed();
}
Expand Down Expand Up @@ -366,7 +366,7 @@ public static int irVersionMaxValue()

public int irVersion()
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onIrVersionAccessed();
}
Expand Down Expand Up @@ -433,7 +433,7 @@ public static int schemaVersionMaxValue()

public int schemaVersion()
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onSchemaVersionAccessed();
}
Expand Down Expand Up @@ -504,7 +504,7 @@ private void onPackageNameAccessed()

public int packageNameLength()
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onPackageNameLengthAccessed();
}
Expand All @@ -515,7 +515,7 @@ public int packageNameLength()

public int skipPackageName()
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onPackageNameAccessed();
}
Expand All @@ -531,7 +531,7 @@ public int skipPackageName()

public int getPackageName(final MutableDirectBuffer dst, final int dstOffset, final int length)
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onPackageNameAccessed();
}
Expand All @@ -548,7 +548,7 @@ public int getPackageName(final MutableDirectBuffer dst, final int dstOffset, fi

public int getPackageName(final byte[] dst, final int dstOffset, final int length)
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onPackageNameAccessed();
}
Expand All @@ -565,7 +565,7 @@ public int getPackageName(final byte[] dst, final int dstOffset, final int lengt

public void wrapPackageName(final DirectBuffer wrapBuffer)
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onPackageNameAccessed();
}
Expand All @@ -579,7 +579,7 @@ public void wrapPackageName(final DirectBuffer wrapBuffer)

public String packageName()
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onPackageNameAccessed();
}
Expand Down Expand Up @@ -662,7 +662,7 @@ private void onNamespaceNameAccessed()

public int namespaceNameLength()
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onNamespaceNameLengthAccessed();
}
Expand All @@ -673,7 +673,7 @@ public int namespaceNameLength()

public int skipNamespaceName()
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onNamespaceNameAccessed();
}
Expand All @@ -689,7 +689,7 @@ public int skipNamespaceName()

public int getNamespaceName(final MutableDirectBuffer dst, final int dstOffset, final int length)
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onNamespaceNameAccessed();
}
Expand All @@ -706,7 +706,7 @@ public int getNamespaceName(final MutableDirectBuffer dst, final int dstOffset,

public int getNamespaceName(final byte[] dst, final int dstOffset, final int length)
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onNamespaceNameAccessed();
}
Expand All @@ -723,7 +723,7 @@ public int getNamespaceName(final byte[] dst, final int dstOffset, final int len

public void wrapNamespaceName(final DirectBuffer wrapBuffer)
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onNamespaceNameAccessed();
}
Expand All @@ -737,7 +737,7 @@ public void wrapNamespaceName(final DirectBuffer wrapBuffer)

public String namespaceName()
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onNamespaceNameAccessed();
}
Expand Down Expand Up @@ -820,7 +820,7 @@ private void onSemanticVersionAccessed()

public int semanticVersionLength()
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onSemanticVersionLengthAccessed();
}
Expand All @@ -831,7 +831,7 @@ public int semanticVersionLength()

public int skipSemanticVersion()
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onSemanticVersionAccessed();
}
Expand All @@ -847,7 +847,7 @@ public int skipSemanticVersion()

public int getSemanticVersion(final MutableDirectBuffer dst, final int dstOffset, final int length)
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onSemanticVersionAccessed();
}
Expand All @@ -864,7 +864,7 @@ public int getSemanticVersion(final MutableDirectBuffer dst, final int dstOffset

public int getSemanticVersion(final byte[] dst, final int dstOffset, final int length)
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onSemanticVersionAccessed();
}
Expand All @@ -881,7 +881,7 @@ public int getSemanticVersion(final byte[] dst, final int dstOffset, final int l

public void wrapSemanticVersion(final DirectBuffer wrapBuffer)
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onSemanticVersionAccessed();
}
Expand All @@ -895,7 +895,7 @@ public void wrapSemanticVersion(final DirectBuffer wrapBuffer)

public String semanticVersion()
{
if (ENABLE_ACCESS_ORDER_CHECKS)
if (SBE_ENABLE_SEQUENCING_CHECKS)
{
onSemanticVersionAccessed();
}
Expand Down
Loading

0 comments on commit 558df22

Please sign in to comment.