コード例 #1
0
ファイル: gsdll.py プロジェクト: ninowalker/graphserver
        PL_TRIPHOP_DEPRIC = 2
        PL_LINK = 3
        PL_EXTERNVALUE = 4
        PL_NONE = 5
        PL_WAIT = 6
        PL_HEADWAY = 7
        PL_TRIPBOARD = 8
        PL_CROSSING = 9
        PL_ALIGHT = 10
        PL_HEADWAYBOARD = 11
        PL_EGRESS = 12
        PL_HEADWAYALIGHT = 13
        PL_ELAPSE_TIME = 14
        PL_COMBINATION = 15

LGSTypes.edgepayload_t = {1:c_int8, 2:c_int16, 4:c_int32, 8:c_int64}[c_size_t.in_dll(lgs, "EDGEPAYLOAD_ENUM_SIZE").value]
declarations = [\
    (lgs.chpNew, LGSTypes.CHPath, [c_int, c_long]),
    (lgs.chpLength, c_int, [LGSTypes.CHPath]),
    (lgs.chpCombine, LGSTypes.CHPath, [LGSTypes.CHPath, LGSTypes.CHPath]),
    (lgs.chpDestroy, None, [LGSTypes.CHPath]),
    (lgs.dist, LGSTypes.CHPath, [LGSTypes.Graph, c_char_p, c_char_p, LGSTypes.WalkOptions, c_int, c_int]),
    (lgs.get_shortcuts, POINTER(LGSTypes.CHPath), [LGSTypes.Graph, LGSTypes.Vertex, LGSTypes.WalkOptions, c_int, POINTER(c_int)]),
    (lgs.init_priority_queue, LGSTypes.Heap, [LGSTypes.Graph, LGSTypes.WalkOptions, c_int]),
    (lgs.pqPush, None, [LGSTypes.Heap, LGSTypes.Vertex, c_long]),
    (lgs.pqPop, LGSTypes.Vertex, [LGSTypes.Heap, POINTER(c_long)]),
    (lgs.get_contraction_hierarchies, LGSTypes.CH, [LGSTypes.Graph, LGSTypes.WalkOptions, c_int]),
    (lgs.chNew, LGSTypes.CH, []),
    (lgs.chUpGraph, LGSTypes.Graph, [LGSTypes.CH]),
    (lgs.chDownGraph, LGSTypes.Graph, [LGSTypes.CH]),
    (lgs.epNew, LGSTypes.EdgePayload, [LGSTypes.edgepayload_t, c_void_p]),
コード例 #2
0
ファイル: sdm_ctypes.py プロジェクト: dougalsutherland/sdm
    get_divs[intype] = fn = _LIB['np_divs_' + name]
    fn.restype = None
    fn.argtypes = [
        POINTER(POINTER(intype)), c_size_t, POINTER(c_size_t),
        POINTER(POINTER(intype)), c_size_t, POINTER(c_size_t),
        c_size_t,
        POINTER(c_char_p), c_size_t,
        POINTER(POINTER(c_double)),
        POINTER(DivParams),
    ]

################################################################################
### C values

default_c_vals = POINTER(c_double).in_dll(_LIB, 'default_c_vals')
num_default_c_vals = c_size_t.in_dll(_LIB, 'num_default_c_vals')

################################################################################
### SDM model stuff
class SDM_ClassifyD(Structure): pass
class SDM_ClassifyF(Structure): pass
class SDM_RegressD(Structure): pass
class SDM_RegressF(Structure): pass

_sdm_classes = [
    (SDM_ClassifyD, c_double, c_int),
    (SDM_ClassifyF, c_float,  c_int),
    (SDM_RegressD,  c_double, c_double),
    (SDM_RegressF,  c_float,  c_double),
]
コード例 #3
0
ファイル: gsdll.py プロジェクト: dzwarg/graphserver
    class ENUM_serialization_status_code_t:
        OK = 0
        GRAPH_FILE_NOT_FOUND = 1
        MMAP_FILE_NOT_FOUND = 2
        UNSUPPORTED_EDGE_TYPE = 3
        SERIALIZATION_READ_ERROR = 4
        BAD_FILE_SIG = 5
        BINARY_INCOMPATIBILITY = 6


for enum in ("edgepayload_t", "serialization_status_code_t"):
    setattr(
        LGSTypes,
        enum,
        {1: c_int8, 2: c_int16, 4: c_int32, 8: c_int64}[c_size_t.in_dll(lgs, "ENUM_SIZE__%s" % enum).value],
    )

declarations = [
    (lgs.chpNew, LGSTypes.CHPath, [c_int, c_long]),
    (lgs.chpLength, c_int, [LGSTypes.CHPath]),
    (lgs.chpCombine, LGSTypes.CHPath, [LGSTypes.CHPath, LGSTypes.CHPath]),
    (lgs.chpDestroy, None, [LGSTypes.CHPath]),
    (lgs.dist, LGSTypes.CHPath, [LGSTypes.Graph, c_char_p, c_char_p, LGSTypes.WalkOptions, c_int, c_int]),
    (
        lgs.get_shortcuts,
        POINTER(LGSTypes.CHPath),
        [LGSTypes.Graph, LGSTypes.Vertex, LGSTypes.WalkOptions, c_int, POINTER(c_int)],
    ),
    (lgs.init_priority_queue, LGSTypes.Heap, [LGSTypes.Graph, LGSTypes.WalkOptions, c_int]),
    (lgs.pqPush, None, [LGSTypes.Heap, LGSTypes.Vertex, c_long]),
コード例 #4
0
def sizeof(struct_type):
    try:
        return c_size_t.in_dll(libcpr, 'cpr_' + struct_type + '_sizeof').value
    except ValueError:
        raise ValueError, "unknown libcpr structure type: {}".format(
            struct_type)
コード例 #5
0
ファイル: gsdll.py プロジェクト: tonny2v/graphserver
        PL_TRIPBOARD = 8
        PL_CROSSING = 9
        PL_ALIGHT = 10
        PL_HEADWAYBOARD = 11
        PL_EGRESS = 12
        PL_HEADWAYALIGHT = 13
        PL_ELAPSE_TIME = 14
        PL_COMBINATION = 15


LGSTypes.edgepayload_t = {
    1: c_int8,
    2: c_int16,
    4: c_int32,
    8: c_int64
}[c_size_t.in_dll(lgs, "EDGEPAYLOAD_ENUM_SIZE").value]
declarations = [\
    (lgs.chpNew, LGSTypes.CHPath, [c_int, c_long]),
    (lgs.chpLength, c_int, [LGSTypes.CHPath]),
    (lgs.chpCombine, LGSTypes.CHPath, [LGSTypes.CHPath, LGSTypes.CHPath]),
    (lgs.chpDestroy, None, [LGSTypes.CHPath]),
    (lgs.dist, LGSTypes.CHPath, [LGSTypes.Graph, c_char_p, c_char_p, LGSTypes.WalkOptions, c_int, c_int]),
    (lgs.get_shortcuts, POINTER(LGSTypes.CHPath), [LGSTypes.Graph, LGSTypes.Vertex, LGSTypes.WalkOptions, c_int, POINTER(c_int)]),
    (lgs.init_priority_queue, LGSTypes.Heap, [LGSTypes.Graph, LGSTypes.WalkOptions, c_int]),
    (lgs.pqPush, None, [LGSTypes.Heap, LGSTypes.Vertex, c_long]),
    (lgs.pqPop, LGSTypes.Vertex, [LGSTypes.Heap, POINTER(c_long)]),
    (lgs.get_contraction_hierarchies, LGSTypes.CH, [LGSTypes.Graph, LGSTypes.WalkOptions, c_int]),
    (lgs.chNew, LGSTypes.CH, []),
    (lgs.chUpGraph, LGSTypes.Graph, [LGSTypes.CH]),
    (lgs.chDownGraph, LGSTypes.Graph, [LGSTypes.CH]),
    (lgs.epNew, LGSTypes.EdgePayload, [LGSTypes.edgepayload_t, c_void_p]),
コード例 #6
0
ファイル: libcpr.py プロジェクト: bavery22/libcpr
def sizeof(struct_type):
  try:
    return c_size_t.in_dll(libcpr, 'cpr_' + struct_type + '_sizeof').value
  except ValueError:
    raise ValueError, "unknown libcpr structure type: {}".format(struct_type)
コード例 #7
0
ファイル: sdm_ctypes.py プロジェクト: PengKiKi/sdm-1
        POINTER(c_size_t),
        POINTER(POINTER(intype)),
        c_size_t,
        POINTER(c_size_t),
        c_size_t,
        POINTER(c_char_p),
        c_size_t,
        POINTER(POINTER(c_double)),
        POINTER(DivParams),
    ]

################################################################################
### C values

default_c_vals = POINTER(c_double).in_dll(_LIB, 'default_c_vals')
num_default_c_vals = c_size_t.in_dll(_LIB, 'num_default_c_vals')


################################################################################
### SDM model stuff
class SDM_ClassifyD(Structure):
    pass


class SDM_ClassifyF(Structure):
    pass


class SDM_RegressD(Structure):
    pass