ICG 2
Electric Boogaloo
Public Member Functions | List of all members
SequenceDataType Class Referenceabstract

Represents an STL sequence type - vector, list, deque, array. More...

#include <SequenceDataType.hpp>

Inheritance diagram for SequenceDataType:
DataType SpecifiedSequenceDataType< T >

Public Member Functions

 SequenceDataType (std::string typeSpecifierName, int typeSize, void *(*allocator)(int), void(*deAllocator)(void *))
 Construct an SequenceDataType. More...
 
 SequenceDataType (const SequenceDataType &original)=delete
 
 ~SequenceDataType ()
 
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 getTypeSpecName () const override
 Get the Type Spec Name object. More...
 
std::string makeDeclaration (std::string declarator) const override
 
bool accept (DataTypeVisitor *visitor) const override
 
std::shared_ptr< const DataTypegetSubType () const
 Get the type of the elements of this sequence. More...
 
virtual std::vector< void * > getElementAddresses (void *address) const =0
 Given the address of a sequence of this type, get a list of all the addresses of the elements within. More...
 
virtual int getNumElements (void *address) const =0
 Given the address of a sequence of this type, get the number of elements in this sequence. More...
 
virtual bool resize (void *address, int n_elems) const =0
 resize the underlying container More...
 
virtual bool clear (void *address) const =0
 clear the underlying container More...
 
- Public Member Functions inherited from DataType
virtual ~DataType ()
 
virtual std::string toString () const
 

Detailed Description

Represents an STL sequence type - vector, list, deque, array.

Constructor & Destructor Documentation

◆ SequenceDataType() [1/2]

SequenceDataType::SequenceDataType ( std::string  typeSpecifierName,
int  typeSize,
void *(*)(int)  allocator,
void(*)(void *)  deAllocator 
)

Construct an SequenceDataType.

Parameters
typeSpecifierNamestring representation of fully qualified type
typeSizesize of container

◆ SequenceDataType() [2/2]

SequenceDataType::SequenceDataType ( const SequenceDataType original)
delete

Copy Constructor for SequenceDataType.

◆ ~SequenceDataType()

SequenceDataType::~SequenceDataType ( )

Destructor for SequenceDataType.

Member Function Documentation

◆ accept()

bool SequenceDataType::accept ( DataTypeVisitor visitor) const
overridevirtual

Implements DataType.

◆ clear()

virtual bool SequenceDataType::clear ( void *  address) const
pure virtual

clear the underlying container

Parameters
addressaddress of sequence object to clear
Returns
int num elements to resize to

Implemented in SpecifiedSequenceDataType< T >.

◆ createInstance()

void * SequenceDataType::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 SequenceDataType::deleteInstance ( void *  address) const
overridevirtual

Delete this instance.

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

Implements DataType.

◆ getElementAddresses()

virtual std::vector<void *> SequenceDataType::getElementAddresses ( void *  address) const
pure virtual

Given the address of a sequence of this type, get a list of all the addresses of the elements within.

Parameters
addresspointer to a sequence object
Returns
std::vector<void *> addresses of all elements

Implemented in SpecifiedSequenceDataType< T >.

◆ getNumElements()

virtual int SequenceDataType::getNumElements ( void *  address) const
pure virtual

Given the address of a sequence of this type, get the number of elements in this sequence.

Parameters
addresspointer to a sequence object
Returns
int number of elements in this sequence

Implemented in SpecifiedSequenceDataType< T >.

◆ getSize()

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

Implements DataType.

◆ getSubType()

std::shared_ptr< const DataType > SequenceDataType::getSubType ( ) const

Get the type of the elements of this sequence.

Returns
std::shared_ptr<const DataType>

◆ getTypeSpecName()

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

Get the Type Spec Name object.

Returns
std::string name of the type

Implements DataType.

◆ isValid()

bool SequenceDataType::isValid ( ) const
overridevirtual

Determine whether this type has already been successfully validated.

Returns
true if validated, false otherwise

Implements DataType.

◆ makeDeclaration()

std::string SequenceDataType::makeDeclaration ( std::string  declarator) const
overridevirtual

Generate a declaration of this DataType.

Parameters
declaratorA declarator, which can be a 1) a variable name or an array declarator (both are direct-declarators) or 2) a pointer declarator ( not a direct-declarator ).

Reimplemented from DataType.

◆ resize()

virtual bool SequenceDataType::resize ( void *  address,
int  n_elems 
) const
pure virtual

resize the underlying container

Parameters
addressaddress of sequence object to resize
n_elemsint num elements to resize to
Returns
bool whether the resize was successful

Implemented in SpecifiedSequenceDataType< T >.

◆ validate()

bool SequenceDataType::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: