#ifndef KOURIERMSG_H
#define KOURIERMSG_H

#ifndef ECOS_SYS

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

using namespace std;

class KourierObject : public cKlog
{
public:
    KourierObject(KTag *meta);
    ~KourierObject();
    uint8_t getID() { return mObjectID; }
    uint8_t getTagCount() { return mTags.size(); }
    vector<KTag *> * getTags() { return new vector<KTag *>(mTags); }
    void addTag(KTag *tag) { mTags.push_back(tag); }
protected:
    uint8_t mObjectID;
    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(); }
    vector<KTag *> * getTags() { return new vector<KTag *>(mTags); }
    vector<KourierObject *> * getObjects() { return new vector<KourierObject *>(mObjects); }
    static KourierMessage * parseKMsg(const KourierDictDef *dict, KMsg *kmsg);
    static KourierErrors * getLastErrors() { return KourierMessage::mLastErrors; }
    static void clearKTagVect(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;
    vector<KTag *> mTags;
    vector<KourierObject *> mObjects;
    static KourierErrors *mLastErrors;
};

#endif
#endif
