Hi,

I'd like to give the FieldHandles for pointer fields a more 
useful/complete (but close to minimal) interface, like so:

for MF:
// "read" access
virtual FieldContainer *get (UInt32 index);
virtual UInt32          size(void);
virtual Int32           find(FieldContainer *fc);

// "write" access
virtual bool add    (FieldContainer *fc);
virtual bool remove (UInt32 index);
virtual bool insert (UInt32 index, FieldContainer *fc);
virtual bool replace(UInt32 index, FieldContainer *fc);
virtual bool clear  (void);

for SF:
virtual FieldContainer *get(void);

virtual bool set(FieldContainer *fc);


For std access and null check access fields these can directly 
manipulate the field, i.e. they use the Field * stored in the handle.

For custom access fields it is the responsibility of the container to 
register appropriate functions with the handle (by calling setAddMethod 
etc.) in {get,edit}Handle<FieldName>.  Some of these functions might not 
be available even (hence all the bool return values).

For all access types (std, null-check, custom) get, find and size will 
go directly to the field, i.e. read access can not be "intercepted". 
This seems to make the most sense given that currently the container 
always has at least a get<FieldName> function.

On the implementation side I'll add
// for custom access fields
typedef boost::function<void (FieldContainer *)> AddMethod;
typedef boost::function<void (UInt32)          > RemoveMethod;
typedef boost::function<void (UInt32,
                               FieldContainer *)> InsertMethod;
typedef boost::function<void (UInt32,
                               FieldContainer *)> ReplaceMethod;
typedef boost::function<void (void)            > ClearMethod;

to EditMFieldHandle<FieldContainerPtrMFieldBase> and place the 
information on what access type to use in the FieldDescription (maybe as 
FieldFlags?).

Comments ?

        Thanks,
                Carsten

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core

Reply via email to