#include "trc_gen_elem.h"
#include "comp_attach_pt_t.h"
#include "interfaces/trc_gen_elem_in_i.h"
class OcsdGenElemStack
{
public:
OcsdGenElemStack();
~OcsdGenElemStack();
void initSendIf(componentAttachPt<ITrcGenElemIn> *pGenElemIf);
void initCSID(const uint8_t CSID) { m_CSID = CSID; };
OcsdTraceElement &getCurrElem(); ocsd_err_t resetElemStack(); ocsd_err_t addElem(const ocsd_trc_index_t trc_pkt_idx); void setCurrElemIdx(const ocsd_trc_index_t trc_pkt_idx); ocsd_err_t addElemType(const ocsd_trc_index_t trc_pkt_idx, ocsd_gen_trc_elem_t elem_type);
ocsd_datapath_resp_t sendElements(); const int numElemToSend() const;
private:
typedef struct _elemPtr {
OcsdTraceElement *pElem; ocsd_trc_index_t trc_pkt_idx; } elemPtr_t;
const bool isInit();
ocsd_err_t growArray();
void copyPersistentData(int src, int dst); void resetIndexes();
elemPtr_t *m_pElemArray; int m_elemArraySize;
int m_elem_to_send; int m_curr_elem_idx; int m_send_elem_idx;
uint8_t m_CSID;
componentAttachPt<ITrcGenElemIn> *m_sendIf;
bool m_is_init;
};
inline const int OcsdGenElemStack::numElemToSend() const
{
return m_elem_to_send;
}
inline void OcsdGenElemStack::initSendIf(componentAttachPt<ITrcGenElemIn> *pGenElemIf)
{
m_sendIf = pGenElemIf;
}
inline void OcsdGenElemStack::setCurrElemIdx(const ocsd_trc_index_t trc_pkt_idx)
{
m_pElemArray[m_curr_elem_idx].trc_pkt_idx = trc_pkt_idx;
}
inline OcsdTraceElement &OcsdGenElemStack::getCurrElem()
{
return *(m_pElemArray[m_curr_elem_idx].pElem);
}