Hi,

the attempt to store smart pointers that handle the reference counting 
internally without the need to have the generated code contain any 
addRef/subRef calls have reached a point were we would like to ask for 
comments on the interface.

For an MF of pointers the following set of functions would be generated, 
please note that at this point the type stored in the field 
(InternalRefPtr) is exposed by the functions that grant access to the 
field itself.

typedef MFForegroundInternalRefPtr ForegroundFieldType;

MFForegroundInternalRefPtr const *getMFForegrounds(void) const;
MFForegroundInternalRefPtr const &getForegrounds  (void) const;
ForegroundPtrConst getForegrounds(UInt32 const index) const;

void addForegrounds(ForegroundPtrConstArg value);
void assignForegrounds(MFForegroundInternalRefPtr const &value);
void insertForegrounds(
        UInt32 const uiIndex, ForegroundPtrConstArg value);
void replaceForegrounds(
        UInt32 const uiIndex, ForegroundPtrConstArg value);
void replaceForegrounds(
         ForegroundPtrConstArg pOldElem,
         ForegroundPtrConstArg pNewElem);
void subForegrounds(UInt32 const uiIndex);
void subForegrounds(ForegroundPtrConstArg value);
void clearForegrounds(void);

One way to hide the fact that the type stored in a field is more 
complicated than a raw C pointer would be to make special field types 
for these that handle the conversion inside their access functions. 
However, this would also require us to write out own iterators for these 
fields, because they also have to be made aware of the difference in types.
Another approach would be to store raw C pointers in the fields and 
handle all bookkeeping inside the access functions provided by the field 
container. The downside of this approach is that it was one of the goals 
to get rid of manual bookkeeping in favor of having the pointer types do it.
Please also note that the template InternalRefPtr<> is distinct from 
RefPtr<> and MTRefPtr<>, which should be used by applications, and 
manipulates a different ref count (RefPtr and MTRefPtr change the 
external ref count, which is stored in the AspectStore).

Dirk and I would very much like to hear your comments and ideas on the 
above interface and the outlined alternatives. Also if you have 
questions or suggestions on different approaches, please let us know.

        Thanks,
                Carsten

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core

Reply via email to