- Aldebaran documentation |
- C++ Libraries |
- index

libqipackage 2.8.7.4

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Macros Pages
package_info.hpp
Go to the documentation of this file.
1 /*
2 ** Author(s):
3 ** - Laurent Lec <llec@aldebaran-robotics.com>
4 ** - Clément Geiger <cgeiger@aldebaran-robotics.com>
5 **
6 ** Copyright (C) 2012-2015 Aldebaran Robotics
7 */
8
9 #pragma once
10 #ifndef _QI_PACKAGE_PACKAGE_INFO_HPP_
11 #define _QI_PACKAGE_PACKAGE_INFO_HPP_
12
13 #include <string>
14 #include <list>
15 #include <map>
16 #include <qipackage/api.hpp>
17 #include <alvalue/alvalue.h>
18 #include <qipackage/language_info.hpp>
19 #include <qipackage/behavior_info.hpp>
20 #include <qipackage/dialog_info.hpp>
21 #include <qi/macro.hpp>
22 #include <qi/anyobject.hpp>
23 #include <qi/type/typeinterface.hpp>
24 #include <QFile>
25
26 namespace qi
27 {
28 class PackageInfoPrivate;
29
30 struct WebInfo;
31
35 struct QI_PACKAGE_API PackageInfo2
36 {
37 std::string uuid;
38 std::string version;
39 std::string author;
40 std::string channel;
41 std::string organization;
42 std::string date;
43 std::string typeVersion;
44 std::string installer;
45 bool installOnlyAtStartup;
46 std::string path;
47
62 std::map<std::string, qi::AnyValue> elems;
63
64 std::map<std::string, qi::AnyValue> contents() const;
65 std::map<std::string, qi::AnyValue>& contents();
66
67 std::vector<qi::BehaviorInfo> behaviors() const;
68 std::vector<qi::BehaviorInfo>& behaviors();
69
70 std::vector<qi::DialogInfo> dialogs() const;
71 std::vector<qi::DialogInfo>& dialogs();
72
73 std::vector<qi::LanguageInfo> languages() const;
74 std::vector<qi::LanguageInfo>& languages();
75
76 qi::WebInfo web() const;
77 qi::WebInfo& web();
78 };
79
83 QI_PACKAGE_API qi::PackageInfo2 loadManifest(const std::string& manifestPath);
84
85
89 struct QI_PACKAGE_API RobotRequirement
90 {
91 std::string model;
92 std::string minHeadVersion;
93 std::string maxHeadVersion;
94 std::string minBodyVersion;
95 std::string maxBodyVersion;
96 };
97
101 struct QI_PACKAGE_API NaoqiRequirement
102 {
103 std::string minVersion;
104 std::string maxVersion;
105 };
106
110 struct QI_PACKAGE_API PackageService
111 {
112 std::string execStart;
113 std::string name;
114 bool autoRun;
115 std::map<std::string, std::string> envVars;
116 };
117
121 struct QI_PACKAGE_API WebInfo
122 {
123 std::string path;
124 };
125
131 class QI_PACKAGE_API PackageInfo
132 {
133 public:
134 PackageInfo();
135
136 PackageInfo(const PackageInfo &package);
137 PackageInfo(const PackageInfo2 &package);
138 ~PackageInfo();
139
140 PackageInfo operator=(const PackageInfo& package);
141
142 /* For serialization purpose */
143 PackageInfo(const AL::ALValue& alvalue);
144 void toALValue(AL::ALValue &alvalue);
145
146 bool loadFromManifestFile(const std::string& filePath);
147 bool loadFromManifestFile(QFile &file);
148 bool loadFromManifestContent(const std::string& manifestContent);
149
152 void trimExtraInfo();
153
154 bool saveToManifestFile(const std::string& filePath) const;
155 bool saveToManifestFile(QFile &file) const;
156 std::string saveToManifestContent() const;
157
158 const std::string& installer() const;
159 void setInstaller(const std::string &installer);
160
161 const std::string& uuid() const;
162 void setUuid(const std::string &uuid);
163
164 const std::string& version() const;
165 void setVersion(const std::string &version);
166
167 const bool& installOnlyAtStartup() const;
168 void setInstallOnlyAtStartup(const bool &installOnlyAtStartup);
169
170 const std::string& typeVersion() const;
171 void setTypeVersion(const std::string &typeVersion);
172
173 const std::string& author() const;
174 void setAuthor(const std::string &author);
175
176 const std::string& organization() const;
177 void setOrganization(const std::string &organization);
178
179 const std::string& date() const;
180 void setDate(const std::string &date);
181
182 const std::string& channel() const;
183 void setChannel(const std::string &channel);
184
185 const std::string& path() const;
186 void setPath(const std::string &path);
187
188 const std::string& name(const std::string &lang) const;
189 const std::map<std::string, std::string> &names() const;
190 void setName(const std::string &name,
191 const std::string &lang);
192 void clearNames();
193
194 const std::list<std::string>& supportedLanguages() const;
195 void addSupportedLanguage(const std::string & language);
196 void removeSupportedLanguage(const std::string & language);
197 void clearSupportedLanguages();
198
199 const std::list<std::string>& descriptionLanguages() const;
200 void addDescriptionLanguage(const std::string & language);
201 void removeDescriptionLanguage(const std::string & language);
202 void clearDescriptionLanguages();
203
204 const std::string& description(const std::string &lang) const;
205 const std::map<std::string, std::string> &descriptions() const;
206 void setDescription(const std::string description,
207 const std::string &lang);
208
209 std::list<RobotRequirement>& robotRequirements() const;
210 void addRobotRequirement(const RobotRequirement& requirement);
211 void clearRobotRequirements();
212
213 std::list<NaoqiRequirement>& naoqiRequirements() const;
214 void addNaoqiRequirement(const NaoqiRequirement& requirement);
215 void clearNaoqiRequirements();
216
217 std::list<BehaviorInfo> & behaviors();
218 const std::list<BehaviorInfo>& behaviors() const;
219 void addBehavior(const BehaviorInfo& behavior);
220 bool hasBehavior() const;
221 void clearBehaviors();
222
223 const std::list<DialogInfo>& dialogs() const;
224 void addDialog(const DialogInfo& dialog);
225 void clearDialogs();
226
227 const std::list<LanguageInfo>& languages() const;
228 void addLanguage(const LanguageInfo& language);
229
230 const std::list<PackageService> &services() const;
231 void addService(const PackageService &service);
232 void clearServices();
233
234 const std::list<std::string> &executableFiles() const;
235 void addExecutableFile(const std::string &executableFile);
236
237 PackageInfoPrivate *_p;
238 };
239
240 typedef std::vector<PackageInfo> PackageInfoList;
241
242 QI_PACKAGE_API std::ostream& operator<<(std::ostream& os,
243 const PackageInfo& package);
244 }
245
246
247 QI_TYPE_STRUCT(::qi::RobotRequirement, model, minHeadVersion, maxHeadVersion, minBodyVersion, maxBodyVersion);
248 QI_TYPE_STRUCT(::qi::NaoqiRequirement, minVersion, maxVersion);
249 QI_TYPE_STRUCT(::qi::PackageService, execStart, name, autoRun, envVars);
250 QI_TYPE_STRUCT_EXTENSION_ADDED_FIELDS(::qi::PackageInfo2, "installOnlyAtStartup");
251 QI_TYPE_STRUCT(::qi::PackageInfo2, uuid, version, author, channel, organization, date, typeVersion, installer, path, elems, installOnlyAtStartup);
252 QI_TYPE_STRUCT(::qi::WebInfo, path);
253
254 #endif // _QI_PACKAGE_PACKAGE_INFO_HPP_
qi::loadManifest
QI_PACKAGE_API qi::PackageInfo2 loadManifest(const std::string &manifestPath)
Returns a qi::PackageInfo2 from a manifest path.
qi::RobotRequirement::minBodyVersion
std::string minBodyVersion
The minimum version for the body to be compatible with this package.
Definition: package_info.hpp:94
qi::RobotRequirement
This structure defines robot requirements for this package.
Definition: package_info.hpp:89
qi::RobotRequirement::maxBodyVersion
std::string maxBodyVersion
The maximum version for the body to be compatible with this package.
Definition: package_info.hpp:95
qi::RobotRequirement::minHeadVersion
std::string minHeadVersion
The minimum needed version for the head to be compatible with this package.
Definition: package_info.hpp:92
qi::PackageInfo2
A dynamic struct for managing packages information.
Definition: package_info.hpp:35
qi::PackageInfo2::installer
std::string installer
Source of the package.
Definition: package_info.hpp:44
QI_TYPE_STRUCT
QI_TYPE_STRUCT(::qi::RobotRequirement, model, minHeadVersion, maxHeadVersion, minBodyVersion, maxBodyVersion)
qi::PackageService
Structure matching a service.
Definition: package_info.hpp:110
qi::WebInfo::path
std::string path
The path to web pages.
Definition: package_info.hpp:123
qi::WebInfo
A structure defining web pages location.
Definition: package_info.hpp:121
qi::NaoqiRequirement::maxVersion
std::string maxVersion
The maximum version of naoqi compatible with this package.
Definition: package_info.hpp:104
qi::NaoqiRequirement::minVersion
std::string minVersion
The minimum version of naoqi compatible with this package.
Definition: package_info.hpp:103
qi::NaoqiRequirement
Requirement on naoqi version.
Definition: package_info.hpp:101
qi::PackageInfo2::uuid
std::string uuid
Unique ID to identify the package.
Definition: package_info.hpp:37
qi::PackageInfo2::version
std::string version
Version of the package.
Definition: package_info.hpp:38
qi::RobotRequirement::model
std::string model
Model of the robot (ROBOT_TYPE_NAO, ROBOT_TYPE_JULIETTE, ROBOT_TYPE_ROMEO, ...)
Definition: package_info.hpp:91
qi::PackageInfo2::path
std::string path
Path to the files. Should not be used.
Definition: package_info.hpp:46
qi::PackageInfo2::date
std::string date
Data of the package.
Definition: package_info.hpp:42
qi::PackageInfo2::organization
std::string organization
Organization.
Definition: package_info.hpp:41
qi::RobotRequirement::maxHeadVersion
std::string maxHeadVersion
The maximum version of the head to be compatible with this package.
Definition: package_info.hpp:93
qi::PackageInfo2::author
std::string author
Author of the package.
Definition: package_info.hpp:39
QI_TYPE_STRUCT_EXTENSION_ADDED_FIELDS
QI_TYPE_STRUCT_EXTENSION_ADDED_FIELDS(::qi::PackageInfo2,"installOnlyAtStartup")
qi::PackageService::autoRun
bool autoRun
If this service should be started automatically at start-up.
Definition: package_info.hpp:114
qi::PackageService::name
std::string name
The name of the service.
Definition: package_info.hpp:113
qi::PackageInfo2::elems
std::map< std::string, qi::AnyValue > elems
Definition: package_info.hpp:62
qi::PackageInfo::_p
PackageInfoPrivate * _p
Definition: package_info.hpp:237
qi::PackageInfo2::installOnlyAtStartup
bool installOnlyAtStartup
Install only at Startup.
Definition: package_info.hpp:45
qi::PackageInfoList
std::vector< PackageInfo > PackageInfoList
Definition: package_info.hpp:240
qi::PackageInfo2::typeVersion
std::string typeVersion
Type version.
Definition: package_info.hpp:43
qi::PackageService::envVars
std::map< std::string, std::string > envVars
The specific environement variables.
Definition: package_info.hpp:115
qi::operator<<
QI_PACKAGE_API std::ostream & operator<<(std::ostream &os, const PackageInfo &package)
qi::PackageInfo
A class that represents a package.
Definition: package_info.hpp:131
qi::PackageInfo2::channel
std::string channel
Channel.
Definition: package_info.hpp:40
qi::PackageService::execStart
std::string execStart
The command line with arguments.
Definition: package_info.hpp:112