docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
array.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include "sdfg/types/type.h"
13
14namespace sdfg {
15
16namespace types {
17
33class Array : public IType {
34private:
35 std::unique_ptr<IType> element_type_;
36 symbolic::Expression num_elements_;
37
38public:
45
56 size_t alignment,
57 const std::string& initializer,
58 const IType& element_type,
60 );
61
69 virtual PrimitiveType primitive_type() const override;
70
72 virtual TypeID type_id() const override;
73
78 virtual bool is_symbol() const override;
79
80 bool is_pointer_like() const override {
81 return true;
82 }
83
88 const IType& element_type() const;
89
95
97 virtual bool operator==(const IType& other) const override;
98
100 virtual std::unique_ptr<IType> clone() const override;
101
103 virtual std::string print() const override;
104
112 virtual void
113 replace_symbols(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override;
114 virtual void replace_symbols(const symbolic::ExpressionMapping& replacements) override;
115};
116
117} // namespace types
118} // namespace sdfg
virtual void replace_symbols(const symbolic::ExpressionMapping &replacements) override
bool is_pointer_like() const override
Checks if this is a pointer or a structure behaves like a pointer.
Definition array.h:80
Array(const IType &element_type, const symbolic::Expression num_elements)
Constructs an Array with the specified element type and size.
virtual std::unique_ptr< IType > clone() const override
Creates a deep copy of this array type.
virtual TypeID type_id() const override
Returns TypeID::Array.
virtual void replace_symbols(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
Replace symbolic expressions on this type.
const symbolic::Expression num_elements() const
Gets the number of elements in this array.
virtual bool operator==(const IType &other) const override
Compares this array with another type for equality.
Array(StorageType storage_type, size_t alignment, const std::string &initializer, const IType &element_type, const symbolic::Expression num_elements)
Constructs an Array with explicit storage, alignment, initializer, element type, and size.
virtual std::string print() const override
Returns a string representation of this array type.
const IType & element_type() const
Gets the type of elements in this array.
virtual PrimitiveType primitive_type() const override
Returns the primitive type of the array's elements.
virtual bool is_symbol() const override
Arrays are not symbolic types.
IType(StorageType storage_type=StorageType::CPU_Stack(), size_t alignment=0, const std::string &initializer="")
Constructs an IType with optional storage, alignment, and initializer.
Definition type.h:638
StorageType storage_type() const
Gets the storage type (const version).
Definition type.h:651
std::string initializer() const
Gets the initializer expression.
Definition type.h:683
size_t alignment() const
Gets the alignment requirement in bytes.
Definition type.h:673
Represents the storage location and management characteristics of data.
Definition type.h:64
SymEngine::RCP< const SymEngine::Basic > Expression
Reference-counted pointer to a symbolic expression (SymEngine Basic).
Definition symbolic.h:83
SymEngine::map_basic_basic ExpressionMapping
Definition symbolic.h:109
Definition symbolic.h:57
PrimitiveType
Enumeration of all primitive data types supported by sdfglib.
Definition type.h:35
TypeID
Enumeration of high-level type categories.
Definition type.h:607
Definition analysis.h:7
Core type system definitions for sdfglib.