Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 440f20ef738e5c65c55eb8e8ad74e2d3949c4221 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*******************************************************************************
 * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * CONTRIBUTORS:
 * 		Peter Karlitschek (initial contribution)
 *
 *******************************************************************************/

#ifndef MSCLOGGER_H_
#define MSCLOGGER_H_

#include "osal/etMutex.h"
#include <iostream>
#include <list>
#include <string>

namespace etRuntime {

class MSCFilter;

class MSCLogger {
public:
	MSCLogger();
	virtual ~MSCLogger();

	void setMSC(const std::string& msc_name, const std::string& path);

	/* synchronized */
	void open();
	void addMessageAsyncOut(const std::string& source, const std::string& target, const std::string& message);
	void addMessageAsyncIn(const std::string& source, const std::string& target, const std::string& message);
	void addMessageSyncCall(const std::string& source, const std::string& target, const std::string& message);
	void addMessageSyncReturn(const std::string& source, const std::string& target, const std::string& message);
	void addMessageActorCreate(const std::string& source, const std::string& target);
	void addMessageActorDestroy(const std::string& source, const std::string& target);
	void addNote(const std::string& actor, const std::string& note);
	void addMessageCreate(const std::string& source, const std::string& target);
	void addActorState(const std::string& actor, const std::string& state);
	void addVisibleComment(const std::string& comment);
	void close();
	/* --- */

	const std::string& getObjectName(void) { return m_objectName; }
	void setObjectName(const std::string& name) { m_objectName = name; }

	std::list<std::string>& getCommandList() {	return m_commandList; };
	MSCFilter* getMSCFilter(){ return m_filter; };

private:

	void createLine(const std::string& source, const std::string& mid, const std::string& target, const std::string& message);
	void saveMSCforTrace2UML(etFileHandle handle);

	std::list<std::string> m_commandList;
	MSCFilter* m_filter;

	std::string m_path;
	std::string m_msc_name ;
	etBool m_is_open;

	etMutex m_mutex;

	std::string m_objectName;

	MSCLogger(const MSCLogger& right);
	MSCLogger& operator=(const MSCLogger& right);


};


} /* namespace etRuntime */
#endif /* MSCLOGGER_H_ */

Back to the top