WSF
WsfAttributeContainer.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 WSFATTRIBUTECONTAINER_HPP
13#define WSFATTRIBUTECONTAINER_HPP
14
15#include "wsf_export.h"
16
17class UtAttributeBase;
18#include "UtAttributeContainer.hpp"
19class UtInput;
20
23class WSF_EXPORT WsfAttributeContainer : public UtAttributeContainer
24{
25public:
28 WsfAttributeContainer* Clone() const override { return new WsfAttributeContainer(*this); }
29
37 virtual bool ProcessInput(UtInput& aInput);
38
39 static bool LoadType(UtInput& aInput); // processes "struct" input, saves the type
40 static void ClearTypes();
41
42protected:
43 void ParseAssignment(UtInput& aInput, std::string& aName, std::string& aValue);
44
45private:
46 bool ProcessAttribute(UtInput& aInput);
47
48 static const WsfAttributeContainer* ProcessStruct(UtInput& aInput); // registers type into base class static member
49
50 static bool mPrototypesRegistered;
51};
52
53namespace WsfUtil
54{
55// Template function to extract an aux_data value from a system (WsfPlatform, WsfPlatformPart, etc...)
56template<typename SYSTEM, typename ATTRIBUTE_TYPE>
57inline bool GetAuxValue(SYSTEM* aSystem, const std::string& aLabel, ATTRIBUTE_TYPE& aValue)
58{
59 bool found(false);
60 if (aSystem->HasAuxData())
61 {
62 found = aSystem->GetAuxDataConst().TryGet(aLabel, aValue);
63 }
64 return found;
65}
66
67template<typename SYSTEM, typename ATTRIBUTE_TYPE>
68inline bool GetAuxValue(SYSTEM& aSystem, const std::string& aLabel, ATTRIBUTE_TYPE& aValue)
69{
70 return GetAuxValue(&aSystem, aLabel, aValue);
71}
72} // namespace WsfUtil
73
74#endif
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfAttributeContainer.hpp:24
WsfAttributeContainer * Clone() const override
Definition WsfAttributeContainer.hpp:28
A set of utilities that perform generic calculations among WSF objects.
Definition WsfAttributeContainer.hpp:54
bool GetAuxValue(SYSTEM *aSystem, const std::string &aLabel, ATTRIBUTE_TYPE &aValue)
Definition WsfAttributeContainer.hpp:57
Copyrights Multiple, All Rights Reserved