本文整理汇总了C++中VariableSymbol::set_name方法的典型用法代码示例。如果您正苦于以下问题:C++ VariableSymbol::set_name方法的具体用法?C++ VariableSymbol::set_name怎么用?C++ VariableSymbol::set_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VariableSymbol
的用法示例。
在下文中一共展示了VariableSymbol::set_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Transform
void TransformSystemsToModules::Transform()
{
assert(procDef != NULL) ;
// Collect all the input scalars and output scalars
list<VariableSymbol*> ports ;
SymbolTable* procSymTab = procDef->get_symbol_table() ;
bool foundInputs = false ;
bool foundOutputs = false ;
for (int i = 0 ; i < procSymTab->get_symbol_table_object_count() ; ++i)
{
SymbolTableObject* nextObject = procSymTab->get_symbol_table_object(i) ;
if (nextObject->lookup_annote_by_name("InputScalar") != NULL)
{
VariableSymbol* toConvert =
dynamic_cast<VariableSymbol*>(nextObject) ;
assert(toConvert != NULL) ;
LString inputName = toConvert->get_name() ;
inputName = inputName + "_in" ;
toConvert->set_name(inputName) ;
ports.push_back(toConvert) ;
foundInputs = true ;
}
if (nextObject->lookup_annote_by_name("OutputVariable") != NULL)
{
VariableSymbol* toConvert =
dynamic_cast<VariableSymbol*>(nextObject) ;
assert(toConvert != NULL) ;
LString outputName = toConvert->get_name() ;
outputName = outputName + "_out" ;
toConvert->set_name(outputName) ;
ports.push_back(toConvert) ;
foundOutputs = true ;
}
}
assert(foundInputs &&
"Could not identify inputs. Were they removed via optimizations?") ;
assert(foundOutputs &&
"Could not identify outputs. Were they removed via optimizations?") ;
// Determine the bit size and add everything to a new symbol table
int bitSize = 0 ;
GroupSymbolTable* structTable =
create_group_symbol_table(theEnv,
procDef->get_symbol_table()) ;
std::map<VariableSymbol*, FieldSymbol*> replacementFields ;
bool portsRemoved = false ;
// If this was actually a new style module, we should make sure to
// put these in the correct order.
if (isModule(procDef))
{
// Go through the original symbol table and remove any parameter
// symbols that originally existed
SymbolTable* originalSymTab = procDef->get_symbol_table() ;
Iter<SymbolTableObject*> originalIter =
originalSymTab->get_symbol_table_object_iterator() ;
while (originalIter.is_valid())
{
SymbolTableObject* currentObj = originalIter.current() ;
originalIter.next() ;
if (dynamic_cast<ParameterSymbol*>(currentObj) != NULL)
{
originalSymTab->remove_symbol_table_object(currentObj) ;
}
}
portsRemoved = true ;
// Sort the variable symbols in parameter order. This is just an
// insertion sort, so it could be done faster.
list<VariableSymbol*> sortedPorts ;
for (int i = 0 ; i < ports.size() ; ++i)
{
list<VariableSymbol*>::iterator portIter = ports.begin() ;
while (portIter != ports.end())
{
BrickAnnote* orderAnnote =
dynamic_cast<BrickAnnote*>((*portIter)->
lookup_annote_by_name("ParameterOrder")) ;
if (orderAnnote == NULL)
{
++portIter ;
continue ;
}
IntegerBrick* orderBrick =
dynamic_cast<IntegerBrick*>(orderAnnote->get_brick(0)) ;
assert(orderBrick != NULL) ;
if (orderBrick->get_value().c_int() == i)
{
sortedPorts.push_back(*portIter) ;
break ;
}
++portIter ;
}
}
if (sortedPorts.size() != ports.size())
//.........这里部分代码省略.........