/*
    <OUTPUTFILENAME>
    Created <DATE> from:
        Messages = <INPUTFILENAME>
        Template = <TEMPLATEFILENAME>
        Language = <LANGUAGEFILENAME>

                     AUTOGENERATED FILE, DO NOT EDIT

*/
<ONCE>import 'dart:typed_data';
<ONCE>import 'package:messages/headers/NetworkHeader.dart';

<ENUMERATIONS>

class <MSGNAME>Message
{
    static const int MSG_ID = <MSGID>;
    static const int MSG_SIZE = <MSGSIZE>;
    ByteBuffer _buffer;
    ByteData _data;
    NetworkHeader _hdr;
    <MSGNAME>Message({int size=MSG_SIZE})
    {
        _buffer = new Uint8List(NetworkHeader.SIZE + size).buffer;
        _hdr = new NetworkHeader.fromBuffer(_buffer);
        _hdr.SetDataLength(size);
        _hdr.SetMessageID(MSG_ID);
        _data = new ByteData.view(_buffer, NetworkHeader.SIZE);
        Init();
    }
    <MSGNAME>Message.fromBuffer(ByteBuffer buffer)
    {
        _buffer = buffer;
        _hdr = new NetworkHeader.fromBuffer(buffer);
        _data = new ByteData.view(buffer, NetworkHeader.SIZE);
    }
    void Init()
    {
        <INIT_CODE>
    }
    <FIELDINFOS>
    <ACCESSORS>
/*
#ifdef ENABLE_REFLECTION
    static MsgInfo* ReflectionInfo()
    {
        static bool firstTime = true;
        static MsgInfo msgInfo(MSG_ID, "<MSGNAME>", "<MSGDESCRIPTION>", MSG_SIZE);
        if(firstTime)
        {
            firstTime = false;
            msgInfo.AddField(new <REFLECTION>);
        }
        return &msgInfo;
    }
#endif
*/
}

/*
#ifdef ENABLE_REFLECTION
class <MSGNAME>MessageReflection
{
public:
    <MSGNAME>MessageReflection()
    {
        Reflection::AddMsg(<MSGNAME>Message::ReflectionInfo());
    }
};
static <MSGNAME>MessageReflection reflection_<MSGNAME>Message;
#endif
*/
