Pseudo code pour rts.h et rts.C

  • NOMENMAJUSCULE :
    • partie a remplacer via generation de code, sauf pour: ACM, RT, TCNAME, MAX_RT_PARAM, NON_PARAMETRIZED
  • __foreach xxxxx___
    • traitement a faire en boucle via generation de code

Fichier rts.h

#ifndef __rts_h
#define __rts_h

#include "Exec/utils.h"
#include "Exec/rt.h"
#include "Exec/param.h"
#include "Exec/singleReaderACM.h"

__foreach RobotTask in ProcedureRobot
  __foreach TemporalContraint in RobotTask write :
#include "mt_TEMPORALCONTRAINTNAME.h"
  __

class orc_RT_ROBOTTASKNAME: public RobotTask
{
protected:
    char cfgFile[MAXFILENAME];
    //Robot task Output parameters ??
    //Robot task Input parameters ??
    __foreach event of type T1 in RobotTask  write : 
    int T1EVENTNAME;
    __
    // Module Tasks
    __foreach ModuleTask in RobotTask write :
    orc_Mt_TEMPORALCONSTRAINNAME mt_TEMPORALCONSTRAINTNAME;
    __
    // Links between Mt
    __foreach LINK of type synchronized write : 
    SingleReaderACM<vartype> * sharedMemoryOnLink_LINKINDEX;
    __

public:
    //Type 1 Exceptions
    __foreach event of type T1 in RobotTask write :
    int aut_output_T1EVENTNAME;
    int T1EVENTNAME;
    __
    orc_RT_RTNAME(char* name, ProcedureRobot *proc, PhR *phR, char *phrName);
    ~orc_RT_ROBOTTASKTNAME();
    int SetParam();
    int TestTimeout();
    __foreach link of type synchronized write :
    int ReadLink_LINKINDEX(vartype *port);
    void WriteLink_LINKINDEX(vartype *port);
    __
    __foreach event of type T1 in RobotTask write :
    void PutT1EVENTNAME(int);
    int Get_T1EVENTNAMEState();
    void Put_T1EVENTNAMEState(int);
    __
};
__// foreach RobotTask defined in RobotProcedure
#endif

Fichier rts.C

#include "rts.h"

__foreach RobotTask in RobotProcedure write :
orc_RT_ROBOTTASKNAME::orc_RT_ROBOTTASKNAME(char *name, ProcedureRobot *prr, PhR *phr,char *cfgfile) : RobotTask(name,prr,phr,10000),
__foreach TemporalConstraint in RobotTask write :
        mt_TEMPORALCONSTRAINTNAME(this, (char *)"TEMPORALCONSTRAINTNAME", TEMPORALCONSTRAINTCPUVALUE, TEMPORALCONSTRAINTPERIOD, TEMPORALCONTRAINTLINKSOURCE, TEMPORALCONSTRAINTPRIORITY, 1, TEMPORALCONSTRAINT??),
__
{
    Param = new Parameters(MAX_RT_PARAM);
    strcpy(cfgFile,cfgfile);
    Parametrized = NON_PARAMETRIZED;
    __foreach TemporalConstraint in RobotTask write :
    insert((ModuleTask *) &mt_TEMPORALCONSTRAINTNAME);
    __
   // Links construction
   __foreach linl of type synchronized write :
   sharedMemoryOnLink_LINKINDEX = new SingleReaderACM<vartype>(varsize);
   __

    printf("pRT depuis rts %p \n", this);
}

orc_RT_ROBOTTASKNAME::~orc_RT_ROBOTTASKNAME()
{
    delete Param;

    __foreach link of type synchronized write :
    delete sharedMemoryOnLink_LINKINDEX;
    __
}

int orc_RT_ROBOTASKNAME::SetParam()
{
    // Set RT Parameters by file
    return(OK);
}

int orc_RT_ROBOTTASKNAME::TestTimeout()
{
    return OK;
}

__foreach link of type synchronized write :
int orc_RT_ROBOTASKNAME::ReadLink_LINKINDEX(double *port)
{
    return sharedMemoryOnLinkLINKINDEX->read(port);
}

void orc_RT_ROBOTASKNAME::WriteLink_LINKINDEX(double *port)
{
    sharedMemoryOnLink_LINKINDEX->write(port);
}
__

__foreach event of type T1 defined in ROBOTASK write :
void orc_RT_ROBOTTASKNAME::PutT1EVENTNAME(int _T1EVENTNAME)
{
    T1EVENTNAME = _T1EVENTNAME;
}

int orc_RT_ROBOTTASKNAME::Get_T1EVENTNAMEState()
{
    return T1EVENTNAMEState;
}

void orc_RT_ROBOTASKNAME::Put_T1EVENTNAMEState(int T1value)
{
    T1EVENTNAMEState = T1value;
    return;
}
__ //foreach link of type synchronized

__ //foreach RobotTask defined in RobotProcedure

-- SorayaArias - 05 May 2010
Topic revision: r3 - 06 May 2010, SorayaArias
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding SedWiki? Send feedback