1 //===- AssertCmd.h --------------------------------------------------------===//
2 //
3 //                     The MCLinker Project
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 #ifndef MCLD_SCRIPT_ASSERTCMD_H
10 #define MCLD_SCRIPT_ASSERTCMD_H
11 
12 #include <mcld/Script/ScriptCommand.h>
13 #include <string>
14 
15 namespace mcld
16 {
17 
18 class RpnExpr;
19 class Module;
20 
21 /** \class AssertCmd
22  *  \brief This class defines the interfaces to assert command.
23  */
24 
25 class AssertCmd : public ScriptCommand
26 {
27 public:
28   AssertCmd(RpnExpr& pRpnExpr, const std::string& pMessage);
29 
30   ~AssertCmd();
31 
32   AssertCmd& operator=(const AssertCmd& pAssertCmd);
33 
getRpnExpr()34   const RpnExpr& getRpnExpr() const { return m_RpnExpr; }
getRpnExpr()35   RpnExpr&       getRpnExpr()       { return m_RpnExpr; }
36 
message()37   const std::string& message() const { return m_Message; }
38 
39   void dump() const;
40 
classof(const ScriptCommand * pCmd)41   static bool classof(const ScriptCommand* pCmd)
42   {
43     return pCmd->getKind() == ScriptCommand::ASSERT;
44   }
45 
46   void activate(Module& pModule);
47 
48 private:
49   RpnExpr& m_RpnExpr;
50   std::string m_Message;
51 };
52 
53 } // namespace of mcld
54 
55 #endif
56