docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
sdfg::types::Structure Class Reference

Represents a structure type (similar to C struct). More...

#include <sdfg/types/structure.h>

Inheritance diagram for sdfg::types::Structure:
[legend]

Public Member Functions

 Structure (const std::string &name)
 Constructs a Structure with the specified name.
 Structure (StorageType storage_type, size_t alignment, const std::string &initializer, const std::string &name)
 Constructs a Structure with explicit storage, alignment, initializer, and name.
virtual PrimitiveType primitive_type () const override
 Returns the primitive type (implementation-defined for structures).
virtual TypeID type_id () const override
 Returns TypeID::Structure.
virtual bool is_symbol () const override
 Structures are not symbolic types.
const std::string & name () const
 Gets the name of this structure type.
virtual bool operator== (const IType &other) const override
 Compares this structure with another type for equality.
virtual std::unique_ptr< IType > clone () const override
 Creates a deep copy of this structure type.
virtual std::string print () const override
 Returns a string representation of this structure type.
bool is_pointer_like () const override
 Checks if this structure behaves like a pointer.
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.

Detailed Description

Represents a structure type (similar to C struct).

Structure types represent composite data types with named members of different types. This is analogous to C/C++ structs. The Structure class holds a reference to a structure type by name, while the actual member layout is defined in StructureDefinition.

Structures can also represent SIMD vector types when configured appropriately.

Constructor & Destructor Documentation

◆ Structure() [1/2]

sdfg::types::Structure::Structure ( const std::string & name)

Constructs a Structure with the specified name.

Parameters
nameThe name of the structure type

◆ Structure() [2/2]

sdfg::types::Structure::Structure ( StorageType storage_type,
size_t alignment,
const std::string & initializer,
const std::string & name )

Constructs a Structure with explicit storage, alignment, initializer, and name.

Parameters
storage_typeThe storage location and management
alignmentMemory alignment in bytes
initializerOptional initializer expression
nameThe name of the structure type

Member Function Documentation

◆ clone()

virtual std::unique_ptr< IType > sdfg::types::Structure::clone ( ) const
overridevirtual

Creates a deep copy of this structure type.

Implements sdfg::types::IType.

◆ is_pointer_like()

bool sdfg::types::Structure::is_pointer_like ( ) const
overridevirtual

Checks if this structure behaves like a pointer.

Some structures may have pointer-like semantics in certain contexts.

Returns
true if this structure is pointer-like, false otherwise

Implements sdfg::types::IType.

◆ is_symbol()

virtual bool sdfg::types::Structure::is_symbol ( ) const
overridevirtual

Structures are not symbolic types.

Returns
Always returns false

Implements sdfg::types::IType.

◆ name()

const std::string & sdfg::types::Structure::name ( ) const

Gets the name of this structure type.

Returns
A const reference to the structure name

◆ operator==()

virtual bool sdfg::types::Structure::operator== ( const IType & other) const
overridevirtual

Compares this structure with another type for equality.

Implements sdfg::types::IType.

◆ primitive_type()

virtual PrimitiveType sdfg::types::Structure::primitive_type ( ) const
overridevirtual

Returns the primitive type (implementation-defined for structures).

Returns
The primitive type

Implements sdfg::types::IType.

◆ print()

virtual std::string sdfg::types::Structure::print ( ) const
overridevirtual

Returns a string representation of this structure type.

Implements sdfg::types::IType.

◆ replace_symbols() [1/2]

virtual void sdfg::types::Structure::replace_symbols ( const symbolic::Expression old_expression,
const symbolic::Expression new_expression )
inlineoverridevirtual

Replace symbolic expressions on this type.

Parameters
old_expressionExpression to replace
new_expressionReplacement expression

Nothing to do.

Implements sdfg::types::IType.

◆ replace_symbols() [2/2]

virtual void sdfg::types::Structure::replace_symbols ( const symbolic::ExpressionMapping & replacements)
inlineoverridevirtual

Implements sdfg::types::IType.

◆ type_id()

virtual TypeID sdfg::types::Structure::type_id ( ) const
overridevirtual

Returns TypeID::Structure.

Implements sdfg::types::IType.


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