Otawa  0.10
Application.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * Application class interface
4  *
5  * This file is part of OTAWA
6  * Copyright (c) 2008, IRIT UPS.
7  *
8  * OTAWA is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * OTAWA is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with OTAWA; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 #ifndef OTAWA_APP_APPLICATION_H_
23 #define OTAWA_APP_APPLICATION_H_
24 
25 #include <elm/options.h>
26 #include <elm/option/ListOption.h>
27 #include <otawa/otawa.h>
28 
29 namespace otawa {
30 
31 using namespace elm;
32 
33 
34 // LogOption class
36 public:
38  LogOption(option::Manager& man, int tag, ...);
39  inline operator Processor::log_level_t(void) const { return log_level; }
40  inline Processor::log_level_t operator*(void) const { return log_level; }
41  virtual void process(String arg);
42 private:
44 };
45 
46 
47 // Application class
49 public:
51  cstring _program,
52  Version _version = Version::ZERO,
53  cstring _description = "",
54  cstring _author = "",
55  cstring _copyright = ""
56  );
57  virtual ~Application(void);
58 
59  int run(int argc, char **argv);
60 
61 protected:
62  virtual void prepare(PropList& props);
63  virtual void work(PropList& props) throw(elm::Exception);
64  virtual void work(const string& entry, PropList &props) throw(elm::Exception);
65 
66  inline WorkSpace *workspace(void) const { return ws; }
67  void require(const AbstractFeature& feature);
68  virtual void process(string arg);
69  inline bool isVerbose(void) const { return verbose; }
70 
71  const genstruct::Vector<string> arguments(void) const { return _args; }
72  Address parseAddress(const string& s) throw(otawa::Exception);
73 
74 private:
80  elm::system::Path path;
84  int result;
86 };
87 
88 } // otawa
89 
90 // application macro
91 #define OTAWA_RUN(name) \
92  int main(int argc, char **argv) { \
93  name app; \
94  return app.run(argc, argv); \
95  }
96 
97 #endif /* OTAWA_APP_APPLICATION_H_ */
log_level_t
Definition: Monitor.h:40
genstruct::Vector< string > _args
Definition: Application.h:81
elm::system::Path path
Definition: Application.h:80
LogOption log_level
Definition: Application.h:79
A class making easier the use of applications built on OTAWA.
Definition: Application.h:48
Processor::log_level_t log_level
Definition: Application.h:43
static const Version ZERO
WorkSpace * workspace(void) const
Provide the current workspace.
Definition: Application.h:66
WorkSpace * ws
Definition: Application.h:85
dtd::Element entry(dtd::make("entry", _ENTRY).attr(id))
PropList * props2
Definition: Application.h:83
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
The representation of an address in OTAWA.
Definition: base.h:54
const int require
Definition: Registration.h:43
const genstruct::Vector< string > arguments(void) const
Definition: Application.h:71
int result
Definition: Application.h:84
Defines a command line option supporting log level thanks to strings 'proc', 'cfg' or 'bb'...
Definition: Application.h:35
bool isVerbose(void) const
Definition: Application.h:69
BoolOption verbose(command, 'v',"verbose","verbose mode", false)
See Feature.
Definition: AbstractFeature.h:36
This a list of properties.
Definition: PropList.h:63
Processor::log_level_t operator*(void) const
Definition: Application.h:40
option::BoolOption verbose
Definition: Application.h:75
option::ListOption< string > ff
Definition: Application.h:78
option::ListOption< string > params
Definition: Application.h:77
option::ListOption< string > sets
Definition: Application.h:76
PropList props
Definition: Application.h:82