Mailing list archive (omnetpp-l at omnetpp.org)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omnetpp-l] Problem with getDisplayString()



Hi Luca,

 

Create a reference to the cDisplayString object: cDisplayString& mhDS = ...

 

Andras

 


From: omnetpp-l-bounces at xxx [mailto:omnetpp-l-bounces at xxx] On Behalf Of Luca De Nardis
Sent: Tuesday, May 26, 2009 9:45 AM
To: omnetpp-l at xxx
Subject: [Omnetpp-l] Problem with getDisplayString()

 

Hi,

 

I have a problem with the getDisplayString() method.

I am migrating a project from the 3.4b2 version, and i had the following lines of code:

 

#define displayS "p=%d,%d,e;b=12,12,oval;o=%s,,1"

...

sprintf(str,displayS, xDisp,yDisp, "black");

mh=parentModule();

mh->setDisplayString(0,str,true);

 

that I changed in:

 

#define displayS "p=%d,%d,e;b=12,12,oval;o=%s,,1"

...

sprintf(str,displayS, xDisp,yDisp, "black");

cDisplayString *mhDS=getParentModule()->getDisplayString(); //LINE 1

mhDS->parse(str); // LINE 2

 

which is basically the same code suggested at page 211 of the new manual, section 10.6.1.

 

When I try to build, however, I get the following errors:

 

cannot convert 'cDisplayString' to 'cDisplayString*' in initialization (for LINE 1)

request for member 'parse' in 'mhDS', which is of non-class type 'cDisplayString*' (for LINE 2).

 

The errors disappear if I change the two lines as follows:

 

cDisplayString mhDS=getParentModule()->getDisplayString(); //LINE 1

mhDS.parse(str); // LINE 2

 

but of course in this case I am getting a copy of the cDisplayString object, and modifications do not reflect on the aspect of the module, so

this is not the right thing to do.

What am I missing here?

 

Thanks in advance

 

Luca

 

_______________________________________________
Omnetpp-l mailing list
Omnetpp-l at xxx
http://lists.omnetpp.org/mailman/listinfo/omnetpp-l

Home | Main Index | Thread Index