hello all ,
i have my idl defined as follows :
#ifndef schedule_Mgmt_idl
#define schedule_Mgmt_idl
module schedule_Mgmt
{
//*************************** Structures *******************************
struct planData {
string planName;
string planDescription;
string scriptExec;
string startDate;
string startTime;
string stopDate;
string stopTime;
string delayInt;
boolean repeatDelay;
boolean notOnWeekend;
boolean validity;
string tempTime;
string tempDate;
};
typedef sequence <planData> planList;
//****************************** Exceptions *****************************
exception alreadyExists {string reason;};
exception unknownErr {string reason;};
exception doNotExist {string reason;};
exception communicationFailure {string reason;};
exception processingFailure {string reason;};
//****************************** Interfaces *****************************
interface config
{
planList getPlandata() raises (doNotExist,unknownErr);
boolean createPlan(in planData newPlanData)
raises (alreadyExists, unknownErr);
boolean modifyPlan(in string schedPlanName,
in planData modifyPlanData)
raises (unknownErr);
boolean removePlan(in string schedPlanName)
raises (unknownErr);
boolean activatePlan(in string schedPlanName)
raises (unknownErr);
boolean deactivatePlan(in string schedPlanName)
raises (unknownErr);
};
interface Listener
{
void message(in string msg);
};
interface MessageServer
{
void register(in Listener lt);
void unregister(in string lt);
};
};
#endif
and my getPlanData.cpp file as follows :
#include <getPlanData.h>
#include <writeLog.h>
schedule_Mgmt::planList getPlanData()
{
try
{
LogItf::setProcessName("Schedule_Mgmt");
schedule_Mgmt::planList singleIMEIarr1;
// Initialise Session using Session Pool
Session::initSessionPool("BOSS", "E_SESSION_EIR", 2, false, true);
// Acquire session while initializing the Session.
Session * schedSession1 ;
schedSession1 = new Session();
DbSchedule * objschedule ;
objschedule = new DbSchedule(schedSession1, "Schedule_mgmt");
objschedule->StartTransaction(10);
objschedule->GetTableDescription();
struct singleIMEI
{
string planName;
string planDescription;
string scriptExec;
string startDate;
string startTime;
string stopDate;
string stopTime;
string delayInterval;
bool repeatDelay;
bool notOnWeekend;
bool activate;
string tempTime;
string tempDate;
} singleIMEIarr[1000]; //VECTOR IMPLEMENTATION PENDING
int j = 1;
objschedule->StartFetch();
do
{
for (int i=1; (i <= objschedule->GetMaxColumns()); i++)
{
//cout << endl <<"venkat" << endl;
//cout << objschedule->GetColumnName(i) << " = " << objschedule->GetColumnValue(i) << ", " ;
if (i == 1)
{
singleIMEIarr[j].planName=objschedule->GetColumnValue(i);
}
else if (i == 2)
{
singleIMEIarr[j].planDescription=objschedule->GetColumnValue(i);
}
else if (i == 3)
{
singleIMEIarr[j].scriptExec=objschedule->GetColumnValue(i);
}
else if (i == 4)
{
singleIMEIarr[j].startDate=objschedule->GetColumnValue(i);
}
else if (i == 5)
{
singleIMEIarr[j].startTime=objschedule->GetColumnValue(i);
}
else if (i == 6)
{
singleIMEIarr[j].stopDate=objschedule->GetColumnValue(i);
}
else if (i == 7)
{
singleIMEIarr[j].stopTime=objschedule->GetColumnValue(i);
}
else if (i == 8)
{
singleIMEIarr[j].delayInterval=objschedule->GetColumnValue(i);
}
else if (i == 9)
{
bool output_repeat;
string repeat_val = objschedule->GetColumnValue(i);
if (strcmp (repeat_val.c_str(),"1") == 0)
{
output_repeat = true;
}
else
{
output_repeat = false;
}
singleIMEIarr[j].repeatDelay= output_repeat;
}
else if (i == 10)
{
bool output_notOnWeekend;
string notOnWeekend_val = objschedule->GetColumnValue(i);
if (strcmp (notOnWeekend_val.c_str(),"1") == 0)
{
output_notOnWeekend = true;
}
else
{
output_notOnWeekend = false;
}
singleIMEIarr[j].notOnWeekend= output_notOnWeekend;
}
else if (i == 11)
{
bool output_activate;
string activate_val = objschedule->GetColumnValue(i);
if (strcmp (activate_val.c_str(),"1") == 0)
{
output_activate = true;
}
else
{
output_activate = false;
}
singleIMEIarr[j].activate= output_activate;
}
else if (i == 12)
{
singleIMEIarr[j].tempTime=objschedule->GetColumnValue(i);
}
else if (i == 13)
{
singleIMEIarr[j].tempDate=objschedule->GetColumnValue(i);
}
}
cout << singleIMEIarr[j].planName << "," << singleIMEIarr[j].planDescription << "," << singleIMEIarr[j].scriptExec << "," << singleIMEIarr[j].startDate << "," << singleIMEIarr[j].startTime << "," << singleIMEIarr[j].stopDate << "," << singleIMEIarr[j].stopTime << "," << singleIMEIarr[j].delayInterval << "," << singleIMEIarr[j].repeatDelay << "," << singleIMEIarr[j].notOnWeekend << "," << singleIMEIarr[j].activate << "," << singleIMEIarr[j].tempTime << "," << singleIMEIarr[j].tempDate;
j = j + 1;
cout << endl ;
} while (objschedule->FetchNextTuple() == true) ;
cout << "PLANNAME,PLANDESCRIPTION,SCRIPTEXEC,STARTDATE,STARTIME,STOPDATE,STOPTIME,REPEATDELAY,NOTONWEEKEND,ACTIVATE" << "\n";
for (int k=1; k <= 5; k++)
{
cout << singleIMEIarr[k].planName << "," << singleIMEIarr[k].planDescription << "," << singleIMEIarr[k].scriptExec << "," << singleIMEIarr[k].startDate << "," << singleIMEIarr[k].startTime << "," << singleIMEIarr[k].stopDate << "," << singleIMEIarr[k].stopTime << "," << singleIMEIarr[k].delayInterval << singleIMEIarr[k].repeatDelay << "," << singleIMEIarr[k].notOnWeekend << "," << singleIMEIarr[k].activate << "," << singleIMEIarr[k].tempTime << "," << singleIMEIarr[k].tempDate << "\n";
}
// delete schedSession1 ;
// Deletes Session using Session Pool
SessionPool::deletePool();
return singleIMEIarr[1000];
char info[50] = "PLAN DISPLAYED";
writeLog(NULL,info);
}
catch(...)
{
char error[50] = "PLAN CANNOT BE DISPLAYED";
writeLog(NULL,error);
cout<<"Unknown Error";
throw;
}
}
i get the following error :
Error 339: "getPlanData.cpp", line 180 # Return type 'struct singleIMEI' does
not match expected return type 'class planList'
return singleIMEIarr[1000];
^^^^^^^^^^^^^^^^^^^
i need to return the singleIMEIarr with the return type "planList",
i have tried type casting , but nothing seems to work ,
any suggestions would be of great help
thank you