Skip to content

Commit

Permalink
fixed transition query and added generated code comments to dummy
Browse files Browse the repository at this point in the history
  • Loading branch information
abelhegedus committed Apr 29, 2015
1 parent 4f93c83 commit 03e9145
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ pattern classStateMachineTransitions(
transition : Transition
) {
find classStateMachineStates(xtClass, cppClass, state);
CompositeState.transitions(state, transition);
CompositeState.substates(compState, state);
CompositeState.transitions(compState, transition);
}

pattern classStateMachineEvents(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ using namespace std;

#include "Test_FSM/Main_Package/Test_Component/Test_Component_def.hh"

using namespace ::Test_FSM::Main_Package::Test_Component::Test_Package;
// GENERATED CODE START

// Constructor
TEST::TEST(): current_state(TEST_STATE_INIT) {
::Test_FSM::Main_Package::Test_Component::Test_Package::TEST::TEST(): current_state(TEST_STATE_INIT) {
}

// Destructor
TEST::~TEST() {
::Test_FSM::Main_Package::Test_Component::Test_Package::TEST::~TEST() {
}

void TEST::processEvent(int eventId, std::string eventContent) {
void ::Test_FSM::Main_Package::Test_Component::Test_Package::TEST::processEvent(int eventId, std::string eventContent) {
cout << "[TEST] Event " << eventId << " received with content: " << eventContent << endl;

switch(current_state){
Expand All @@ -42,13 +42,14 @@ void TEST::processEvent(int eventId, std::string eventContent) {
processEventInWorkingState(eventId, eventContent);
break;
}

}

void TEST::performEntryActionForInitState(int eventId, std::string eventContent) {
void ::Test_FSM::Main_Package::Test_Component::Test_Package::TEST::performEntryActionForInitState(int eventId, std::string eventContent) {
cout << " [Entry: INIT]" << endl;
}

void TEST::processEventInInitState(int eventId, std::string eventContent) {
void ::Test_FSM::Main_Package::Test_Component::Test_Package::TEST::processEventInInitState(int eventId, std::string eventContent) {
cout << " [State: INIT] Processing event" << endl;

// Init -WORK-> Work transition
Expand Down Expand Up @@ -78,7 +79,7 @@ void TEST::processEventInInitState(int eventId, std::string eventContent) {
return;
}

bool TEST::evaluateGuardOnInitToWorkingTransition(int eventId, std::string eventContent) {
bool ::Test_FSM::Main_Package::Test_Component::Test_Package::TEST::evaluateGuardOnInitToWorkingTransition(int eventId, std::string eventContent) {
if(eventContent == "valid") {
return true;
} else {
Expand All @@ -87,19 +88,19 @@ bool TEST::evaluateGuardOnInitToWorkingTransition(int eventId, std::string event
}
}

void TEST::performActionsOnInitToInitTransition(int eventId, std::string eventContent) {
void ::Test_FSM::Main_Package::Test_Component::Test_Package::TEST::performActionsOnInitToInitTransition(int eventId, std::string eventContent) {
cout << " [Action]" << endl;
}

void TEST::performExitActionForInitState(int eventId, std::string eventContent) {
void ::Test_FSM::Main_Package::Test_Component::Test_Package::TEST::performExitActionForInitState(int eventId, std::string eventContent) {
cout << " [Exit]" << endl;
}

void TEST::performEntryActionForWorkingState(int eventId, std::string eventContent) {
void ::Test_FSM::Main_Package::Test_Component::Test_Package::TEST::performEntryActionForWorkingState(int eventId, std::string eventContent) {
cout << " [Entry: WORKING]" << endl;
}

void TEST::processEventInWorkingState(int eventId, std::string eventContent) {
void ::Test_FSM::Main_Package::Test_Component::Test_Package::TEST::processEventInWorkingState(int eventId, std::string eventContent) {
cout << " [State: WORKING] Processing event" << endl;

// Working -DONE-> Init transition
Expand All @@ -126,14 +127,16 @@ void TEST::processEventInWorkingState(int eventId, std::string eventContent) {
return;
}

void TEST::performActionsOnWorkingToWorkingTransition(int eventId, std::string eventContent) {
void ::Test_FSM::Main_Package::Test_Component::Test_Package::TEST::performActionsOnWorkingToWorkingTransition(int eventId, std::string eventContent) {
cout << " [Action]" << endl;
}

void TEST::performExitActionForWorkingState(int eventId, std::string eventContent) {
void ::Test_FSM::Main_Package::Test_Component::Test_Package::TEST::performExitActionForWorkingState(int eventId, std::string eventContent) {
cout << " [Exit]" << endl;
}

void TEST::generateEvent(int eventId, std::string eventContent) {
void ::Test_FSM::Main_Package::Test_Component::Test_Package::TEST::generateEvent(int eventId, std::string eventContent) {
cout << " [Generate] Event " << eventId << " generated with content: " << eventContent << endl;
}

// GENERATED CODE END
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ namespace Test_FSM {
namespace Main_Package {
namespace Test_Component {
namespace Test_Package {

// GENERATED CODE START

class TEST {
public:
enum TEST_state {TEST_STATE_INIT, TEST_STATE_WORKING};
Expand Down Expand Up @@ -78,8 +81,9 @@ namespace Test_FSM {
// State machine
void generateEvent(int eventId, std::string eventContent);


};

// GENERATED CODE END
}
}
}
Expand Down

0 comments on commit 03e9145

Please sign in to comment.