GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java™ (public API).
com.jogamp.gluegen.ConstantDefinition Class Reference

Represents a [native] constant expression, comprises the [native] expression, see getNativeExpr() and the optional CNumber representation, see getNumber(). More...

Inheritance diagram for com.jogamp.gluegen.ConstantDefinition:
Collaboration diagram for com.jogamp.gluegen.ConstantDefinition:

Classes

class  CNumber
 A Number, either integer, optionally [long, unsigned], or floating point, optionally [double]. More...
 
class  JavaExpr
 A valid java expression, including its result type, usually generated from a native [C] expression, see JavaExpr#create(ConstantDefinition). More...
 

Public Member Functions

 ConstantDefinition (final String name, final String nativeExpr, final CNumber number, final ASTLocusTag astLocus)
 Constructor for plain const-values, non-enumerates. More...
 
 ConstantDefinition (final String name, final String nativeExpr, final CNumber number, final String enumName, final ASTLocusTag astLocus)
 Constructor for enumerates. More...
 
ASTLocusTag getASTLocusTag ()
 Returns this instance's ASTLocusTag, if available, otherwise returns null. More...
 
final int hashCode ()
 Hash by its given name. More...
 
final boolean equals (final Object arg)
 Equality test by its given name. More...
 
final int hashCodeSemantics ()
 Semantic hashcode for Types exclusive its given name. More...
 
final boolean equalSemantics (final SemanticEqualityOp arg)
 Semantic equality test for Types exclusive its given name. More...
 
String getNativeExpr ()
 Returns the original [native] expression. More...
 
CNumber getNumber ()
 Returns the parsed CNumber of the native expression, or null if the latter does not comprise a single number, i.e. More...
 
boolean hasNumber ()
 Returns true if this instance represents has a number, otherwise false. More...
 
String getEnumName ()
 Returns null if this definition was not part of an enumeration, or if the enumeration is anonymous. More...
 
boolean isEnum ()
 
String toString ()
 
final JavaExpr computeJavaExpr (final Map< String, ConstantDefinition.JavaExpr > constMap)
 Computes the java expression based on this instance, see JavaExpr#create(ConstantDefinition). More...
 
- Public Member Functions inherited from com.jogamp.gluegen.cgram.types.AliasedSymbol.AliasedSymbolImpl
 AliasedSymbolImpl (final String origName)
 
 AliasedSymbolImpl (final AliasedSymbolImpl o)
 
void rename (final String newName)
 Rename this symbol with the given newName if not equal current-name. More...
 
void addAliasedName (final String origName)
 Add the given origName to the list of aliases if not equal current-name. More...
 
boolean hasAliases ()
 Returns true if this symbol has aliases, i.e. More...
 
Set< String > getAliasedNames ()
 Return all aliases for this symbol, i.e. More...
 
String getOrigName ()
 Return the original-name as set at creation. More...
 
String getName ()
 Return the current-name, which is the last renamed-name if issued, or the original-name. More...
 
String getAliasedString ()
 Return this object's toString() wrapped w/ the current-name and all aliases. More...
 
void rename (final String newName)
 Rename this symbol with the given newName if not equal current-name. More...
 
void addAliasedName (final String origName)
 Add the given origName to the list of aliases if not equal current-name. More...
 
boolean hasAliases ()
 Returns true if this symbol has aliases, i.e. More...
 
Set< String > getAliasedNames ()
 Return all aliases for this symbol, i.e. More...
 
String getOrigName ()
 Return the original-name as set at creation. More...
 
String getName ()
 Return the current-name, which is the last renamed-name if issued, or the original-name. More...
 
String getAliasedString ()
 Return this object's toString() wrapped w/ the current-name and all aliases. More...
 
int hashCodeSemantics ()
 Semantic hashcode for Types exclusive its given name. More...
 
boolean equalSemantics (final SemanticEqualityOp arg)
 Semantic equality test for Types exclusive its given name. More...
 
ASTLocusTag getASTLocusTag ()
 Returns this instance's ASTLocusTag, if available, otherwise returns null. More...
 

Static Public Member Functions

static boolean isConstantExpression (final String value)
 
static boolean isIdentifier (final String value)
 
static CNumber decodeANumber (final String v)
 Returns either decodeIntegerNumber(String), decodeDecimalNumber(String) or null. More...
 
static CNumber decodeIntegerNumber (final String v)
 If the given string isIntegerNumber(String), return the decoded integer value, represented as a ANumber, otherwise returns null. More...
 
static CNumber decodeDecimalNumber (final String v)
 If the given string isDecimalNumber(String), return the decoded floating-point value, represented as a ANumber object, otherwise returns null. More...
 
static boolean isNumber (final String s)
 Matches isHexNumber(String) or isDecimalOrIntNumber(String). More...
 
static boolean isIntegerNumber (final String s)
 Matches isHexNumber(String) or patternIntegerNumber. More...
 
static boolean isHexNumber (final String s)
 Matches patternHexNumber. More...
 
static boolean isDecimalNumber (final String s)
 Matches pattern for floating point number, compatible and described in Double#valueOf(String). More...
 
static boolean isDecimalOrIntNumber (final String s)
 Complete pattern for floating point and integer number, covering patternDecimalNumber and patternIntegerNumber. More...
 
static boolean isCPPOperand (final String s)
 Matches pattern for valid CPP operands, see patternCPPOperand. More...
 

Static Public Attributes

static final long UNSIGNED_INT_MAX_VALUE = 0xffffffffL
 
static final BigInteger UNSIGNED_LONG_MAX_VALUE = new BigInteger("ffffffffffffffff", 16)
 
static Pattern patternHexNumber
 Complete pattern for hexadecimal number, including an optional sign [+-] and optional suffixes [uUlL]. More...
 
static final Pattern patternDecimalNumber
 Complete pattern for floating point number, compatible and described in Double#valueOf(String). More...
 
static final Pattern patternDecimalOrIntNumber
 Complete pattern for floating point and integer number, covering patternDecimalNumber and patternIntegerNumber. More...
 
static final Pattern patternIntegerNumber
 Complete pattern for integer number, including an optional sign [+-] and optional suffixes [uUlL]. More...
 
static Pattern patternCPPOperand
 One of: + - * / | & ( ) << >> ~ @endiliteral.
More...
 

Detailed Description

Represents a [native] constant expression, comprises the [native] expression, see getNativeExpr() and the optional CNumber representation, see getNumber().

The representation of the equivalent java expression including the result type is covered by JavaExpr, which can be computed via computeJavaExpr(Map).

This class and its sub-classes define and convert all native expressions to Java space.

Definition at line 54 of file ConstantDefinition.java.

Constructor & Destructor Documentation

◆ ConstantDefinition() [1/2]

com.jogamp.gluegen.ConstantDefinition.ConstantDefinition ( final String  name,
final String  nativeExpr,
final CNumber  number,
final ASTLocusTag  astLocus 
)

Constructor for plain const-values, non-enumerates.

Parameters
nameunique name of this constant expression
nativeExproriginal [native] expression
numberoptional CNumber representing this constant. If null, implementation attempts to derive a CNumber of the given nativeExpr.
astLocusAST location of the represented constant.

Definition at line 329 of file ConstantDefinition.java.

Here is the caller graph for this function:

◆ ConstantDefinition() [2/2]

com.jogamp.gluegen.ConstantDefinition.ConstantDefinition ( final String  name,
final String  nativeExpr,
final CNumber  number,
final String  enumName,
final ASTLocusTag  astLocus 
)

Constructor for enumerates.

Parameters
nameunique name of this constant expression
nativeExproriginal [native] expression
numberoptional CNumber representing this constant. If null, implementation attempts to derive a CNumber of the given nativeExpr.
enumNameoptional name of the represented enumeration
astLocusAST location of the represented constant.

Definition at line 345 of file ConstantDefinition.java.

Member Function Documentation

◆ computeJavaExpr()

final JavaExpr com.jogamp.gluegen.ConstantDefinition.computeJavaExpr ( final Map< String, ConstantDefinition.JavaExpr >  constMap)

Computes the java expression based on this instance, see JavaExpr#create(ConstantDefinition).

Definition at line 494 of file ConstantDefinition.java.

Here is the call graph for this function:

◆ decodeANumber()

static CNumber com.jogamp.gluegen.ConstantDefinition.decodeANumber ( final String  v)
static

Returns either decodeIntegerNumber(String), decodeDecimalNumber(String) or null.

Parameters
v

Definition at line 558 of file ConstantDefinition.java.

Here is the call graph for this function:

◆ decodeDecimalNumber()

static CNumber com.jogamp.gluegen.ConstantDefinition.decodeDecimalNumber ( final String  v)
static

If the given string isDecimalNumber(String), return the decoded floating-point value, represented as a ANumber object, otherwise returns null.

Method utilizes Double#valueOf(String).

Parameters
v
isDoublereturn value for double flag

Definition at line 670 of file ConstantDefinition.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decodeIntegerNumber()

static CNumber com.jogamp.gluegen.ConstantDefinition.decodeIntegerNumber ( final String  v)
static

If the given string isIntegerNumber(String), return the decoded integer value, represented as a ANumber, otherwise returns null.

Method strips off sign prefix + and integer modifier suffixes [uUlL] before utilizing Long#decode(String).

Parameters
v

Definition at line 577 of file ConstantDefinition.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ equals()

final boolean com.jogamp.gluegen.ConstantDefinition.equals ( final Object  arg)

Equality test by its given name.

Definition at line 404 of file ConstantDefinition.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ equalSemantics()

final boolean com.jogamp.gluegen.ConstantDefinition.equalSemantics ( final SemanticEqualityOp  arg)

Semantic equality test for Types exclusive its given name.

See also
hashCodeSemantics()

Implements com.jogamp.gluegen.cgram.types.TypeComparator.SemanticEqualityOp.

Definition at line 426 of file ConstantDefinition.java.

Here is the call graph for this function:

◆ getASTLocusTag()

ASTLocusTag com.jogamp.gluegen.ConstantDefinition.getASTLocusTag ( )

Returns this instance's ASTLocusTag, if available, otherwise returns null.

Implements com.jogamp.gluegen.ASTLocusTag.ASTLocusTagProvider.

Definition at line 390 of file ConstantDefinition.java.

Here is the caller graph for this function:

◆ getEnumName()

String com.jogamp.gluegen.ConstantDefinition.getEnumName ( )

Returns null if this definition was not part of an enumeration, or if the enumeration is anonymous.

Definition at line 467 of file ConstantDefinition.java.

◆ getNativeExpr()

String com.jogamp.gluegen.ConstantDefinition.getNativeExpr ( )

Returns the original [native] expression.

Definition at line 452 of file ConstantDefinition.java.

Here is the caller graph for this function:

◆ getNumber()

CNumber com.jogamp.gluegen.ConstantDefinition.getNumber ( )

Returns the parsed CNumber of the native expression, or null if the latter does not comprise a single number, i.e.

is a complex expression.

Definition at line 458 of file ConstantDefinition.java.

Here is the caller graph for this function:

◆ hashCode()

final int com.jogamp.gluegen.ConstantDefinition.hashCode ( )

Hash by its given name.

Definition at line 396 of file ConstantDefinition.java.

Here is the call graph for this function:

◆ hashCodeSemantics()

final int com.jogamp.gluegen.ConstantDefinition.hashCodeSemantics ( )

Semantic hashcode for Types exclusive its given name.

See also
equalSemantics(SemanticEqualityOp)

Implements com.jogamp.gluegen.cgram.types.TypeComparator.SemanticEqualityOp.

Definition at line 416 of file ConstantDefinition.java.

Here is the call graph for this function:

◆ hasNumber()

boolean com.jogamp.gluegen.ConstantDefinition.hasNumber ( )

Returns true if this instance represents has a number, otherwise false.

Definition at line 463 of file ConstantDefinition.java.

Here is the caller graph for this function:

◆ isConstantExpression()

static boolean com.jogamp.gluegen.ConstantDefinition.isConstantExpression ( final String  value)
static

Definition at line 502 of file ConstantDefinition.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isCPPOperand()

static boolean com.jogamp.gluegen.ConstantDefinition.isCPPOperand ( final String  s)
static

Matches pattern for valid CPP operands, see patternCPPOperand.

Definition at line 736 of file ConstantDefinition.java.

Here is the caller graph for this function:

◆ isDecimalNumber()

static boolean com.jogamp.gluegen.ConstantDefinition.isDecimalNumber ( final String  s)
static

Matches pattern for floating point number, compatible and described in Double#valueOf(String).

Definition at line 721 of file ConstantDefinition.java.

Here is the caller graph for this function:

◆ isDecimalOrIntNumber()

static boolean com.jogamp.gluegen.ConstantDefinition.isDecimalOrIntNumber ( final String  s)
static

Complete pattern for floating point and integer number, covering patternDecimalNumber and patternIntegerNumber.

Definition at line 729 of file ConstantDefinition.java.

Here is the caller graph for this function:

◆ isEnum()

boolean com.jogamp.gluegen.ConstantDefinition.isEnum ( )

Definition at line 469 of file ConstantDefinition.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isHexNumber()

static boolean com.jogamp.gluegen.ConstantDefinition.isHexNumber ( final String  s)
static

Matches patternHexNumber.

Definition at line 713 of file ConstantDefinition.java.

Here is the caller graph for this function:

◆ isIdentifier()

static boolean com.jogamp.gluegen.ConstantDefinition.isIdentifier ( final String  value)
static

Definition at line 532 of file ConstantDefinition.java.

◆ isIntegerNumber()

static boolean com.jogamp.gluegen.ConstantDefinition.isIntegerNumber ( final String  s)
static

Matches isHexNumber(String) or patternIntegerNumber.

Definition at line 702 of file ConstantDefinition.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isNumber()

static boolean com.jogamp.gluegen.ConstantDefinition.isNumber ( final String  s)
static

Matches isHexNumber(String) or isDecimalOrIntNumber(String).

Definition at line 691 of file ConstantDefinition.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString()

String com.jogamp.gluegen.ConstantDefinition.toString ( )

Definition at line 472 of file ConstantDefinition.java.

Here is the call graph for this function:

Member Data Documentation

◆ patternCPPOperand

Pattern com.jogamp.gluegen.ConstantDefinition.patternCPPOperand
static

One of: + - * / | & ( ) << >> ~ @endiliteral.

Expression excludes patternDecimalOrIntNumber.

Definition at line 770 of file ConstantDefinition.java.

◆ patternDecimalNumber

final Pattern com.jogamp.gluegen.ConstantDefinition.patternDecimalNumber
static

Complete pattern for floating point number, compatible and described in Double#valueOf(String).

Definition at line 750 of file ConstantDefinition.java.

◆ patternDecimalOrIntNumber

final Pattern com.jogamp.gluegen.ConstantDefinition.patternDecimalOrIntNumber
static

Complete pattern for floating point and integer number, covering patternDecimalNumber and patternIntegerNumber.

Definition at line 756 of file ConstantDefinition.java.

◆ patternHexNumber

Pattern com.jogamp.gluegen.ConstantDefinition.patternHexNumber
static

Complete pattern for hexadecimal number, including an optional sign [+-] and optional suffixes [uUlL].

Definition at line 744 of file ConstantDefinition.java.

◆ patternIntegerNumber

final Pattern com.jogamp.gluegen.ConstantDefinition.patternIntegerNumber
static

Complete pattern for integer number, including an optional sign [+-] and optional suffixes [uUlL].

Definition at line 762 of file ConstantDefinition.java.

◆ UNSIGNED_INT_MAX_VALUE

final long com.jogamp.gluegen.ConstantDefinition.UNSIGNED_INT_MAX_VALUE = 0xffffffffL
static

Definition at line 55 of file ConstantDefinition.java.

◆ UNSIGNED_LONG_MAX_VALUE

final BigInteger com.jogamp.gluegen.ConstantDefinition.UNSIGNED_LONG_MAX_VALUE = new BigInteger("ffffffffffffffff", 16)
static

Definition at line 56 of file ConstantDefinition.java.


The documentation for this class was generated from the following file: