Sidereon.CCSDS.TDM.WritePolicy (Sidereon v3.0.0)

Copy Markdown View Source

The departures from CCSDS 503.0-B-2 the TDM writer may emit.

Each axis is :strict, which refuses a value the writer cannot write conformingly, or :forgive, which writes it and reports the departure as a Sidereon.CCSDS.TDM.Departure. The axes mirror those of Sidereon.CCSDS.TDM.Policy, so a message read leniently can be written back by asking for the same departures, and add one:

  • :repeated_keywords - a keyword written twice in one block with the same value, which 4.2.5 a) gives one value assignment.

The default emits none, which is what Sidereon.CCSDS.TDM.encode_kvn/1 applies. Nothing outside the mirror is emittable under any policy: a field keyed COMMENT, a key holding = or whitespace, a comment holding a line break, a value that does not parse as its keyword's type, or a comment position or order the writer cannot emit unchanged each produce a file that reads back as something else.

The refusals for options that do not read are those Sidereon.CCSDS.TDM.Policy lists.

Summary

Functions

The policy that emits every departure the mirror allows.

Builds a policy from a keyword list or map of axes, or checks a policy struct. Returns {:ok, policy} or one of the refusals Sidereon.CCSDS.TDM.Policy lists.

The policy that emits no departure.

Types

choice()

@type choice() :: :strict | :forgive

t()

@type t() :: %Sidereon.CCSDS.TDM.WritePolicy{
  duplicate_records: choice(),
  empty_data_sections: choice(),
  final_terminator: choice(),
  keyword_order: choice(),
  long_lines: choice(),
  missing_keywords: choice(),
  non_printable: choice(),
  record_order: choice(),
  repeated_keywords: choice()
}

Functions

lenient()

@spec lenient() :: t()

The policy that emits every departure the mirror allows.

new(opts \\ [])

@spec new(t() | keyword() | map()) :: {:ok, t()} | {:error, term()}

Builds a policy from a keyword list or map of axes, or checks a policy struct. Returns {:ok, policy} or one of the refusals Sidereon.CCSDS.TDM.Policy lists.

strict()

@spec strict() :: t()

The policy that emits no departure.