static public Link Create(Link source, Link linker, Link target) { if (!MemoryManagerIsReady) { throw new Exception("Менеджер памяти ещё не готов."); } if (LinkWasDeleted(source)) { throw new ArgumentException("Удалённая связь не может использоваться в качестве значения.", "source"); } if (LinkWasDeleted(linker)) { throw new ArgumentException("Удалённая связь не может использоваться в качестве значения.", "linker"); } if (LinkWasDeleted(target)) { throw new ArgumentException("Удалённая связь не может использоваться в качестве значения.", "target"); } __link *link = CreateLink(source, linker, target); if (link == null) { throw new OutOfMemoryException(); } Parallel.Invoke(() => CreatedEvent.Invoke(new LinkDefinition(source, linker, target))); return(link); }
static private extern void SetMappedLink(int index, __link *link);
static private extern __link *SearchLink(__link *source, __link *linker, __link *target);
static private extern __link *ReplaceLink(__link *link, __link *replacement);
static private extern void DeleteLink(__link *link);
static private extern __link *UpdateLink(__link *link, __link *newSource, __link *newLinker, __link *newTarget);
static private extern __link *CreateLink(__link *source, __link *linker, __link *target);
static private bool LinkWasDeleted(__link *link) { return(link != null && link->Source == null); }
public Link(__link *link) { _link = link; }
static private bool LinkDoesNotExist(__link *link) { return(link == null || link->Source == null); }
static private extern int WalkThroughReferersByTarget(__link *root, StopableVisitor func);
static private extern void WalkThroughAllReferersByTarget(__link *root, Visitor action);
static private extern uint GetLinkNumberOfReferersByTarget(__link *link);
static private extern uint GetLinkNumberOfReferersByLinker(__link *link);
static private extern uint GetLinkNumberOfReferersBySource(__link *link);