Example #1
0
    def get_all_objects(self, prefix, type = 0, fast=False):
        '''
        Return all objects in the provenance database. If fast = True, then
        fetch only incomplete information about each object, so that it is
        faster.
        '''

        if fast:
            flags = CPLDirect.CPL_I_FAST
        else:
            flags = 0

        vp = CPLDirect.new_std_vector_cplxx_object_info_tp()
        ret = CPLDirect.cpl_get_all_objects(prefix, flags, type,
            CPLDirect.cpl_cb_collect_object_info_vector, vp)

        if not CPLDirect.cpl_is_ok(ret):
            CPLDirect.delete_std_vector_cplxx_object_info_tp(vp)
            raise CPLException('Unable to get all objects: ' +
                    CPLDirect.cpl_error_string(ret), ret)

        v = CPLDirect.cpl_dereference_p_std_vector_cplxx_object_info_t(vp)
        l = []
        if v != S_NO_DATA :
            for e in v:
                l.append(cpl_object_info(cpl_object(e.id),
                    e.creation_time, e.prefix, e.name,
                    e.type))

        CPLDirect.delete_std_vector_cplxx_object_info_tp(vp)
        return l
Example #2
0
    def get_all_objects(self, fast=False):
        '''
        Return all objects in the provenance database. If fast = True, then
        fetch only incomplete information about each object, so that it is
        faster.
        '''

        if fast:
            flags = CPLDirect.CPL_I_FAST
        else:
            flags = 0

        vp = CPLDirect.new_std_vector_cplxx_object_info_tp()
        ret = CPLDirect.cpl_get_all_objects(flags,
            CPLDirect.cpl_cb_collect_object_info_vector, vp)

        if not CPLDirect.cpl_is_ok(ret):
            CPLDirect.delete_std_vector_cplxx_object_info_tp(vp)
            raise CPLException('Unable to get all objects: ' +
                    CPLDirect.cpl_error_string(ret), ret)

        v = CPLDirect.cpl_dereference_p_std_vector_cplxx_object_info_t(vp)
        l = []
        if v != S_NO_DATA :
            for e in v:
                if e.bundle_id == NONE:
                    bundle = None
                else:
                    bundle = cpl_object(e.bundle_id)
                l.append(cpl_object_info(cpl_object(e.id),
                    e.creation_time, e.prefix, e.name,
                    e.type, bundle))

        CPLDirect.delete_std_vector_cplxx_object_info_tp(vp)
        return l
Example #3
0
    def get_all_objects(self, fast=False):
        '''
		Return all objects in the provenance database. If fast = True, then
		fetch only incomplete information about each object, so that it is
		faster.
		'''

        if fast:
            flags = CPLDirect.CPL_I_FAST
        else:
            flags = 0

        vp = CPLDirect.new_std_vector_cplxx_object_info_tp()
        ret = CPLDirect.cpl_get_all_objects(
            flags, CPLDirect.cpl_cb_collect_object_info_vector, vp)

        if not CPLDirect.cpl_is_ok(ret):
            CPLDirect.delete_std_vector_cplxx_object_info_tp(vp)
            raise Exception('Unable to get all objects: ' +
                            CPLDirect.cpl_error_string(ret))

        v = CPLDirect.cpl_dereference_p_std_vector_cplxx_object_info_t(vp)
        l = []
        if v != S_NO_DATA:
            for e in v:
                if e.container_id == NONE or e.container_version < 0:
                    container = None
                else:
                    container = cpl_object_version(cpl_object(e.container_id),
                                                   e.container_version)
                if e.creation_session == NONE:
                    creation_session = None
                else:
                    creation_session = cpl_session(e.creation_session)
                l.append(
                    cpl_object_info(cpl_object(e.id), e.version,
                                    creation_session, e.creation_time,
                                    e.originator, e.name, e.type, container))

        CPLDirect.delete_std_vector_cplxx_object_info_tp(vp)
        return l
	def get_all_objects(self, fast=False):
		'''
		Return all objects in the provenance database. If fast = True, then
		fetch only incomplete information about each object, so that it is
		faster.
		'''

		if fast:
			flags = CPLDirect.CPL_I_FAST
		else:
			flags = 0

		vp = CPLDirect.new_std_vector_cplxx_object_info_tp()
		ret = CPLDirect.cpl_get_all_objects(flags,
			CPLDirect.cpl_cb_collect_object_info_vector, vp)

		if not CPLDirect.cpl_is_ok(ret):
			CPLDirect.delete_std_vector_cplxx_object_info_tp(vp)
			raise Exception('Unable to get all objects: ' +
					CPLDirect.cpl_error_string(ret))

		v = CPLDirect.cpl_dereference_p_std_vector_cplxx_object_info_t(vp)
		l = []
		if v != S_NO_DATA :
			for e in v:
				if e.container_id == NONE or e.container_version < 0:
					container = None
				else:
					container = cpl_object_version(cpl_object(e.container_id),
							e.container_version)
				if e.creation_session == NONE:
					creation_session = None
				else:
					creation_session = cpl_session(e.creation_session)
				l.append(cpl_object_info(cpl_object(e.id), e.version,
					creation_session, e.creation_time, e.originator, e.name,
					e.type, container))

		CPLDirect.delete_std_vector_cplxx_object_info_tp(vp)
		return l