gwnavgeneration/input/clientinputsectordescriptor.h Source File

clientinputsectordescriptor.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 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 // primary contact: MAMAU - secondary contact: NOBODY
8 #ifndef GwNavGen_ClientInputSectorDescriptor_H
9 #define GwNavGen_ClientInputSectorDescriptor_H
10 
15 
16 namespace Kaim
17 {
18 
21 class ClientInputSectorDescriptorBlob
22 {
23  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
25  KY_ROOT_BLOB_CLASS(Generator, ClientInputSectorDescriptorBlob, 0)
26 public:
28  BlobFieldArray m_fields;
29 };
30 inline void SwapEndianness(Endianness::Target e, ClientInputSectorDescriptorBlob& self)
31 {
32  SwapEndianness(e, self.m_fields);
33 }
34 
36 class ClientInputSectorDescriptor
37 {
39 
40 public:
42 
43  KyResult ReadFromAggregate(const BlobAggregate& aggregate)
44  {
45  BlobAggregate::Collection<ClientInputSectorDescriptorBlob> sectorDescs = aggregate.GetCollection<ClientInputSectorDescriptorBlob>();
46  if (sectorDescs.GetCount() != 1)
47  return KY_ERROR; // 1 and only 1 ClientInputSectorDescriptor
48  return ReadFromBlob(*sectorDescs.GetHandler(0)->Blob());
49  }
50 
51  void AddMapping(BlobFieldsMapping& mapping)
52  {
53  mapping.AddUInt32("Database index", m_databaseIndex);
54  }
55 
56  KyResult ReadFromBlob(const ClientInputSectorDescriptorBlob& blob)
57  {
58  BlobFieldsMapping mapping;
59  AddMapping(mapping);
60  return mapping.ReadFromBlobFieldArray(blob.m_fields);
61  }
62 
63 public:
67 };
68 
69 class ClientInputSectorDescriptorBlobBuilder : public BaseBlobBuilder<ClientInputSectorDescriptorBlob>
70 {
71 public:
72  ClientInputSectorDescriptorBlobBuilder(ClientInputSectorDescriptor* sectorDescriptor)
73  : m_descriptor(sectorDescriptor) {}
74 
75 private:
76  virtual void DoBuild()
77  {
78  BlobFieldsMapping mapping;
79  m_descriptor->AddMapping(mapping);
80  BlobFieldArrayBuilder blobFieldArrayBuilder("ClientInputSectorDescriptor", mapping);
81  BLOB_BUILD(m_blob->m_fields, blobFieldArrayBuilder);
82  }
83  ClientInputSectorDescriptor* m_descriptor;
84 };
85 
86 
87 
88 }
89 
90 
91 #endif
92 
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
#define BLOB_BUILD(blob, builder)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:189
The Generator is the principal class in the NavData generation system.
Definition: generator.h:61
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
Definition: gamekitcrowddispersion.h:20
Easy to write/read version of ClientInputSectorDescriptorBlob.
Definition: clientinputsectordescriptor.h:38
#define KY_ERROR
Shorthand for Kaim::Result::Failure.
Definition: types.h:272
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
KyUInt32 m_databaseIndex
Index of the Lab's database in which the NavData will be added to.
Definition: clientinputsectordescriptor.h:71
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
Set of Key-Values embedded within a ClientInput BlobAggregate (serialized form).
Definition: clientinputsectordescriptor.h:22