本文整理汇总了C++中MacroDefinition::getOutputDefinition方法的典型用法代码示例。如果您正苦于以下问题:C++ MacroDefinition::getOutputDefinition方法的具体用法?C++ MacroDefinition::getOutputDefinition怎么用?C++ MacroDefinition::getOutputDefinition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MacroDefinition
的用法示例。
在下文中一共展示了MacroDefinition::getOutputDefinition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
ParameterDefinition *MacroParameterNode::getParameterDefinition(
boolean includeDummies)
{
MacroDefinition *md = this->getNetwork()->getDefinition();
//
// During deletion of a MacroDefinition, there is no MacroDefinition
// for this node and therefore no ParameterDefinition. So return NULL.
//
if (!md)
return NULL;
int idx = this->getIndex();
if (idx <= 0)
return NULL;
if (this->isInput()) {
ASSERT(this->isInputRepeatable() == FALSE);
if (idx > md->getInputCount())
return NULL;
} else {
ASSERT(this->isOutputRepeatable() == FALSE);
if (idx > md->getOutputCount())
return NULL;
}
ParameterDefinition *pd;
if (this->isInput()) {
if (includeDummies)
pd = md->getInputDefinition(idx);
else
pd = md->getNonDummyInputDefinition(idx);
} else {
if (includeDummies)
pd = md->getOutputDefinition(idx);
else
pd = md->getNonDummyOutputDefinition(idx);
}
return pd;
}
示例2: switchNetwork
void MacroParameterNode::switchNetwork(Network *from, Network *to, boolean silently)
{
MacroDefinition *md = from->getDefinition();
ParameterDefinition *pd = this->getParameterDefinition();
ParameterDefinition *dummyPd;
int n;
dummyPd = new ParameterDefinition(-1);
dummyPd->setDummy(TRUE);
dummyPd->addType(new DXType(DXType::ObjectType));
if(this->isInput())
md->replaceInput(dummyPd, pd);
else
md->replaceOutput(dummyPd, pd);
//
// Switch the Network pointers
//
this->UniqueNameNode::switchNetwork(from, to, silently);
//
// Make sure we are a macro
//
to->makeMacro(TRUE);
md = to->getDefinition();
if(this->isInput())
{
n = md->getFirstAvailableInputPosition();
if (n <= md->getInputCount()) {
dummyPd = md->getInputDefinition(n);
ASSERT(dummyPd->isDummy());
md->replaceInput(pd,dummyPd);
} else {
md->addInput(pd);
}
this->setIndex(n);
}
else
{
n = md->getFirstAvailableOutputPosition();
if (n <= md->getOutputCount()) {
ParameterDefinition *dummyPd = md->getOutputDefinition(n);
ASSERT(dummyPd->isDummy());
md->replaceOutput(pd,dummyPd);
} else {
md->addOutput(pd);
}
this->setIndex(n);
}
//
// See if the input is named input_%d or output_%d
// and if so, change it to match the possibly new index.
//
pd = this->getParameterDefinition();
char buf[64];
if (this->isInput()) {
strcpy(buf,"input_");
} else {
strcpy(buf,"output_");
}
int buflen = strlen(buf);
const char* current_name = pd->getNameString();
const char* new_name = NUL(char*);
boolean name_reset = FALSE;
if (EqualSubstring(current_name, buf, buflen)) {
int endint = 0;
const char *end = ¤t_name[strlen(current_name)];
if (IsInteger(current_name+buflen,endint) &&
((current_name+buflen+endint) == end)) {
sprintf(buf+buflen,"%d",this->getIndex());
pd->setName(buf);
name_reset = TRUE;
}
}
//
// Resolve name conflicts with other nodes using global names.
//
if (!name_reset) {
int name_clash=0, i;
if (this->isInput()) {
int count = to->getInputCount();
for (i=1 ; !name_clash && (i <= count) ; i++) {
ParameterDefinition *opd = to->getInputDefinition(i);
if ((i != this->getIndex()) &&
EqualString(current_name,opd->getNameString()))
name_clash = i;
}
} else {
int count = to->getOutputCount();
for (i=1 ; !name_clash && (i <= count) ; i++) {
ParameterDefinition *opd = to->getOutputDefinition(i);
if ((i != this->getIndex()) &&
EqualString(current_name,opd->getNameString()))
//.........这里部分代码省略.........
示例3: ParameterDefinition
boolean
MacroParameterNode::initialize()
{
this->UniqueNameNode::initialize();
Network *net = this->getNetwork();
if (!net->isMacro())
net->makeMacro(TRUE);
MacroDefinition *md = net->getDefinition();
ParameterDefinition *param=NULL;
boolean input = this->isInput();
if (!md->isReadingNet()) {
param = new ParameterDefinition(-1);
param->addType(new DXType(DXType::ObjectType));
}
char s[100];
if (input)
{
if (!md->isReadingNet()) {
int n = md->getFirstAvailableInputPosition();
param->markAsInput();
if (n <= md->getInputCount()) {
ParameterDefinition *dummyPd = md->getInputDefinition(n);
ASSERT(dummyPd->isDummy());
md->replaceInput(param,dummyPd);
} else {
md->addInput(param);
}
this->setIndex(n);
sprintf(s, "input_%d", this->index);
param->setName(s);
param->setDefaultValue("(no default)");
}
//
// The Parameter must have its own ParameterDefinition since
// it may change depending upon what we are connected to.
// FIXME: ParameterDefinition should have a dup() method.
//
Parameter *p = this->getOutputParameter(1);
ParameterDefinition *pd = p->getDefinition();
#if 11
ParameterDefinition *newpd = pd->duplicate();
#else
ParameterDefinition *newpd =
new ParameterDefinition(pd->getNameSymbol());
List *l = pd->getTypes();
DXType *dxt;
for (ListIterator li(*l); dxt = (DXType*)li.getNext();)
newpd->addType(dxt);
newpd->markAsOutput();
newpd->setDefaultVisibility(pd->getDefaultVisibility());
newpd->setViewability(pd->isViewable());
newpd->setDescription(pd->getDescription());
newpd->setWriteableCacheability(pd->hasWriteableCacheability());
newpd->setDefaultCacheability(pd->getDefaultCacheability());
if (pd->isRequired())
newpd->setRequired();
else
newpd->setNotRequired();
if (pd->isDefaultValue())
newpd->setDefaultValue(pd->getDefaultValue());
else
newpd->setDescriptiveValue(pd->getDefaultValue());
#endif
p->setDefinition(newpd);
}
else
{
if (!md->isReadingNet()) {
int n = md->getFirstAvailableOutputPosition();
param->markAsOutput();
if (n <= md->getOutputCount()) {
ParameterDefinition *dummyPd = md->getOutputDefinition(n);
ASSERT(dummyPd->isDummy());
md->replaceOutput(param,dummyPd);
} else {
md->addOutput(param);
}
this->setIndex(n);
sprintf(s, "output_%d", this->index);
param->setName(s);
param->setDefaultValue("(no default)");
}
//
// The Parameter must have its own ParameterDefinition since
// it may change depending upon what we are connected to.
// FIXME: ParameterDefinition should have a dup() method.
//
Parameter *p = this->getInputParameter(1);
ParameterDefinition *pd = p->getDefinition();
#if 11
ParameterDefinition *newpd = pd->duplicate();
#else
ParameterDefinition *newpd =
new ParameterDefinition(pd->getNameSymbol());
List *l = pd->getTypes();
DXType *dxt;
//.........这里部分代码省略.........