C++: Added scriptdependentpricespecification
[smartapi.git] / Common / C++ / SmartAPI / smartapi / common / ClassMapper.h
1 #ifndef __CLASSMAPPER_H__
2 #define __CLASSMAPPER_H__
3
4 #include "smartapi/rdf/RDFNode.h"
5 #include "smartapi/rdf/Model.h"
6 #include "smartapi/rdf/Variant.h"
7 #include "smartapi/common/RESOURCE.h"
8 #include "smartapi/model/Ability.h"
9 #include "smartapi/model/AbstractEntity.h"
10 #include "smartapi/model/Activity.h"
11 #include "smartapi/model/Account.h"
12 #include "smartapi/model/AccountAction.h"
13 #include "smartapi/model/AccountTransaction.h"
14 #include "smartapi/model/Address.h"
15 #include "smartapi/model/Availability.h"
16 #include "smartapi/model/Authorization.h"
17 #include "smartapi/model/Capacity.h"
18 #include "smartapi/model/Condition.h"
19 #include "smartapi/model/Contract.h"
20 #include "smartapi/model/Controllability.h"
21 #include "smartapi/model/Coordinates.h"
22 #include "smartapi/model/Device.h"
23 #include "smartapi/model/Direction.h"
24 #include "smartapi/model/Entity.h"
25 #include "smartapi/model/Error.h"
26 #include "smartapi/model/Evaluation.h"
27 #include "smartapi/model/HeartBeat.h"
28 #include "smartapi/model/Input.h"
29 #include "smartapi/model/InterfaceAddress.h"
30 //#include "smartapi/model/Location.h"
31 #include "smartapi/model/Map.h"
32 #include "smartapi/model/Message.h"
33 #include "smartapi/model/Notification.h"
34 #include "smartapi/model/Obj.h"
35 #include "smartapi/model/Offering.h"
36 #include "smartapi/model/Orientation.h"
37 #include "smartapi/model/Organization.h"
38 #include "smartapi/model/Output.h"
39 #include "smartapi/model/Parameter.h"
40 #include "smartapi/model/Person.h"
41 #include "smartapi/model/PhysicalEntity.h"
42 #include "smartapi/model/PriceSpecification.h"
43 #include "smartapi/model/Provenance.h"
44 #include "smartapi/model/Request.h"
45 #include "smartapi/model/Response.h"
46 #include "smartapi/model/Ring.h"
47 #include "smartapi/model/Route.h"
48 #include "smartapi/model/Service.h"
49 #include "smartapi/model/ServiceProvider.h"
50 #include "smartapi/model/Size.h"
51 #include "smartapi/model/SomeItems.h"
52 #include "smartapi/model/Status.h"
53 #include "smartapi/model/SystemOfInterest.h"
54 #include "smartapi/model/SubscriptionPriceSpecification.h"
55 #include "smartapi/model/UnitPriceSpecification.h"
56
57 #include "smartapi/model/LinearCalculation.h"
58 #include "smartapi/model/PriceListSpecification.h"
59 #include "smartapi/model/TimeDependentPriceSpecification.h"
60 #include "smartapi/model/TimeDependentPriceListSpecification.h"
61 #include "smartapi/model/PropertyDependentPriceSpecification.h"
62 #include "smartapi/model/DurationDependentPriceSpecification.h"
63 #include "smartapi/model/TravelDistanceDependentPriceSpecification.h"
64 #include "smartapi/model/DistanceDependentPriceSpecification.h"
65 #include "smartapi/model/ScriptDependentPriceSpecification.h"
66 #include "smartapi/model/ZoneDependentPriceSpecification.h"
67 #include "smartapi/model/ZoneTravelDependentPriceSpecification.h"
68 #include "smartapi/model/TravelDistanceDurationDependentPriceSpecification.h"
69 #include "smartapi/model/ZoneTravelDurationDependentPriceSpecification.h"
70 #include "smartapi/model/DurationAtDistanceDependentPriceSpecification.h"
71 #include "smartapi/model/DurationAtZoneDependentPriceSpecification.h"
72 #include "smartapi/model/ObjectOperationDependentPriceSpecification.h"
73
74 #include "smartapi/model/TemporalContext.h"
75 #include "smartapi/model/TimeSeries.h"
76 #include "smartapi/model/Transaction.h"
77 #include "smartapi/model/TypeAndQuantityNode.h"
78 #include "smartapi/model/ValueObject.h"
79 #include "smartapi/model/Velocity.h"
80 #include "smartapi/model/Waypoint.h"
81 #include "smartapi/model/Waypoints.h"
82 #include "smartapi/model/Zone.h"
83
84 class ClassMapper
85 {
86 public:
87
88         ClassMapper() {}
89
90         static bool isClass(QString type)
91         {
92                 Obj* o = getClass(type);
93                 if (o != NULL) { delete o; return true; }
94                 return false;
95         }
96
97         Obj* getClass(QStringList typelist)
98         {
99                 for (int i = 0; i < typelist.length(); i++) {
100                         Obj* o = getClass(typelist.at(i));
101                         if (o != NULL) return o;
102                 }
103                 return NULL;
104         }
105         
106         Obj* getClass(QList<QString> typelist)
107         {
108                 for (int i = 0; i < typelist.length(); i++) {
109                         Obj* o = getClass(typelist.at(i));
110                         if (o != NULL) return o;
111                 }
112                 return NULL;
113         }
114         
115         Obj* getClass(QList<QString> typelist, Obj* oo)
116         {
117                 if (typelist.length() == 0) return new Obj(oo); // qDebug() << "WARNING, cannot copy an object with no type information";
118                 for (int i = 0; i < typelist.length(); i++) {
119                         Obj* o = getClass(typelist.at(i), oo);
120                         if (o != NULL) return o;
121                 }
122                 return NULL;
123         }
124
125         static Obj* getClass(QString type)
126         {
127                 if (type == RESOURCE__ABILITY) return new Ability();
128                 if (type == RESOURCE__ABSTRACTENTITY) return new AbstractEntity();
129                 if (type == RESOURCE__ACCOUNT) return new Account();
130                 if (type == RESOURCE__ACCOUNTACTION) return new AccountAction();
131                 if (type == RESOURCE__ACCOUNTTRANSACTION) return new AccountTransaction();
132                 if (type == RESOURCE__ACTIVITY) return new Activity();
133                 if (type == RESOURCE__AUTHORIZATION) return new Authorization();
134                 if (type == RESOURCE__AVAILABILITY) return new Availability();
135                 if (type == RESOURCE__CAPACITY) return new Capacity();
136                 if (type == RESOURCE__CONDITION) return new Condition();
137                 if (type == RESOURCE__CONTRACT) return new Contract();
138                 if (type == RESOURCE__CONTROLLABILITY) return new Controllability();
139                 if (type == RESOURCE__DEVICE) return new Device();
140                 if (type == RESOURCE__DIRECTION) return new Direction();
141                 if (type == RESOURCE__ENTITY) return new Entity();
142                 if (type == RESOURCE__ERROR) return new Error();
143                 if (type == RESOURCE__EVALUATION) return new Evaluation();
144                 if (type == RESOURCE__HEARTBEAT) return new HeartBeat();
145                 if (type == RESOURCE__INPUT) return new Input();
146                 if (type == RESOURCE__INTERFACEADDRESS) return new InterfaceAddress();
147                 
148                 if (type == RESOURCE__MAP) return new Map();
149                 if (type == RESOURCE__MESSAGE) return new Message();
150                 if (type == RESOURCE__NOTIFICATION) return new Notification();
151                 if (type == RESOURCE__OBJECT) return new Obj();
152                 if (type == RESOURCE__ORGANIZATION) return new Organization();
153                 if (type == RESOURCE__ORIENTATION) return new Orientation();
154                 if (type == RESOURCE__OUTPUT) return new Output();
155                 if (type == RESOURCE__PARAMETER) return new Parameter();
156                 if (type == RESOURCE__PERSON) return new Person();
157                 if (type == RESOURCE__PHYSICALENTITY) return new PhysicalEntity();
158                 if (type == RESOURCE__PROVENANCE) return new Provenance();
159                 if (type == RESOURCE__REQUEST) return new Request();
160                 if (type == RESOURCE__RESPONSE) return new Response();
161                 if (type == RESOURCE__RING) return new Ring();
162                 if (type == RESOURCE__ROUTE) return new Route();
163                 if (type == RESOURCE__SERVICE) return new Service();
164                 if (type == RESOURCE__SERVICEPROVIDER) return new ServiceProvider();
165                 if (type == RESOURCE__SIZE) return new Size();
166                 if (type == RESOURCE__SOMEITEMS) return new SomeItems();
167                 if (type == RESOURCE__VELOCITY) return new Velocity();
168                 if (type == RESOURCE__STATUS) return new Status();
169                 if (type == RESOURCE__SYSTEMOFINTEREST) return new SystemOfInterest();
170                 if (type == RESOURCE__TEMPORALCONTEXT) return new TemporalContext();
171                 if (type == RESOURCE__TIMESERIES) return new TimeSeries();
172                 if (type == RESOURCE__TYPEANDQUANTITYNODE) return new TypeAndQuantityNode();
173                 if (type == RESOURCE__VALUEOBJECT) return new ValueObject();
174                 if (type == RESOURCE__WAYPOINT) return new Waypoint();
175                 if (type == RESOURCE__WAYPOINTS) return new Waypoints();
176                 if (type == RESOURCE__ZONE) return new Zone();
177                 
178                 if (type == RESOURCE__ADDRESS) return new Address();
179                 if (type == RESOURCE__GEO_POINT) return new Coordinates();
180
181                 if (type == RESOURCE__OFFERING) return new Offering();
182                 if (type == RESOURCE__PRICESPECIFICATION) return new PriceSpecification();
183                 if (type == RESOURCE__UNITPRICESPECIFICATION) return new UnitPriceSpecification();
184                 if (type == RESOURCE__SUBSCRIPTIONPRICESPECIFICATION) return new SubscriptionPriceSpecification();
185                 if (type == RESOURCE__TRANSACTION) return new Transaction();
186
187                 if (type == RESOURCE__PRICELISTSPECIFICATION) return new PriceListSpecification();
188                 if (type == RESOURCE__TIMEDEPENDENTPRICESPECIFICATION) return new TimeDependentPriceSpecification();
189                 if (type == RESOURCE__TIMEDEPENDENTPRICELISTSPECIFICATION) return new TimeDependentPriceListSpecification();
190                 if (type == RESOURCE__PROPERTYDEPENDENTPRICESPECIFICATION) return new PropertyDependentPriceSpecification();
191                 if (type == RESOURCE__DURATIONDEPENDENTPRICESPECIFICATION) return new DurationDependentPriceSpecification();
192                 if (type == RESOURCE__LINEARCALCULATION) return new LinearCalculation();
193                 if (type == RESOURCE__TRAVELDISTANCEDEPENDENTPRICESPECIFICATION) return new TravelDistanceDependentPriceSpecification();
194                 if (type == RESOURCE__DISTANCEDEPENDENTPRICESPECIFICATION) return new DistanceDependentPriceSpecification();
195                 if (type == RESOURCE__SCRIPTDEPENDENTPRICESPECIFICATION) return new ScriptDependentPriceSpecification();
196                 if (type == RESOURCE__ZONEDEPENDENTPRICESPECIFICATION) return new ZoneDependentPriceSpecification();
197                 if (type == RESOURCE__ZONETRAVELDEPENDENTPRICESPECIFICATION) return new ZoneTravelDependentPriceSpecification();
198                 if (type == RESOURCE__TRAVELDISTANCEDURATIONDEPENDENTPRICESPECIFICATION) return new TravelDistanceDurationDependentPriceSpecification();
199                 if (type == RESOURCE__ZONETRAVELDURATIONDEPENDENTPRICESPECIFICATION) return new ZoneTravelDurationDependentPriceSpecification();
200                 if (type == RESOURCE__DURATIONATDISTANCEDEPENDENTPRICESPECIFICATION) return new DurationAtDistanceDependentPriceSpecification();
201                 if (type == RESOURCE__DURATIONATZONEDEPENDENTPRICESPECIFICATION) return new DurationAtZoneDependentPriceSpecification();
202                 if (type == RESOURCE__OBJECTOPERATIONDEPENDENTPRICESPECIFICATION) return new ObjectOperationDependentPriceSpecification();
203
204                 // qWarning() << "Classmapper could not find an object of type" << type;
205                 return NULL;
206         }
207         
208         Obj* getClass(QString type, Obj* o)
209         {
210                 if (type == RESOURCE__ABILITY) return new Ability((Ability*)o);
211                 if (type == RESOURCE__ABSTRACTENTITY) return new AbstractEntity((AbstractEntity*)o);
212                 if (type == RESOURCE__ACCOUNT) return new Account((Account*)o);
213                 if (type == RESOURCE__ACCOUNTACTION) return new AccountAction((AccountAction*)o);
214                 if (type == RESOURCE__ACCOUNTTRANSACTION) return new AccountTransaction((AccountTransaction*)o);
215                 if (type == RESOURCE__ACTIVITY) return new Activity((Activity*)o);
216                 if (type == RESOURCE__AUTHORIZATION) return new Authorization((Authorization*)o);
217                 if (type == RESOURCE__AVAILABILITY) return new Availability((Availability*)o);
218                 if (type == RESOURCE__CAPACITY) return new Capacity((Capacity*)o);
219                 if (type == RESOURCE__CONDITION) return new Condition((Condition*)o);
220                 if (type == RESOURCE__CONTRACT) return new Contract((Contract*)o);
221                 if (type == RESOURCE__CONTROLLABILITY) return new Controllability((Controllability*)o);
222                 if (type == RESOURCE__DEVICE) return new Device((Device*)o);
223                 if (type == RESOURCE__DIRECTION) return new Direction((Direction*)o);
224                 if (type == RESOURCE__ENTITY) return new Entity((Entity*)o);
225                 if (type == RESOURCE__ERROR) return new Error((Error*)o);
226                 if (type == RESOURCE__EVALUATION) return new Evaluation((Evaluation*)o);
227                 if (type == RESOURCE__HEARTBEAT) return new HeartBeat((HeartBeat*)o);
228                 if (type == RESOURCE__INPUT) return new Input((Input*)o);
229                 if (type == RESOURCE__INTERFACEADDRESS) return new InterfaceAddress((InterfaceAddress*)o);
230                 if (type == RESOURCE__MAP) return new Map((Map*)o);
231                 if (type == RESOURCE__MESSAGE) return new Message((Message*)o);
232                 if (type == RESOURCE__NOTIFICATION) return new Notification((Notification*)o);
233                 if (type == RESOURCE__OBJECT) return new Obj((Obj*)o);
234                 if (type == RESOURCE__ORGANIZATION) return new Organization((Organization*)o);
235                 if (type == RESOURCE__ORIENTATION) return new Orientation((Orientation*)o);
236                 if (type == RESOURCE__OUTPUT) return new Output((Output*)o);
237                 if (type == RESOURCE__PARAMETER) return new Parameter((Parameter*)o);
238                 if (type == RESOURCE__PERSON) return new Person((Person*)o);
239                 if (type == RESOURCE__PHYSICALENTITY) return new PhysicalEntity((PhysicalEntity*)o);
240                 if (type == RESOURCE__PROVENANCE) return new Provenance((Provenance*)o);
241                 if (type == RESOURCE__REQUEST) return new Request((Request*)o);
242                 if (type == RESOURCE__RESPONSE) return new Response((Response*)o);
243                 if (type == RESOURCE__RING) return new Ring((Ring*)o);
244                 if (type == RESOURCE__ROUTE) return new Route((Route*)o);
245                 if (type == RESOURCE__SERVICE) return new Service((Service*)o);
246                 if (type == RESOURCE__SERVICEPROVIDER) return new ServiceProvider((ServiceProvider*)o);
247                 if (type == RESOURCE__SIZE) return new Size((Size*)o);
248                 if (type == RESOURCE__VELOCITY) return new Velocity((Velocity*)o);
249                 if (type == RESOURCE__SOMEITEMS) return new SomeItems((SomeItems*)o);
250                 if (type == RESOURCE__STATUS) return new Status((Status*)o);
251                 if (type == RESOURCE__SYSTEMOFINTEREST) return new SystemOfInterest((SystemOfInterest*)o);
252                 if (type == RESOURCE__TEMPORALCONTEXT) return new TemporalContext((TemporalContext*)o);
253                 if (type == RESOURCE__TIMESERIES) return new TimeSeries((TimeSeries*)o);
254                 if (type == RESOURCE__TYPEANDQUANTITYNODE) return new TypeAndQuantityNode((TypeAndQuantityNode*)o);
255                 if (type == RESOURCE__VALUEOBJECT) return new ValueObject((ValueObject*)o);
256                 if (type == RESOURCE__WAYPOINT) return new Waypoint((Waypoint*)o);
257                 if (type == RESOURCE__WAYPOINTS) return new Waypoints((Waypoints*)o);
258                 if (type == RESOURCE__ZONE) return new Zone((Zone*)o);
259                 
260                 if (type == RESOURCE__ADDRESS) return new Address((Address*)o);
261                 if (type == RESOURCE__GEO_POINT) return new Coordinates((Coordinates*)o);
262
263                 if (type == RESOURCE__OFFERING) return new Offering((Offering*)o);
264                 if (type == RESOURCE__PRICESPECIFICATION) return new PriceSpecification((PriceSpecification*)o);
265                 if (type == RESOURCE__UNITPRICESPECIFICATION) return new UnitPriceSpecification((UnitPriceSpecification*)o);
266                 if (type == RESOURCE__SUBSCRIPTIONPRICESPECIFICATION) return new SubscriptionPriceSpecification((SubscriptionPriceSpecification*) o);
267                 if (type == RESOURCE__TRANSACTION) return new Transaction((Transaction*)o);
268
269                 if (type == RESOURCE__PRICELISTSPECIFICATION) return new PriceListSpecification((PriceListSpecification*)o);
270                 if (type == RESOURCE__TIMEDEPENDENTPRICESPECIFICATION) return new TimeDependentPriceSpecification((TimeDependentPriceSpecification*)o);
271                 if (type == RESOURCE__PROPERTYDEPENDENTPRICESPECIFICATION) return new PropertyDependentPriceSpecification((PropertyDependentPriceSpecification*)o);
272                 if (type == RESOURCE__DURATIONDEPENDENTPRICESPECIFICATION) return new DurationDependentPriceSpecification((DurationDependentPriceSpecification*)o);
273                 if (type == RESOURCE__LINEARCALCULATION) return new LinearCalculation((LinearCalculation*)o);
274                 if (type == RESOURCE__TRAVELDISTANCEDEPENDENTPRICESPECIFICATION) return new TravelDistanceDependentPriceSpecification((TravelDistanceDependentPriceSpecification*)o);
275                 if (type == RESOURCE__DISTANCEDEPENDENTPRICESPECIFICATION) return new DistanceDependentPriceSpecification((DistanceDependentPriceSpecification*)o);
276                 if (type == RESOURCE__SCRIPTDEPENDENTPRICESPECIFICATION) return new ScriptDependentPriceSpecification((ScriptDependentPriceSpecification*)o);
277                 if (type == RESOURCE__ZONEDEPENDENTPRICESPECIFICATION) return new ZoneDependentPriceSpecification((ZoneDependentPriceSpecification*)o);
278                 if (type == RESOURCE__ZONETRAVELDEPENDENTPRICESPECIFICATION) return new ZoneTravelDependentPriceSpecification((ZoneTravelDependentPriceSpecification*)o);
279                 if (type == RESOURCE__TRAVELDISTANCEDURATIONDEPENDENTPRICESPECIFICATION) return new TravelDistanceDurationDependentPriceSpecification((TravelDistanceDurationDependentPriceSpecification*)o);
280                 if (type == RESOURCE__ZONETRAVELDURATIONDEPENDENTPRICESPECIFICATION) return new ZoneTravelDurationDependentPriceSpecification((ZoneTravelDurationDependentPriceSpecification*)o);
281                 if (type == RESOURCE__DURATIONATDISTANCEDEPENDENTPRICESPECIFICATION) return new DurationAtDistanceDependentPriceSpecification((DurationAtDistanceDependentPriceSpecification*)o);
282                 if (type == RESOURCE__DURATIONATZONEDEPENDENTPRICESPECIFICATION) return new DurationAtZoneDependentPriceSpecification((DurationAtZoneDependentPriceSpecification*)o);
283                 if (type == RESOURCE__OBJECTOPERATIONDEPENDENTPRICESPECIFICATION) return new ObjectOperationDependentPriceSpecification((ObjectOperationDependentPriceSpecification*)o);
284
285                 qWarning() << "Classmapper could not find the requested type of object:" << type;
286                 return NULL;
287         }
288         
289         Obj* castToClass(Obj* o)
290         {
291                 if (Ability* oo                         = dynamic_cast<Ability*>(o)) return oo;
292                 if (AbstractEntity* oo          = dynamic_cast<AbstractEntity*>(o)) return oo;
293                 if (Account* oo                         = dynamic_cast<Account*>(o)) return oo;
294                 if (AccountAction* oo           = dynamic_cast<AccountAction*>(o)) return oo;
295                 if (AccountTransaction* oo      = dynamic_cast<AccountTransaction*>(o)) return oo;
296                 if (Activity* oo                        = dynamic_cast<Activity*>(o)) return oo;
297                 if (Authorization* oo           = dynamic_cast<Authorization*>(o)) return oo;
298                 if (Availability* oo            = dynamic_cast<Availability*>(o)) return oo;
299                 if (Capacity* oo                        = dynamic_cast<Capacity*>(o)) return oo;
300                 if (Condition* oo                       = dynamic_cast<Condition*>(o)) return oo;
301                 if (Contract* oo                        = dynamic_cast<Contract*>(o)) return oo;
302                 if (Controllability* oo         = dynamic_cast<Controllability*>(o)) return oo;
303                 if (Device* oo                          = dynamic_cast<Device*>(o)) return oo;
304                 if (Direction* oo                       = dynamic_cast<Direction*>(o)) return oo;
305                 if (Entity* oo                          = dynamic_cast<Entity*>(o)) return oo;
306                 if (Error* oo                           = dynamic_cast<Error*>(o)) return oo;
307                 if (Error* oo                           = dynamic_cast<Error*>(o)) return oo;
308                 if (Evaluation* oo                      = dynamic_cast<Evaluation*>(o)) return oo;
309                 if (HeartBeat* oo                       = dynamic_cast<HeartBeat*>(o)) return oo;
310                 if (Input* oo                           = dynamic_cast<Input*>(o)) return oo;
311                 if (InterfaceAddress* oo        = dynamic_cast<InterfaceAddress*>(o)) return oo;
312                 if (Map* oo                             = dynamic_cast<Map*>(o)) return oo;
313                 if (Message* oo                         = dynamic_cast<Message*>(o)) return oo;
314                 if (Notification* oo            = dynamic_cast<Notification*>(o)) return oo;
315                 if (Obj* oo                             = dynamic_cast<Obj*>(o)) return oo;
316                 if (Organization* oo            = dynamic_cast<Organization*>(o)) return oo;
317                 if (Orientation* oo             = dynamic_cast<Orientation*>(o)) return oo;
318                 if (Output* oo                          = dynamic_cast<Output*>(o)) return oo;
319                 if (Parameter* oo                       = dynamic_cast<Parameter*>(o)) return oo;
320                 if (Person* oo                          = dynamic_cast<Person*>(o)) return oo;
321                 if (PhysicalEntity* oo          = dynamic_cast<PhysicalEntity*>(o)) return oo;
322                 if (Provenance* oo                      = dynamic_cast<Provenance*>(o)) return oo;
323                 if (Request* oo                         = dynamic_cast<Request*>(o)) return oo;
324                 if (Response* oo                        = dynamic_cast<Response*>(o)) return oo;
325                 if (Ring* oo                            = dynamic_cast<Ring*>(o)) return oo;
326                 if (Route* oo                           = dynamic_cast<Route*>(o)) return oo;
327                 if (Service* oo                         = dynamic_cast<Service*>(o)) return oo;
328                 if (ServiceProvider* oo         = dynamic_cast<ServiceProvider*>(o)) return oo;
329                 if (Size* oo                            = dynamic_cast<Size*>(o)) return oo;
330                 if (SomeItems* oo                       = dynamic_cast<SomeItems*>(o)) return oo;
331                 if (Velocity* oo                        = dynamic_cast<Velocity*>(o)) return oo;
332                 if (Status* oo                          = dynamic_cast<Status*>(o)) return oo;
333                 if (SystemOfInterest* oo        = dynamic_cast<SystemOfInterest*>(o)) return oo;
334                 if (TemporalContext* oo         = dynamic_cast<TemporalContext*>(o)) return oo;
335                 if (TimeSeries* oo                      = dynamic_cast<TimeSeries*>(o)) return oo;
336                 if (TypeAndQuantityNode* oo = dynamic_cast<TypeAndQuantityNode*>(o)) return oo;
337                 if (ValueObject* oo             = dynamic_cast<ValueObject*>(o)) return oo;
338                 if (Waypoint* oo                        = dynamic_cast<Waypoint*>(o)) return oo;
339                 if (Waypoints* oo                       = dynamic_cast<Waypoints*>(o)) return oo;
340                 if (Zone* oo                            = dynamic_cast<Zone*>(o)) return oo;
341                 if (Address* oo                         = dynamic_cast<Address*>(o)) return oo;
342                 if (Coordinates* oo             = dynamic_cast<Coordinates*>(o)) { return oo; }
343                 if (Offering* oo                                                                                        = dynamic_cast<Offering*>(o)) { return oo; }
344                 if (PriceSpecification* oo                                                                      = dynamic_cast<PriceSpecification*>(o)) { return oo; }
345                 if (UnitPriceSpecification* oo                                                          = dynamic_cast<UnitPriceSpecification*>(o)) { return oo; }
346                 if (SubscriptionPriceSpecification* oo                                          = dynamic_cast<SubscriptionPriceSpecification*>(o)) { return oo; }
347                 if (Transaction* oo                                                                             = dynamic_cast<Transaction*>(o)) { return oo; }
348
349                 if (PriceListSpecification* oo                                                          = dynamic_cast<PriceListSpecification*>(o)) { return oo; }
350                 if (TimeDependentPriceSpecification* oo                                         = dynamic_cast<TimeDependentPriceSpecification*>(o)) { return oo; }
351                 if (PropertyDependentPriceSpecification* oo                                     = dynamic_cast<PropertyDependentPriceSpecification*>(o)) { return oo; }
352                 if (DurationDependentPriceSpecification* oo                                     = dynamic_cast<DurationDependentPriceSpecification*>(o)) { return oo; }
353                 if (LinearCalculation* oo                                                                       = dynamic_cast<LinearCalculation*>(o)) { return oo; }
354                 if (TravelDistanceDependentPriceSpecification* oo                       = dynamic_cast<TravelDistanceDependentPriceSpecification*>(o)) { return oo; }
355                 if (DistanceDependentPriceSpecification* oo                                     = dynamic_cast<DistanceDependentPriceSpecification*>(o)) { return oo; }
356                 if (ScriptDependentPriceSpecification* oo                                       = dynamic_cast<ScriptDependentPriceSpecification*>(o)) { return oo; }
357                 if (ZoneDependentPriceSpecification* oo                                         = dynamic_cast<ZoneDependentPriceSpecification*>(o)) { return oo; }
358                 if (ZoneTravelDependentPriceSpecification* oo                           = dynamic_cast<ZoneTravelDependentPriceSpecification*>(o)) { return oo; }
359                 if (TravelDistanceDurationDependentPriceSpecification* oo       = dynamic_cast<TravelDistanceDurationDependentPriceSpecification*>(o)) { return oo; }
360                 if (ZoneTravelDurationDependentPriceSpecification* oo           = dynamic_cast<ZoneTravelDurationDependentPriceSpecification*>(o)) { return oo; }
361                 if (DurationAtDistanceDependentPriceSpecification* oo           = dynamic_cast<DurationAtDistanceDependentPriceSpecification*>(o)) { return oo; }
362                 if (DurationAtZoneDependentPriceSpecification* oo                       = dynamic_cast<DurationAtZoneDependentPriceSpecification*>(o)) { return oo; }
363
364                 return o;
365         }
366         
367         RDFNode* serializeClass(Obj* o, Model* model)
368         {
369                 if (Ability* oo                         = dynamic_cast<Ability*>(o)) return oo->serialize(model);
370                 if (AbstractEntity* oo          = dynamic_cast<AbstractEntity*>(o)) return oo->serialize(model);
371                 if (Account* oo                         = dynamic_cast<Account*>(o)) return oo->serialize(model);
372                 if (AccountAction* oo           = dynamic_cast<AccountAction*>(o)) return oo->serialize(model);
373                 if (AccountTransaction* oo      = dynamic_cast<AccountTransaction*>(o)) return oo->serialize(model);
374                 if (Activity* oo                        = dynamic_cast<Activity*>(o)) return oo->serialize(model);
375                 if (Authorization* oo           = dynamic_cast<Authorization*>(o)) return oo->serialize(model);
376                 if (Availability* oo            = dynamic_cast<Availability*>(o)) return oo->serialize(model);
377                 if (Capacity* oo                        = dynamic_cast<Capacity*>(o)) return oo->serialize(model);
378                 if (Condition* oo                       = dynamic_cast<Condition*>(o)) return oo->serialize(model);
379                 if (Contract* oo                        = dynamic_cast<Contract*>(o)) return oo->serialize(model);
380                 if (Controllability* oo         = dynamic_cast<Controllability*>(o)) return oo->serialize(model);
381                 if (Device* oo                          = dynamic_cast<Device*>(o)) return oo->serialize(model);
382                 if (Direction* oo                       = dynamic_cast<Direction*>(o)) return oo->serialize(model);
383                 if (Entity* oo                          = dynamic_cast<Entity*>(o)) return oo->serialize(model);
384                 if (Error* oo                           = dynamic_cast<Error*>(o)) return oo->serialize(model);
385                 if (Error* oo                           = dynamic_cast<Error*>(o)) return oo->serialize(model);
386                 if (Evaluation* oo                      = dynamic_cast<Evaluation*>(o)) return oo->serialize(model);
387                 if (HeartBeat* oo                       = dynamic_cast<HeartBeat*>(o)) return oo->serialize(model);
388                 if (Input* oo                           = dynamic_cast<Input*>(o)) return oo->serialize(model);
389                 if (InterfaceAddress* oo        = dynamic_cast<InterfaceAddress*>(o)) return oo->serialize(model);
390                 if (Map* oo                             = dynamic_cast<Map*>(o)) return oo->serialize(model);
391                 if (Message* oo                         = dynamic_cast<Message*>(o)) return oo->serialize(model);
392                 if (Notification* oo            = dynamic_cast<Notification*>(o)) return oo->serialize(model);
393                 if (Organization* oo            = dynamic_cast<Organization*>(o)) return oo->serialize(model);
394                 if (Orientation* oo             = dynamic_cast<Orientation*>(o)) return oo->serialize(model);
395                 if (Output* oo                          = dynamic_cast<Output*>(o)) return oo->serialize(model);
396                 if (Parameter* oo                       = dynamic_cast<Parameter*>(o)) return oo->serialize(model);
397                 if (Person* oo                          = dynamic_cast<Person*>(o)) return oo->serialize(model);
398                 if (PhysicalEntity* oo          = dynamic_cast<PhysicalEntity*>(o)) return oo->serialize(model);
399                 if (Provenance* oo                      = dynamic_cast<Provenance*>(o)) return oo->serialize(model);
400                 if (Request* oo                         = dynamic_cast<Request*>(o)) return oo->serialize(model);
401                 if (Response* oo                        = dynamic_cast<Response*>(o)) return oo->serialize(model);
402                 if (Ring* oo                            = dynamic_cast<Ring*>(o)) return oo->serialize(model);
403                 if (Route* oo                           = dynamic_cast<Route*>(o)) return oo->serialize(model);
404                 if (Service* oo                         = dynamic_cast<Service*>(o)) return oo->serialize(model);
405                 if (ServiceProvider* oo         = dynamic_cast<ServiceProvider*>(o)) return oo->serialize(model);
406                 if (Size* oo                            = dynamic_cast<Size*>(o)) return oo->serialize(model);
407                 if (SomeItems* oo                       = dynamic_cast<SomeItems*>(o)) return oo->serialize(model);
408                 if (Velocity* oo                        = dynamic_cast<Velocity*>(o)) return oo->serialize(model);
409                 if (Status* oo                          = dynamic_cast<Status*>(o)) return oo->serialize(model);
410                 if (SystemOfInterest* oo        = dynamic_cast<SystemOfInterest*>(o)) return oo->serialize(model);
411                 if (TemporalContext* oo         = dynamic_cast<TemporalContext*>(o)) return oo->serialize(model);
412                 if (TimeSeries* oo                      = dynamic_cast<TimeSeries*>(o)) return oo->serialize(model);
413                 if (TypeAndQuantityNode* oo = dynamic_cast<TypeAndQuantityNode*>(o)) return oo->serialize(model);
414                 if (ValueObject* oo             = dynamic_cast<ValueObject*>(o)) return oo->serialize(model);
415                 if (Waypoint* oo                        = dynamic_cast<Waypoint*>(o)) return oo->serialize(model);
416                 if (Waypoints* oo                       = dynamic_cast<Waypoints*>(o)) return oo->serialize(model);     
417                 if (Zone* oo                            = dynamic_cast<Zone*>(o)) return oo->serialize(model);
418                 if (Address* oo                         = dynamic_cast<Address*>(o)) return oo->serialize(model);
419                 if (Coordinates* oo             = dynamic_cast<Coordinates*>(o)) return oo->serialize(model);
420                 if (Offering* oo                        = dynamic_cast<Offering*>(o)) return oo->serialize(model);
421                 if (PriceSpecification* oo      = dynamic_cast<PriceSpecification*>(o)) return oo->serialize(model);
422                 if (UnitPriceSpecification* oo  = dynamic_cast<UnitPriceSpecification*>(o)) return oo->serialize(model);
423                 if (SubscriptionPriceSpecification* oo  = dynamic_cast<SubscriptionPriceSpecification*>(o)) return oo->serialize(model);
424                 if (Transaction* oo             = dynamic_cast<Transaction*>(o)) return oo->serialize(model);
425
426                 if (PriceListSpecification* oo                                                          = dynamic_cast<PriceListSpecification*>(o)) return oo->serialize(model);
427                 if (TimeDependentPriceSpecification* oo                                         = dynamic_cast<TimeDependentPriceSpecification*>(o)) return oo->serialize(model);
428                 if (PropertyDependentPriceSpecification* oo                                     = dynamic_cast<PropertyDependentPriceSpecification*>(o)) return oo->serialize(model);
429                 if (DurationDependentPriceSpecification* oo                                     = dynamic_cast<DurationDependentPriceSpecification*>(o)) return oo->serialize(model);
430                 if (LinearCalculation* oo                                                                       = dynamic_cast<LinearCalculation*>(o)) return oo->serialize(model);
431                 if (TravelDistanceDependentPriceSpecification* oo                       = dynamic_cast<TravelDistanceDependentPriceSpecification*>(o)) return oo->serialize(model);
432                 if (DistanceDependentPriceSpecification* oo                                     = dynamic_cast<DistanceDependentPriceSpecification*>(o)) return oo->serialize(model);
433                 if (ScriptDependentPriceSpecification* oo                                       = dynamic_cast<ScriptDependentPriceSpecification*>(o)) return oo->serialize(model);
434                 if (ZoneDependentPriceSpecification* oo                                         = dynamic_cast<ZoneDependentPriceSpecification*>(o)) return oo->serialize(model);
435                 if (ZoneTravelDependentPriceSpecification* oo                           = dynamic_cast<ZoneTravelDependentPriceSpecification*>(o)) return oo->serialize(model);
436                 if (TravelDistanceDurationDependentPriceSpecification* oo       = dynamic_cast<TravelDistanceDurationDependentPriceSpecification*>(o)) return oo->serialize(model);
437                 if (ZoneTravelDurationDependentPriceSpecification* oo           = dynamic_cast<ZoneTravelDurationDependentPriceSpecification*>(o)) return oo->serialize(model);
438                 if (DurationAtDistanceDependentPriceSpecification* oo           = dynamic_cast<DurationAtDistanceDependentPriceSpecification*>(o)) return oo->serialize(model);
439                 if (DurationAtZoneDependentPriceSpecification* oo                       = dynamic_cast<DurationAtZoneDependentPriceSpecification*>(o)) return oo->serialize(model);
440
441
442                 if (Obj* oo                             = dynamic_cast<Obj*>(o)) { return oo->serialize(model); }  // this must be in the list last
443         }
444 };
445
446 #endif // __CLASSMAPPER_H__