libstorage-ng
Remote.h
1 /*
2  * Copyright (c) 2015 Novell, Inc.
3  *
4  * All Rights Reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as published
8  * by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, contact Novell, Inc.
17  *
18  * To contact Novell about this file by physical or electronic mail, you may
19  * find current contact information at www.novell.com.
20  */
21 
22 
23 #ifndef STORAGE_REMOTE_H
24 #define STORAGE_REMOTE_H
25 
26 
27 #include <string>
28 #include <vector>
29 
30 
31 // TODO the classnames are bad since the classes for also used in Mockup
32 // TODO swig does not support nested classes so here are currently ugly names
33 
34 namespace storage
35 {
36 
41  {
42  RemoteCommand() : stdout(), stderr(), exit_code(0) {}
43  RemoteCommand(const std::vector<std::string>& stdout)
44  : stdout(stdout), stderr(), exit_code(0) {}
45  RemoteCommand(const std::vector<std::string>& stdout,
46  const std::vector<std::string>& stderr, int exit_code)
47  : stdout(stdout), stderr(stderr), exit_code(exit_code) {}
48 
49  std::vector<std::string> stdout;
50  std::vector<std::string> stderr;
51  int exit_code;
52  };
53 
54 
58  struct RemoteFile
59  {
60  RemoteFile() : content() {}
61  RemoteFile(const std::vector<std::string>& content) : content(content) {}
62 
63  std::vector<std::string> content;
64  };
65 
66 
68  {
69  public:
70 
71  virtual ~RemoteCallbacks() {}
72 
73  virtual RemoteCommand get_command(const std::string& name) const = 0;
74  virtual RemoteFile get_file(const std::string& name) const = 0;
75 
76  };
77 
78  const RemoteCallbacks* get_remote_callbacks();
79  void set_remote_callbacks(const RemoteCallbacks* remote_callbacks);
80 
81 }
82 
83 
84 #endif
Contents of an unnamed file (vector of lines)
Definition: Remote.h:58
A result of an unnamed command: stdout + stderr + exit_code.
Definition: Remote.h:40
Definition: Remote.h:67
The storage namespace.
Definition: Actiongraph.h:37