|
docc 0.8.3 (0d44999b)
C++ API Reference
|
Represents a scalar primitive type. More...
#include <sdfg/types/scalar.h>
Public Member Functions | |
| Scalar (PrimitiveType primitive_type) | |
| Constructs a Scalar with the specified primitive type. | |
| Scalar (StorageType storage_type, size_t alignment, const std::string &initializer, PrimitiveType primitive_type) | |
| Constructs a Scalar with explicit storage, alignment, initializer, and primitive type. | |
| virtual TypeID | type_id () const override |
| Returns TypeID::Scalar. | |
| virtual PrimitiveType | primitive_type () const override |
| Returns the primitive type of this scalar. | |
| virtual bool | is_symbol () const override |
| Checks if this scalar type can be used as a symbol. | |
| bool | is_pointer_like () const override |
| Checks if this is a pointer or a structure behaves like a pointer. | |
| Scalar | as_signed () const |
| Creates a copy of this scalar with signed integer type. | |
| Scalar | as_unsigned () const |
| Creates a copy of this scalar with unsigned integer type. | |
| virtual bool | operator== (const IType &other) const override |
| Compares this scalar with another type for equality. | |
| virtual std::unique_ptr< IType > | clone () const override |
| Creates a deep copy of this scalar. | |
| virtual std::string | print () const override |
| Returns a string representation of this scalar type. | |
| virtual void | replace_symbols (const symbolic::Expression old_expression, const symbolic::Expression new_expression) override |
| Replace symbolic expressions on this type. | |
| virtual void | replace_symbols (const symbolic::ExpressionMapping &replacements) override |
| Public Member Functions inherited from sdfg::types::IType | |
| IType (StorageType storage_type=StorageType::CPU_Stack(), size_t alignment=0, const std::string &initializer="") | |
| Constructs an IType with optional storage, alignment, and initializer. | |
| virtual | ~IType ()=default |
| Virtual destructor for proper cleanup of derived classes. | |
| StorageType | storage_type () const |
| Gets the storage type (const version). | |
| StorageType & | storage_type () |
| Gets the storage type (mutable reference). | |
| void | storage_type (const StorageType &storage_type) |
| Sets the storage type. | |
| size_t | alignment () const |
| Gets the alignment requirement in bytes. | |
| void | alignment (size_t alignment) |
| Sets the alignment requirement in bytes. | |
| std::string | initializer () const |
| Gets the initializer expression. | |
| void | initializer (const std::string &initializer) |
| Sets the initializer expression. | |
Additional Inherited Members | |
| Protected Attributes inherited from sdfg::types::IType | |
| StorageType | storage_type_ |
| Where and how the data is stored. | |
| size_t | alignment_ |
| Memory alignment requirement in bytes. | |
| std::string | initializer_ |
| Optional initializer expression. | |
Represents a scalar primitive type.
The Scalar class wraps a PrimitiveType and provides operations for working with scalar types, including type conversions between signed and unsigned variants.
Scalar types are the most basic types in the type system and include integers, floating-point numbers, and booleans.
| sdfg::types::Scalar::Scalar | ( | PrimitiveType | primitive_type | ) |
Constructs a Scalar with the specified primitive type.
| primitive_type | The primitive type (e.g., Int32, Float, Bool) |
| sdfg::types::Scalar::Scalar | ( | StorageType | storage_type, |
| size_t | alignment, | ||
| const std::string & | initializer, | ||
| PrimitiveType | primitive_type ) |
Constructs a Scalar with explicit storage, alignment, initializer, and primitive type.
| storage_type | The storage location and management |
| alignment | Memory alignment in bytes |
| initializer | Optional initializer expression |
| primitive_type | The primitive type |
| Scalar sdfg::types::Scalar::as_signed | ( | ) | const |
| Scalar sdfg::types::Scalar::as_unsigned | ( | ) | const |
|
overridevirtual |
Creates a deep copy of this scalar.
Implements sdfg::types::IType.
|
inlineoverridevirtual |
Checks if this is a pointer or a structure behaves like a pointer.
Some structures may have pointer-like semantics in certain contexts.
Implements sdfg::types::IType.
|
overridevirtual |
Checks if this scalar type can be used as a symbol.
Integer types (signed and unsigned) are considered symbolic and can be used in symbolic expressions. Floating-point types are not symbolic.
Implements sdfg::types::IType.
|
overridevirtual |
Compares this scalar with another type for equality.
Implements sdfg::types::IType.
|
overridevirtual |
Returns the primitive type of this scalar.
Implements sdfg::types::IType.
|
overridevirtual |
Returns a string representation of this scalar type.
Implements sdfg::types::IType.
|
inlineoverridevirtual |
Replace symbolic expressions on this type.
| old_expression | Expression to replace |
| new_expression | Replacement expression |
Nothing to do.
Implements sdfg::types::IType.
|
inlineoverridevirtual |
Implements sdfg::types::IType.
|
overridevirtual |
Returns TypeID::Scalar.
Implements sdfg::types::IType.