Struct nnPacket: Serialization of the Nets

From nnBackProp.h (this file will be broken up into more includes):

typedef struct {  /* all the numbers are in host format */

	INT opcode;
	INT len; /* how long the array of REALs */
	REAL *array;

}nnPACKET;

All Nets in the nn-os are serialized via the struct nnPacket i.e. any graph like or matrix like structures for the Neural Networks or Petri Nets are serialized into a long array of floats for two purposes:

  1. Persistence: Storage and retrieval
  2. Network IO: TCP sockets send() and recv() a large packet which is a memcpy() of the nnPacket serialized into an (unsigned chat *) buffer

 

Note that the files nnProto.c and nnNetworkIO.c have all the support for portable number formats. There is no worries about the big-endian vs. little-endian of the integers or the floating point formats.

 

This entry was posted in C/C++, Documentation, Software. Bookmark the permalink.

Leave a Reply