1 #ifndef FIPA_ACL_CONVERSATION_H
2 #define FIPA_ACL_CONVERSATION_H
6 #include <boost/shared_ptr.hpp>
7 #include <boost/thread/mutex.hpp>
8 #include <boost/thread/condition.hpp>
9 #include <fipa_acl/message_generator/acl_message.h>
10 #include <fipa_acl/conversation_monitor/transition.h>
11 #include <fipa_acl/conversation_monitor/statemachine_factory.h>
12 #include <base/Time.hpp>
17 class ConversationObserver;
27 namespace conversation {
38 static const std::string EventTypeTxt[] = {
"UNKNOWN",
"START_OF_CONVERSATION",
"INTERMEDIATE_UPDATE",
"END_OF_CONVERSATION",
"FAILURE" };
39 static const std::string StatusTxt[] = {
"UNINITIALIZED",
"RUNNING",
"ENDED",
"FAILED" };
59 : std::runtime_error(
"fipa::acl::conversation::ProtocolException")
63 : std::runtime_error(
"fipa::acl::conversation::ProtocolException: '" + msg +
"'" )
71 : std::runtime_error(
"fipa::acl::conversation::InvalidOperation")
75 : std::runtime_error(
"fipa::acl::conversation::InvalidOperation: '" + msg +
"'" )
143 boost::condition mCondition;
144 mutable boost::mutex mEventsMutex;
149 std::vector<conversation::Event> mEvents;
151 mutable boost::mutex mObservablesMutex;
153 std::vector<ConversationObservablePtr> mObservables;
237 mutable boost::mutex mObserverMutex;
322 std::vector<fipa::acl::ACLMessage>
getMessages()
const {
return mMessages; }
359 static std::string
toString(
const std::vector<fipa::acl::ACLMessage>& messages);
385 int mNumberOfSubConversations;
390 std::vector<fipa::acl::ACLMessage> mMessages;
392 mutable boost::mutex mMutex;
412 #endif //FIPA_ACL_CONVERSATION_H
std::string ConversationID
bool hasObservers() const
std::vector< fipa::acl::ACLMessage > getMessages() const
fipa::acl::Protocol getProtocol() const
boost::shared_ptr< ConversationObservable > ConversationObservablePtr
void setConversationId(const fipa::acl::ConversationID &conversationId)
static fipa::acl::ConversationID generateConversationID(const std::string &topic="")
std::string getOwner() const
std::vector< ConversationObserverPtr > ConversationObserverList
boost::shared_ptr< Conversation > ConversationPtr
boost::shared_ptr< ConversationObserver > ConversationObserverPtr
fipa::acl::ContentLanguage getContentLanguage() const
bool getNextEvent(conversation::Event &msg)
void notify(const fipa::acl::ACLMessage &msg, conversation::EventType eventType)
virtual ~ConversationObserver()
conversation::Status getStatus() const
fipa::acl::ConversationID getConversationId() const
void setNumberOfSubConversations(int amount)
ConversationObserverList getObservers() const
void operator()(void const *) const
std::string ContentLanguage
ProtocolException(const std::string &msg)
fipa::acl::ACLMessage getLastMessage() const
void addObserver(const ConversationObserverPtr &observer)
This class provides a representation of a message conforming to the FIPA specification SC00061...
Conversation(const std::string &owner, const fipa::acl::ConversationID &conversationId=fipa::acl::ConversationID())
fipa::acl::ConversationID mConversationId
conversation::Event waitForNextEvent()
void removeObserver(const ConversationObserverPtr &observer)
void setProtocol(const fipa::acl::Protocol &protocol)
void update(const fipa::acl::ACLMessage &msg)
std::string toString() const
InvalidOperation(const std::string &msg)
fipa::acl::ACLMessage msg
void setContentLanguage(const fipa::acl::ContentLanguage &language)
virtual ~ConversationObservable()
std::vector< fipa::acl::ConversationID > getConversationIdsOfObservables() const