# SFBReactor.h File Reference

Register packet handlers and dispatch packets. More...

`#include "SFBTypes.h"`
`#include "SFBAssert.h"`

Include dependency graph for SFBReactor.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
struct | GRL
| A GRL is a "General Reflex Locator". More...
struct | SFBGRLMasterTable
| The description of all the known arrays-of-PacketHandler's 'reflex tables'. More...
struct | SFBDispatchEntry
| An SFBDispatchEntry describes an SFB reflex. More...
class | SFBReactor
| The SFBReactor manages the SFB reflex triggering system: It determines how an SFB will react to any given packet type. More...
class | SFBBrainReflex
| A 'convenience class' (with a prebuilt instance Brain) which provides a means of declaring reflexes that trigger at the "brain" -- i.e., after the individual faces and the Spine. More...
class | SFBSpineReflex
| A 'convenience class' (with a prebuilt instance Spine) which provides a means of declaring reflexes that trigger at the "spine" -- i.e., after the individual faces, but before the Brain. More...
## Defines
#define | MAX_GRL_TABLES 7
| The maximum number of tables of GRLs that can be defined.
#define | MAX_REACTORS 200
#define | MAX_CASUAL_REFLEXES 10
| The maximum number of packet handlers that can be used in reflexes 'casually' -- i.e., without making a packet handler array and calling SFBReactor::reflexes() (which see).
#define | TRIGGER_SET_TYPE s16
#define | MAX_NESTED_TRIGGERS (sizeof(TRIGGER_SET_TYPE)*8)
## Typedefs
typedef void(* | PacketHandler )(u8 *packet)
| A pointer to a function that handles packets.
typedef void(* | DispatchHandler )(u8 *packet, u8 face)
## Functions
bool | isNone (GRL g)
GRL | makeGRL (u8 table, u8 entry)
void | initGRL (GRL &g, u8 table=0, u8 entry=0)
void | reflex (const char type, PacketHandler ph, int flags=SFBReactor::TRIGGER_SPINE)
| Equivalent to Body.reflex(type,ph,flags).
## Variables
SFBReactor | Body
| The 'central locus' for reacting to packets.
SFBBrainReflex | Brain
| An instance of SFBBrainReflex (which see) for creating 'brain level' reflexes.
SFBSpineReflex | Spine
| An instance of SFBSpineReflex (which see) for creating 'spinal' reflexes.

## Detailed Description

Register packet handlers and dispatch packets.

Author:
  David H. Ackley.

Date:
  (C) 2009 All rights reserved.

Code License:
  The GNU Lesser General Public License

License Note:
  All code samples shown in documentation are placed into the public domain.

## Define Documentation

#define MAX_GRL_TABLES 7

The maximum number of tables of GRLs that can be defined.

Calls to SFBReactor::reflexes draw against this limit. This value consumes BODYRAM at the rate of 5*MAX_GRL_TABLES.

## Typedef Documentation

typedef void(* PacketHandler)(u8 *packet)

A pointer to a function that handles packets.

This is the signature of user-defined 'reflexes'