-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@2018.3
- Loading branch information
Showing
70 changed files
with
2,941 additions
and
1,226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using Unity.MemoryProfiler.Editor.Debuging; | ||
|
||
namespace Unity.MemoryProfiler.Editor.Database | ||
{ | ||
// A request to open a link. | ||
internal class LinkRequest | ||
{ | ||
ParameterSet m_Parameters; | ||
public ParameterSet Parameters | ||
{ | ||
get | ||
{ | ||
if (m_Parameters == null) m_Parameters = new ParameterSet(); | ||
return m_Parameters; | ||
} | ||
} | ||
public bool HasParameters | ||
{ | ||
get | ||
{ | ||
return m_Parameters != null && m_Parameters.Count > 0; | ||
} | ||
} | ||
} | ||
|
||
// Definition of a link to a table | ||
internal class TableLink | ||
{ | ||
public string TableName; | ||
public System.Collections.Generic.List<View.Where.Builder> RowWhere; | ||
public System.Collections.Generic.Dictionary<string, string> Parameters; | ||
public void SetParameter(string name, string value) | ||
{ | ||
if (Parameters == null) | ||
{ | ||
Parameters = new System.Collections.Generic.Dictionary<string, string>(); | ||
} | ||
Parameters.Add(name, value); | ||
} | ||
} | ||
|
||
// Request to open a link to a table | ||
internal class LinkRequestTable : LinkRequest | ||
{ | ||
public TableLink LinkToOpen; | ||
public View.ViewTable SourceView; | ||
public Table SourceTable; | ||
public Column SourceColumn; | ||
public long SourceRow; | ||
|
||
public static LinkRequestTable MakeLinkRequest(TableLink metaLink, Table sourceTable, Column sourceColumn, long sourceRow, Database.Operation.ExpressionParsingContext expressionParsingContext) | ||
{ | ||
if (metaLink == null) return null; | ||
using (ScopeDebugContext.Func(() => { return "MakeLinkRequest from table '" + sourceTable.GetName() + "' row " + sourceRow; })) | ||
{ | ||
var lr = new LinkRequestTable(); | ||
lr.LinkToOpen = metaLink; | ||
lr.SourceTable = sourceTable; | ||
lr.SourceView = sourceTable as View.ViewTable; | ||
lr.SourceColumn = sourceColumn; | ||
lr.SourceRow = sourceRow; | ||
|
||
if (lr.LinkToOpen.Parameters != null) | ||
{ | ||
foreach (var p in lr.LinkToOpen.Parameters) | ||
{ | ||
var opt = new Operation.Expression.ParseIdentifierOption(sourceTable.Schema as View.ViewSchema, sourceTable, true, true, typeof(string), expressionParsingContext); | ||
var metaExpression = new Operation.Expression.MetaExpression(p.Value, true); | ||
var exp = Operation.Expression.ParseIdentifier(metaExpression, opt); | ||
var exp2 = Operation.ColumnCreator.CreateTypedExpressionFixedRow(exp, sourceRow); | ||
lr.Parameters.Add(p.Key, exp2); | ||
} | ||
} | ||
return lr; | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
namespace Unity.MemoryProfiler.Editor.Database | ||
{ | ||
internal class ParameterSet | ||
{ | ||
System.Collections.Generic.Dictionary<string, Operation.Expression> m_Parameters = new System.Collections.Generic.Dictionary<string, Operation.Expression>(); | ||
public int Count { get { return m_Parameters.Count; } } | ||
public void Add(string key, Operation.Expression value) | ||
{ | ||
m_Parameters.Add(key, value); | ||
} | ||
|
||
public bool TryGet(string key, out Operation.Expression value) | ||
{ | ||
return m_Parameters.TryGetValue(key, out value); | ||
} | ||
|
||
public void AddValue<DataT>(string key, DataT value) where DataT : System.IComparable | ||
{ | ||
m_Parameters.Add(key, new Operation.ExpConst<DataT>(value)); | ||
} | ||
|
||
public bool TryGetValue<DataT>(string key, out DataT value) where DataT : System.IComparable | ||
{ | ||
Operation.Expression exp; | ||
if (m_Parameters.TryGetValue(key, out exp)) | ||
{ | ||
if (exp is Operation.ExpConst<DataT>) | ||
{ | ||
value = (exp as Operation.ExpConst<DataT>).GetValue(0); | ||
return true; | ||
} | ||
} | ||
value = default(DataT); | ||
return false; | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
System.Text.StringBuilder sb = new System.Text.StringBuilder(); | ||
sb.Append("("); | ||
bool needComma = false; | ||
foreach (var p in m_Parameters) | ||
{ | ||
if (needComma) | ||
{ | ||
sb.Append(", "); | ||
} else | ||
{ | ||
needComma = true; | ||
} | ||
sb.AppendFormat("{0}={1}", p.Key, p.Value.GetValueString(0)); | ||
} | ||
sb.Append(")"); | ||
return sb.ToString(); | ||
} | ||
|
||
public System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, Operation.Expression>> AllParameters | ||
{ | ||
get | ||
{ | ||
return m_Parameters; | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.