gwnavgeneration/input/clientinputsectordescriptor.h Source File

clientinputsectordescriptor.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 #pragma once
8 
13 
14 namespace Kaim
15 {
16 
20 {
21  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
23  KY_ROOT_BLOB_CLASS(Generator, ClientInputSectorDescriptorBlob, 0)
24 public:
26  BlobFieldArray m_fields;
27 };
28 inline void SwapEndianness(Endianness::Target e, ClientInputSectorDescriptorBlob& self)
29 {
30  SwapEndianness(e, self.m_fields);
31 }
32 
35 {
36  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_NavData)
37 
38 public:
40 
41  KyResult ReadFromAggregate(const BlobAggregate& aggregate)
42  {
43  BlobAggregate::Collection<ClientInputSectorDescriptorBlob> sectorDescs = aggregate.GetCollection<ClientInputSectorDescriptorBlob>();
44  if (sectorDescs.GetCount() != 1)
45  return KY_ERROR; // 1 and only 1 ClientInputSectorDescriptor
46  return ReadFromBlob(*sectorDescs.GetHandler(0)->Blob());
47  }
48 
49  void AddMapping(BlobFieldsMapping& mapping)
50  {
51  mapping.AddUInt32("Database index", m_databaseIndex);
52  }
53 
54  KyResult ReadFromBlob(const ClientInputSectorDescriptorBlob& blob)
55  {
56  BlobFieldsMapping mapping;
57  AddMapping(mapping);
58  return mapping.ReadFromBlobFieldArray(blob.m_fields);
59  }
60 
61 public:
65 };
66 
67 class ClientInputSectorDescriptorBlobBuilder : public BaseBlobBuilder<ClientInputSectorDescriptorBlob>
68 {
69 public:
70  ClientInputSectorDescriptorBlobBuilder(ClientInputSectorDescriptor* sectorDescriptor)
71  : m_descriptor(sectorDescriptor) {}
72 
73 private:
74  virtual void DoBuild()
75  {
76  BlobFieldsMapping mapping;
77  m_descriptor->AddMapping(mapping);
78  BlobFieldArrayBuilder blobFieldArrayBuilder("ClientInputSectorDescriptor", mapping);
79  BLOB_BUILD(m_blob->m_fields, blobFieldArrayBuilder);
80  }
81  ClientInputSectorDescriptor* m_descriptor;
82 };
83 
84 
85 
86 }
87 
88 
89 
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
#define BLOB_BUILD(blob, builder)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:175
The Generator is the principal class in the NavData generation system.
Definition: generator.h:56
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:27
Navigation return code class.
Definition: types.h:108
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
Easy to write/read version of ClientInputSectorDescriptorBlob.
Definition: clientinputsectordescriptor.h:34
#define KY_ERROR
use result == KY_ERROR to test for error
Definition: types.h:132
BaseBlobBuilder is an abstract base class that builds a blob within a contiguous block of memory...
Definition: baseblobbuilder.h:27
KyUInt32 m_databaseIndex
Index of the Lab's database in which the NavData will be added to.
Definition: clientinputsectordescriptor.h:64
Set of Key-Values embedded within a ClientInput BlobAggregate (serialized form).
Definition: clientinputsectordescriptor.h:19