| | 1684 | /*-------------------------------------------------------------------------*/ |
|---|
| | 1685 | /* Parent linking */ |
|---|
| | 1686 | |
|---|
| | 1687 | bool ImageBase::linkParent( |
|---|
| | 1688 | const FieldContainerPtr pParent, |
|---|
| | 1689 | const UInt16 childFieldId, |
|---|
| | 1690 | const UInt16 parentFieldId ) |
|---|
| | 1691 | { |
|---|
| | 1692 | if(parentFieldId == ParentsFieldId) |
|---|
| | 1693 | { |
|---|
| | 1694 | FieldContainerPtr pTypedParent = |
|---|
| | 1695 | dynamic_cast< FieldContainerPtr >(pParent); |
|---|
| | 1696 | |
|---|
| | 1697 | if(pTypedParent != NullFC) |
|---|
| | 1698 | { |
|---|
| | 1699 | editMField(ParentsFieldMask, _mfParents); |
|---|
| | 1700 | |
|---|
| | 1701 | _mfParents.push_back(pParent, childFieldId); |
|---|
| | 1702 | |
|---|
| | 1703 | return true; |
|---|
| | 1704 | } |
|---|
| | 1705 | |
|---|
| | 1706 | return false; |
|---|
| | 1707 | } |
|---|
| | 1708 | |
|---|
| | 1709 | return Inherited::linkParent(pParent, childFieldId, parentFieldId); |
|---|
| | 1710 | } |
|---|
| | 1711 | |
|---|
| | 1712 | bool ImageBase::unlinkParent( |
|---|
| | 1713 | const FieldContainerPtr pParent, |
|---|
| | 1714 | const UInt16 parentFieldId) |
|---|
| | 1715 | { |
|---|
| | 1716 | if(parentFieldId == ParentsFieldId) |
|---|
| | 1717 | { |
|---|
| | 1718 | FieldContainerPtr pTypedParent = |
|---|
| | 1719 | dynamic_cast< FieldContainerPtr >(pParent); |
|---|
| | 1720 | |
|---|
| | 1721 | if(pTypedParent != NullFC) |
|---|
| | 1722 | { |
|---|
| | 1723 | MFParentFieldContainerPtr::iterator pI = |
|---|
| | 1724 | _mfParents.find_nc(pParent); |
|---|
| | 1725 | |
|---|
| | 1726 | if(pI != _mfParents.end()) |
|---|
| | 1727 | { |
|---|
| | 1728 | editMField(ParentsFieldMask, _mfParents); |
|---|
| | 1729 | |
|---|
| | 1730 | _mfParents.erase(pI); |
|---|
| | 1731 | |
|---|
| | 1732 | return true; |
|---|
| | 1733 | } |
|---|
| | 1734 | |
|---|
| | 1735 | FWARNING(("ImageBase::unlinkParent: " |
|---|
| | 1736 | "Child <-> Parent link inconsistent.\n")); |
|---|
| | 1737 | |
|---|
| | 1738 | return false; |
|---|
| | 1739 | } |
|---|
| | 1740 | |
|---|
| | 1741 | return false; |
|---|
| | 1742 | } |
|---|
| | 1743 | |
|---|
| | 1744 | return Inherited::unlinkParent(pParent, parentFieldId); |
|---|
| | 1745 | } |
|---|
| | 1746 | |
|---|