WSF
WsfPProxyStructValue.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 2016 Infoscitex, a DCS 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 WSFPPROXYSTRUCTVALUE_HPP
13#define WSFPPROXYSTRUCTVALUE_HPP
14
15#include "wsf_parser_export.h"
16
18
20
21// A wrapper for storing / operating on a struct instance.
22class WSF_PARSER_EXPORT WsfPProxyStructValue : public WsfPProxyValue
23{
24public:
30 : WsfPProxyValue(aValue)
31 {
32 if (!mTypePtr || !mTypePtr->IsStruct())
33 {
34 mTypePtr = nullptr;
35 }
36 // if the data type can be derived from, make sure we have the most
37 // specialized struct type
38 else if (mTypePtr->mTypeFlags & WsfProxy::cPOLYMORPHIC)
39 {
40 mTypePtr = (WsfPProxyType*)static_cast<WsfPProxyStructHeader*>(mDataPtr)->mStructPtr;
41 }
42 }
43
45
46 size_t GetMemberIndex(const std::string& aName) const override;
47
48 WsfPProxyType* GetMemberType(const std::string& aName) const override;
49
50 WsfPProxyType* GetMemberType(size_t aMemberIndex) const override;
51
54 {
56 if (hdr && !hdr->GetBasePath().Empty())
57 {
58 return &hdr->GetBasePath();
59 }
60 return nullptr;
61 }
62 void SetBase(const WsfPProxyPath& aPath)
63 {
65 if (hdr)
66 {
67 hdr->mBasePath = aPath;
68 }
69 }
71 void* GetMemberData() const { return GetHeader()->GetStart(); }
72 size_t GetMemberCount();
73 void* GetMember(size_t aMemberIndex);
74 void* GetMember(const std::string& aName);
75
76 std::string GetMemberName(size_t aMemberIndex) const;
77};
78
79#endif
if(fuelPtr !=nullptr)
Definition WsfScriptPlatformClass.cpp:1038
Represents a path or unique key to a value in the proxy.
Definition WsfPProxyPath.hpp:64
bool Empty() const
Definition WsfPProxyPath.hpp:152
Definition WsfPProxyStructType.hpp:33
Definition WsfPProxyStructValue.hpp:23
WsfPProxyStructHeader * GetHeader() const
Definition WsfPProxyStructValue.hpp:52
void * GetMemberData() const
Definition WsfPProxyStructValue.hpp:71
const WsfPProxyStructType * GetStruct() const
Definition WsfPProxyStructValue.hpp:70
void SetBase(const WsfPProxyPath &aPath)
Definition WsfPProxyStructValue.hpp:62
WsfPProxyStructValue()
Definition WsfPProxyStructValue.hpp:25
WsfPProxyStructValue(const WsfPProxyValue &aValue)
Definition WsfPProxyStructValue.hpp:29
WsfPProxyPath * GetBase() const
Definition WsfPProxyStructValue.hpp:53
Definition WsfPProxyType.hpp:37
virtual size_t GetMemberIndex(const std::string &aName) const
Definition WsfPProxyValue.cpp:194
void * mDataPtr
Definition WsfPProxyValue.hpp:198
WsfPProxyValue()
Definition WsfPProxyValue.hpp:35
const WsfPProxyType * mTypePtr
Definition WsfPProxyValue.hpp:196
virtual WsfPProxyType * GetMemberType(const std::string &aName) const
Definition WsfPProxyValue.cpp:199
@ cPOLYMORPHIC
Definition WsfPProxyCommon.hpp:28
Definition WsfPProxyStructHeader.hpp:21
WsfPProxyPath & GetBasePath()
Definition WsfPProxyStructHeader.hpp:75
WsfPProxyPath mBasePath
Definition WsfPProxyStructHeader.hpp:46
Copyrights Multiple, All Rights Reserved