Skip to content

Advanced Serialization

Andrew Gresyk edited this page Mar 29, 2022 · 3 revisions

Serialization

  1. FSM instance can be stored to char buffer and restored from it.

  2. Serialization can be used for saving FSM to file or network replication.


Tests


  1. Enable serialization support

     #define FFSM2_ENABLE_SERIALIZATION
    
  1. Store FSM instance:

     void save(SerialBuffer& buffer) const;
    
  2. Restore FSM instance:

     void load(const SerialBuffer& buffer);
    

State Methods (TBD)

SerialBuffer

  1. Data type:

     using Data = uint8_t[N];
    
  2. Clear buffer:

     void clear();
    
  3. Data access:

     Data& data();
     const Data& data() const;