#include <PhxDescription.h>
Inheritance diagram for Phx::Description:

Public Types | |
|
typedef ValueType< TypeClass, uint32_t > | Type |
| Each Description subclass is assigned a type constant which is used to identify the complete type at runtime. | |
Public Member Functions | |
| virtual BitVector | serializedData (void) const =0 |
| Constructs and returns the serialized form of this Description. | |
| virtual void | serializedData (const BitVector &serializedData)=0 |
| Given a serialized form of a description of this type, set this Description's attributes to match the serialized version. | |
| Type | type () const |
| Returns the Type constant for the subclass that this Description is an instance of. | |
Static Public Attributes | |
| static const Type | INVALID_TYPE |
| A sentinel Type constant used to indicate an invalid type. | |
Friends | |
| class | Manager |
Classes | |
| class | Manager |
| A manager accessory type to Description that keeps track of Description types and creates new instances. More... | |
A Description is a piece of data that describes an entity. This data may come from either binary or XML serialized data (which itself may be acquired from disk, network, or elsewhere), or may simply be created and configured programatically. Descriptions are supplied to entities when they are constructed to specify what characteristics they should take on. In general, Descriptions may also specify only part of an entity. An entity would then use the Description to change only a subset of its attributes as appropriate.
class MyClass { void foo(void); Ptr<const Description> mAircraftDescription; }; void MyClass::foo(void) { // create mutable description Ptr<AircraftDescription> descriptionPtr = descriptionMgr->newDescription(AircraftDescription::DESCRIPTION_TYPE).dynamicCast<AircraftDescription>(); // set up attributes as necessary; safe since we're the only client. descriptionPtr->xmlData(aircraftXmlData); ... // store the description in our Ptr<const Description> member, // thus giving up the ability to modify it through mAircraftDescription. mAircraftDescription = descriptionPtr; // descriptionPtr is destructed here -- now there are // no non-const pointers to the description in the system. // You could later use mAircraftDescription to construct an Aircraft // and the compiler will prevent calls to non-const methods on the // AircraftDescription that would create issues with sharing. }
|
|
Given a serialized form of a description of this type, set this Description's attributes to match the serialized version. In short, this method deserializes the BitVector and loads the data into the fields of the Description subclass. Viewed as an attribute, this is just a write accessor that sets all of the subclass's attributes to those contained in the serialized representation.
|
|
|
Constructs and returns the serialized form of this Description. The serializedData() attribute is the serialized representation of the attributes of this description. Reading the attribute just retrieves the serialized data.
|
|
|
Returns the Type constant for the subclass that this Description is an instance of.
|
|
|
A sentinel Type constant used to indicate an invalid type. This will be the value of the type() attribute when the Description is constructed. The correct value is set by the Manager class after the Description is created. |
1.4.2