Gyoji Compiler
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Gyoji::mir::Types Class Reference

Set of types extracted from a translation unit. More...

#include <types.hpp>

Public Member Functions

 Types ()
 Creates a new types table with only the primitive types defined.
 
 ~Types ()
 Move along, nothing to see here.
 
Typeget_type (std::string type) const
 
const Typeget_pointer_to (const Type *_type, const Gyoji::context::SourceReference &src_ref)
 
const Typeget_reference_to (const Type *_type, const Gyoji::context::SourceReference &src_ref)
 
const Typeget_array_of (const Type *_type, size_t _length, const Gyoji::context::SourceReference &src_ref)
 
void define_type (Gyoji::owned< Type > type)
 
void dump (FILE *out) const
 
const std::map< std::string, Gyoji::owned< Type > > & get_types () const
 

Detailed Description

Set of types extracted from a translation unit.

This class represents a type extracted from the source translation unit. Types may be primitive or composite structures containing other types.

Constructor & Destructor Documentation

◆ Types()

Types::Types ( )

Creates a new types table with only the primitive types defined.

This constructs a new table of types and defined the primitive types of the type system inside it. Composite and user-defined types may also be added after construction.

◆ ~Types()

Types::~Types ( )

Move along, nothing to see here.

Move along, nothing to see here.

Member Function Documentation

◆ define_type()

void Types::define_type ( Gyoji::owned< Type type)

This is used to define a fully-qualified type from the definition. Note that some types may be incompletely specified when they are initially declared and a final resolution step may be required in order to ensure that the type is fully specified.

◆ dump()

void Types::dump ( FILE *  out) const

This is used for debugging purposes to dump the content of the type database.

◆ get_array_of()

const Type * Types::get_array_of ( const Type _type,
size_t  _length,
const Gyoji::context::SourceReference src_ref 
)

This returns a type that is an array of _length instances of the given type. The type returned may be a new type and if so, it is inserted into the table of types. If the pointer type already exists, then a pointer to the already existing immutable type will be returned.

◆ get_pointer_to()

const Type * Types::get_pointer_to ( const Type _type,
const Gyoji::context::SourceReference src_ref 
)

This returns a type that is a pointer to the given type. The type returned may be a new type and if so, it is inserted into the table of types. If the pointer type already exists, then a pointer to the already existing immutable type will be returned.

◆ get_reference_to()

const Type * Types::get_reference_to ( const Type _type,
const Gyoji::context::SourceReference src_ref 
)

This returns a type that is a reference to the given type. The type returned may be a new type and if so, it is inserted into the table of types. If the pointer type already exists, then a pointer to the already existing immutable type will be returned.

◆ get_type()

Type * Types::get_type ( std::string  type) const

This returns the fully resolved type from the fully-qualified name of the type. By fully-qualified, we mean a namespace path beginning with the root namespace and identifying a specific type.

◆ get_types()

const std::map< std::string, Gyoji::owned< Type > > & Types::get_types ( ) const

This is used to provide direct (immutable) access to the types table.


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