Kernel.h
Go to the documentation of this file.
1
9// Documentation for the doxygen main page
27/*====================================================================================================================*/
28/*== Guards, Includes ==============================================================================================*/
29/*====================================================================================================================*/
30
31// INCLUDE GUARDS
32//
33#ifndef LIBPF_USER_KERNEL_H
34#define LIBPF_USER_KERNEL_H
35
36/* SYSTEM INCLUDES */
37//
38#include <string>
39#include <vector>
40#include <map>
41
42/* PROJECT INCLUDES */
43//
44
45/* LOCAL INCLUDES */
46//
47#include <libpf/user/Handle.h>
48#ifndef SWIG
50#include <libpf/core/Enumerator.h>
51#endif
52
53/* FORWARD REFERENCES */
54//
55namespace Libpf {
56namespace Persistency {
57struct TypeDescriptor;
58} // namespace User
59} // namespace Libpf
60
61/* FUNCTIONS */
62//
63
64namespace Libpf {
65namespace User {
66
67enum ErrorCode { ERROR_OK = 0,
70 ERROR_SERVER = -93
71}; // enum ErrorCode
72
83
86
87#ifndef SWIG
88void addLocale(const std::string &locale); // to be called by derived classes only
89void addEnumerator(const Libpf::Utility::EnumeratorInterface& ei); // to be called by derived classes only
90#endif // ifndef SWIG
91
93const std::string &name(void);
94
100const std::string &uuid(void);
101
103const std::string &description(void);
104
106const std::string &license(void);
107
109const std::string &version(void);
110
115const std::string &apiVersion(int &error);
116
119const std::string &defaultType(void);
120
126const std::vector<std::string> &supportedLocales(int &error);
127
133int setLocale(const std::string &locale);
134
137int activate(void);
138
139#ifndef SWIG
144const std::vector<Libpf::Persistency::TypeDescriptor> &listTypes(int &error);
145#endif
148
178std::string jsonListTypes(int &error);
179
180#ifndef SWIG
184const std::vector<Libpf::Core::Enumerator> &listEnumerators(int &error);
185#endif
187std::string jsonListEnumerators(int &error);
188
189#ifndef SWIG
193const Libpf::Persistency::TypeDescriptor *typeDescriptor(std::string name, int&error);
194#endif
198
224std::string jsonTypeDescriptor(std::string name, int &error);
225
226#ifndef SWIG
231const Libpf::Core::Enumerator *enumerator(const std::string &name, int &error);
232#endif
233
235
253Libpf::User::Handle createCase(const std::string &type, const std::string &tag, const std::string &description,
254 const std::map<std::string, std::string> &stringOptions,
255 const std::map<std::string, int> &integerOptions,
256 int &error);
258
274Libpf::User::Handle createCase(const std::string &jcd, int &error);
275
277
291Libpf::User::Handle createCase(const std::string &type, const std::string &tag, const std::string &description,
292 const std::string &jcd, int &error);
293
299
307Libpf::User::Handle duplicate(Libpf::User::Handle handle, const std::string &tag, const std::string &description, int &error);
308
312int purge(void);
313
316std::string errorMessage(int error);
317
323void setVerbosityGlobal(int verbosity);
324
325/*====================================================================================================================*/
326/*== struct KernelImplementation declaration =======================================================================*/
327/*====================================================================================================================*/
328
337 std::string name_;
338 std::string description_;
339 std::string license_;
340 std::string version_;
341 std::string apiVersion_;
342 std::string defaultType_;
344 std::string uuid_;
345
346 bool valid_; //< every Kernel method must check this attribute before execution
347
349 std::map<Libpf::User::Handle, Libpf::User::CaseDescriptor> handleMap_;
350
351 std::vector<std::string> supportedLocales_;
352 std::string locale_;
353
354 std::vector<Libpf::Core::Enumerator> enumerators_;
355
356 KernelImplementation(std::string name, std::string description, std::string license, std::string version, std::string defaultType, std::string uuid);
357}; // struct KernelImplementation
358
359} // namespace User
360} // namespace Libpf
361
362#endif // LIBPF_USER_KERNEL_H
Interface to the CaseDescriptor class.
Interface to the Handle class.
Opaque pointer to a server-side resource i.e. a Case object.
Definition: Handle.h:43
const std::string & version(void)
void addLocale(const std::string &locale)
int setLocale(const std::string &locale)
sets the locale for internationalization; the default value is en
std::string jsonTypeDescriptor(std::string name, int &error)
queries a specific type
int purge(void)
remove all existing case instances
const std::string & apiVersion(int &error)
query the Model User API version
const std::vector< Libpf::Core::Enumerator > & listEnumerators(int &error)
queries the available enumerators
void uninitializeKernel(void)
std::string jsonListTypes(int &error)
queries the available types
std::string jsonListEnumerators(int &error)
const std::string & defaultType(void)
query the default type
void initializeKernel(void)
std::string errorMessage(int error)
const std::vector< std::string > & supportedLocales(int &error)
query the locales supported by the server side derived classes can re-implement this method to overri...
void setVerbosityGlobal(int verbosity)
const std::string & name(void)
const Libpf::Core::Enumerator * enumerator(const std::string &name, int &error)
queries a specific enumerator
const std::vector< Libpf::Persistency::TypeDescriptor > & listTypes(int &error)
queries the available types
int activate(void)
performs activation of the server side
Libpf::User::Handle createCase(const std::string &type, const std::string &tag, const std::string &description, const std::map< std::string, std::string > &stringOptions, const std::map< std::string, int > &integerOptions, int &error)
creates a new case instance
Libpf::User::Handle duplicate(Libpf::User::Handle handle, const std::string &tag, const std::string &description, int &error)
duplicate an existing case instance
const Libpf::Persistency::TypeDescriptor * typeDescriptor(std::string name, int &error)
const std::string & description(void)
ErrorCode
Definition: Kernel.h:67
@ ERROR_ARGUMENT
supplied argument is not valid
Definition: Kernel.h:69
@ ERROR_OK
no error
Definition: Kernel.h:67
@ ERROR_SERVER
server-side error while performing the operation
Definition: Kernel.h:70
@ ERROR_COMMUNICATION
communication problem
Definition: Kernel.h:68
const std::string & uuid(void)
int remove(Libpf::User::Handle handle)
remove an existing case instance
const std::string & license(void)
void addEnumerator(const Libpf::Utility::EnumeratorInterface &ei)
Definition: Case.h:35
Describes the capabilities of a service / standalone kernel for a specific simulation domain.
Definition: Kernel.h:336
std::string apiVersion_
UTF-8 encoded string.
Definition: Kernel.h:341
std::string name_
UTF-8 encoded string; acts as URN in the kernel: namespace.
Definition: Kernel.h:337
std::string version_
UTF-8 encoded string.
Definition: Kernel.h:340
std::string license_
UTF-8 encoded string.
Definition: Kernel.h:339
std::vector< Libpf::Core::Enumerator > enumerators_
Definition: Kernel.h:354
bool valid_
Definition: Kernel.h:346
std::vector< std::string > supportedLocales_
Definition: Kernel.h:351
std::map< Libpf::User::Handle, Libpf::User::CaseDescriptor > handleMap_
maps handles to the internal data structure that holds all the information to restore the state of a ...
Definition: Kernel.h:349
std::string uuid_
service UUID (Universally Unique Identifier), uniquely identifies a specific service + service versio...
Definition: Kernel.h:344
std::string defaultType_
Definition: Kernel.h:342
KernelImplementation(std::string name, std::string description, std::string license, std::string version, std::string defaultType, std::string uuid)
std::string description_
UTF-8 encoded string.
Definition: Kernel.h:338
std::string locale_
Definition: Kernel.h:352