Skip to content

Commit bcb60bf

Browse files
committed
dss_capi_lib.cs: Expose the new DSS C-API functions
1 parent 9fdd75e commit bcb60bf

File tree

1 file changed

+56
-4
lines changed

1 file changed

+56
-4
lines changed

src/dss_capi_lib.cs

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
// dss_sharp: A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.
3-
// Copyright (c) 2016-2022 Paulo Meira
4-
// Copyright (c) 2018-2022 DSS Extensions contributors
3+
// Copyright (c) 2016-2023 Paulo Meira
4+
// Copyright (c) 2018-2023 DSS Extensions contributors
55
//
66
// See LICENSE for more information.
77
//
@@ -18,8 +18,12 @@ namespace native
1818
{
1919
/// <summary>
2020
/// The DSS_CAPI static class exposes DSS C-API functions to C#.
21-
/// Some functions are not exposed through the traditional API classes,
22-
/// but advanced users are free to use them.
21+
/// DSS C-API is the library from DSS Extensions that implements the
22+
/// (customized, not supported by EPRI, etc.) OpenDSS engine and wraps
23+
/// it in easily consumable C-compatible functions.
24+
///
25+
/// Some functions in this class are not exposed through the traditional
26+
/// API classes, but advanced users are free to use them.
2327
/// </summary>
2428
public static class DSS_CAPI
2529
{
@@ -1119,6 +1123,15 @@ public static void ctx_Capacitors_Set_IsDelta(IntPtr /* void */ ctx, bool Value)
11191123
public static extern double ctx_CktElement_Get_Variable(IntPtr /* void */ ctx, [param: MarshalAs(UnmanagedType.LPStr)] string MyVarName, ref int Code);
11201124
#endif
11211125

1126+
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
1127+
public static extern int ctx_CktElement_Get_VariableIdx(IntPtr /* void */ ctx);
1128+
1129+
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
1130+
public static extern IntPtr ctx_CktElement_Get_VariableName(IntPtr /* void */ ctx);
1131+
1132+
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
1133+
public static extern double ctx_CktElement_Get_VariableValue(IntPtr /* void */ ctx);
1134+
11221135
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
11231136
public static extern double ctx_CktElement_Get_Variablei(IntPtr /* void */ ctx, int Idx, ref int Code);
11241137

@@ -1184,6 +1197,20 @@ public static void ctx_CktElement_Set_Enabled(IntPtr /* void */ ctx, bool Value)
11841197
public static extern void ctx_CktElement_Set_Variable(IntPtr /* void */ ctx, [param: MarshalAs(UnmanagedType.LPStr)] string MyVarName, ref int Code, double Value);
11851198
#endif
11861199

1200+
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
1201+
public static extern void ctx_CktElement_Set_VariableIdx(IntPtr /* void */ ctx, int Value);
1202+
1203+
#if NETSTANDARD2_1_OR_GREATER
1204+
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
1205+
public static extern void ctx_CktElement_Set_VariableName(IntPtr /* void */ ctx, [param: MarshalAs(UnmanagedType.LPUTF8Str)] string Value);
1206+
#else
1207+
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
1208+
public static extern void ctx_CktElement_Set_VariableName(IntPtr /* void */ ctx, [param: MarshalAs(UnmanagedType.LPStr)] string Value);
1209+
#endif
1210+
1211+
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
1212+
public static extern void ctx_CktElement_Set_VariableValue(IntPtr /* void */ ctx, double Value);
1213+
11871214
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
11881215
public static extern void ctx_CktElement_Set_Variablei(IntPtr /* void */ ctx, int Idx, ref int Code, double Value);
11891216

@@ -1355,12 +1382,18 @@ public static void ctx_CktElement_Set_Enabled(IntPtr /* void */ ctx, bool Value)
13551382
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
13561383
public static extern void ctx_DSS_Get_Classes_GR(IntPtr /* void */ ctx);
13571384

1385+
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
1386+
public static extern uint ctx_DSS_Get_CompatFlags(IntPtr /* void */ ctx);
1387+
13581388
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
13591389
public static extern IntPtr ctx_DSS_Get_DataPath(IntPtr /* void */ ctx);
13601390

13611391
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
13621392
public static extern IntPtr ctx_DSS_Get_DefaultEditor(IntPtr /* void */ ctx);
13631393

1394+
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
1395+
public static extern ushort ctx_DSS_Get_EnableArrayDimensions(IntPtr /* void */ ctx);
1396+
13641397
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
13651398
public static extern ushort ctx_DSS_Get_LegacyModels(IntPtr /* void */ ctx);
13661399

@@ -1444,6 +1477,9 @@ public static void ctx_DSS_Set_COMErrorResults(IntPtr /* void */ ctx, bool Value
14441477
ctx_DSS_Set_COMErrorResults(ctx, (ushort) (Value ? 1u : 0u));
14451478
}
14461479

1480+
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
1481+
public static extern void ctx_DSS_Set_CompatFlags(IntPtr /* void */ ctx, uint Value);
1482+
14471483
#if NETSTANDARD2_1_OR_GREATER
14481484
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
14491485
public static extern void ctx_DSS_Set_DataPath(IntPtr /* void */ ctx, [param: MarshalAs(UnmanagedType.LPUTF8Str)] string Value);
@@ -1452,6 +1488,14 @@ public static void ctx_DSS_Set_COMErrorResults(IntPtr /* void */ ctx, bool Value
14521488
public static extern void ctx_DSS_Set_DataPath(IntPtr /* void */ ctx, [param: MarshalAs(UnmanagedType.LPStr)] string Value);
14531489
#endif
14541490

1491+
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
1492+
public static extern void ctx_DSS_Set_EnableArrayDimensions(IntPtr /* void */ ctx, ushort Value);
1493+
1494+
public static void ctx_DSS_Set_EnableArrayDimensions(IntPtr /* void */ ctx, bool Value)
1495+
{
1496+
ctx_DSS_Set_EnableArrayDimensions(ctx, (ushort) (Value ? 1u : 0u));
1497+
}
1498+
14551499
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
14561500
public static extern void ctx_DSS_Set_LegacyModels(IntPtr /* void */ ctx, ushort Value);
14571501

@@ -1493,6 +1537,14 @@ public static void ctx_DSS_Set_LegacyModels(IntPtr /* void */ ctx, bool Value)
14931537
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
14941538
public static extern IntPtr ctx_Error_Get_NumberPtr(IntPtr /* void */ ctx);
14951539

1540+
#if NETSTANDARD2_1_OR_GREATER
1541+
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
1542+
public static extern void ctx_Error_Set_Description(IntPtr /* void */ ctx, [param: MarshalAs(UnmanagedType.LPUTF8Str)] string Value);
1543+
#else
1544+
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
1545+
public static extern void ctx_Error_Set_Description(IntPtr /* void */ ctx, [param: MarshalAs(UnmanagedType.LPStr)] string Value);
1546+
#endif
1547+
14961548
[DllImport("dss_capi", CallingConvention = CallingConvention.Cdecl)]
14971549
public static extern void ctx_Error_Set_EarlyAbort(IntPtr /* void */ ctx, ushort Value);
14981550

0 commit comments

Comments
 (0)