Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ConstantBuffer.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.Collections;
5 using System.Collections.Generic;
6 
7 namespace SiliconStudio.Shaders.Ast.Hlsl
8 {
9  /// <summary>
10  /// Declaration of a constant buffer.
11  /// </summary>
13  {
14  #region Constructors and Destructors
15 
16  /// <summary>
17  /// Initializes a new instance of the <see cref = "ConstantBuffer" /> class.
18  /// </summary>
19  public ConstantBuffer()
20  {
21  Members = new List<Node>();
22  Attributes = new List<AttributeBase>();
23  Qualifiers = Qualifier.None;
24  }
25 
26  #endregion
27 
28  #region Public Properties
29 
30  /// <summary>
31  /// Gets or sets the attributes.
32  /// </summary>
33  /// <value>
34  /// The attributes.
35  /// </value>
36  public List<AttributeBase> Attributes { get; set; }
37 
38  /// <summary>
39  /// Gets or sets a value indicating whether this instance is texture buffer.
40  /// </summary>
41  /// <value>
42  /// <c>true</c> if this instance is texture buffer; otherwise, <c>false</c>.
43  /// </value>
44  public ConstantBufferType Type { get; set; }
45 
46  /// <summary>
47  /// Gets or sets the members.
48  /// </summary>
49  /// <value>
50  /// The members.
51  /// </value>
52  public List<Node> Members { get; set; }
53 
54  /// <summary>
55  /// Gets or sets the name.
56  /// </summary>
57  /// <value>
58  /// The name.
59  /// </value>
60  public Identifier Name { get; set; }
61 
62  /// <summary>
63  /// Gets or sets the register.
64  /// </summary>
65  /// <value>
66  /// The register.
67  /// </value>
68  public RegisterLocation Register { get; set; }
69 
70  /// <summary>
71  /// Gets or sets the qualifiers.
72  /// </summary>
73  /// <value>
74  /// The qualifiers.
75  /// </value>
76  public Qualifier Qualifiers { get; set; }
77 
78  #endregion
79 
80  #region Public Methods
81 
82  /// <inheritdoc />
83  public override IEnumerable<Node> Childrens()
84  {
85  ChildrenList.Clear();
86  ChildrenList.AddRange(Attributes);
87  ChildrenList.Add(Type);
88  if (Name != null) ChildrenList.Add(Name);
89  if (Register != null) ChildrenList.Add(Register);
90  ChildrenList.AddRange(Members);
91  return ChildrenList;
92  }
93 
94  /// <inheritdoc />
95  public override string ToString()
96  {
97  return string.Format("{0} {1} {{...}}", Type, Name);
98  }
99 
100  #endregion
101  }
102 }
Abstract node.
Definition: Node.cs:15
Declaration of a constant buffer.
ConstantBuffer()
Initializes a new instance of the ConstantBuffer class.
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes