Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/14/10 00:42:28 (15 years ago)
Author:
epitzer
Message:

Update API docs. (#548)

Location:
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/DataMemberAccessor.cs

    r3004 r3016  
    1212  public class DataMemberAccessor {
    1313
     14    /// <summary>
     15    /// The function to get the value of the data member.
     16    /// </summary>
    1417    public readonly Func<object> Get;
     18
     19    /// <summary>
     20    /// The function to set the value of the data member.
     21    /// </summary>
    1522    public readonly Action<object> Set;
     23
     24    /// <summary>
     25    /// The name of the data member.
     26    /// </summary>
    1627    public readonly string Name;
     28
     29    /// <summary>
     30    /// The default value of the data member, can remain <c>null</c>
     31    /// if no default value. If left null, this will also leave the
     32    /// default value for value types (e.g. 0 for <c>int</c>).
     33    /// </summary>
    1734    public readonly object DefaultValue;
    1835
    1936
    2037    /// <summary>
    21     /// Create a DataMemberAccessor from a FieldInfo or PropertyInfo for the give object.
     38    /// Create a <see cref="DataMemberAccessor"/> from a FieldInfo or
     39    /// PropertyInfo for the give object.
    2240    /// </summary>
     41    /// <param name="memberInfo">The member info.</param>
     42    /// <param name="name">The name.</param>
     43    /// <param name="defaultvalue">The defaultvalue.</param>
     44    /// <param name="obj">The object.</param>
    2345    public DataMemberAccessor(MemberInfo memberInfo, string name, object defaultvalue, object obj) {
    2446      Name = name;
     
    4567    /// Wrap existing getter and setter functions.
    4668    /// </summary>
     69    /// <param name="name">The name.</param>
     70    /// <param name="defaultValue">The default value.</param>
     71    /// <param name="getter">The getter.</param>
     72    /// <param name="setter">The setter.</param>
    4773    public DataMemberAccessor(string name, object defaultValue,
    4874        Func<object> getter, Action<object> setter) {
     
    5278      Set = setter;
    5379    }
    54    
     80
    5581    /// <summary>
    5682    /// Create an empty accessor that just encapsulates an object
    5783    /// without access.
    5884    /// </summary>
     85    /// <param name="o">The object</param>
    5986    public DataMemberAccessor(object o) {
    6087      Name = null;
     
    6895    /// without access.
    6996    /// </summary>
     97    /// <param name="o">The object</param>
     98    /// <param name="name">The object's name.</param>
    7099    public DataMemberAccessor(object o, string name) {
    71100      Name = name;
     
    75104    }
    76105
     106    /// <summary>
     107    /// Returns a <see cref="System.String"/> that represents this instance.
     108    /// </summary>
     109    /// <returns>
     110    /// A <see cref="System.String"/> that represents this instance.
     111    /// </returns>
    77112    public override string ToString() {
    78113      return String.Format("DataMemberAccessor({0}, {1}, {2}, {3})",
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableAttribute.cs

    r2994 r3016  
    99
    1010  /// <summary>
    11   /// Mark the member of a class to be considered by the <code>StorableSerializer</code>.
    12   /// The class must be marked as <code>[StorableClass(StorableClassType.Empty)]</code> and the
    13   /// <code>StorableClassType</code> should be set to <code>MarkedOnly</code> for
     11  /// Mark the member of a class to be considered by the <c>StorableSerializer</c>.
     12  /// The class must be marked as <c>[StorableClass(StorableClassType.Empty)]</c> and the
     13  /// <c>StorableClassType</c> should be set to <c>MarkedOnly</c> for
    1414  /// this attribute to kick in.
    1515  /// </summary>
     
    2222    /// <summary>
    2323    /// An optional name for this member that will be used during serialization.
    24     ///
    2524    /// This allows to rename a field/property in code but still be able to read
    2625    /// the old serialized format.
    2726    /// </summary>
     27    /// <value>The name.</value>
    2828    public string Name { get; set; }
    2929
     
    3434    /// deserialization.
    3535    /// </summary>
     36    /// <value>The default value.</value>
    3637    public object DefaultValue { get; set; }
    3738
     39    /// <summary>
     40    /// Returns a <see cref="System.String"/> that represents this instance.
     41    /// </summary>
     42    /// <returns>
     43    /// A <see cref="System.String"/> that represents this instance.
     44    /// </returns>
    3845    public override string ToString() {
    3946      StringBuilder sb = new StringBuilder();
     
    6067      BindingFlags.DeclaredOnly;
    6168
     69    /// <summary>
     70    /// Encapsulate information about storable members of a class
     71    /// that have the storable attribute set.
     72    /// </summary>
    6273    public sealed class StorableMemberInfo {
     74
     75      /// <summary>
     76      /// Gets the [Storable] attribute itself.
     77      /// </summary>
     78      /// <value>The [Storable] attribute.</value>
    6379      public StorableAttribute Attribute { get; private set; }
     80
     81      /// <summary>
     82      /// Gets the .NET reflection MemberInfo.
     83      /// </summary>
     84      /// <value>The member info.</value>
    6485      public MemberInfo MemberInfo { get; private set; }
     86
     87
     88      /// <summary>
     89      /// Gets disentangled name (i.e. unique access name regardless of
     90      /// type hierarchy.
     91      /// </summary>
     92      /// <value>The disentangled name.</value>
    6593      public string DisentangledName { get; private set; }
     94
     95
     96      /// <summary>
     97      /// Gets the fully qualified member name.
     98      /// </summary>
     99      /// <value>The the fully qualified member name.</value>
    66100      public string FullyQualifiedMemberName {
    67101        get {
     
    73107        }
    74108      }
    75       public StorableMemberInfo(StorableAttribute attribute, MemberInfo memberInfo) {
     109
     110      internal StorableMemberInfo(StorableAttribute attribute, MemberInfo memberInfo) {
    76111        this.Attribute = attribute;
    77112        this.MemberInfo = memberInfo;
    78113      }
     114
     115      /// <summary>
     116      /// Returns a <see cref="System.String"/> that represents this instance.
     117      /// </summary>
     118      /// <returns>
     119      /// A <see cref="System.String"/> that represents this instance.
     120      /// </returns>
    79121      public override string ToString() {
    80122        return new StringBuilder()
     
    82124          .Append(MemberInfo).Append('}').ToString();
    83125      }
    84       public void SetDisentangledName(string name) {
     126
     127      internal void SetDisentangledName(string name) {
    85128        DisentangledName = Attribute.Name ?? name;
    86129      }
     130
     131      /// <summary>
     132      /// Gets the delcaring type of the property.
     133      /// </summary>
     134      /// <returns></returns>
    87135      public Type GetPropertyDeclaringBaseType() {
    88136        return ((PropertyInfo)MemberInfo).GetGetMethod(true).GetBaseDefinition().DeclaringType;
     
    90138    }
    91139
    92     sealed class TypeQuery {
     140    private sealed class TypeQuery {
    93141      public Type Type { get; private set; }
    94142      public bool Inherited { get; private set; }
     
    99147    }
    100148
    101     sealed class MemberCache : Dictionary<TypeQuery, IEnumerable<StorableMemberInfo>> { }
     149    private sealed class MemberCache : Dictionary<TypeQuery, IEnumerable<StorableMemberInfo>> { }
    102150
    103151    private static MemberCache memberCache = new MemberCache();
     
    106154    /// <summary>
    107155    /// Get all fields and properties of a class that have the
    108     /// <code>[Storable]</code> attribute set.
    109     /// </summary>   
     156    /// <c>[Storable]</c> attribute set.
     157    /// </summary>
     158    /// <param name="type">The type.</param>
     159    /// <returns>An enumerable of StorableMemberInfos.</returns>
    110160    public static IEnumerable<StorableMemberInfo> GetStorableMembers(Type type) {
    111161      return GetStorableMembers(type, true);
     
    114164    /// <summary>
    115165    /// Get all fields and properties of a class that have the
    116     /// <code>[Storable]</code> attribute set.
    117     /// </summary>       
    118     /// <param name="inherited">should storable members from base classes be included</param>   
     166    /// <c>[Storable]</c> attribute set.
     167    /// </summary>
     168    /// <param name="type">The type.</param>
     169    /// <param name="inherited">should storable members from base classes be included</param>
     170    /// <returns>An enumerable of StorableMemberInfos</returns>
    119171    public static IEnumerable<StorableMemberInfo> GetStorableMembers(Type type, bool inherited) {
    120172      lock (memberCache) {
     
    144196    /// Get the associated accessors for all storable memebrs.
    145197    /// </summary>
    146     /// <param name="obj"></param>
    147     /// <returns></returns>
     198    /// <param name="obj">The object</param>
     199    /// <returns>An enumerable of storable accessors.</returns>
    148200    public static IEnumerable<DataMemberAccessor> GetStorableAccessors(object obj) {     
    149201      foreach (var memberInfo in GetStorableMembers(obj.GetType()))
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableClassAttribute.cs

    r2994 r3016  
    4848
    4949  /// <summary>
    50   /// Mark a class to be considered by the <code>StorableSerializer</code>.
     50  /// Mark a class to be considered by the <c>StorableSerializer</c>.
    5151  /// </summary>
    5252  [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
     
    6060
    6161    /// <summary>
    62     /// Mark a class to be serialize by the <code>StorableSerizlier</code>   
     62    /// Mark a class to be serialize by the <c>StorableSerizlier</c>   
    6363    /// </summary>   
    6464    public StorableClassAttribute(StorableClassType type) {
     
    7070    /// or conatins proper parameterization through the storable attribute.
    7171    /// </summary>
    72     /// <param name="type"></param>
    73     /// <param name="recusrive"></param>
    74     /// <returns></returns>
     72    /// <param name="type">The type.</param>
     73    /// <param name="recusrive">if set to <c>true</c> recusrively checks class hierarchy.</param>
     74    /// <returns>
     75    /// <c>true</c> if the specified type is a storable type; otherwise, <c>false</c>.
     76    /// </returns>
    7577    public static bool IsStorableType(Type type, bool recusrive) {
    7678      if (IsEmptyType(type, recusrive))
     
    9193
    9294
     95    /// <summary>
     96    /// Determines whether the specified type has no fields or properties except
     97    /// readonly properties or constant fields.
     98    /// </summary>
     99    /// <param name="type">The type.</param>
     100    /// <param name="recursive">if set to <c>true</c> recursively check class hierarchy.</param>
     101    /// <returns>
     102    /// <c>true</c> if the specified type is empty; otherwise, <c>false</c>.
     103    /// </returns>
    93104    public static bool IsEmptyType(Type type, bool recursive) {
    94105      foreach (MemberInfo memberInfo in type.GetMembers(allDeclaredMembers)) {
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableConstructorAttribute.cs

    r2994 r3016  
    1111  /// <summary>
    1212  /// Indicate that this constructor should be used instead of the default constructor
    13   /// when the <code>StorableSerializer</code> instantiates this class during
     13  /// when the <c>StorableSerializer</c> instantiates this class during
    1414  /// deserialization.
    1515  ///
    16   /// The constructor must take exactly one <code>bool</code> argument that will be
    17   /// set to <code>true</code> during deserialization.
     16  /// The constructor must take exactly one <c>bool</c> argument that will be
     17  /// set to <c>true</c> during deserialization.
    1818  /// </summary>
    1919  [AttributeUsage(AttributeTargets.Constructor, Inherited = false, AllowMultiple = false)]
     
    2828
    2929    /// <summary>
    30     /// Get a designated storable constructor for a type or <code>null</code>.
    31     /// </summary>   
     30    /// Get a designated storable constructor for a type or <c>null</c>.
     31    /// </summary>
     32    /// <param name="type">The type.</param>
     33    /// <returns>The <see cref="ConstructorInfo"/> of the storable constructor or <c>null</c></returns>
    3234    public static ConstructorInfo GetStorableConstructor(Type type) {
    3335      lock (constructorCache) {
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableHookAttribute.cs

    r3010 r3016  
    1616  /// <summary>
    1717  /// Mark methods that should be called at certain times during
    18   /// serialization/deserialization by the <code>StorableSerializer</code>.
     18  /// serialization/deserialization by the <c>StorableSerializer</c>.
    1919  /// </summary>
    2020  [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)]
     
    3232
    3333    private readonly HookType hookType;
     34    /// <summary>
     35    /// Gets the type of the hook.
     36    /// </summary>
     37    /// <value>The type of the hook.</value>
    3438    public HookType HookType {
    3539      get { return hookType; }
     
    3842
    3943    /// <summary>
    40     /// Mark method as <code>StorableSerializer</code> hook to be run
    41     /// at the <code>HookType</code> time.
     44    /// Mark method as <c>StorableSerializer</c> hook to be run
     45    /// at the <c>HookType</c> time.
    4246    /// </summary>
    43     /// <param name="hookType"></param>
     47    /// <param name="hookType">Type of the hook.</param>
    4448    public StorableHookAttribute(HookType hookType) {
    4549      this.hookType = hookType;
     
    5660
    5761    /// <summary>
    58     /// Invoke <code>hookType</code> hook on <code>obj</code>.
    59     /// </summary>   
     62    /// Invoke <c>hookType</c> hook on <c>obj</c>.
     63    /// </summary>
     64    /// <param name="hookType">Type of the hook.</param>
     65    /// <param name="obj">The object.</param>
    6066    public static void InvokeHook(HookType hookType, object obj) {
    6167      if (obj == null)
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs

    r2994 r3016  
    1111  /// <summary>
    1212  /// Intended for serialization of all custom classes. Classes should have the
    13   /// <code>[StorableClass(StorableClassType.Empty)]</code> attribute set and a serialization mode set.
     13  /// <c>[StorableClass(StorableClassType.Empty)]</c> attribute set and a serialization mode set.
    1414  /// Optionally selected fields and properties can be marked with the
    15   /// <code>[Storable]</code> attribute.
     15  /// <c>[Storable]</c> attribute.
    1616  /// </summary>
    1717  [StorableClass(StorableClassType.Empty)]   
Note: See TracChangeset for help on using the changeset viewer.