Skip to content

Commit 77cf2d8

Browse files
committed
构建C语言适配层(输入部分)。
1 parent 1d8b7ff commit 77cf2d8

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/algorithm_module/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SET(LIBRARY_OUTPUT_PATH ${ALGORITHM_MODULE_SOURCE_DIR}/lib)
2-
SET(SRC_LIST algorithm_module.cpp)
2+
SET(SRC_LIST algorithm_module.cpp c_adapt.cpp)
33

44
IF(DEBUG)
55
SET(LIBRARY_TYPE STATIC)

src/algorithm_module/c_adapt.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "algorithm_module.h"
2+
#define C_PUBLIC extern "C" __declspec(dllexport) //CÓïÑԵĵ¼³ö±ê¼Ç
3+
namespace GraphAlgorithm
4+
{
5+
typedef int (*_FirstEdgeAdapter)(int idx_v);
6+
typedef int (*_NextEdgeAdapter)(int idx_v, int idx_e);
7+
typedef int (*_EdgeToAdapter)(int idx_v, int idx_e);
8+
PathType bfsResult;
9+
C_PUBLIC void RunBfs(int idx_start_v, int idx_dest_v,
10+
_FirstEdgeAdapter firstOf,
11+
_NextEdgeAdapter nextOf,
12+
_EdgeToAdapter destOf)
13+
{
14+
bfsResult = bfs(idx_start_v, idx_dest_v, FirstEdgeAdapter(firstOf), NextEdgeAdapter(nextOf), EdgeToAdapter(destOf));
15+
};
16+
17+
}

0 commit comments

Comments
 (0)