Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
System.h
1 /*
2  * System class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2006-12, IRIT UPS.
6  *
7  * OTAWA is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * OTAWA is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OTAWA; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #ifndef ELM_SYS_SYSTEM_H
22 #define ELM_SYS_SYSTEM_H
23 
24 #include <elm/util/Pair.h>
25 #include <elm/sys/Path.h>
26 #include <elm/sys/SystemIO.h>
27 #include <elm/sys/SystemException.h>
28 
29 namespace elm { namespace io {
30  class InStream;
31  class OutStream;
32  class RandomAccessStream;
33 } } // elm::io
34 
35 namespace elm { namespace sys {
36 
37 // System class
38 class System {
39 public:
40  typedef int access_t;
41  static const int READ = 1;
42  static const int WRITE = 2;
43  static const int READ_WRITE = READ | WRITE;
44 
46  static unsigned int random(unsigned int top);
47  static io::OutStream *createFile(const Path& path) throw(SystemException);
48  static io::OutStream *appendFile(const Path& path) throw(SystemException);
49  static io::InStream *readFile(const Path& path) throw(SystemException);
50  static io::RandomAccessStream *openRandomFile(const Path& path, access_t access = READ)
51  throw(SystemException);
52  static io::RandomAccessStream *createRandomFile(const Path& path, access_t access = READ)
53  throw(SystemException);
54  static Path getUnitPath(void *address);
55  static cstring getEnv(cstring key);
56  static bool hasEnv(cstring key);
58  static string getLibraryFileName(const string& name);
59  static string getPluginFileName(const string& name);
60 };
61 
62 } } // elm::system
63 
64 #endif // ELM_SYS_SYSTEM_H
65 
Definition: CString.h:17
Definition: System.h:38
static cstring getEnv(cstring key)
Definition: Path.h:31
Definition: OutStream.h:30
static cstring library_prefix
Definition: System.h:57
Definition: SystemException.h:29
static Pair< SystemInStream *, SystemOutStream * > pipe(void)
Definition: system_System.cpp:193
static io::RandomAccessStream * createRandomFile(const Path &path, access_t access=READ)
Definition: system_System.cpp:476
int access_t
Definition: System.h:40
static const int READ_WRITE
Definition: System.h:43
static cstring library_suffix
Definition: System.h:57
static bool hasEnv(cstring key)
Definition: RandomAccessStream.h:34
static io::OutStream * createFile(const Path &path)
Definition: system_System.cpp:264
static cstring exec_suffix
Definition: System.h:57
static const int WRITE
Definition: System.h:42
static const int READ
Definition: System.h:41
static string getPluginFileName(const string &name)
static unsigned int random(unsigned int top)
Definition: system_System.cpp:247
Definition: Pair.h:16
static io::OutStream * appendFile(const Path &path)
Definition: system_System.cpp:332
static Path getUnitPath(void *address)
Definition: system_System.cpp:505
static string getLibraryFileName(const string &name)
static io::InStream * readFile(const Path &path)
Definition: system_System.cpp:297
static io::RandomAccessStream * openRandomFile(const Path &path, access_t access=READ)
Definition: system_System.cpp:451
Definition: InStream.h:30