ICG 2
Electric Boogaloo
Functions
DataTypeAlgorithm Namespace Reference

Functions

ContainsPointer::Result containsPointer (std::shared_ptr< const DataType > node)
 Determine whether or not this type is a pointer, or has any pointer members or subtypes. More...
 
FindLeaves::Result findLeaves (std::shared_ptr< const DataType > node, std::string starting_name, void *starting_address)
 Find all of the leaves in this allocation as name-value pairs. More...
 
LookupAddressAndTypeByName::Result lookupAddressAndTypeByName (std::shared_ptr< const DataType > node, void *starting_address, std::string full_name)
 Search in the allocation of the given type for a nested member with the correct name. If the name does not match the type, returns an empty result. More...
 
LookupAddressAndTypeByName::Result lookupAddressAndTypeByName (std::shared_ptr< const DataType > node, void *starting_address, MutableVariableName name_elems)
 Search in the allocation of the given type for the address and type of a nested member with the correct name. If the name does not match the type, returns an empty result. More...
 
LookupNameByAddressAndType::Result lookupNameByAddressAndType (std::shared_ptr< const DataType > node, std::string starting_name, void *starting_address, void *lookup_address, std::shared_ptr< const DataType > const search_type)
 Traverse the allocation of the given type to get the name of nested member that starts at the given address and is of the given type. More...
 
void printValue (std::shared_ptr< const DataType > node, std::ostream &s, void *address)
 Print an ascii representation of the value starting at the given address of the given type to the given stream. More...
 
AssignValue::Result assignValue (std::shared_ptr< const DataType > node, Value *val, void *address)
 Assign the value of a leaf type (string, pointer, primitive, enum) More...
 
GetValue::Result getValue (std::shared_ptr< const DataType > node, void *address)
 Get the value of a leaf type (string, pointer, primitive, enum) More...
 
void clearValue (std::shared_ptr< const DataType > node, void *address)
 Clear the contents of an instance of a type. More...
 
bool resizeSequence (std::shared_ptr< const DataType > node, void *address, int num_elems)
 Resize a sequence to the given size. More...
 
void checkType (std::shared_ptr< const DataType > node, const char *function_name)
 
LookupAddressAndTypeByName::Result _lookupAddressAndTypeByName (std::shared_ptr< const DataType > node, LookupAddressAndTypeByName::LookupAddressAndTypeByNameVisitor &visitor)
 

Function Documentation

◆ _lookupAddressAndTypeByName()

LookupAddressAndTypeByName::Result DataTypeAlgorithm::_lookupAddressAndTypeByName ( std::shared_ptr< const DataType node,
LookupAddressAndTypeByName::LookupAddressAndTypeByNameVisitor visitor 
)

◆ assignValue()

AssignValue::Result DataTypeAlgorithm::assignValue ( std::shared_ptr< const DataType node,
Value val,
void *  address 
)

Assign the value of a leaf type (string, pointer, primitive, enum)

Parameters
nodeType to assign to
valValue to assign, must be compatible with node
addressinstance of type to assign to
Returns
AssignValue::Result bool representing success

◆ checkType()

void DataTypeAlgorithm::checkType ( std::shared_ptr< const DataType node,
const char *  function_name 
)

◆ clearValue()

void DataTypeAlgorithm::clearValue ( std::shared_ptr< const DataType node,
void *  address 
)

Clear the contents of an instance of a type.

Parameters
nodeType to clear
addressinstance of type to clear

◆ containsPointer()

ContainsPointer::Result DataTypeAlgorithm::containsPointer ( std::shared_ptr< const DataType node)

Determine whether or not this type is a pointer, or has any pointer members or subtypes.

Parameters
nodeDataType to search
Returns
bool true if some subtype of this type is a pointer, false otherwise

◆ findLeaves()

FindLeaves::Result DataTypeAlgorithm::findLeaves ( std::shared_ptr< const DataType node,
std::string  starting_name,
void *  starting_address 
)

Find all of the leaves in this allocation as name-value pairs.

Parameters
nodeDataType to search
starting_namename of allocation that we're searching
starting_addressstarting address of allocation that we're searching
Returns
FindLeaves::Result

◆ getValue()

GetValue::Result DataTypeAlgorithm::getValue ( std::shared_ptr< const DataType node,
void *  address 
)

Get the value of a leaf type (string, pointer, primitive, enum)

Parameters
nodeType to get from
addressinstance of type to get value of
Returns
GetValue::Result Value * representing the value

◆ lookupAddressAndTypeByName() [1/2]

LookupAddressAndTypeByName::Result DataTypeAlgorithm::lookupAddressAndTypeByName ( std::shared_ptr< const DataType node,
void *  starting_address,
MutableVariableName  name_elems 
)

Search in the allocation of the given type for the address and type of a nested member with the correct name. If the name does not match the type, returns an empty result.

Parameters
nodeDataType to search
starting_addressaddress of allocation to search
name_elemsname of variable to match, already parsed
Returns
LookupAddressAndTypeByName::Result

◆ lookupAddressAndTypeByName() [2/2]

LookupAddressAndTypeByName::Result DataTypeAlgorithm::lookupAddressAndTypeByName ( std::shared_ptr< const DataType node,
void *  starting_address,
std::string  full_name 
)

Search in the allocation of the given type for a nested member with the correct name. If the name does not match the type, returns an empty result.

Parameters
nodeDataType to search
starting_addressaddress of allocation to search
full_namename of variable to match
Returns
LookupAddressAndTypeByName::Result

◆ lookupNameByAddressAndType()

LookupNameByAddressAndType::Result DataTypeAlgorithm::lookupNameByAddressAndType ( std::shared_ptr< const DataType node,
std::string  starting_name,
void *  starting_address,
void *  lookup_address,
std::shared_ptr< const DataType > const  search_type 
)

Traverse the allocation of the given type to get the name of nested member that starts at the given address and is of the given type.

Parameters
nodeDataType to search
starting_nameName of the root allocation
starting_addressaddress of the allocation to search
lookup_addressaddress of the variable we are looking for
search_typetype of the variable we are looking for
Returns
LookupNamebyAddressAndType::Result

◆ printValue()

void DataTypeAlgorithm::printValue ( std::shared_ptr< const DataType node,
std::ostream &  s,
void *  address 
)

Print an ascii representation of the value starting at the given address of the given type to the given stream.

Parameters
nodeDataType of value to print
sostream to print to
addressStarting address of value to print

◆ resizeSequence()

bool DataTypeAlgorithm::resizeSequence ( std::shared_ptr< const DataType node,
void *  address,
int  num_elems 
)

Resize a sequence to the given size.

Parameters
nodetype (should be a SequenceDataType)
addressaddress of allocation
num_elemsnew size