I want to implement an aggregation transport layer in mixim.
I am a bit confused by the omnet manual. At page 108, there is a
paragraph on "Encapsulating several messages", which is exactly what I
want to do. It suggests to define a message type with a "mesages"
std::list field to store message pointers.
So did I. Unfortunately, Omnet++ doesn't like it:
messages/AggrPkt.msg: Error: pointers not supported yet in 'AggrPkt'
which was to be expected after reading p.117 "Pointers: not supported
yet".
I am now declaring my abstract array as storing long values (using
reinterpret_cast to convert between long and *cMessage). I have one
weird compilation error: the call to setBitLength(int) is not
recognized:
error: ‘class AggrPkt’ has no member named ‘setBitLength’.
However, my class AggrPkt subclasses AggrPkt_Base, which subclasses
cMessage. The class is registered using Register_Class(AggrPkt).
Two questions:
1) why can't I call setBitLength (or any of the related methods) ?
2) is there a better approach to the problem than converting the pointer
addresses into long ?
Regards,
Jérôme
message AggrPkt {
@customize(true);
abstract long storedPackets[];
};
cplusplus {{It worked for me without problems. I hope you get your model working :)
typedef cMessage* pMsg;
}}
class noncobject pMsg;
message ServiceBrokerOfferList {
//Number of offers the OfferList has
int numOffers;
//Pointer to the original request
pMsg request;
//Array with all the offers
pMsg listOffers[];
}
--
You received this message because you are subscribed to the Google Groups "omnetpp" group.
To post to this group, send email to omn...@googlegroups.com.
To unsubscribe from this group, send email to omnetpp+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/omnetpp?hl=en.
thanks for your message ! I checked cmessage.h for setBitLength() but
didn't realize I was in the wrong class.
Now it's much better, but I have a problem with message ownership and
the copy constructor.
If I take ownership of the stored messages in my aggregation packet
(with take()), then when a copy of this aggregation packet is used to
retrieve the stored messages, the call to drop() fails.
So I put these calls in my Aggregation module (drop() before storing
each message and take() after retrieving them), but this leads to
segfaults at the upper layer when deleting the message. It seems that
the seg fault only happens after a few messages. I tried to take()
ownership in this upper module before deleting, but it didn't improve
things.
If I don't delete the messages, the simulation does work. But this isn't
a realistic approach.
Any idea on this ?
Regards,
Jérôme
> For more options, visit this group at
> http://groups.google.com/group/omnetpp?hl=en.
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "omnetpp" group.
> To post to this group, send email to omn...@googlegroups.com.
> To unsubscribe from this group, send email to omnetpp
Thanks,
Jérôme
To unsubscribe from this group, send email to omnetpp+u...@googlegroups.com.