def append(self , data): if isinstance(data , int): ArgPack.cNamespace().append_int( self , data ) elif isinstance(data , float): ArgPack.cNamespace().append_double( self , data ) elif isinstance(data , BaseCClass): ArgPack.cNamespace().append_ptr( self , BaseCClass.from_param( data ) ) self.child_list.append( data ) else: raise TypeError("Can only add int/double/basecclass")
def append(self, data): if isinstance(data, int): self._append_int(data) elif isinstance(data, float): self._append_double(data) elif isinstance(data, BaseCClass): self._append_ptr(BaseCClass.from_param(data)) self.child_list.append(data) else: raise TypeError("Can only add int/double/basecclass")
def addTask(self, cfunc, arg): """ The function should come from CThreadPool.lookupCFunction(). """ if isinstance(arg, BaseCClass): arg_ptr = BaseCClass.from_param(arg) else: arg_ptr = arg self.arg_list.append(arg) self._add_job(cfunc, arg_ptr)
def addTask(self , cfunc , arg): """ The function should come from CThreadPool.lookupCFunction(). """ if isinstance(arg, BaseCClass): arg_ptr = BaseCClass.from_param( arg ) else: arg_ptr = arg self.arg_list.append( arg ) CThreadPool.cNamespace().add_job( self , cfunc , arg_ptr )
def test_return_type(self): stringlist_alloc = cwrapper.prototype( "c_void_p stringlist_alloc_new( )") string_list1 = StringListTest() stringlist_alloc = cwrapper.prototype( "stringlisttest_obj stringlist_alloc_new( )") string_list2 = stringlist_alloc() stringlist_alloc = cwrapper.prototype( "stringlisttest_ref stringlist_alloc_new( )") string_list3 = stringlist_alloc() self.assertIsInstance(string_list1, StringListTest) self.assertIsInstance(string_list2, StringListTest) self.assertIsInstance(string_list3, StringListTest) self.assertFalse(string_list1.isReference()) self.assertFalse(string_list2.isReference()) self.assertTrue(string_list3.isReference()) self.assertNotEqual(BaseCClass.from_param(string_list1), BaseCClass.from_param(string_list2)) self.assertNotEqual(BaseCClass.from_param(string_list2), BaseCClass.from_param(string_list3)) self.assertNotEqual(BaseCClass.from_param(string_list1), BaseCClass.from_param(string_list3))
def test_return_type(self): stringlist_alloc = cwrapper.prototype("c_void_p stringlist_alloc_new( )") string_list1 = StringListTest() stringlist_alloc = cwrapper.prototype("stringlisttest_obj stringlist_alloc_new( )") string_list2 = stringlist_alloc() stringlist_alloc = cwrapper.prototype("stringlisttest_ref stringlist_alloc_new( )") string_list3 = stringlist_alloc() self.assertIsInstance(string_list1, StringListTest) self.assertIsInstance(string_list2, StringListTest) self.assertIsInstance(string_list3, StringListTest) self.assertFalse(string_list1.isReference()) self.assertFalse(string_list2.isReference()) self.assertTrue(string_list3.isReference()) self.assertNotEqual(BaseCClass.from_param(string_list1), BaseCClass.from_param(string_list2)) self.assertNotEqual(BaseCClass.from_param(string_list2), BaseCClass.from_param(string_list3)) self.assertNotEqual(BaseCClass.from_param(string_list1), BaseCClass.from_param(string_list3))