#include <transition.h>
Inherited by fipa::acl::default_transition::ConversationCancelFailure, fipa::acl::default_transition::ConversationCancelling, fipa::acl::default_transition::ConversationCancelSuccess, fipa::acl::default_transition::GeneralFailure, and fipa::acl::default_transition::NotUnderstood.
|
| | Transition () |
| | empty constructor for the transition class; initializes fields More...
|
| |
| | Transition (const Role &senderRole, const Role &receiverRole, const fipa::acl::ACLMessage::Performative &performative, const fipa::acl::StateId &sourceState, const fipa::acl::StateId &targetState) |
| |
| | Transition (const Role &senderRole, const Role &receiverRole, const std::string &performativeRegExp, const StateId &sourceState, const StateId &targetState) |
| |
| bool | triggers (const ACLMessage &msg, const ACLMessage &initiatingMsg, const RoleMapping &roleMapping) const |
| | check whether a certain message trigger the execution of the transition More...
|
| |
| bool | validateMessage (const ACLMessage &msg, const ACLMessage &validatorMsg, const RoleMapping &roleMapping, validation::Flags flags=validation::ALL) const |
| | method that validates all parameters of a message More...
|
| |
| void | setPerformativeRegExp (const std::string &performativeRegExp) |
| | setter methods for various fields of the class More...
|
| |
| void | setPerformative (const fipa::acl::ACLMessage::Performative &performative) |
| | setter methods for various fields of the class More...
|
| |
| void | setSourceState (const StateId &stateId) |
| |
| void | setTargetState (const StateId &stateId) |
| |
| void | setSenderRole (const Role &role) |
| |
| void | setReceiverRole (const Role &role) |
| |
| Role | getSenderRole () const |
| |
| Role | getReceiverRole () const |
| |
| std::string | getPerformativeRegExp () const |
| | getter methods for various fields of the class More...
|
| |
| StateId | getSourceStateId () const |
| |
| StateId | getTargetStateId () const |
| |
| std::string | toString () const |
| |
| std::string | toXML () const |
| |
| bool | operator== (const Transition &t) const |
| |
A transition that can be associated with a state object
Definition at line 26 of file transition.h.
| fipa::acl::Transition::Transition |
( |
| ) |
|
empty constructor for the transition class; initializes fields
Definition at line 14 of file transition.cpp.
17 , mPerformativeRegExp()
Transition constructor using an explicit Performative instead of a regular expression
Definition at line 23 of file transition.cpp.
24 : mSenderRole(senderRole)
25 , mReceiverRole(receiverRole)
27 , mSourceStateId(sourceState)
28 , mTargetStateId(targetState)
std::map< ACLMessage::Performative, std::string > PerformativeTxt
| fipa::acl::Transition::Transition |
( |
const Role & |
senderRole, |
|
|
const Role & |
receiverRole, |
|
|
const std::string & |
performativeRegExp, |
|
|
const StateId & |
sourceState, |
|
|
const StateId & |
targetState |
|
) |
| |
Transition constructor
Definition at line 33 of file transition.cpp.
34 : mSenderRole(senderRole)
35 , mReceiverRole(receiverRole)
36 , mPerformativeRegExp(performativeRegExp)
37 , mSourceStateId(sourceState)
38 , mTargetStateId(targetState)
| std::string fipa::acl::Transition::getPerformativeRegExp |
( |
| ) |
const |
|
inline |
getter methods for various fields of the class
Definition at line 128 of file transition.h.
128 {
return mPerformativeRegExp; }
| Role fipa::acl::Transition::getReceiverRole |
( |
| ) |
const |
|
inline |
Get the receiver role
Definition at line 121 of file transition.h.
121 {
return mReceiverRole; }
| Role fipa::acl::Transition::getSenderRole |
( |
| ) |
const |
|
inline |
Get the sender role
Definition at line 116 of file transition.h.
116 {
return mSenderRole; }
| StateId fipa::acl::Transition::getSourceStateId |
( |
| ) |
const |
|
inline |
Get the state id of the source state
Definition at line 133 of file transition.h.
133 {
return mSourceStateId; }
| StateId fipa::acl::Transition::getTargetStateId |
( |
| ) |
const |
|
inline |
Get the state id of the target state
Definition at line 138 of file transition.h.
138 {
return mTargetStateId; }
| bool fipa::acl::Transition::operator== |
( |
const Transition & |
t | ) |
const |
Equals operator
Definition at line 198 of file transition.cpp.
200 if(mSourceStateId != other.mSourceStateId)
203 }
else if (mTargetStateId != other.mTargetStateId)
206 }
else if (mSenderRole != other.mSenderRole)
209 }
else if (mReceiverRole != other.mReceiverRole)
212 }
else if (mPerformativeRegExp != other.mPerformativeRegExp)
setter methods for various fields of the class
Definition at line 91 of file transition.h.
std::map< ACLMessage::Performative, std::string > PerformativeTxt
| void fipa::acl::Transition::setPerformativeRegExp |
( |
const std::string & |
performativeRegExp | ) |
|
|
inline |
setter methods for various fields of the class
Definition at line 85 of file transition.h.
85 { mPerformativeRegExp = performativeRegExp; }
| void fipa::acl::Transition::setReceiverRole |
( |
const Role & |
role | ) |
|
|
inline |
Set the receiver role
Definition at line 111 of file transition.h.
111 { mReceiverRole = role; }
| void fipa::acl::Transition::setSenderRole |
( |
const Role & |
role | ) |
|
|
inline |
Set the sender role
Definition at line 106 of file transition.h.
106 { mSenderRole = role; }
| void fipa::acl::Transition::setSourceState |
( |
const StateId & |
stateId | ) |
|
|
inline |
Set the source state of this transition
Definition at line 96 of file transition.h.
96 { mSourceStateId = stateId; }
| void fipa::acl::Transition::setTargetState |
( |
const StateId & |
stateId | ) |
|
|
inline |
Set the target state of this transition
Definition at line 101 of file transition.h.
101 { mTargetStateId = stateId; }
| std::string fipa::acl::Transition::toString |
( |
| ) |
const |
Convert transition to string
Definition at line 150 of file transition.cpp.
152 std::stringstream transition;
153 transition <<
"transition: sender role: '" << mSenderRole.
getId() <<
"', ";
154 transition <<
"receiver role: '" << mReceiverRole.
getId() <<
"', ";
155 transition <<
"performative: '" << mPerformativeRegExp <<
"', ";
156 transition <<
"source state: '" << mSourceStateId <<
"', ";
157 transition <<
"target state: '" << mTargetStateId <<
"'";
159 return transition.str();
| std::string fipa::acl::Transition::toXML |
( |
| ) |
const |
Convert transition to XML
Definition at line 162 of file transition.cpp.
164 std::stringstream transition;
165 transition <<
"<transition ";
166 transition <<
"performative=\"" << mPerformativeRegExp <<
"\" ";
167 transition <<
"from=\"" << mSenderRole.
getId() <<
"\" ";
168 transition <<
"to=\"" << mReceiverRole.
getId() <<
"\" ";
169 transition <<
"target=\"" << mTargetStateId <<
"\" ";
172 return transition.str();
check whether a certain message trigger the execution of the transition
- Parameters
-
| msg | message to process |
| initiatingMsg | message that initiated the conversation or represents the direct predecessor of the current one |
| roleMapping | Current role mapping |
- Returns
- true if message triggers this transition, false otherwise
Definition at line 42 of file transition.cpp.
50 LOG_DEBUG(
"Message validation failed: message does not apply to transition");
bool validateMessage(const ACLMessage &msg, const ACLMessage &validatorMsg, const RoleMapping &roleMapping, validation::Flags flags=validation::ALL) const
method that validates all parameters of a message
method that validates all parameters of a message
- Parameters
-
| msg | message passed as parameter to be checked |
| validatorMsg | To validate conversation id, protocol, encoding, language, ontology and in_reply_to the validatorMsg is referred to |
| roleMapping | Current role mapping |
| flags | Flag which shall be considered during validation |
- Returns
- true if message is valid false otherwise
Definition at line 55 of file transition.cpp.
66 boost::regex performativeRegex(mPerformativeRegExp);
67 if(!regex_match(msg.getPerformative(), performativeRegex))
69 LOG_DEBUG(
"Performative validation failed: was '%s' but expected: '%s'", msg.getPerformative().c_str(), mPerformativeRegExp.c_str());
76 AgentID senderAgent = msg.getSender();
77 if(!roleMapping.isExpected(mSenderRole, senderAgent))
79 LOG_DEBUG(
"Sender validation failed: '%s' unexpected for role '%s'", senderAgent.getName().c_str(), mSenderRole.
getId().c_str());
86 if(!validateReceivers(msg, roleMapping))
88 LOG_DEBUG(
"Receivers validation failed");
95 if (msg.getConversationID() != validatorMsg.getConversationID())
97 LOG_DEBUG(
"ConversationID validation failed: was '%s' but expected: '%s'", msg.getConversationID().c_str(), validatorMsg.getConversationID().c_str());
104 if (msg.getProtocol() != validatorMsg.getProtocol())
106 LOG_DEBUG(
"Protocol validation failed: was '%s' but expected: '%s'", msg.getProtocol().c_str(), validatorMsg.getProtocol().c_str());
113 if (msg.getEncoding() != validatorMsg.getEncoding())
115 LOG_DEBUG(
"Encoding validation failed: was '%s' but expected: '%s'", msg.getEncoding().c_str(), validatorMsg.getEncoding().c_str());
122 if (msg.getLanguage() != validatorMsg.getLanguage())
124 LOG_DEBUG(
"Language validation failed: was '%s' but expected: '%s'", msg.getLanguage().c_str(), validatorMsg.getLanguage().c_str());
131 if (msg.getOntology() != validatorMsg.getOntology())
133 LOG_DEBUG(
"Ontology validation failed: was '%s' but expected: '%s'", msg.getOntology().c_str(), validatorMsg.getOntology().c_str());
140 if (msg.getInReplyTo() != validatorMsg.getInReplyTo())
142 LOG_DEBUG(
"InReplyTo validation failed: was '%s' but expected: '%s'", msg.getInReplyTo().c_str(), validatorMsg.getInReplyTo().c_str());
The documentation for this class was generated from the following files:
- /build/rock-master-18.09-multiagent-fipa-acl-0.20180914/src/conversation_monitor/transition.h
- /build/rock-master-18.09-multiagent-fipa-acl-0.20180914/src/conversation_monitor/transition.cpp