Book a Demo

Author Topic: How do I model an initialized array?  (Read 4091 times)

EricP

  • EA User
  • **
  • Posts: 122
  • Karma: +0/-0
    • View Profile
How do I model an initialized array?
« on: June 04, 2010, 04:22:42 am »
I have an array of structs that looks like this:

struct SomeKindaStruct
{
    char* somePointerToChar;
    int someInt;
} anArrayOfStructs[] =
{
    { &someOtherChar1, 3 },
    { &someOtherChar2, 5 },
    { &someOtherChar3, 7 }
};

How do I model that in EA?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How do I model an initialized array?
« Reply #1 on: June 04, 2010, 08:26:09 am »
I would start by separating the struct declaration and attribute declaration into separate statements.

EricP

  • EA User
  • **
  • Posts: 122
  • Karma: +0/-0
    • View Profile
Re: How do I model an initialized array?
« Reply #2 on: June 05, 2010, 02:25:23 am »
Quote
I would start by separating the struct declaration and attribute declaration into separate statements.

Good afternoon, Simon.

OK, something like...

struct SomeKindaStruct
{
   char* somePointerToChar;
   int someInt;
};

struct SomeKindaStruct anArrayOfStructs[] =
{
   { &someOtherChar1, 3 },
   { &someOtherChar2, 5 },
   { &someOtherChar3, 7 }
};

How do I model that?

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: How do I model an initialized array?
« Reply #3 on: June 07, 2010, 06:54:32 pm »
Class 'SomeKindaStruct', Array container class. Instance of Array container, 3 instances of 'SomeKindaStruct' with the concrete attribute values filled in ...

HTH
g.