The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Q: function overloading in OriginC
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

hajo_old

Germany
141 Posts

Posted - 03/10/2003 :  04:01:45 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello, all

I've a problem creating an interface to a specific function shown in the next section.

What I wanted to do is, to define a function like

void XXwriteGlobalHeader1( _STRUCT_MINDRUCK_DATA* structData, Page actualProjPg )

as the functions all should do the same but with other calling types
like

void XXwriteGlobalHeader1( _STRUCT_KM_DATA* structData, Page actualProjPg )

I thought of defining them using overloding shown as above.
But the compiler shows an error, saying, the functions are defined twice. It works for a different number of parameters or different function name, but not for different types within the function call.

Is there a restriction of the overloading features prommised by the documentation ?
I'd like to create a suitable OO- Calling interface for those functions as the really do the same things (=same name) by needing different calling types (=same number of variables, different types) as known from C++ (or is that the error I made - to much thinking in C++ space?)

Thanks
Hajo

--------------------------



void XXwriteGlobalHeader1( _STRUCT_MINDRUCK_DATA* structData, Page actualProjPg )
{
// Schreiben der INFO Struktur
actualProjPg.Info.HEADER.VA.TESTBENCH$ = structData->testbench;
actualProjPg.Info.HEADER.VA.METERINGUNIT$ = structData->meteringunit;
actualProjPg.Info.HEADER.VA.DATUM$ = structData->date;
actualProjPg.Info.HEADER.VA.INJNR$ = "DIVERSE";
actualProjPg.Info.HEADER.VA.KUNDE$ = structData->kunde;
actualProjPg.Info.HEADER.VA.TYP$ = structData->Typ;

actualProjPg.Info.HEADER.WORKINGPOINT.FUP_MEAN = structData->fup_mean;
actualProjPg.Info.HEADER.WORKINGPOINT.Energie_MEAN = structData->energie_mean;
actualProjPg.Info.HEADER.WORKINGPOINT.QMain_MEAN = structData->qmain_mean;
actualProjPg.Info.HEADER.WORKINGPOINT.TiMain_MEAN = structData->timain_mean;
}

/**************************************************************************
* XXwriteGlobalHeader1( _STRUCT_KM_DATA* structData, Page actualProjPg )
* Schreiben der globalen Headerdaten fuer die Messung:
* "minimaler Betriebsdruck"
**************************************************************************/
/**************************************************************************
* XXwriteGlobalHeader1( _STRUCT_EV_DATA* structEVData, Page actualProjPg, int structPos = 1)
* Schreiben der globalen Headerdaten fuer die Einspritzverlaufsmessung
**************************************************************************/
void XXwriteGlobalHeaderKM( _STRUCT_KM_DATA* structKMData, Page actualProjPg, int structPos = 1)
{
// Header Informationen initialisieren ...
actualProjPg.Info.Add("HEADER");
using Info_Header = actualProjPg.Info.HEADER;

Info_Header.AddSection("GLOBAL"); // globale Angaben
using IH_Global = Info_Header.GLOBAL;
IH_Global.GHVer$ = SVDO_GLOBAL_HEADER_TYPE_1;
IH_Global.WKSName$ = actualProjPg.GetName();

Info_Header.AddSection("VA"); // Versuchs-Auftrag
using IH_VA = Info_Header.VA;
IH_VA.TestBench$ = structKMData->testbench;
IH_VA.MeteringUnit$ = structKMData->meteringunit;
IH_VA.Datum$ = structKMData->date;
IH_VA.InjNr$ = structKMData->strInj;
IH_VA.Kunde$ = structKMData->kunde;
IH_VA.Typ$ = structKMData->typ;

// SubSection "WorkingPoint"
Info_Header.AddSection("WORKINGPOINT");
using IH_WorkingPoint = Info_Header.WorkingPoint;
IH_WorkingPoint.BPName$ = structKMData->strMP[structPos];
IH_WorkingPoint.TiMain = structKMData->vTimain[structPos];
IH_WorkingPoint.Energie = structKMData->vEnergie[structPos];
}



-- --
Dipl.-Ing. Hans-Joerg Koch
Siemens VDO, Regensburg

SVDO_Origin1
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000