2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
6 // $Header: r:/t2repos/thief2/src/object/propman_.h,v 1.18 2000/01/29 13:24:39 adurant Exp $
27 typedef cDynArray
<IProperty
*> PropArray
;
28 typedef cDynArray
<PropertyID
> PropIDArray
;
31 ////////////////////////////////////////////////////////////
35 // The cPropertyManager is the one place that knows about all the
36 // properties. Only it has the ability to do things like iterate over
37 // all properties, etc.
39 ////////////////////////////////////////////////////////////
42 class cPropertyManager
: public IPropertyManager
44 // Hash table mapping strings to Properties
45 class cPropertyTable
: public cStrIHashSet
<IProperty
*>
49 tHashSetKey
GetKey (tHashSetNode node
) const
51 return (tHashSetKey
) (((IProperty
*) (node
))->Describe()->name
);
56 // We're going to be an aggregate member when we grow up
57 DECLARE_AGGREGATION(cPropertyManager
);
60 cPropertyManager (IUnknown
* outer
); // constructor
61 virtual ~cPropertyManager (); // destructor
63 // Find the Property with a given name, can return NULL
64 STDMETHOD_(IProperty
*,GetProperty
) (PropertyID id
) const;
65 STDMETHOD_(IProperty
*,GetPropertyNamed
) (const char* name
) const;
68 // Notify the property system of an event
69 STDMETHOD(Notify
)(ePropertyNotifyMsg msg
, PropNotifyData data
);
71 // Iteration functions
72 STDMETHOD(BeginIter
)(struct sPropertyIter
* iter
);
73 STDMETHOD_(IProperty
*,NextIter
)(struct sPropertyIter
* iter
);
75 //------------------------------------------------------------
76 // Property system internal methods
80 // Add a Property to the list being managed, return success
81 // Sets id to be unique
82 STDMETHOD_(BOOL
,AddProperty
)(IProperty
*prop
, PropertyID
*id
);
84 // Remove a Property from the list being managed, return success
85 STDMETHOD_(BOOL
,DelProperty
)(IProperty
*prop
);
87 // Lookups that don't bump refcount
88 IProperty
* ByID (PropertyID id
) const;
89 IProperty
* ByName (const char* name
) const;
92 // Called when a property message is recieved. Will be sent to appropriate prop for handling.
93 static void NetworkMessageCallback(const sNetMsg_Generic
*pMsg
, ulong size
, ObjID from
, void *pClientData
);
95 // Code shared by AddProperty and AddMetaProperty
96 BOOL
AddPropertyBase (IProperty
* prop
);
98 //----------------------------------------
109 cPropertyTable name_hash_
; // mapping of names to Properties
110 PropArray props_
; // mapping of IDs to properties
111 PropIDArray sort_order_
; // constrained sort order.
112 PropIDArray begin_create_
; // props that need begin create
113 PropIDArray end_create_
; // props that need end create
114 PropIDArray load_obj_
; // props that need load obj
116 cNullProperty
* nullprop_
;
117 BOOL props_sorted_
; // is sort_order valid?