Jump to content

Overloading operator<< for printing transaction

Recommended Posts



I would like to be able to overload operator<< to be able to print transaction information (assuming tlm_generic_payload for transaction type).


I think on two alternatives:


1) ostream& operator<<(ostream& os, tlm_generic_payload& trans): the problem is that operator<< should be declared a friend function inside the definition of class tlm_generic_payload, and that is not the case.


2) Define a new class derived from tlm_generic_payload with the friend declaration. The problem is that I sould change the transaction type all over the design, and that attempts against interoperability because tlm_generic_payload is not the type in use.


What do you think is the right way of doing this?


Thank you in advance.



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...