Hi,
I'm currently reworking cloneTree/deepCloneTree and associated functions
(see also ticket #84). There will be a couple of overloads of these
functions that provide different interfaces (including those that
currently exist, of course) which all forward to the function with this
interface:
NodePtr
cloneTree(
NodePtrConstArg rootNode,
const std::vector<FieldContainerType *> &cloneTypes =
std::vector<FieldContainerType *>(),
const std::vector<FieldContainerType *> &ignoreTypes =
std::vector<FieldContainerType *>(),
const std::vector<UInt16> &cloneGroupIds =
std::vector<UInt16>(),
const std::vector<UInt16> &ignoreGroupIds =
std::vector<UInt16>() );
a Type derived from one mentioned in cloneTypes or belonging to a group
mentioned in cloneGroupIds will be cloned instead of shared, while a
Type derived from one mentioned in ignoreTypes or belonging to a group
mentioned in ignoreGroupIds will not appear in the cloned tree. A
similar change is planned for deepCloneTree (with cloneTypes,
cloneGroupIds replaced with shareTypes, shareGroupIds to force a share
instead of cloning).
In 2 most of the actual cloning is done by
FieldDescription<>::cloneValuesV, which has a std::vector<std::string>
argument to specify which types to share instead of clone (which is
analog to the current deepCloneTree interface).
Would it be OK to change FieldDescription<>::cloneValuesV to the new
interface ?
Actually I would much rather not have this "type filtering" inside
FieldDescription, but the peculiar nature of the attachments field (it's
officially an SField, but actually a map and does not contain uniform
types) makes this necessary, it seems.
A different approach might be to add the ability to only perform cloning
of a part of a field to FieldDescription
cloneValuesV(const Field *pSrc,
ConstFieldMaskArg whichField,
FieldContainerPtrConstArg pDst,
UInt32 index)
For the attachments field, index would be used as
std::advance(amap.begin(), index). (Note that this breaks if the
attachment map is changed to a std::tr1::unordered_map, i.e. a hash map :( )
Comments ?
Carsten
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core