15#ifndef UTPACKSCHEMA_HPP
16#define UTPACKSCHEMA_HPP
49 const char* what() const noexcept override;
62 void Begin(
const std::string& aType)
65 (*mStreamPtr) << aType <<
" {\n";
73 (*mStreamPtr) <<
"}\n";
76 void Field(
const std::string& aName)
79 (*mStreamPtr) << aName <<
": ";
81 void Value(
const std::string& aValue) { (*mStreamPtr) << aValue <<
'\n'; }
86 for (
int i = 0; i < mIndent; ++i)
92 std::ostream* mStreamPtr;
112 std::shared_ptr<UtPackNamespace> mRoot;
113 std::string mNamespaceName;
120 using NestedTypesList = std::vector<std::pair<std::string, std::unique_ptr<UtPackType>>>;
138 const std::string& GetTypeName()
const;
140 std::string GetTypePath()
const;
141 UtPackType* FindType(
const std::string& aTypeName);
142 const UtPackType* FindType(
const std::string& aTypeName)
const;
143 virtual void Resolve();
145 bool IsStruct()
const;
146 bool IsUnion()
const;
147 bool IsBasicType()
const;
153 const UtPackType* FindTypeP(
const std::string& aTypeName)
const;
173 : mContextType(nullptr)
182 bool IsNull()
const {
return mTypeName.empty(); }
185 std::string mTypeName;
229 std::string mDefaultValue;
243 const std::vector<UtPackField>&
GetFields()
const {
return mFields; }
244 std::vector<UtPackField> GetAllFields()
const;
256 std::vector<UtPackField> mFields;
268 const std::vector<UtPackField>&
GetFields()
const {
return mFields; }
271 std::vector<UtPackField> mFields;
283 void Resolve()
override;
298 std::string mCPP_Type;
311 const std::map<std::string, int>&
GetEnumValues()
const {
return mEnumValues; }
312 const std::map<int, std::string>&
GetValueToName()
const {
return mValueToName; }
315 std::map<std::string, int> mEnumValues;
316 std::map<int, std::string> mValueToName;
317 std::string mCPP_Type;
318 std::string mUnderlyingType;
326 , mSchemaPtr(aSchemaPtr)
#define WSF_UT_EXPORT
Definition WsfUtExport.hpp:32
A basic type defined in the schema.
Definition UtPackSchema.hpp:290
void Read(UtmlObject &aInput)
Definition UtPackSchema.cpp:382
int GetSize() const
Definition UtPackSchema.hpp:295
UtPackBasicType(UtPackType &aParent)
Definition UtPackSchema.cpp:482
const std::string & GetCPP_Type() const
Definition UtPackSchema.cpp:377
void Resolve() override
Definition UtPackSchema.cpp:453
std::string GetCPP_Type() const
Definition UtPackSchema.hpp:309
const std::map< std::string, int > & GetEnumValues() const
Definition UtPackSchema.hpp:311
UtPackEnumType(UtPackType &aParent)
Definition UtPackSchema.cpp:448
void Read(UtmlObject &aInput)
Definition UtPackSchema.cpp:409
const std::map< int, std::string > & GetValueToName() const
Definition UtPackSchema.hpp:312
std::string GetUnderlyingType() const
Definition UtPackSchema.hpp:310
std::string mReason
Definition UtPackSchema.hpp:50
~UtPackException() override
Definition UtPackSchema.hpp:48
UtPackException(const std::string &aReason)
Definition UtPackSchema.cpp:494
A field in a struct or union.
Definition UtPackSchema.hpp:197
UtPackField()
Definition UtPackSchema.hpp:199
bool IsOptional() const
Definition UtPackSchema.hpp:212
bool IsObsolete() const
Definition UtPackSchema.hpp:223
UtPackTypeReference & GetType()
Definition UtPackSchema.hpp:209
int GetOptionIndex() const
Definition UtPackSchema.hpp:215
int GetBitIndex() const
Definition UtPackSchema.hpp:217
bool IsIndex() const
Definition UtPackSchema.hpp:219
bool IsTime() const
Definition UtPackSchema.hpp:221
const UtPackTypeReference & GetType() const
Definition UtPackSchema.hpp:210
std::string GetDefaultValue() const
Definition UtPackSchema.hpp:213
std::string GetFieldName() const
Definition UtPackSchema.hpp:211
A list type defined in the schema.
Definition UtPackSchema.hpp:276
UtPackListType(UtPackType &aParent)
Definition UtPackSchema.hpp:278
UtPackTypeReference mContainedType
Definition UtPackSchema.hpp:285
Definition UtPackSchema.hpp:322
UtPackNamespace(UtPackSchema *aSchemaPtr)
Definition UtPackSchema.hpp:324
UtPackSchema * GetSchema() const
Definition UtPackSchema.hpp:331
void Begin(const std::string &aType)
Definition UtPackSchema.hpp:62
void Value(const std::string &aValue)
Definition UtPackSchema.hpp:81
void End()
Definition UtPackSchema.hpp:69
void Field(const std::string &aName)
Definition UtPackSchema.hpp:76
UtPackPrinter(std::ostream *aStream)
Definition UtPackSchema.hpp:56
Definition UtPackSchema.hpp:97
std::vector< std::string > GetTypeNames() const
Definition UtPackSchema.cpp:584
static std::unique_ptr< UtPackType > ReadType(UtmlObject &aInput, UtPackType &aParentType)
Definition UtPackSchema.cpp:504
void Resolve()
Definition UtPackSchema.cpp:558
UtPackSchema()
Definition UtPackSchema.cpp:540
UtPackType * FindType(const std::string &aTypeName)
Definition UtPackSchema.cpp:563
void Read(UtmlObject &aInput)
Definition UtPackSchema.cpp:545
const std::string & GetNamespaceName() const
Definition UtPackSchema.hpp:109
A struct is a set of fields.
Definition UtPackSchema.hpp:238
void Read(UtmlObject &aInput, UtPackType &aContainer)
Definition UtPackSchema.cpp:215
UtPackStruct(UtPackType &aParentType)
Definition UtPackSchema.cpp:254
void Resolve() override
Definition UtPackSchema.cpp:261
const UtPackTypeReference & GetBaseType() const
Definition UtPackSchema.hpp:252
int GetBitsetBytes() const
Definition UtPackSchema.hpp:247
bool IsVirtual() const
Definition UtPackSchema.hpp:251
const std::vector< UtPackField > & GetFields() const
Definition UtPackSchema.hpp:243
int GetMessageId() const
Returns -1 if struct is not a message.
Definition UtPackSchema.hpp:249
int GetBitsetSize() const
Definition UtPackSchema.hpp:246
bool IsMessage() const
Definition UtPackSchema.hpp:250
Definition UtPackSchema.hpp:170
UtPackTypeReference()
Definition UtPackSchema.hpp:172
bool IsNull() const
Definition UtPackSchema.hpp:182
UtPackType * GetType() const
Definition UtPackSchema.hpp:180
Definition UtPackSchema.hpp:118
Encoding mEncoding
Definition UtPackSchema.hpp:162
Encoding
Definition UtPackSchema.hpp:129
@ cENC_VAR_BYTES
Definition UtPackSchema.hpp:132
@ cENC_LITTLE_ENDIAN
Definition UtPackSchema.hpp:131
@ cENC_BIT
Definition UtPackSchema.hpp:133
@ cENC_STRUCT
Definition UtPackSchema.hpp:134
@ cENC_NONE
Definition UtPackSchema.hpp:130
@ cENC_LIST
Definition UtPackSchema.hpp:135
const NestedTypesList & GetNestedTypes() const
Definition UtPackSchema.hpp:150
Encoding GetEncoding() const
Definition UtPackSchema.hpp:144
UtPackType & operator=(const UtPackType &)=delete
std::string mTypeName
Definition UtPackSchema.hpp:164
UtPackType * mParentType
Definition UtPackSchema.hpp:163
virtual ~UtPackType()=default
std::vector< std::pair< std::string, std::unique_ptr< UtPackType > > > NestedTypesList
Definition UtPackSchema.hpp:120
NestedTypesList mNestedTypes
Definition UtPackSchema.hpp:165
UtPackType(const UtPackType &)=delete
const std::vector< UtPackField > & GetFields() const
Definition UtPackSchema.hpp:268
void Resolve() override
Definition UtPackSchema.cpp:343
UtPackUnion(UtPackType &aParentType)
Definition UtPackSchema.cpp:338
void Read(UtmlObject &aInput, UtPackType &aContainer)
Definition UtPackSchema.cpp:315
Template specialization for wsf::comm::Address. Allows usage of Address in std::unordered_map/set.
Definition WsfCommAddress.hpp:185