Struct

Top  Previous  Next

Description


The Struct statement is used to define a Struct, which is a user-defined collection of related FreeFlyer objects. The End statement is used to close the definition of the Struct. Unlike Lists, Structs can contain many objects of different types. Structs can be passed as arguments into Procedures, effectively passing several related objects into the Procedure as a single argument. FreeFlyer Structs are also designed to allow users to easily import and export JSON data. For more information, see the Structs script reference guide.

 

 

Syntax


Generic Example

 

Struct StructName;

 

    ObjectType InstanceName1; // repeat as needed

 

End;

 

Specific Example

 

// The Struct type "SpacecraftWithMetaData" represents a Spacecraft object plus some additional metadata

 

Struct SpacecraftWithMetaData;

 

      Spacecraft SC;

 

      Variable ObsAvailable; 

      Variable ObsUsed;

      Variable ResidualsAccepted;

      Variable WeightedRMS; 

 

      String Comments; 

 

End;

 

Example using the extends keyword

 

Struct ManeuveringSpacecraft extends SpacecraftWithMetaData;

 

 TimeSpan ManeuverEpoch;

 

End;

 

 

Details


Structs can contain instances of any type of FreeFlyer object. 

Structs can contain Lists of FreeFlyer objects.

You can define a Struct that will contain other types of Structs.

You can define a Struct that derives off of another type of Struct, using the "extends" keyword.

You can specify annotations (using the @ symbol) for individual objects contained in a Struct to indicate how that object's data should be handled when serializing to JSON format, or deserializing from JSON format. For more information on working with JSON data in FreeFlyer, see the JSON-Formatted Data page.

The Struct definition must be followed by an End statement.

You can use the assignment operator (=) to assign two instances of the same type of Struct, so long as all the object types contained within the Struct are assignable.

You can create a List of instances of a Struct.

You can pass an instance of a Struct as an argument into a Procedure.

You can define Structs in a separate file and include the file in your Mission Plan using the Include command or the "Externals" tab.

 

 

See Also


Structs Script Reference

JSON-Formatted Data

Using Procedures

Include Command