docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
scalar.h
Go to the documentation of this file.
1
8
9#pragma once
10
11#include "sdfg/types/type.h"
12
13namespace sdfg {
14
15namespace types {
16
27class Scalar : public IType {
28private:
29 PrimitiveType primitive_type_;
30
31public:
37
46
48 virtual TypeID type_id() const override;
49
51 virtual PrimitiveType primitive_type() const override;
52
61 virtual bool is_symbol() const override;
62
63 bool is_pointer_like() const override {
64 return false;
65 }
66
76
86
88 virtual bool operator==(const IType& other) const override;
89
91 virtual std::unique_ptr<IType> clone() const override;
92
94 virtual std::string print() const override;
95
103 virtual void
104 replace_symbols(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override {
105 }
106 virtual void replace_symbols(const symbolic::ExpressionMapping& replacements) override {
107 }
108};
109} // namespace types
110} // namespace sdfg
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
virtual void replace_symbols(const symbolic::ExpressionMapping &replacements) override
Definition scalar.h:106
virtual bool is_symbol() const override
Checks if this scalar type can be used as a symbol.
virtual std::string print() const override
Returns a string representation of this scalar type.
Scalar(PrimitiveType primitive_type)
Constructs a Scalar with the specified primitive type.
virtual std::unique_ptr< IType > clone() const override
Creates a deep copy of this scalar.
virtual void replace_symbols(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
Replace symbolic expressions on this type.
Definition scalar.h:104
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 TypeID type_id() const override
Returns TypeID::Scalar.
virtual bool operator==(const IType &other) const override
Compares this scalar with another type for equality.
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.
bool is_pointer_like() const override
Checks if this is a pointer or a structure behaves like a pointer.
Definition scalar.h:63
virtual PrimitiveType primitive_type() const override
Returns the primitive type of this scalar.
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.