WSF
WsfTaskResource.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 WSFTASKRESOURCE_HPP
13#define WSFTASKRESOURCE_HPP
14
15#include "wsf_export.h"
16
17#include <cassert>
18
19#include "WsfStringId.hpp"
20
21enum // Reserve 0-2 for wsf
22{
26};
27
30{
31public:
36 WsfTaskResource(int aResourceType)
37 : mType(aResourceType)
38 {
39 // Ensure that mType identifies the correct c++ class.
40 // These types have no specialized c++ type:
41 assert(aResourceType == cTASK_RESOURCE_TYPE_NONE || aResourceType == cTASK_RESOURCE_TYPE_SENSOR ||
42 aResourceType == cTASK_RESOURCE_TYPE_PROCESSOR);
43 }
44 WsfTaskResource(const WsfTaskResource& aSrc) = default;
45 virtual ~WsfTaskResource() = default;
46
47 virtual WsfTaskResource* Clone() const;
48
49 virtual bool IsMatch(const WsfTaskResource& aRhs) const;
50
51 virtual WsfStringId GetTypeName() const;
52
54 template<typename AR>
55 void Serialize(AR& aAr)
56 {
58 }
59
62
65
66 int GetType() const { return mType; }
67
68protected:
69 // Constructor to bypass the resource type check
70 WsfTaskResource(int aResourceType, bool /*aIsSpecialization*/)
71 : mType(aResourceType)
72 {
73 }
74
76 int mType;
77
78private:
79 // disable operator=
80 void operator=(const WsfTaskResource& aRhs) = delete;
81};
82
83#endif
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
@ cTASK_RESOURCE_TYPE_SENSOR
resource is a sensor
Definition WsfTaskResource.hpp:24
@ cTASK_RESOURCE_TYPE_NONE
resource is not set
Definition WsfTaskResource.hpp:23
@ cTASK_RESOURCE_TYPE_PROCESSOR
resource is a processor
Definition WsfTaskResource.hpp:25
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
virtual bool IsMatch(const WsfTaskResource &aRhs) const
Returns true if this is a match for resource 'aRhs'.
Definition WsfTaskResource.cpp:18
virtual WsfStringId GetTypeName() const
Definition WsfTaskResource.cpp:30
int GetType() const
Definition WsfTaskResource.hpp:66
void Serialize(AR &aAr)
For XIO (de)serialization.
Definition WsfTaskResource.hpp:55
WsfStringId mModeNameId
The name of the mode of the assigned resource.
Definition WsfTaskResource.hpp:64
WsfTaskResource(int aResourceType)
Definition WsfTaskResource.hpp:36
int mType
The type of resource.
Definition WsfTaskResource.hpp:76
virtual WsfTaskResource * Clone() const
Definition WsfTaskResource.cpp:24
WsfTaskResource(const WsfTaskResource &aSrc)=default
WsfTaskResource()
Definition WsfTaskResource.hpp:32
WsfStringId mNameId
The name of the assigned resource (sensor, processor, etc) on the assigned platform (string ID).
Definition WsfTaskResource.hpp:61
virtual ~WsfTaskResource()=default
WsfTaskResource(int aResourceType, bool)
Definition WsfTaskResource.hpp:70
Copyrights Multiple, All Rights Reserved