Skip to content

Commit 5a6811d

Browse files
committed
Merge pull request #1 from Symphony-DAS/2.0
2.0
2 parents bac938d + 070d5c8 commit 5a6811d

File tree

117 files changed

+5565
-483243
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+5565
-483243
lines changed
0 Bytes
Binary file not shown.
23 KB
Binary file not shown.
0 Bytes
Binary file not shown.
25.5 KB
Binary file not shown.

src/symphony-core/HDF5/HDF5.csproj

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{52BF0608-F91F-4AFD-A620-02A112E6A06D}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>HDF5</RootNamespace>
11+
<AssemblyName>HDF5</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<TargetFrameworkProfile />
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
25+
<Prefer32Bit>false</Prefer32Bit>
26+
</PropertyGroup>
27+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
<Prefer32Bit>false</Prefer32Bit>
35+
</PropertyGroup>
36+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
37+
<DebugSymbols>true</DebugSymbols>
38+
<OutputPath>bin\x64\Debug\</OutputPath>
39+
<DefineConstants>DEBUG;TRACE</DefineConstants>
40+
<DebugType>full</DebugType>
41+
<PlatformTarget>x64</PlatformTarget>
42+
<ErrorReport>prompt</ErrorReport>
43+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
44+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
45+
<Prefer32Bit>false</Prefer32Bit>
46+
</PropertyGroup>
47+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
48+
<OutputPath>bin\x64\Release\</OutputPath>
49+
<DefineConstants>TRACE</DefineConstants>
50+
<Optimize>true</Optimize>
51+
<DebugType>pdbonly</DebugType>
52+
<PlatformTarget>x64</PlatformTarget>
53+
<ErrorReport>prompt</ErrorReport>
54+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
55+
<Prefer32Bit>false</Prefer32Bit>
56+
</PropertyGroup>
57+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
58+
<DebugSymbols>true</DebugSymbols>
59+
<OutputPath>bin\x86\Debug\</OutputPath>
60+
<DefineConstants>DEBUG;TRACE</DefineConstants>
61+
<DebugType>full</DebugType>
62+
<PlatformTarget>x86</PlatformTarget>
63+
<ErrorReport>prompt</ErrorReport>
64+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
65+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
66+
<Prefer32Bit>false</Prefer32Bit>
67+
</PropertyGroup>
68+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
69+
<OutputPath>bin\x86\Release\</OutputPath>
70+
<DefineConstants>TRACE</DefineConstants>
71+
<Optimize>true</Optimize>
72+
<DebugType>pdbonly</DebugType>
73+
<PlatformTarget>x86</PlatformTarget>
74+
<ErrorReport>prompt</ErrorReport>
75+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
76+
<Prefer32Bit>false</Prefer32Bit>
77+
</PropertyGroup>
78+
<ItemGroup Condition=" '$(Platform)' == 'x86' ">
79+
<Reference Include="HDF5DotNet, Version=1.8.9.0, Culture=neutral, processorArchitecture=x86">
80+
<HintPath>$(ProjectDir)..\..\..\externals\HDF5DotNet\x86\HDF5DotNet.dll</HintPath>
81+
</Reference>
82+
</ItemGroup>
83+
<ItemGroup Condition=" '$(Platform)' == 'x64' ">
84+
<Reference Include="HDF5DotNet, Version=1.8.9.0, Culture=neutral, processorArchitecture=x64">
85+
<HintPath>$(ProjectDir)..\..\..\externals\HDF5DotNet\x64\HDF5DotNet.dll</HintPath>
86+
</Reference>
87+
</ItemGroup>
88+
<ItemGroup>
89+
<Reference Include="nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
90+
<SpecificVersion>False</SpecificVersion>
91+
<HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
92+
</Reference>
93+
<Reference Include="System" />
94+
<Reference Include="System.Core" />
95+
</ItemGroup>
96+
<ItemGroup>
97+
<Compile Include="Source\H5Attribute.cs" />
98+
<Compile Include="Source\H5AttributeManager.cs" />
99+
<Compile Include="Source\H5Dataset.cs" />
100+
<Compile Include="Source\H5Datatype.cs" />
101+
<Compile Include="Source\H5File.cs" />
102+
<Compile Include="Source\H5Group.cs" />
103+
<Compile Include="Source\H5Link.cs" />
104+
<Compile Include="Source\H5Object.cs" />
105+
<Compile Include="Source\Misc.cs" />
106+
<Compile Include="Properties\AssemblyInfo.cs" />
107+
<Compile Include="Tests\HDF5Tests.cs" />
108+
</ItemGroup>
109+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
110+
<PropertyGroup>
111+
<PostBuildEvent>copy "$(ProjectDir)..\..\..\externals\HDF5DotNet\$(Platform)\hdf5dll.dll" "$(TargetDir)"
112+
copy "$(ProjectDir)..\..\..\externals\HDF5DotNet\$(Platform)\hdf5_hldll.dll" "$(TargetDir)"
113+
copy "$(ProjectDir)..\..\..\externals\HDF5DotNet\$(Platform)\szip.dll" "$(TargetDir)"
114+
copy "$(ProjectDir)..\..\..\externals\HDF5DotNet\$(Platform)\zlib.dll"</PostBuildEvent>
115+
</PropertyGroup>
116+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
117+
Other similar extension points exist, see Microsoft.Common.targets.
118+
<Target Name="BeforeBuild">
119+
</Target>
120+
<Target Name="AfterBuild">
121+
</Target>
122+
-->
123+
</Project>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
4+
// General Information about an assembly is controlled through the following
5+
// set of attributes. Change these attribute values to modify the information
6+
// associated with an assembly.
7+
[assembly: AssemblyTitle("HDF5")]
8+
[assembly: AssemblyDescription("")]
9+
[assembly: AssemblyConfiguration("")]
10+
[assembly: AssemblyCompany("")]
11+
[assembly: AssemblyProduct("HDF5")]
12+
[assembly: AssemblyCopyright("Copyright © 2015")]
13+
[assembly: AssemblyTrademark("")]
14+
[assembly: AssemblyCulture("")]
15+
16+
// Setting ComVisible to false makes the types in this assembly not visible
17+
// to COM components. If you need to access a type in this assembly from
18+
// COM, set the ComVisible attribute to true on that type.
19+
[assembly: ComVisible(false)]
20+
21+
// The following GUID is for the ID of the typelib if this project is exposed to COM
22+
[assembly: Guid("42fb9359-a9a5-41c3-ad14-cac18b00facc")]
23+
24+
// Version information for an assembly consists of the following four values:
25+
//
26+
// Major Version
27+
// Minor Version
28+
// Build Number
29+
// Revision
30+
//
31+
// You can specify all the values or you can default the Build and Revision Numbers
32+
// by using the '*' as shown below:
33+
// [assembly: AssemblyVersion("1.0.*")]
34+
[assembly: AssemblyVersion("1.0.0.0")]
35+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
using System;
2+
using System.Linq;
3+
using System.Text;
4+
using HDF5DotNet;
5+
6+
namespace HDF5
7+
{
8+
public class H5Attribute : H5Object
9+
{
10+
private readonly string _name;
11+
12+
public override string Name { get { return _name; } }
13+
14+
internal object Value { get; private set; }
15+
16+
internal H5Attribute(H5File file, string path, string name) : base(file, path)
17+
{
18+
_name = name;
19+
}
20+
21+
public H5Attribute(object value) : this(null, null, null)
22+
{
23+
Value = value;
24+
}
25+
26+
public static implicit operator H5Attribute(string value)
27+
{
28+
return new H5Attribute(value);
29+
}
30+
31+
public static implicit operator string(H5Attribute a)
32+
{
33+
return (string) a.GetValue();
34+
}
35+
36+
public static implicit operator H5Attribute(long value)
37+
{
38+
return new H5Attribute(value);
39+
}
40+
41+
public static implicit operator long(H5Attribute a)
42+
{
43+
return (long) a.GetValue();
44+
}
45+
46+
public static implicit operator H5Attribute(double value)
47+
{
48+
return new H5Attribute(value);
49+
}
50+
51+
public static implicit operator double(H5Attribute a)
52+
{
53+
return (double)a.GetValue();
54+
}
55+
56+
public static implicit operator H5Attribute(uint value)
57+
{
58+
return new H5Attribute(value);
59+
}
60+
61+
public static implicit operator uint(H5Attribute a)
62+
{
63+
return (uint)a.GetValue();
64+
}
65+
66+
public object GetValue()
67+
{
68+
H5ObjectWithAttributes oid = null;
69+
H5DataTypeId tmpid = null;
70+
H5DataTypeId tid = null;
71+
H5DataSpaceId sid = null;
72+
H5AttributeId aid = null;
73+
try
74+
{
75+
oid = H5Ox.open(File.Fid, Path);
76+
aid = H5A.open(oid, _name);
77+
sid = H5A.getSpace(aid);
78+
79+
tmpid = H5A.getType(aid);
80+
tid = H5T.getNativeType(tmpid, H5T.Direction.DEFAULT);
81+
82+
object value;
83+
if (H5T.getClass(tid) == H5T.H5TClass.STRING)
84+
{
85+
if (H5S.get_simple_extent_type(sid) == H5S.H5SClass.NULLSPACE)
86+
{
87+
value = string.Empty;
88+
}
89+
else
90+
{
91+
var buffer = new byte[H5T.getSize(tid)];
92+
H5A.read(aid, tid, new H5Array<byte>(buffer));
93+
value = Encoding.ASCII.GetString(buffer);
94+
}
95+
}
96+
else
97+
{
98+
Type elementType = H5Tx.getSystemType(tid);
99+
100+
long[] dims = H5S.getSimpleExtentDims(sid);
101+
102+
Array data = Array.CreateInstance(elementType, dims.Any() ? dims : new long[] { 1 });
103+
104+
if (data.Length > 0)
105+
{
106+
//H5Array<type> buffer = new H5Array<type>(data);
107+
var bufferType = typeof(H5Array<>).MakeGenericType(new[] { elementType });
108+
var buffer = Activator.CreateInstance(bufferType, new object[] { data });
109+
110+
//H5A.read(attributeId, typeId, buffer);
111+
var methodInfo = typeof(H5A).GetMethod("read").MakeGenericMethod(new[] { elementType });
112+
methodInfo.Invoke(null, new[] { aid, tid, buffer });
113+
}
114+
115+
value = dims.Any() ? data : data.GetValue(0);
116+
}
117+
118+
return value;
119+
}
120+
finally
121+
{
122+
if (aid != null && aid.Id > 0)
123+
H5A.close(aid);
124+
if (sid != null && sid.Id > 0)
125+
H5S.close(sid);
126+
if (tmpid != null && tmpid.Id > 0)
127+
H5T.close(tmpid);
128+
if (tid != null && tid.Id > 0)
129+
H5T.close(tid);
130+
if (oid != null && oid.Id > 0)
131+
H5Ox.close(oid);
132+
}
133+
}
134+
}
135+
}

0 commit comments

Comments
 (0)