ICG 2
Electric Boogaloo
Public Types | Public Member Functions | Protected Member Functions | List of all members
CompositeDataType Class Referenceabstract

#include <CompositeDataType.hpp>

Inheritance diagram for CompositeDataType:
DataType SpecifiedCompositeType< T >

Public Types

typedef std::map< std::string, StructMemberMemberMap
 
typedef std::vector< StructMember * > SortedMemberList
 

Public Member Functions

 CompositeDataType (std::string name, size_t sizeof_struct, void *(*allocator)(int), void(*deAllocator)(void *))
 
 CompositeDataType (const CompositeDataType &original)=delete
 
 ~CompositeDataType ()
 
bool validate (DataTypeInator *dataTypeInator) override
 Verify that all of the types that are named by this DataType or subordinate DataTypes are resolvable to actual DataTypes in the TypeDictionary. More...
 
bool isValid () const override
 Determine whether this type has already been successfully validated. More...
 
size_t getSize () const override
 
void * createInstance (unsigned int num) const override
 Create one or more instances of this type. More...
 
void deleteInstance (void *address) const override
 Delete this instance. More...
 
std::string toString () const override
 
bool accept (DataTypeVisitor *visitor) const override
 
std::string getTypeSpecName () const override
 Get the Type Spec Name object. More...
 
virtual const MemberMapgetMemberMap () const =0
 Get the map of struct members in this object. More...
 
const SortedMemberListgetSortedMemberList () const
 Get the Sorted Member List object. More...
 
bool hasMemberNamed (std::string name)
 Look up whether this struct has a member with the given name. More...
 
- Public Member Functions inherited from DataType
virtual ~DataType ()
 
virtual std::string makeDeclaration (std::string declarator) const
 

Protected Member Functions

virtual MemberMapgetMemberMap ()=0
 

Detailed Description

A CompositeDataType represents user-defined types - structs and classes. It is 'composed' of ordered lists of component types.

Member Typedef Documentation

◆ MemberMap

typedef std::map<std::string, StructMember> CompositeDataType::MemberMap

◆ SortedMemberList

Constructor & Destructor Documentation

◆ CompositeDataType() [1/2]

CompositeDataType::CompositeDataType ( std::string  name,
size_t  sizeof_struct,
void *(*)(int)  allocator,
void(*)(void *)  deAllocator 
)

Constructor for CompositeDataType.

Parameters
sizeof_structSize, in bytes, of the struct, class or union that this class represents.

◆ CompositeDataType() [2/2]

CompositeDataType::CompositeDataType ( const CompositeDataType original)
delete

◆ ~CompositeDataType()

CompositeDataType::~CompositeDataType ( )

Member Function Documentation

◆ accept()

bool CompositeDataType::accept ( DataTypeVisitor visitor) const
overridevirtual

Implements DataType.

◆ createInstance()

void * CompositeDataType::createInstance ( unsigned int  n) const
overridevirtual

Create one or more instances of this type.

Parameters
nnumber to create
Returns
void* address of the beginnning of the allocation

Implements DataType.

◆ deleteInstance()

void CompositeDataType::deleteInstance ( void *  address) const
overridevirtual

Delete this instance.

Parameters
addressof instance to delete
Note
Is this compatible with the createInstance?

Implements DataType.

◆ getMemberMap() [1/2]

virtual const MemberMap& CompositeDataType::getMemberMap ( ) const
pure virtual

Get the map of struct members in this object.

Returns
MemberMap& reference to the MemberMap object

Implemented in SpecifiedCompositeType< T >.

◆ getMemberMap() [2/2]

virtual MemberMap& CompositeDataType::getMemberMap ( )
protectedpure virtual

Implemented in SpecifiedCompositeType< T >.

◆ getSize()

size_t CompositeDataType::getSize ( ) const
overridevirtual
Returns
The size (in bytes) of an instance of the CompositeDataType.

Implements DataType.

◆ getSortedMemberList()

const CompositeDataType::SortedMemberList & CompositeDataType::getSortedMemberList ( ) const

Get the Sorted Member List object.

Returns
const SortedMemberList

◆ getTypeSpecName()

std::string CompositeDataType::getTypeSpecName ( ) const
overridevirtual

Get the Type Spec Name object.

Returns
std::string name of the type

Implements DataType.

◆ hasMemberNamed()

bool CompositeDataType::hasMemberNamed ( std::string  name)

Look up whether this struct has a member with the given name.

Parameters
namename of member
Returns
true struct has member with that name
false otherwise

◆ isValid()

bool CompositeDataType::isValid ( ) const
overridevirtual

Determine whether this type has already been successfully validated.

Returns
true if validated, false otherwise

Implements DataType.

◆ toString()

std::string CompositeDataType::toString ( ) const
overridevirtual

Generate a definition of this DataType.

Reimplemented from DataType.

◆ validate()

bool CompositeDataType::validate ( DataTypeInator dataTypeInator)
overridevirtual

Verify that all of the types that are named by this DataType or subordinate DataTypes are resolvable to actual DataTypes in the TypeDictionary.

Parameters
dataTypeInator- type resolver machine
Returns
true if successful, false otherwise

Implements DataType.


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