Python, Java, C++: more modifications to fit struture to arch doc
[smartapi.git] / Common / C++ / SmartAPI / smartapi / model / Activity.h
1 #ifndef _ACTIVITY_H_
2 #define _ACTIVITY_H_
3
4 #include "smartapi/common/RESOURCE.h"
5 #include "smartapi/model/Evaluation.h"
6 #include "smartapi/model/Input.h"
7 #include "smartapi/model/Output.h"
8 #include "smartapi/model/Availability.h"
9 #include "smartapi/model/Authorization.h"
10 #include "smartapi/model/InterfaceAddress.h"
11 #include "smartapi/model/Entity.h"
12 #include "smartapi/model/TimeSeries.h"
13 #include "smartapi/model/TemporalContext.h"
14
15 #include "smartapi/rdf/PropertyList.h"
16 #include "smartapi/rdf/Variant.h"
17 #include "smartapi/rdf/Resource.h"
18 #include "smartapi/rdf/Statement.h"
19 #include "smartapi/rdf/Model.h"
20
21 #include <QString>
22 #include <QList>
23
24 class Activity : public Evaluation
25 {
26 public:
27         Activity(QString uri = QString());
28         Activity(Activity* a);
29         ~Activity();
30         
31         Resource* serialize(Model* model);
32         void parse(Statement* statement);
33         virtual void clearReferences(QSet<GraphItem*>* trash);
34         
35         bool hasInput()                                                                                         { return mInputs.length() > 0; }
36         PropertyList<Input*> getInputs()                                                        { return mInputs; }
37         void setInput(Input* input)                                                                     { addInput(input); }
38         void addInput(Input* input)                                                                     { mInputs.append(input); }
39         Input* firstInput();
40         Input* newInput();
41         
42         bool hasOutput()                                                                                        { return mOutputs.length() > 0; }
43         PropertyList<Output*> getOutputs()                                                      { return mOutputs; }
44         void setOutput(Output* output)                                                          { addOutput(output); }
45         void addOutput(Output* output)                                                          { mOutputs.append(output); }
46         Output* firstOutput();
47         Output* newOutput();
48         
49         bool hasAvailability()                                                                          { return !mAvailabilities.isEmpty(); }
50         PropertyList<Availability*> getAvailabilities()                         { return mAvailabilities; }
51         void addAvailability(Availability* availability)                        { mAvailabilities.append(availability); }
52
53         bool hasDataAvailability()                                                                      { return !mDataAvailabilities.isEmpty(); }
54         PropertyList<Availability*> getDataAvailabilities()                     { return mDataAvailabilities; }
55         void addDataAvailability(Availability* availability)            { mDataAvailabilities.append(availability); }
56
57         bool hasInterface()                                                                                     { return (mInterfaces.length() > 0); }
58         PropertyList<InterfaceAddress*> getInterfaces()                         { return mInterfaces; }
59         InterfaceAddress* getHTTPInterface();
60         void setInterface(InterfaceAddress* interfaceAddress)           { addInterface(interfaceAddress); }
61         void addInterface(InterfaceAddress* interfaceAddress)           { mInterfaces.append(interfaceAddress); }
62
63         bool hasEntity()                                                                                        { return (mEntities.length() > 0); }
64         PropertyList<Entity*> getEntities()                                                     { return mEntities; }
65         void addEntity(Entity* entity)                                                          { mEntities.append(entity); }
66         void setEntities(PropertyList<Entity*> entities)                        { mEntities = entities; add(PROPERTY__ENTITY, &mEntities);  }
67         void unlinkEntities();
68         Entity* firstEntity()                                                                           { if (mEntities.length() > 0) return mEntities.at(0); return NULL; }
69         Entity* newEntity(QString identifier = QString());
70
71         bool hasAuthorization()                                                                         { return (mAuthorization != NULL); }
72         Authorization* getAuthorization()                                                       { return mAuthorization; }
73         void setAuthorization(Authorization* auth)                                      { add(PROPERTY__AUTHORIZATION, auth); mAuthorization = auth; }
74
75         bool hasTraverseUntil()                                                                         { return (mTraverseUntil != NULL); }
76         int getTraverseUntil()                                                                          { PROPERTYVAL(mTraverseUntil, asInt, -1); }
77         void setTraverseUntil(Variant* depth)                                           { mTraverseUntil = depth; }
78         void setTraverseUntil(int depth)                                                        { setTraverseUntil(new Variant(depth)); }
79
80         bool hasTraverseTo()                                                                            { return !mTraverseTo.isEmpty(); }
81         PropertyList<Variant*> getTraverseTo()                                          { return mTraverseTo; }
82         void setTraverseTo(PropertyList<Variant*> depths)                       { mTraverseTo = depths; add(PROPERTY__TRAVERSETO, &mTraverseTo); }
83         void setTraverseTo(int depth)                                                           { mTraverseTo.isEmpty(); addTraverseTo(depth); }
84         void addTraverseTo(Variant* depth)                                                      { mTraverseTo.append(depth); }
85         void addTraverseTo(int depth)                                                           { addTraverseTo(new Variant(depth)); }
86
87 private:
88         Authorization* mAuthorization;
89         PropertyList<Input*> mInputs;
90         PropertyList<Output*> mOutputs;
91         PropertyList<Availability*> mAvailabilities;
92         PropertyList<Availability*> mDataAvailabilities;
93         PropertyList<InterfaceAddress*> mInterfaces;
94         PropertyList<Entity*> mEntities;
95         Variant* mTraverseUntil;
96         PropertyList<Variant*> mTraverseTo;
97         //QSet<int> mTraverseTo;
98 };
99
100 #endif // _ACTIVITY_H_