I have the following function. in this function i am not able to push back in vector.
I will explain how it works. if same f_pin will comes in the second iteration compared to first iteration of EventNum loop it will get into if Loop and have to push into opNo vector, if different fpin will come in second iteration it has to enter else loop and push in other vector..
I did all conditions but i am not getting how to push in separate vectors.. I am trying from past 2 days, struckked here. Any one plz help. the code is as follows.
the print statement is giving correct values..
void InitFbNode()
{
SUCCNODE *succ;
succ=(struct SUCCNODE *)malloc(sizeof(SUCCNODE));
for(int FBNum=0;FBNum<fbnodeLst.size();FBNum++)
{
if(fbnodeLst[FBNum].fbInfo->fb_str->output_event_cnt>0)
{
for(int EventNum=0;EventNum<fbnodeLst[FBNum].fbInfo->fb_str->output_event_cnt;EventNum++)
{
int FirstNo=fbnodeLst[FBNum].fbInfo->eventLink[0].f_pin;
succ->pinNo=fbnodeLst[FBNum].fbInfo->eventLink[EventNum].f_pin;
//same f_pin comes in the 2nd loop push into the same vector, i.e same in first fpin vector
if(succ->pinNo==FirstNo)
{
printf("pinNo %d:%d\n",EventNum, succ->pinNo);
printf("NO:%d\n", fbnodeLst[FBNum].fbInfo->eventLink[EventNum].no);
////here have to push in vector
//succ->opNo.push_back(fbnodeLst[FBNum].fbInfo->eventLink[EventNum].no);
}
else
// different f_pin will come in 2nd loop push into another vector
{
//here have to push in vector
//succ[succ->pinNo].opNo.push_back(fbnodeLst[FBNum].fbInfo->eventLink[EventNum].no);
printf("%d:%d\n",EventNum, succ->pinNo);
}
fbnodeLst[FBNum].succNodeNo.push_back(*succ);
}
}
}
Structure declaration isa as follows.
struct SUCCNODE{
int pinNo;
vector<unsigned long>opNo;
};
struct LINK{
unsigned short no;
unsigned short pin;
unsigned short f_pin;
};
struct FB_STR{
unsigned long fbCode;
unsigned long wait_event;
unsigned char wait_type;
unsigned char pinCnt;
unsigned short output_event_cnt;
unsigned short breakpoint;
unsigned short property_cnt;
};
struct FB_INFO{
FB_STR *fb_str;
unsigned int *dataLink;
LINK *eventLink;
unsigned long *property;
};
typedef struct{
int Offset;
int Bytes;
int page_no;
} FBD_FILE_POS;
/* FBノード */
struct FB_NODE
{
unsigned long nodeNo;
vector<unsigned long> predNode;
vector<SUCCNODE> succNodeNo;
unsigned long analyzFinFlag;
unsigned long fbNo;
unsigned long blockStartFlag;
unsigned long sourceNode;
unsigned long feedbackFlag;
FB_INFO *fbInfo;
};
void InitFbNode();
vector<FB_NODE> fbnodeLst;
void DispFBTable();