blob: 0b0c90e6771272032131803035ce74f1852f7cb3 [file] [log] [blame]
#ifndef RESOURCEMANAGER_HH
#define RESOURCEMANAGER_HH
#include "Resource.hh"
#include "ResourceType.hh"
#include "umlrtcapsule.hh"
#include "umlrtcapsuleclass.hh"
#include "umlrtcapsuleid.hh"
#include "umlrtframeprotocol.hh"
#include "umlrtmessage.hh"
#include "umlrttimerid.hh"
#include "umlrttimerprotocol.hh"
struct UMLRTCapsulePart;
struct UMLRTCommsPort;
struct UMLRTSlot;
#include "USBPrinterDriver.hh"
#include "USBStorageDriver.hh"
#include <iostream>
#include <iomanip>
#include <ctime>
#include "ResourceType.hh"
#include "USBPrinterDriver.hh"
#include "USBStorageDriver.hh"
class Capsule_ResourceManager : public UMLRTCapsule
{
public:
Capsule_ResourceManager( const UMLRTCapsuleClass * cd, UMLRTSlot * st, const UMLRTCommsPort * * border, const UMLRTCommsPort * * internal, bool isStat );
enum BorderPortId
{
borderport_resMgr,
borderport_appPort,
borderport_frame,
borderport_timer
};
protected:
Resource::Base appPort;
UMLRTFrameProtocol_baserole frame;
Resource::Base resMgr;
UMLRTTimerProtocol_baserole timer;
public:
enum PartId
{
part_usbPrinterDriver,
part_usbStorageDriver
};
protected:
const UMLRTCapsulePart * const usbPrinterDriver;
const UMLRTCapsulePart * const usbStorageDriver;
public:
enum PortId
{
port_appPort,
port_frame,
port_resMgr,
port_timer
};
virtual void bindPort( bool isBorder, int portId, int index );
virtual void unbindPort( bool isBorder, int portId, int index );
protected:
UMLRTCapsuleId printerID;
UMLRTCapsuleId storageID;
int printerRequestCount;
int storageRequestCount;
bool status;
ResourceType resourceType;
UMLRTTimerId timerID;
int numSec;
public:
virtual void inject( const UMLRTMessage & message );
virtual void initialize( const UMLRTMessage & message );
const char * getCurrentStateString() const;
private:
enum State
{
top__InitFail,
top__WaitingForRequest,
top__WaitInitTimeout,
SPECIAL_INTERNAL_STATE_UNVISITED
};
const char * stateNames[4];
State currentState;
void entryaction_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__InitFail__initFailState( const UMLRTMessage * msg );
void entryaction_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__WaitInitTimeout__waitOnTimeout( const UMLRTMessage * msg );
void entryaction_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__WaitingForRequest__waitingForRequest( const UMLRTMessage * msg );
void exitaction_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__WaitingForRequest__requestReceived( const UMLRTMessage * msg );
void transitionaction_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__NOK__InitiFailed( const UMLRTMessage * msg );
void transitionaction_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__OK__InstantiateSuccess( const UMLRTMessage * msg );
void transitionaction_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__initialize__Initialize( const UMLRTMessage * msg );
void transitionaction_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__onAppPortStorageRequest__sendAppPortStorageResource( const UMLRTMessage * msg );
void transitionaction_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__onAppPrinterRequest__sendAppPortPrinterResource( const UMLRTMessage * msg );
void transitionaction_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__onResMgrPrinterRequest__sendResMgrPrinterResource( const UMLRTMessage * msg );
void transitionaction_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__onResMgrStorageRequest__sendResMgrStorageResource( const UMLRTMessage * msg );
void transitionaction_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__onTimeout__broadcastReady( const UMLRTMessage * msg );
bool guard_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__NOK__FailedInitialization( const UMLRTMessage * msg );
bool guard_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__OK__SuccesfulInitialization( const UMLRTMessage * msg );
void actionchain_____action_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__NOK( const UMLRTMessage * msg );
void actionchain_____action_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__OK( const UMLRTMessage * msg );
void actionchain_____action_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__initialize( const UMLRTMessage * msg );
void actionchain_____action_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__onAppPortStorageRequest( const UMLRTMessage * msg );
void actionchain_____action_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__onAppPrinterRequest( const UMLRTMessage * msg );
void actionchain_____action_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__onResMgrPrinterRequest( const UMLRTMessage * msg );
void actionchain_____action_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__onResMgrStorageRequest( const UMLRTMessage * msg );
void actionchain_____action_____ComputerSystem__Computer__ResourceManager__ResourceManager_SM__Region1__onTimeout( const UMLRTMessage * msg );
State choice_____top__instantiateOK( const UMLRTMessage * msg );
State state_____top__InitFail( const UMLRTMessage * msg );
State state_____top__WaitInitTimeout( const UMLRTMessage * msg );
State state_____top__WaitingForRequest( const UMLRTMessage * msg );
};
extern const UMLRTCapsuleClass ResourceManager;
#endif