-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refs #22761. Add builtin @Feed annotation. Signed-off-by: Miguel Company <miguelcompany@eprosima.com> * Refs #22761. Add auxiliary STG utilities to Operation class. Signed-off-by: Miguel Company <miguelcompany@eprosima.com> * Refs #22761. Add auxiliary STG utilities to Param class. Signed-off-by: Miguel Company <miguelcompany@eprosima.com> --------- Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
- Loading branch information
1 parent
4772983
commit 5492e2f
Showing
4 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/main/java/com/eprosima/fastdds/idl/grammar/Annotation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2025 Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
// | ||
// 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. | ||
|
||
package com.eprosima.fastdds.idl.grammar; | ||
|
||
import com.eprosima.idl.parser.tree.AnnotationDeclaration; | ||
|
||
public class Annotation extends com.eprosima.idl.parser.tree.Annotation | ||
{ | ||
public static final String rpc_feed_str = "feed"; | ||
|
||
public Annotation(AnnotationDeclaration declaration) | ||
{ | ||
super(declaration); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/main/java/com/eprosima/fastdds/idl/grammar/Operation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2025 Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
// | ||
// 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. | ||
|
||
package com.eprosima.fastdds.idl.grammar; | ||
|
||
import com.eprosima.idl.parser.exception.RuntimeGenerationException; | ||
import org.antlr.v4.runtime.Token; | ||
|
||
public class Operation extends com.eprosima.idl.parser.tree.Operation | ||
{ | ||
public Operation(String scopeFile, boolean isInScope, String scope, String name, Token tk) | ||
{ | ||
super(scopeFile, isInScope, scope, name, tk); | ||
} | ||
|
||
/** | ||
* Return whether the operation has been annotated as feed | ||
* | ||
* @return true when the operation has been annotated as feed, false otherwise. | ||
*/ | ||
public boolean isAnnotationFeed() | ||
{ | ||
com.eprosima.idl.parser.tree.Annotation ann = getAnnotations().get(Annotation.rpc_feed_str); | ||
if (ann != null) | ||
{ | ||
try | ||
{ | ||
return ann.getValue().toUpperCase().equals(Annotation.capitalized_true_str); | ||
} | ||
catch (RuntimeGenerationException ex) | ||
{ | ||
// Should not be called as @feed annotation has only one parameter | ||
} | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2025 Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
// | ||
// 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. | ||
|
||
package com.eprosima.fastdds.idl.grammar; | ||
|
||
import com.eprosima.idl.parser.exception.RuntimeGenerationException; | ||
import com.eprosima.idl.parser.typecode.TypeCode; | ||
|
||
import org.antlr.v4.runtime.Token; | ||
|
||
public class Param extends com.eprosima.idl.parser.tree.Param | ||
{ | ||
public Param(String name, TypeCode typecode, Kind kind) | ||
|
||
{ | ||
super(name, typecode, kind); | ||
} | ||
|
||
/** | ||
* Return whether the operation has been annotated as feed | ||
* | ||
* @return true when the operation has been annotated as feed, false otherwise. | ||
*/ | ||
public boolean isAnnotationFeed() | ||
{ | ||
com.eprosima.idl.parser.tree.Annotation ann = getAnnotations().get(Annotation.rpc_feed_str); | ||
if (ann != null) | ||
{ | ||
try | ||
{ | ||
return ann.getValue().toUpperCase().equals(Annotation.capitalized_true_str); | ||
} | ||
catch (RuntimeGenerationException ex) | ||
{ | ||
// Should not be called as @feed annotation has only one parameter | ||
} | ||
} | ||
return false; | ||
} | ||
} |