WSF
WsfExchange.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef WSFEXCHANGE_HPP
13#define WSFEXCHANGE_HPP
14
15#include <string>
16
17#include "UtCallbackHolder.hpp"
18#include "UtLog.hpp"
19class UtInput;
20#include "UtScriptAccessible.hpp"
21#include "WsfEvent.hpp"
23#include "wsf_export.h"
24
25#include "WsfNamed.hpp"
26class WsfPlatform;
27
28#include "WsfStringId.hpp"
29
39
40namespace WsfExchange
41{
42/* TODO - VS2015 The following only works in VS2015 or gcc 5.x due to dll
43 deadlock in vs2013 and older for mutexes un dictionary call.
44// Enumerated Transactor States:
45static const WsfStringId sSTATE_READY("STATE_READY");
46static const WsfStringId sSTATE_REQUESTING("STATE_REQUESTING");
47static const WsfStringId sSTATE_ACCEPTING("STATE_ACCEPTING");
48static const WsfStringId sSTATE_OFFERING("STATE_OFFERING");
49static const WsfStringId sSTATE_SUPPLYING("STATE_SUPPLYING");
50
51// Enumerated Transactor Events:
52static const WsfStringId sEVENT_REQUESTED("EVENT_REQUESTED");
53static const WsfStringId sEVENT_OFFERED("EVENT_OFFERED");
54static const WsfStringId sEVENT_ACCEPTED("EVENT_ACCEPTED");
55static const WsfStringId sEVENT_SUPPLIED("EVENT_SUPPLIED");
56static const WsfStringId sEVENT_RECEIVED("EVENT_RECEIVED");
57static const WsfStringId sEVENT_CANCELLED("EVENT_CANCELLED");
58static const WsfStringId sEVENT_OFFEROR_COMPLETED("EVENT_OFFEROR_COMPLETED");
59static const WsfStringId sEVENT_REQUESTOR_RESPONDED("EVENT_REQUESTOR_RESPONDED");
60*/
61
63
64// Enumerated Transactor States:
70
71// Enumerated Transactor Events:
80
81// ========================== CLASS TENDER =====================================
87{
88public:
89 static bool LoadInstance(UtInput& aInput, Tender*& aTenderPtr);
90
91 Tender();
92 Tender(WsfStringId aTypeId,
93 double aQuantity = 0.0,
94 double aRate = 0.0, // default is instantaneously, if possible
95 bool aIsService = false); // default is a commodity, not a service
96 Tender* Clone() const;
97
98 bool ProcessInput(UtInput& aInput);
99 bool Initialize();
100
101 void Null() { mQuantity = 0.0; }
102 bool IsNull() const { return mQuantity == 0.0; }
103
104 bool operator==(const Tender& aRhs) const;
105
106 double Rate() const { return mRate; }
107 bool IsService() const { return mIsService; }
108 bool IsCommodity() const { return !mIsService; }
109 double Interval() const { return (mRate == 0.0) ? 0.0 : mQuantity / mRate; }
110 double Quantity() const { return mQuantity; }
111 bool IsCompatibleWith(const Tender& aRhs) const;
112
113 void SetQuantity(double aValue) { SetQuantityP(aValue); }
114 void SetRate(double aValue) { SetRateP(aValue); }
115
116 // Note: This command is not normally for end-user to use...
117 void SetIsService(bool aValue);
118
119 void ConstrainQuantityTo(double aQuantity);
120 void ConstrainRateTo(double aRate);
121 void ConstrainTo(const Tender& aLimit);
122 double Decrement(double aAmount);
123 double Increment(double aAmount);
124
125 const char* GetScriptClassName() const;
126
127protected:
128 void SetQuantityP(double aQuantity);
129 void SetRateP(double aQuantity);
130
131 double mQuantity; // Max Quantity Requested or Offered.
132 double mRate; // Max Transactor Rate supported.
133 bool mIsService; // If true, is not a tangible commodity, but an action, such as "repair".
134
135}; // end WsfExchange::Tender
136
138{
139public:
149
150 Result(Value aStartValue = cPENDING)
151 : mValue(aStartValue){};
152 void Set(Value aValue) { mValue = aValue; }
153 Value Get() const { return mValue; }
154 bool IsDone() const;
155 void Restart();
156 std::string GetString() const;
157
158protected:
160};
161
163class Query
164{
165public:
166 Query(WsfSimulation* aSimulationPtr = nullptr);
167
168 // Const 'Gets':
169 bool IsOfferor() const { return mIsOfferor; }
170 bool IsService() const { return mIsService; }
171 bool IsDone() const { return mResult.IsDone(); }
172
173 size_t OwningIndex() const { return mOwningIndex; }
174 unsigned int RequestId() const { return mRequestId; }
175 size_t RequestingIndex() const { return mRequestingIndex; }
176 size_t RespondingIndex() const { return mRespondingIndex; }
177
178 WsfSimulation* GetSimulation() const { return mSimulationPtr; }
179
180 double OfferedQuantity() const { return mOfferedQuantity; }
181 double OfferedRate() const { return mOfferedRate; }
182 double DesiredQuantity() const { return mDesiredQuantity; }
183 double DesiredRate() const { return mDesiredRate; }
184 double NegotiatedQuantity() const { return mNegotiatedQuantity; }
185 double NegotiatedRate() const { return mNegotiatedRate; }
186 double NegotiatedInterval() const;
187
188 std::string GetResultString() const { return mResult.GetString(); }
189 Result::Value GetResultValue() const { return mResult.Get(); }
191 size_t OppositeIndex() const;
192
193 WsfStringId ItemId() const { return mItemId; }
194 WsfStringId StateId() const { return mStateId; }
195 WsfStringId EventId() const { return mEventId; }
196
197 // Non-const 'Sets':
198 void SetOwningIndex(size_t aValue);
199 void SetRespondingIndex(size_t aValue);
200 void SetResult(Result::Value aValue);
201 void SetOfferedQuantity(double aValue);
202 void SetDesiredQuantity(double aValue);
203 void SetOfferedRate(double aValue);
204 void SetDesiredRate(double aValue);
205 void SetRequestId(unsigned int aValue);
206 void SetNegotiatedQuantity(double aValue);
207 void SetNegotiatedRate(double aValue);
208
209 // Other methods:
210 void ConstrainTo(double aQuantity);
211
214 void FinalReset();
216 // provided his quantity is not exhausted yet.
217 void ContinuingReset(double aNewOfferQuantity);
218
219 // For a given Query, these items are set once, and never changed:
220 bool Initialize(WsfPlatform* aOwningPlatform, bool aIsOfferor, WsfStringId aCommodityId, bool aIsService);
221
222 bool FormRequest(size_t aOwningIndex,
223 size_t aRequestingIndex,
224 size_t aRespondingIndex,
225 double aDesiredQuantity,
226 double aDesiredRate,
227 unsigned int aRequestId,
228 WsfStringId aItemId,
229 bool aIsOfferor,
230 bool aIsService);
231
232 bool FormOffer(size_t aOwningIndex,
233 size_t aRequestingIndex,
234 size_t aRespondingIndex,
235 double aDesiredQuantity,
236 double aDesiredRate,
237 double aOfferedQuantity,
238 double aOfferedRate,
239 unsigned int aRequestId,
240 WsfStringId aItemId,
241 bool aIsOfferor,
242 bool aIsService);
243
244 void SetState(WsfStringId aValue) { mStateId = aValue; }
245 void SetEvent(WsfStringId aValue) { mEventId = aValue; }
246
247 Tender GetTender() const;
248 void DebugDump(ut::log::MessageStream& aStream) const;
249
250 // Returns the new state that should be, after the provided event triggers:
251 WsfStringId StateMachine(WsfStringId aEventId) const;
252
253 const char* GetScriptClassName() const;
254
255private:
256 WsfStringId mItemId; // or service
257 WsfStringId mStateId;
258 WsfStringId mEventId;
259 bool mIsService;
260 bool mIsOfferor; // the initiator of this event.
261 size_t mOwningIndex; // the initiator of this event.
262 unsigned int mRequestId;
263 size_t mRespondingIndex; // the index of the platform Suppling Product
264 double mOfferedQuantity;
265 double mOfferedRate;
266 size_t mRequestingIndex; // the index of the platform Receiving Product
267 double mDesiredQuantity;
268 double mDesiredRate;
269 double mNegotiatedQuantity;
270 double mNegotiatedRate;
271 Result mResult;
272 WsfSimulation* mSimulationPtr{nullptr};
273};
274
275// ================================================================================
276// ======================= Begin Platform Capabilities ============================
278{
279 // This enumeration identifies what services the platform offers, if any.
280 // (Compare this to the values in DisCapabilities.hpp.)
281 cSUPPLY_PAYLOAD = 0, // NOTE: This name varies from the DIS standard
285 cSUPPLY_ADS_B = 4, // Automatic Dependent Surveillance - Broadcast
286 cNO_CAPABILITY = 5 // enum hack.
287};
288
289void ModifyCapabilities(WsfPlatform* aPlatformPtr, unsigned int aOldCapability, unsigned int aNewCapability);
290
291void SetCapabilityFlag(WsfPlatform* aPlatformPtr, CapabilityType aCapability, bool aValue);
292
293bool IsCapable(const WsfPlatform* aPlatformPtr, CapabilityType aCapability);
294bool IsCapable(unsigned int aCapabilityWord, CapabilityType aCapability);
295
296void SetCapabilityFlag(unsigned int& aCapabilityWord, CapabilityType aCapability, bool aValue);
297
298// Capability Translators:
299unsigned int CapabilityToBitNumber(CapabilityType aCapability);
300CapabilityType BitNumberToCapability(unsigned int aBitNumber);
303
304// ======================= End Platform Capabilities ============================
305// ==============================================================================
306
307
308// ========================== CLASS CONTAINER ==================================
312{
313public:
314 static bool LoadInstance(UtInput& aInput, Container*& aContainerPtr);
315
316 Container();
317 Container(WsfStringId aNameId);
318
319 bool ProcessInput(UtInput& aInput);
320 bool Initialize();
321
322 bool IsFull() const;
323 bool IsEmpty() const;
324 double CurrentQuantity() const { return mQuantity; }
325 double MaximumQuantity() const { return mTender.Quantity(); }
326 double QuantityNeeded() const;
327 bool IsCompatibleWith(const Tender& aTender) const;
328
329 Tender TenderNeeded() const;
330 Tender TenderRemaining() const;
331
332 const Tender& MaximumTender() const { return mTender; }
334
335 bool IsService() const { return mTender.IsService(); }
336 bool SetQuantity(double aValue);
337 double Decrement(double aAmount);
338 double Increment(double aAmount);
339
340 const char* GetScriptClassName() const;
341
342protected:
343 Tender mTender; // This indicates a maximum not-to-exceed capacity for the container.
344 double mQuantity; // This represents a current amount in the container, constrained to mTender.mQuantity.
345
346}; // end WsfExchange::Container
347
348// ========================== CLASS Transactor =====================================
356{
357public:
358 // Transactor States are enumerated above, at top of file.
359 // For debugging. Confirms state string is valid.
360 static bool IsState(WsfStringId aState);
361 static bool IsEvent(WsfStringId aEventId);
362
363 static bool LoadInstance(UtInput& aInput, Transactor*& aInstancePtr);
364
365 static unsigned int NextSerialRequestId();
366
367 // Reset RequestId counter to zero.
368 static void ResetNextSerialRequestId();
369
370 // Constructors/Destructor
371 Transactor();
372 ~Transactor() override; // not virtual, as there are no derived classes.
373
374 bool Initialize(double aSimTime, WsfExchangeProcessor* aProcessorPtr);
375
377
378 bool IsReady() const { return mIsEnabled && mQuery.StateId() == sSTATE_READY; }
379 bool IsInProgress() const { return mIsEnabled && !mQuery.IsDone(); }
380 bool ContinueToOffer() const { return mIsContinueToOffer; }
381 bool AlwaysHonorRate() const { return mIsAlwaysHonorRate; }
382 bool IsEnabled() const { return mIsEnabled; }
383 bool IsOfferor() const { return mIsOfferor; }
384 bool IsRequester() const { return !mIsOfferor; }
385
386 bool IsHookedToFuel() const { return mIsHookedToFuel; }
387 bool IsHookedToPayload() const { return mIsHookedToPayload; }
388 bool IsExclusiveHook() const { return mIsExclusiveHook; }
389
390 WsfStringId ContainerNameId() const { return mContainerNameId; }
391 Container* ContainerPtr() { return mContainerPtr; }
392 const Container* ContainerPtr() const { return mContainerPtr; }
393
394 double TimeOutClockInterval() const { return mTimeOutClockInterval; }
395
396 std::string OwningPlatformName() const;
397 std::string OppositePlatformName() const;
398 std::string RequestorPlatformName() const;
399 std::string ResponderPlatformName() const;
400 std::string MyFullName() const; // For debugging.
401
402 bool RequestFrom(double aSimTime, const WsfPlatform* aSupplierPtr, const Tender& aTender);
403
404 // Note that "Cancel" will terminate the transaction in progress,
405 // if any. To simultaneously disable the transactor from further
406 // transactions, call Disable() instead.
407 void Cancel(double aSimTime);
408 bool DebugEnabled() const;
409 bool IsService() const { return mContainerPtr->IsService(); }
410 void DebugDump(double aSimTime, const Query& aQuery, ut::log::MessageStream& aMessageStream) const;
411
412 void SetIsOfferor(bool aValue) { mIsOfferor = aValue; }
413 void SetContinueToOffer(bool aValue) { mIsContinueToOffer = aValue; }
414 void SetIsHookedToPayload(bool aValue) { mIsHookedToPayload = aValue; }
415 void SetIsHookedToFuel(bool aValue) { mIsHookedToFuel = aValue; }
416 void SetTimeOutClockInterval(double aValue) { mTimeOutClockInterval = aValue; }
417 void SetProximityLimit(double aValue) { mProximityLimit = aValue; }
418 double ProximityLimit() const { return mProximityLimit; }
419
420 Query& GetQuery() { return mQuery; }
421 Query* GetQueryPtr() { return &mQuery; }
422 const Query& GetQuery() const { return mQuery; }
423
424 bool ProcessInput(UtInput& aInput);
425
426 // Callback to test for interest in this Transactor.
427 // Return true = I was impacted by this query... it was for me.
428 bool ExchangeQueried(double aSimTime, const Query& aQuery);
429
430 // bool ExchangeNegotiated(double aSimTime,
431 // const Query& aQuery);
432
433 // Called by an event to kick the class into action:
434 void TakeQueuedAction(double aSimTime, unsigned int aRequestId, bool aIsTimeOut);
435
436 bool ReserveAll(double aSimTime);
437
438 bool ReserveTender(double aSimTime, const Tender& aTender);
439
440 bool ReserveFor(double aSimTime, const Tender& aTender, WsfPlatform* aReceiverPtr);
441
443
444 bool IsInConflictWith(const Transactor& aRhs) const;
445
446 bool SetDesiredTender(const Tender& aTender);
447 bool SetOfferedTender(const Tender& aTender);
448
449 void Disable();
450
451 const char* GetScriptClassName() const;
452
453private:
454 bool ConsummateNow(double aSimTime);
455 bool RepairWasCompleted(double aSimTime);
456 void DetermineFinalResult(bool aWasTimedOut = false);
457 bool NegotiationComplete(double aSimTime, double aNegotiatedQuantity);
458 bool RequestFrom(double aSimTime, size_t aSupplierIndex);
459 bool Offer(double aSimTime, const Query& aQuery);
460 bool Accept(double aSimTime, const Query& aQuery);
461 bool Supply(double aSimTime);
462 void SetEnable(bool aValue);
463 void UnreserveFromContainer();
464 static unsigned int sNextRequestId;
465 bool IsInProximityTo(size_t aOppositePlatIndex);
466
467 // ============= Begin Sub-Class ===================
468 class QueuedEvent : public WsfEvent
469 {
470 // There are only two possible events to Queue.
471 // The first is a timeout, the second is a Consumate.
472 public:
473 QueuedEvent(double aSimTime, unsigned int aRequestId, size_t aPlatformIndex, Transactor* aTransactorPtr, bool aIsTimeOut);
474 EventDisposition Execute() override;
475
476 private:
477 bool mIsTimeOut; // else Consummate
478 unsigned int mRequestId;
479 size_t mPlatIndex;
480 Transactor* mTransactorPtr;
481 };
482 // ============= End Sub-Class ===================
483
484 WsfStringId mContainerNameId;
485 double mStartTime;
486 Container* mContainerPtr;
487 WsfExchangeProcessor* mExchangeProcPtr;
488 bool mIsEnabled;
489 bool mIsOfferor; // Is the supplier of a commodity or service, else consumer.
490 bool mIsContinueToOffer; // Once a transaction to supply is successful, stay on-line for others.
491 bool mIsAlwaysHonorRate; // If true, we always stay
492 bool mIsHookedToFuel;
493 bool mIsHookedToPayload;
494 bool mIsExclusiveHook; // License to totally own Fuel or Payload, and set quantity unilaterally.
495 double mTimeOutClockInterval; // How long do we wait for a response before we assume we will not get one?
496 double mProximityLimit; // Optional. If non-zero, will be checked prior to start of Transactor.
497 double mReservedFromContainer; // Amount TAKEN from container at start of transaction to supply.
498 double mAttenuatedOfferAmount; // Incrementally drawn from when offering...
499 Query mQuery; // Used in callbacks.
500}; // end WsfExchange::Transactor
501
502}; // end namespace WsfExchange
503
504UT_MAP_CLASS_TO_SCRIPT_NAME(WsfExchange::Tender, "Tender")
505UT_MAP_CLASS_TO_SCRIPT_NAME(WsfExchange::Container, "Container")
506UT_MAP_CLASS_TO_SCRIPT_NAME(WsfExchange::Query, "Query")
507UT_MAP_CLASS_TO_SCRIPT_NAME(WsfExchange::Transactor, "Transactor")
508
509#endif
bool operator==(int aId, const WsfStringInt &aRhs)
Equal relational operator for the case of an integer on the LHS and a StringId on the RHS.
Definition WsfStringId.hpp:69
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfEvent.hpp:29
Definition WsfExchangeProcessor.hpp:45
Definition WsfExchange.hpp:312
double MaximumQuantity() const
Definition WsfExchange.hpp:325
double mQuantity
Definition WsfExchange.hpp:344
bool IsEmpty() const
Definition WsfExchange.cpp:1009
Tender mTender
Definition WsfExchange.hpp:343
bool IsService() const
Definition WsfExchange.hpp:335
Container()
Definition WsfExchange.cpp:860
const char * GetScriptClassName() const
Tender & MaximumTender()
Definition WsfExchange.hpp:333
bool IsFull() const
Definition WsfExchange.cpp:997
bool Initialize()
Definition WsfExchange.cpp:927
bool ProcessInput(UtInput &aInput)
Definition WsfExchange.cpp:898
const Tender & MaximumTender() const
Definition WsfExchange.hpp:332
double CurrentQuantity() const
Definition WsfExchange.hpp:324
static bool LoadInstance(UtInput &aInput, Container *&aContainerPtr)
Definition WsfExchange.cpp:833
Callback Query class.
Definition WsfExchange.hpp:164
WsfStringId StateId() const
Definition WsfExchange.hpp:194
size_t RespondingIndex() const
Definition WsfExchange.hpp:176
WsfSimulation * GetSimulation() const
Definition WsfExchange.hpp:178
size_t OppositeIndex() const
Definition WsfExchange.cpp:392
Tender GetTender() const
Definition WsfExchange.cpp:479
double DesiredQuantity() const
Definition WsfExchange.hpp:182
std::string GetResultString() const
Definition WsfExchange.hpp:188
void ContinuingReset(double aNewOfferQuantity)
This is used for an Offeror who will continue offering,.
Definition WsfExchange.cpp:348
size_t OwningIndex() const
Definition WsfExchange.hpp:173
double OfferedRate() const
Definition WsfExchange.hpp:181
void SetNegotiatedQuantity(double aValue)
Definition WsfExchange.cpp:410
bool IsDone() const
Definition WsfExchange.hpp:171
unsigned int RequestId() const
Definition WsfExchange.hpp:174
void ConstrainTo(double aQuantity)
Definition WsfExchange.cpp:383
void SetOfferedQuantity(double aValue)
Definition WsfExchange.cpp:416
double NegotiatedRate() const
Definition WsfExchange.hpp:185
WsfStringId StateMachine(WsfStringId aEventId) const
Definition WsfExchange.cpp:551
double NegotiatedInterval() const
Definition WsfExchange.cpp:446
void SetRequestId(unsigned int aValue)
Definition WsfExchange.cpp:440
size_t IntendedRecipientIndex() const
void SetOwningIndex(size_t aValue)
Definition WsfExchange.cpp:398
void SetDesiredRate(double aValue)
void SetNegotiatedRate(double aValue)
Definition WsfExchange.cpp:434
void DebugDump(ut::log::MessageStream &aStream) const
Definition WsfExchange.cpp:361
void SetDesiredQuantity(double aValue)
Definition WsfExchange.cpp:422
void SetOfferedRate(double aValue)
Definition WsfExchange.cpp:428
bool IsOfferor() const
Definition WsfExchange.hpp:169
void SetRespondingIndex(size_t aValue)
Definition WsfExchange.cpp:404
double NegotiatedQuantity() const
Definition WsfExchange.hpp:184
WsfStringId EventId() const
Definition WsfExchange.hpp:195
WsfStringId ItemId() const
Definition WsfExchange.hpp:193
double OfferedQuantity() const
Definition WsfExchange.hpp:180
bool FormOffer(size_t aOwningIndex, size_t aRequestingIndex, size_t aRespondingIndex, double aDesiredQuantity, double aDesiredRate, double aOfferedQuantity, double aOfferedRate, unsigned int aRequestId, WsfStringId aItemId, bool aIsOfferor, bool aIsService)
Definition WsfExchange.cpp:517
void SetResult(Result::Value aValue)
Definition WsfExchange.cpp:322
Query(WsfSimulation *aSimulationPtr=nullptr)
Definition WsfExchange.cpp:298
const char * GetScriptClassName() const
bool FormRequest(size_t aOwningIndex, size_t aRequestingIndex, size_t aRespondingIndex, double aDesiredQuantity, double aDesiredRate, unsigned int aRequestId, WsfStringId aItemId, bool aIsOfferor, bool aIsService)
Definition WsfExchange.cpp:488
void SetState(WsfStringId aValue)
Definition WsfExchange.hpp:244
double DesiredRate() const
Definition WsfExchange.hpp:183
bool Initialize(WsfPlatform *aOwningPlatform, bool aIsOfferor, WsfStringId aCommodityId, bool aIsService)
Definition WsfExchange.cpp:456
void SetEvent(WsfStringId aValue)
Definition WsfExchange.hpp:245
bool IsService() const
Definition WsfExchange.hpp:170
Result::Value GetResultValue() const
Definition WsfExchange.hpp:189
size_t RequestingIndex() const
Definition WsfExchange.hpp:175
void FinalReset()
Definition WsfExchange.cpp:334
Definition WsfExchange.hpp:138
Value
Definition WsfExchange.hpp:141
@ cPARTLY_SATISFIED
Definition WsfExchange.hpp:146
@ cPENDING
Definition WsfExchange.hpp:142
@ cTIMED_OUT
Definition WsfExchange.hpp:144
@ cFULLY_SATISFIED
Definition WsfExchange.hpp:147
@ cCANCELLED_REJECTED
Definition WsfExchange.hpp:145
@ cIN_PROGRESS
Definition WsfExchange.hpp:143
Result(Value aStartValue=cPENDING)
Definition WsfExchange.hpp:150
void Set(Value aValue)
Definition WsfExchange.hpp:152
bool IsDone() const
Definition WsfExchange.cpp:328
std::string GetString() const
Definition WsfExchange.cpp:269
Value Get() const
Definition WsfExchange.hpp:153
Value mValue
Definition WsfExchange.hpp:159
Definition WsfExchange.hpp:87
static bool LoadInstance(UtInput &aInput, Tender *&aTenderPtr)
Definition WsfExchange.cpp:624
Tender()
Definition WsfExchange.cpp:652
bool mIsService
Definition WsfExchange.hpp:133
bool ProcessInput(UtInput &aInput)
Definition WsfExchange.cpp:691
bool IsService() const
Definition WsfExchange.hpp:107
void SetRateP(double aQuantity)
Definition WsfExchange.cpp:746
void Null()
Definition WsfExchange.hpp:101
double mQuantity
Definition WsfExchange.hpp:131
double Quantity() const
Definition WsfExchange.hpp:110
void SetQuantity(double aValue)
Definition WsfExchange.hpp:113
double mRate
Definition WsfExchange.hpp:132
bool IsCommodity() const
Definition WsfExchange.hpp:108
bool IsNull() const
Definition WsfExchange.hpp:102
void SetQuantityP(double aQuantity)
Definition WsfExchange.cpp:736
const char * GetScriptClassName() const
double Rate() const
Definition WsfExchange.hpp:106
double Interval() const
Definition WsfExchange.hpp:109
void SetRate(double aValue)
Definition WsfExchange.hpp:114
Tender * Clone() const
Definition WsfExchange.cpp:678
Container * ContainerPtr()
Definition WsfExchange.hpp:391
bool IsReady() const
Definition WsfExchange.hpp:378
static bool IsEvent(WsfStringId aEventId)
Definition WsfExchange.cpp:1057
bool RequestFrom(double aSimTime, const WsfPlatform *aSupplierPtr, const Tender &aTender)
Definition WsfExchange.cpp:1567
WsfSimulation * GetSimulation() const
Definition WsfExchange.cpp:1555
Query * GetQueryPtr()
Definition WsfExchange.hpp:421
void SetProximityLimit(double aValue)
Definition WsfExchange.hpp:417
void SetIsOfferor(bool aValue)
Definition WsfExchange.hpp:412
void SetTimeOutClockInterval(double aValue)
Definition WsfExchange.hpp:416
static bool LoadInstance(UtInput &aInput, Transactor *&aInstancePtr)
Definition WsfExchange.cpp:1186
void SetContinueToOffer(bool aValue)
Definition WsfExchange.hpp:413
const char * GetScriptClassName() const
void SetIsHookedToPayload(bool aValue)
Definition WsfExchange.hpp:414
bool Initialize(double aSimTime, WsfExchangeProcessor *aProcessorPtr)
Definition WsfExchange.cpp:1456
bool IsInProgress() const
Definition WsfExchange.hpp:379
bool IsOfferor() const
Definition WsfExchange.hpp:383
bool IsHookedToPayload() const
Definition WsfExchange.hpp:387
bool ReserveFor(double aSimTime, const Tender &aTender, WsfPlatform *aReceiverPtr)
const Query & GetQuery() const
Definition WsfExchange.hpp:422
Query & GetQuery()
Definition WsfExchange.hpp:420
bool IsRequester() const
Definition WsfExchange.hpp:384
bool SetDesiredTender(const Tender &aTender)
Definition WsfExchange.cpp:1112
bool IsInConflictWith(const Transactor &aRhs) const
Definition WsfExchange.cpp:1133
static bool IsState(WsfStringId aState)
Definition WsfExchange.cpp:1170
const Container * ContainerPtr() const
Definition WsfExchange.hpp:392
void Disable()
Definition WsfExchange.cpp:1281
double ProximityLimit() const
Definition WsfExchange.hpp:418
bool IsService() const
Definition WsfExchange.hpp:409
static void ResetNextSerialRequestId()
Definition WsfExchange.cpp:1066
bool AlwaysHonorRate() const
Definition WsfExchange.hpp:381
bool IsExclusiveHook() const
Definition WsfExchange.hpp:388
bool IsHookedToFuel() const
Definition WsfExchange.hpp:386
static unsigned int NextSerialRequestId()
Definition WsfExchange.cpp:1024
bool SetOfferedTender(const Tender &aTender)
Definition WsfExchange.cpp:1072
double TimeOutClockInterval() const
Definition WsfExchange.hpp:394
void SetIsHookedToFuel(bool aValue)
Definition WsfExchange.hpp:415
Transactor()
Definition WsfExchange.cpp:1034
bool IsEnabled() const
Definition WsfExchange.hpp:382
WsfStringId ContainerNameId() const
Definition WsfExchange.hpp:390
bool ContinueToOffer() const
Definition WsfExchange.hpp:380
WsfNamed()
Definition WsfNamed.cpp:17
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
The main controller for a simulation.
Definition WsfSimulation.hpp:109
Definition WsfExchange.cpp:66
static WsfStringId sSTATE_ACCEPTING
Definition WsfExchange.hpp:67
void SetCapabilityFlag(WsfPlatform *aPlatformPtr, CapabilityType aCapability, bool aValue)
Definition WsfExchange.cpp:113
static WsfStringId sEVENT_RECEIVED
Definition WsfExchange.hpp:76
CapabilityType BitNumberToCapability(unsigned int aBitNumber)
Definition WsfExchange.cpp:165
static WsfStringId sEVENT_REQUESTOR_RESPONDED
Definition WsfExchange.hpp:79
static WsfStringId sEVENT_OFFERED
Definition WsfExchange.hpp:73
void InitializeStatics()
Definition WsfExchange.cpp:69
static WsfStringId sSTATE_SUPPLYING
Definition WsfExchange.hpp:69
static WsfStringId sSTATE_READY
Definition WsfExchange.hpp:65
static WsfStringId sEVENT_SUPPLIED
Definition WsfExchange.hpp:75
void ModifyCapabilities(WsfPlatform *aPlatformPtr, unsigned int aOldCapability, unsigned int aNewCapability)
Definition WsfExchange.cpp:95
static WsfStringId sEVENT_ACCEPTED
Definition WsfExchange.hpp:74
WsfStringId CapabilityToNameId(CapabilityType aCapability)
Definition WsfExchange.cpp:235
static WsfStringId sSTATE_OFFERING
Definition WsfExchange.hpp:68
unsigned int CapabilityToBitNumber(CapabilityType aCapability)
Definition WsfExchange.cpp:144
CapabilityType NameIdToCapability(WsfStringId aCapabilityNameId)
Definition WsfExchange.cpp:194
bool IsCapable(unsigned int aCapabilityWord, CapabilityType aCapability)
Definition WsfExchange.cpp:133
static WsfStringId sEVENT_CANCELLED
Definition WsfExchange.hpp:77
static WsfStringId sEVENT_OFFEROR_COMPLETED
Definition WsfExchange.hpp:78
static WsfStringId sSTATE_REQUESTING
Definition WsfExchange.hpp:66
static WsfStringId sEVENT_REQUESTED
Definition WsfExchange.hpp:72
CapabilityType
Definition WsfExchange.hpp:278
@ cSUPPLY_FUEL
Definition WsfExchange.hpp:282
@ cNO_CAPABILITY
Definition WsfExchange.hpp:286
@ cSUPPLY_ADS_B
Definition WsfExchange.hpp:285
@ cVEHICLE_RECOVERY
Definition WsfExchange.hpp:283
@ cSUPPLY_PAYLOAD
Definition WsfExchange.hpp:281
@ cVEHICLE_REPAIR
Definition WsfExchange.hpp:284
Copyrights Multiple, All Rights Reserved