// ----------------------------------------------------------------------------------------------------------------- public bool Add(CTag.CObject t) { if (m_limit > 0 && m_limit == m_objects.GetOrderLen()) { // Limit is reached if (m_limit_policy == ELimitPolicy.LP_DENY) { // Deny new objects return(false); } else { // Remove first object RemoveByIdx(0); } } // Set tag if it is not set yet int ref_cnt = m_objects.GetRefCnt(t); if (!t.IsTagSet(this)) { utils.Assert(ref_cnt == 0, "Failed to add tagged object. Ref-cnt not zero:: tag={0} obj={1} ref-cnt={2}", m_name, t.GetTagName(), ref_cnt); t.SetTag(this); } else { utils.Assert(ref_cnt > 0, "Failed to add tagged object. Ref-cnt is zero :: tag={0} obj={1} ref-cnt={2}", m_name, t.GetTagName(), ref_cnt); } // Add new object to list m_objects.Add(t, null); AddToChangeset(t); return(true); }
// ------------------------------------------------------------------------------------------------------------- public bool IsTagSet(CTag.CObject obj, int tag_idx) { return(obj.IsTagSet(GetTag(tag_idx))); }