# Module `Base`

BASE classes.

# #BASE class

The #BASE class is the super class for most of the classes defined within MOOSE.

It handles:

- The construction and inheritance of child classes.
- The tracing of objects during mission execution within the DCS.log file (under saved games folder).

Note: Normally you would not use the BASE class unless you are extending the MOOSE framework with new classes.

# BASE Trace functionality

The BASE class contains trace methods to trace progress within a mission execution of a certain object. Note that these trace methods are inherited by each MOOSE class interiting BASE. As such, each object created from derived class from BASE can use the tracing functions to trace its execution.

## Trace a function call

There are basically 3 types of tracing methods available within BASE:

- BASE.F: Trace the beginning of a function and its given parameters.
- BASE.T: Trace further logic within a function giving optional variables or parameters.
- BASE.E: Trace an execption within a function giving optional variables or parameters. An exception will always be traced.

## Tracing levels

There are 3 tracing levels within MOOSE.
These tracing levels were defined to avoid bulks of tracing to be generated by lots of objects.

As such, the F and T methods have additional variants to trace level 2 and 3 respectively:

- BASE.F2: Trace the beginning of a function and its given parameters with tracing level 2.
- BASE.F3: Trace the beginning of a function and its given parameters with tracing level 3.
- BASE.T2: Trace further logic within a function giving optional variables or parameters with tracing level 2.
- BASE.T3: Trace further logic within a function giving optional variables or parameters with tracing level 3.

# BASE Inheritance support

The following methods are available to support inheritance:

- BASE.Inherit: Inherits from a class.
- BASE.Inherited: Returns the parent class from the class.

# Future

Further methods may be added to BASE whenever there is a need to make "overall" functions available within MOOSE.

## Global(s)

BASE |
FORMATION |

## Type `BASE`

BASE:AddEvent(Event, EventFunction) | Set a new listener for the class.
BASE.ClassID | The ID number of the class.
BASE.ClassName | The name of the class.
BASE:CreateEventBirth(EventTime, Initiator, IniUnitName, place, subplace) | Creation of a Birth Event.
BASE:CreateEventCrash(EventTime, Initiator) | Creation of a Crash Event.
BASE:DisableEvents() | Disable the event listeners for the class.
BASE:E(Arguments) | Log an exception which will be traced always.
BASE:EnableEvents() | Enable the event listeners for the class.
BASE:Event() | Returns the event dispatcher
BASE.Events |
BASE:F(Arguments) | Trace a function call.
BASE:F2(Arguments) | Trace a function call level 2.
BASE:F3(Arguments) | Trace a function call level 3.
BASE:GetClassID() | Get the ClassID of the class instance.
BASE:GetClassName() | Get the ClassName of the class instance.
BASE:GetClassNameAndID() | Get the ClassName + ClassID of the class instance.
BASE:Inherit(Child, Parent) | This is the worker method to inherit from a parent class.
BASE:Inherited(Child) | This is the worker method to retrieve the Parent class.
BASE:New() |
BASE:T(Arguments) | Trace a function logic.
BASE:T2(Arguments) | Trace a function logic level 2.
BASE:T3(Arguments) | Trace a function logic level 3.
BASE:TraceClass(Class) | Set tracing for a class
BASE:TraceClassMethod(Class, Method) | Set tracing for a specific method of class
BASE:TraceLevel(Level) | Set trace level
BASE:onEvent(event) |

## Type `FORMATION`

FORMATION.Cone | A cone formation.

## Global(s)

#BASE BASE

#FORMATION FORMATION

## Type `Base`

The BASE Class

### Field(s)

BASE:AddEvent(Event, EventFunction)

  Set a new listener for the class.

  ### Parameters

  - `DCSTypes#Event Event` :

  - `#function EventFunction` :

  ### Return value

  #BASE:

BASE.ClassID

  The ID number of the class.

BASE.ClassName

  The name of the class.

BASE:CreateEventBirth(EventTime, Initiator, IniUnitName, place, subplace)

  Creation of a Birth Event.

  ### Parameters

  - `DCSTypes#Time EventTime` : The time stamp of the event.

  - `DCSObject#Object Initiator` : The initiating object of the event.

  - `#string IniUnitName` : The initiating unit name.

  - `place` :

  - `subplace` :

BASE:CreateEventCrash(EventTime, Initiator)

  Creation of a Crash Event.

  ### Parameters

  - `DCSTypes#Time EventTime` : The time stamp of the event.

  - `DCSObject#Object Initiator` : The initiating object of the event.

BASE:DisableEvents()

  Disable the event listeners for the class.

  ### Return value

  #BASE:

BASE:E(Arguments)

  Log an exception which will be traced always.

  Can be anywhere within the function logic.

  ### Parameter

  - `Arguments` : A #table or any field.

BASE:EnableEvents()

  Enable the event listeners for the class.

  ### Return value

  #BASE:

BASE:Event()

  Returns the event dispatcher

  ### Return value

  Event#EVENT:

BASE.Events

BASE:F(Arguments)

  Trace a function call.

  Must be at the beginning of the function logic.

  ### Parameter

  - `Arguments` : A #table or any field.

BASE:F2(Arguments)

  Trace a function call level 2.

  Must be at the beginning of the function logic.

  ### Parameter

  - `Arguments` : A #table or any field.

BASE:F3(Arguments)

  Trace a function call level 3.

  Must be at the beginning of the function logic.

  ### Parameter

  - `Arguments` : A #table or any field.

BASE:GetClassID()

  Get the ClassID of the class instance.

  ### Return value

  #string: The ClassID of the class instance.

BASE:GetClassName()

  Get the ClassName of the class instance.

  ### Return value

  #string: The ClassName of the class instance.

BASE:GetClassNameAndID()

  Get the ClassName + ClassID of the class instance.

  The ClassName + ClassID is formatted as '%s#%09d'.

  ### Return value

  #string: The ClassName + ClassID of the class instance.

BASE:Inherit(Child, Parent)

  This is the worker method to inherit from a parent class.

  ### Parameters

  - `Child` : is the Child class that inherits.

  - `#BASE Parent` : is the Parent class that the Child inherits from.

  ### Return value

  #BASE: Child

BASE:Inherited(Child)

  This is the worker method to retrieve the Parent class.

  ### Parameter

  - `#BASE Child` : is the Child class from which the Parent class needs to be retrieved.

  ### Return value

  #BASE:

BASE:New()

BASE:T(Arguments)

  Trace a function logic.

  Can be anywhere within the function logic.

  ### Parameter

  - `Arguments` : A #table or any field.

BASE:T2(Arguments)

  Trace a function logic level 2.

  Can be anywhere within the function logic.

  ### Parameter

  - `Arguments` : A #table or any field.

BASE:T3(Arguments)

  Trace a function logic level 3.

  Can be anywhere within the function logic.

  ### Parameter

  - `Arguments` : A #table or any field.

BASE:TraceClass(Class)

  Set tracing for a class

  ### Parameter

  - `#string Class` :

BASE:TraceClassMethod(Class, Method)

  Set tracing for a specific method of class

  ### Parameters

  - `#string Class` :

  - `#string Method` :

BASE:TraceLevel(Level)

  Set trace level

  ### Parameter

  - `#number Level` :

BASE:onEvent(event)

  TODO: Complete DCSTypes#Event structure.
  - The main event handling function... This function captures all events generated for the class. @param #BASE self @param DCSTypes#Event event

  ### Parameter

  - `event` :

## Type `FORMATION`

The Formation Class

### Field(s)

FORMATION.Cone

  A cone formation.