WsfGroup

WsfGroup inherits WsfObject

WsfGroup is an aggregation of platform and platform part (sensor, processor, comm) objects.

Accessor Methods

Accessor methods allow access to group members .. method:: Array<string> MembersByName()

Returns a list of member names

Array<WsfObject> Members()

Returns a list containing all members of the group. Each returned WsfObject can be either a WsfPlatform or a WsfPlatformPart.

int Size()

Returns the number of members in the group.

WsfObject Member(int aIndex)

Returns a member of the group by index. The specified index should be in the range [0, Size). You can use the bracket operator “[ ]” instead of Member (e.g., myGroup[0] instead of myGroup.Member(0))

Group Methods

Group methods allow changes to the structure of the group

void AddMember(WsfPlatform aPlatform)
void AddMember(WsfPlatformPart aPlatformPart)

Adds the given platform or platform part to the group

void RemoveMember(WsfPlatform aPlatform)
void RemoveMember(WsfPlatformPart aPlatformPart)

Adds the given platform or platform part to the group

static WsfGroup CreateGroup(string aGroupName, string aGroupType)

Creates a group with the given name using a base group type or an already defined group as a template.

static WsfGroup Group(string aGroupName)

Returns a WsfGroup object matching the given name

static Array<string> Groups()

Returns a list of the names of all groups in the simulation.

Auxiliary Data Methods

Auxiliary Data is a collection of optional named user data attributes that can be stored with the object. The framework will maintain the attributes but in no other way attempts to use the data contained within. The definition and use of any attribute is defined purely by the user.

bool AuxDataBool(string aName)
int AuxDataInt(string aName)
double AuxDataDouble(string aName)
string AuxDataString(string aName)
Object AuxDataObject(string aName)

Retrieve the value of the auxiliary data attribute with the indicated name. If the attribute does not exist then a default value will be returned (false for bool, 0 for int and 0.0 for double).

bool AuxDataExists(string aName)
bool CheckAuxData(string aName)

Returns true if an auxiliary data member exists with the specified name.

bool HasAuxData()

Returns true if the object has auxiliary data.

bool DeleteAuxData(string aName)

Delete the auxiliary data attribute with the indicated name. Returns true if the attribute exists and was deleted, or false if the attribute did not exist.

void SetAuxData(string aName, bool aValue)
void SetAuxData(string aName, int aValue)
void SetAuxData(string aName, double aValue)
void SetAuxData(string aName, string aValue)
void SetAuxData(string aName, Object aValue)

Set the value of the auxiliary data attribute with the indicated name. The last form of SetAuxData() can store any script object type.

Map<string, string> GetAllAuxDataTypes()

Return the names and types of all auxiliary data attributes in the form of a Map<string,string>. Map keys are valid names of auxiliary data attributes. Map values are type names corresponding to valid auxiliary data attribute names.

example

group group_template WSF_GROUP
   *group properties go here*
end_group

PLATFORM.GroupJoin("dynamic_group", "group_template");
Array<string> groups = WsfGroup.Groups();
foreach(string groupName in groups)
{
   WsfGroup group = WsfGroup.Group(groupName);
   if( group.IsValid() )
   {
      writeln( "Group: " + groupName );
      foreach( string memberName in group.Members() )
      {
         writeln( "     " + memberName );
      }
   }
}