#ifndef KOURIERMSG_H
#define KOURIERMSG_H

#ifndef ECOS_SYS

#include <vector>
#include <klog.h>
#include "kourier.h"

class KourierObject : public cKlog
{
public:
    KourierObject(KTag *meta);
    ~KourierObject();
    uint8_t getID() { return mObjectID; }
    uint8_t getTagCount() { return mTags.size(); }
    std::vector<KTag *> * getTags() { return new std::vector<KTag *>(mTags); }
    void addTag(KTag *tag) { mTags.push_back(tag); }
protected:
    uint8_t mObjectID;
    std::vector<KTag *> mTags;
    KTag * mIDTag;
};

class KourierMessage : public cKlog
{
public:
    ~KourierMessage();
    uint8_t getID() { return mMessageID; }
    uint8_t getTagCount() { return mTags.size(); }
    uint8_t getObjectCount() { return mObjects.size(); }
    std::vector<KTag *> * getTags() { return new std::vector<KTag *>(mTags); }
    std::vector<KourierObject *> * getObjects() { return new std::vector<KourierObject *>(mObjects); }
    static KourierMessage * parseKMsg(const KourierDictDef *dict, KMsg *kmsg);
    static KourierErrors * getLastErrors() { return KourierMessage::mLastErrors; }
    static void clearKTagVect(std::vector<KTag *> *vect);
protected:
    void addTag(KTag *tag) { mTags.push_back(tag); }
    void addObject(KourierObject *object) { mObjects.push_back(object); }
    KourierMessage(uint8_t iMessageID);
    uint8_t mMessageID;
    std::vector<KTag *> mTags;
    std::vector<KourierObject *> mObjects;
    static KourierErrors *mLastErrors;
};

#endif
#endif
