rad  5.1.0
ReplaceRules.h
Go to the documentation of this file.
1 
10 /*
11  * scampl4cpp/parser
12  *
13  * Copyright by European Southern Observatory, 2012
14  * All rights reserved
15  *
16  * This library is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU Lesser General Public
18  * License as published by the Free Software Foundation; either
19  * version 2.1 of the License, or (at your option) any later version.
20  *
21  * This library is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24  * Lesser General Public License for more details.
25  *
26  * You should have received a copy of the GNU Lesser General Public
27  * License along with this library; if not, write to the Free Software
28  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
29  * 02111-1307 USA.
30  */
31 
32 #ifndef SCXML4CPP_REPLACE_RULES_H
33 #define SCXML4CPP_REPLACE_RULES_H
34 
35 #ifndef __cplusplus
36 #error This is a C++ include file and cannot be used from plain C
37 #endif
38 
39 #include <string>
40 #include <map>
41 #include <ostream>
42 
43 namespace scxml4cpp {
44 
45 class Context;
46 
53 {
54  public:
55  enum ElementType {
56  State = 0,
60  Activity
61  };
62 
66  ReplaceRules();
67  ReplaceRules(const ReplaceRules&) = default;
68  ReplaceRules& operator= (const ReplaceRules&) = default;
69 
79  void add(const ElementType elementType,
80  const std::string& srcId,
81  const std::string& dstId);
82 
86  void clear();
87 
95  std::string apply(const ElementType elementType, const std::string& srcId);
96 
100  const std::map<std::string, std::string>& get() const;
101 
108  friend std::ostream& operator<< (std::ostream& stream, const ReplaceRules& rules);
109 
110  private:
111  std::map<std::string, std::string> mRules;
112  std::map<ElementType, std::string> mPrefixes;
113 };
114 
115 } // namespace scxml4cpp
116 
117 #endif // SCXML4CPP_REPLACE_RULES_H
Definition: Activity.h:52
Definition: ReplaceRules.h:53
void add(const ElementType elementType, const std::string &srcId, const std::string &dstId)
Definition: ReplaceRules.cpp:49
std::string apply(const ElementType elementType, const std::string &srcId)
Definition: ReplaceRules.cpp:63
const std::map< std::string, std::string > & get() const
Definition: ReplaceRules.cpp:76
friend std::ostream & operator<<(std::ostream &stream, const ReplaceRules &rules)
Definition: ReplaceRules.cpp:83
ElementType
Definition: ReplaceRules.h:55
@ Guard
Definition: ReplaceRules.h:58
@ Event
Definition: ReplaceRules.h:57
@ Action
Definition: ReplaceRules.h:59
void clear()
Definition: ReplaceRules.cpp:57
ReplaceRules(const ReplaceRules &)=default
ReplaceRules & operator=(const ReplaceRules &)=default
ReplaceRules()
Definition: ReplaceRules.cpp:38
Definition: State.h:60
Definition: Action.h:40
Definition: testCoroActivity.cpp:16