Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » How can I add a struct type to a member variable?
How can I add a struct type to a member variable? [message #1835503] Sat, 05 December 2020 01:56 Go to next message
Manuel Malagon is currently offline Manuel MalagonFriend
Messages: 81
Registered: December 2011
Member
I'm creating a design with socket programming. One of the variables I'm bringing from C shall be struct in_addr ip_address; but I can't find a straightforward way of adding the type struct in_addr to my variable.

If I add it as a Type in the properties like so
index.php/fa/39471/0/

I get ::iotHub::network::Client::struct in_addr m_ip_address; that is definitely not what it should be.

How can I get just struct in_addr m_ip_address;?
  • Attachment: struct.jpeg
    (Size: 49.16KB, Downloaded 370 times)
Re: How can I add a struct type to a member variable? [message #1835681 is a reply to message #1835503] Thu, 10 December 2020 10:06 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 461
Registered: March 2011
Location: Paris Saclay, France
Senior Member
The struct in_addr has been created as a nested classifier in the class Client. It seems that you created the type via the "+" dialog inside the class instead of referencing an existing via "...".
A good approach is to create a package "socket" (or similar, eventually in a different model that you import for reuse). Then create the type "in_addr" inside the package and declare it as External (Stereotype from C/C++ profile), since you want to use an existing C type instead of declaring a new one. Setup the stereotype attribute "include" and "name" (optionally, if you need the prefix "struct") accordingly.
Re: How can I add a struct type to a member variable? [message #1835719 is a reply to message #1835681] Thu, 10 December 2020 22:33 Go to previous message
Manuel Malagon is currently offline Manuel MalagonFriend
Messages: 81
Registered: December 2011
Member
Ansgar Radermacher wrote on Thu, 10 December 2020 05:06
A good approach is to create a package "socket" (or similar, eventually in a different model that you import for reuse).

This is what I ended up doing, seemed the easiest approach and I'll be adding more types to it so it is good to have it as a separate package.

Thanks!
Previous Topic:Is it possible to model a map?
Next Topic:Include and namespace appearing out of nothing
Goto Forum:
  


Current Time: Thu Apr 18 23:15:55 GMT 2024

Powered by FUDForum. Page generated in 0.02618 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top