/// <summary> /// Initializes a new instance of the <see cref="ProfilingKey" /> class. /// </summary> /// <param name="parent">The parent.</param> /// <param name="name">The name.</param> /// <exception cref="System.ArgumentNullException">parent</exception> public ProfilingKey(ProfilingKey parent, string name, ProfilingKeyFlags flags = ProfilingKeyFlags.None) { if (parent == null) { throw new ArgumentNullException("parent"); } if (name == null) { throw new ArgumentNullException("name"); } Children = new List <ProfilingKey>(); Parent = parent; // TODO: add a lock because the currently passed parent is static and might crash in the game studio where we have multiple concurrent games - this need to be reviewed. lock (parent.Children) { // Register ourself in parent's children. parent.Children.Add(this); } Name = string.Format("{0}.{1}", Parent, name); Flags = flags; lock (AllKeys) { AllKeys.Add(this); } }
/// <summary> /// Initializes a new instance of the <see cref="ProfilingKey" /> class. /// </summary> /// <param name="name">The name.</param> public ProfilingKey(string name, ProfilingKeyFlags flags = ProfilingKeyFlags.None) { if (name == null) throw new ArgumentNullException("name"); Children = new List<ProfilingKey>(); Name = name; Flags = flags; lock (AllKeys) { AllKeys.Add(this); } }
/// <summary> /// Initializes a new instance of the <see cref="ProfilingKey" /> class. /// </summary> /// <param name="name">The name.</param> public ProfilingKey([NotNull] string name, ProfilingKeyFlags flags = ProfilingKeyFlags.None) { if (name == null) { throw new ArgumentNullException(nameof(name)); } Children = new List <ProfilingKey>(); Name = name; Flags = flags; lock (AllKeys) { AllKeys.Add(this); } }
/// <summary> /// Initializes a new instance of the <see cref="ProfilingKey" /> class. /// </summary> /// <param name="parent">The parent.</param> /// <param name="name">The name.</param> /// <exception cref="System.ArgumentNullException">parent</exception> public ProfilingKey(ProfilingKey parent, string name, ProfilingKeyFlags flags = ProfilingKeyFlags.None) { if (parent == null) throw new ArgumentNullException("parent"); if (name == null) throw new ArgumentNullException("name"); Children = new List<ProfilingKey>(); Parent = parent; Name = $"{Parent}.{name}"; Flags = flags; lock (AllKeys) { // Register ourself in parent's children. parent.Children?.Add(this); AllKeys.Add(this); } }
/// <summary> /// Initializes a new instance of the <see cref="ProfilingKey" /> class. /// </summary> /// <param name="parent">The parent.</param> /// <param name="name">The name.</param> /// <exception cref="System.ArgumentNullException">parent</exception> public ProfilingKey(ProfilingKey parent, string name, ProfilingKeyFlags flags = ProfilingKeyFlags.None) { if (parent == null) throw new ArgumentNullException("parent"); if (name == null) throw new ArgumentNullException("name"); Children = new List<ProfilingKey>(); Parent = parent; // Register ourself in parent's children. parent.Children.Add(this); Name = string.Format("{0}.{1}", Parent, name); Flags = flags; lock (AllKeys) { AllKeys.Add(this); } }
/// <summary> /// Initializes a new instance of the <see cref="ProfilingKey" /> class. /// </summary> /// <param name="parent">The parent.</param> /// <param name="name">The name.</param> /// <exception cref="System.ArgumentNullException">parent</exception> public ProfilingKey([NotNull] ProfilingKey parent, [NotNull] string name, ProfilingKeyFlags flags = ProfilingKeyFlags.None) { if (parent == null) { throw new ArgumentNullException(nameof(parent)); } if (name == null) { throw new ArgumentNullException(nameof(name)); } Children = new List <ProfilingKey>(); Parent = parent; Name = $"{Parent}.{name}"; Flags = flags; lock (AllKeys) { // Register ourself in parent's children. parent.Children?.Add(this); AllKeys.Add(this); } }
/// <summary> /// Initializes a new instance of the <see cref="ProfilingKey" /> class. /// </summary> /// <param name="parent">The parent.</param> /// <param name="name">The name.</param> /// <exception cref="System.ArgumentNullException">parent</exception> public ProfilingKey(ProfilingKey parent, string name, ProfilingKeyFlags flags = ProfilingKeyFlags.None) { if (parent == null) { throw new ArgumentNullException("parent"); } if (name == null) { throw new ArgumentNullException("name"); } Children = new List <ProfilingKey>(); Parent = parent; // Register ourself in parent's children. parent.Children.Add(this); Name = string.Format("{0}.{1}", Parent, name); Flags = flags; lock (AllKeys) { AllKeys.Add(this); } }