def data_flow_from(self, src, type=DATA_INPUT, version=None): ''' Add data flow edge of the given type from src to self. If version is specified, then add flow to dest with explicit version, else add to most recent version. Allowed types: CPL.DATA_INPUT (default) CPL.DATA_IPC CPL.DATA_TRANSLATION CPL.DATA_COPY CPL.DATA_GENERIC is an alias for CPL.DATA_INPUT. ''' if isinstance(src, cpl_object_version): if version is not None and version != VERSION_NONE: raise Exception('The version argument must be None if ' + 'src is of type cpl_object_version') _version = src.version _src = src.object elif version is None or version == VERSION_NONE: _version = src.version() _src = src else: _version = version _src = src ret = CPLDirect.cpl_data_flow_ext(self.id, _src.id, _version, type) if not CPLDirect.cpl_is_ok(ret): raise Exception('Could not add data dependency ' + CPLDirect.cpl_error_string(ret)) return not ret == S_DUPLICATE_IGNORED
def data_flow_to(self, dest, type=DATA_INPUT, version=None): ''' Add data flow edge of type from self to dest. If version is specified, then add flow to dest with explicit version, else add to most recent version. Allowed types: CPL.DATA_INPUT (default) CPL.DATA_IPC CPL.DATA_TRANSLATION CPL.DATA_COPY CPL.DATA_GENERIC is an alias for CPL.DATA_INPUT. ''' if version is None or version == VERSION_NONE: version = self.version() ret = CPLDirect.cpl_data_flow_ext(dest.id, self.id, version, type) if not CPLDirect.cpl_is_ok(ret): raise Exception('Could not add data dependency ' + CPLDirect.cpl_error_string(ret)) return not ret == S_DUPLICATE_IGNORED