~ubuntu-branches/ubuntu/wily/afnix/wily

« back to all changes in this revision

Viewing changes to src/srv/csm/shl/LocalSpace.hpp

  • Committer: Package Import Robot
  • Author(s): Nobuhiro Iwamatsu
  • Date: 2015-07-11 02:00:35 UTC
  • mfrom: (10.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20150711020035-2nhpztq7s15qyc0v
Tags: 2.5.1-1
* New upstream release. (Closes: #789968)
* Update debian/control.
  - Update Standards-Version to 3.9.6.
* Add support mips64(el) and ppc64el. (Closes: #741508, #748146)
* Add patches/support-gcc-5.x.patch. (Closes: #777767)
  - Fix build with gcc-5.x.
* Add patches/Disable-NET0001.als.patch.
  - Disable test of NET0001.als.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ---------------------------------------------------------------------------
 
2
// - LocalSpace.hpp                                                           -
 
3
// - afnix:csm module - abstract local space class definition                  -
 
4
// ---------------------------------------------------------------------------
 
5
// - This program is free software;  you can redistribute it  and/or  modify -
 
6
// - it provided that this copyright notice is kept intact.                  -
 
7
// -                                                                         -
 
8
// - This program  is  distributed in  the hope  that it will be useful, but -
 
9
// - without  any  warranty;  without  even   the   implied    warranty   of -
 
10
// - merchantability or fitness for a particular purpose.  In no event shall -
 
11
// - the copyright holder be liable for any  direct, indirect, incidental or -
 
12
// - special damages arising in any way out of the use of this software.     -
 
13
// ---------------------------------------------------------------------------
 
14
// - copyright (c) 1999-2015 amaury darsch                                   -
 
15
// ---------------------------------------------------------------------------
 
16
 
 
17
#ifndef  AFNIX_LOCALSPACE_HPP
 
18
#define  AFNIX_LOCALSPACE_HPP
 
19
 
 
20
#ifndef  AFNIX_WORKSPACE_HPP
 
21
#include "WorkSpace.hpp"
 
22
#endif
 
23
 
 
24
namespace afnix {
 
25
 
 
26
  /// The LocalSpace class is a local implementation of the abstract
 
27
  /// workspace class. A local space is constructed with a root directory
 
28
  /// which serves as a root place for the whole workspace. The local space
 
29
  /// is persistent, except for the global temporary directory if it exists.
 
30
  /// There is no protection mechanism with respect to the underlying file
 
31
  /// system hosting the local space. By default, a localspace is created in
 
32
  /// a temporary space so it can be delete also at reboot.
 
33
  /// @author amaury darsch
 
34
 
 
35
  class LocalSpace : public WorkSpace {
 
36
  private:
 
37
    /// the root directory
 
38
    String d_root;
 
39
    /// the temporary directory
 
40
    String d_tdir;
 
41
 
 
42
  public:
 
43
    /// create a default local space
 
44
    LocalSpace (void);
 
45
 
 
46
    /// create a local space by root directory
 
47
    /// @param root the root directory
 
48
    LocalSpace (const String& root);
 
49
 
 
50
    /// create a local space by name, info and root directory
 
51
    /// @param name the workspace name
 
52
    /// @param info the workspace info
 
53
    /// @param root the root directory
 
54
    LocalSpace (const String& name, const String& info, const String& root);
 
55
 
 
56
    /// destroy this local space
 
57
    ~LocalSpace (void);
 
58
 
 
59
    /// @return the class name
 
60
    String repr (void) const;
 
61
 
 
62
    /// check if a zone exists by name
 
63
    /// @param zone the zone to check
 
64
    bool iszone (const String& zone) const;
 
65
 
 
66
    /// add a new working zone by name
 
67
    /// @param zone the zone name
 
68
    bool addzone (const String& zone);
 
69
 
 
70
    /// check if an entity exists by zone and uri
 
71
    /// @param zone the working zone
 
72
    /// @param uri  the uri to check
 
73
    bool exists (const String& zone, const Uri& uri) const;
 
74
 
 
75
    /// map a file path to a workspace uri if possible - no public mapping
 
76
    /// @param zone the working zone
 
77
    /// @param name the file name to map
 
78
    String towuri (const String& zone, const String& name) const;
 
79
 
 
80
    /// map a file name to a uri string if possible
 
81
    /// @param zone the working zone
 
82
    /// @param name the file name to map
 
83
    String tonuri (const String& zone, const String& name) const;
 
84
 
 
85
    /// get a workspace zone file list
 
86
    /// @param zone the working zone
 
87
    Strvec* getfiles (const String& zone) const;
 
88
 
 
89
    /// get a workspace zone file list
 
90
    /// get a workspace zone file table
 
91
    /// @param zone the working zone
 
92
    PrintTable* tofptbl (const String& zone) const;
 
93
 
 
94
    /// get an input stream by zone and uri
 
95
    /// @param zone the working zone
 
96
    /// @param uri  the uri to open
 
97
    InputStream* getis (const String& zone, const Uri& uri) const;
 
98
    
 
99
    /// get an output stream by zone and uri
 
100
    /// @param zone the working zone
 
101
    /// @param uri  the uri to open
 
102
    OutputStream* getos (const String& zone, const Uri& uri) const;
 
103
    
 
104
    /// @return the local root directory
 
105
    virtual String getroot (void) const;
 
106
 
 
107
  private:
 
108
    // make the copy constructor private
 
109
    LocalSpace (const LocalSpace&);
 
110
    // make the assignment operator private
 
111
    LocalSpace& operator = (const LocalSpace&);
 
112
 
 
113
  public:
 
114
    /// create a new object in a generic way
 
115
    /// @param argv the argument vector
 
116
    static Object* mknew (Vector* argv);
 
117
 
 
118
    /// @return true if the given quark is defined
 
119
    bool isquark (const long quark, const bool hflg) const;
 
120
 
 
121
    /// apply this object with a set of arguments and a quark
 
122
    /// @param robj  the current runnable
 
123
    /// @param nset  the current nameset    
 
124
    /// @param quark the quark to apply these arguments
 
125
    /// @param argv  the arguments to apply
 
126
    Object* apply (Runnable* robj, Nameset* nset, const long quark,
 
127
                   Vector* argv);
 
128
  };
 
129
}
 
130
 
 
131
#endif