1
1
use crate :: bindings as ll_bindings;
2
2
use crate :: error:: TskitError ;
3
3
use crate :: ffi:: WrapTskitType ;
4
- use crate :: metadata:: * ;
5
4
use crate :: types:: Bookmark ;
6
5
use crate :: EdgeTable ;
7
6
use crate :: IndividualTable ;
@@ -19,12 +18,11 @@ use crate::TableEqualityOptions;
19
18
use crate :: TableIntegrityCheckFlags ;
20
19
use crate :: TableOutputOptions ;
21
20
use crate :: TableSortOptions ;
22
- use crate :: Time ;
23
21
use crate :: TreeSequenceFlags ;
24
22
use crate :: TskReturnValue ;
25
23
use crate :: TskitTypeAccess ;
26
24
use crate :: { tsk_id_t, tsk_size_t} ;
27
- use crate :: { EdgeId , MigrationId , NodeId , PopulationId } ;
25
+ use crate :: { EdgeId , NodeId } ;
28
26
use ll_bindings:: tsk_table_collection_free;
29
27
use mbox:: MBox ;
30
28
@@ -314,6 +312,7 @@ impl TableCollection {
314
312
/// # }
315
313
=> add_individual_with_metadata, self , ( * self . inner) . individuals) ;
316
314
315
+ migration_table_add_row ! (
317
316
/// Add a row to the migration table
318
317
///
319
318
/// # Warnings
@@ -329,36 +328,9 @@ impl TableCollection {
329
328
/// (0, 1),
330
329
/// 53.5).is_ok());
331
330
/// ```
332
- pub fn add_migration <
333
- L : Into < Position > ,
334
- R : Into < Position > ,
335
- N : Into < NodeId > ,
336
- SOURCE : Into < PopulationId > ,
337
- DEST : Into < PopulationId > ,
338
- T : Into < Time > ,
339
- > (
340
- & mut self ,
341
- span : ( L , R ) ,
342
- node : N ,
343
- source_dest : ( SOURCE , DEST ) ,
344
- time : T ,
345
- ) -> Result < MigrationId , TskitError > {
346
- let rv = unsafe {
347
- ll_bindings:: tsk_migration_table_add_row (
348
- & mut ( * self . as_mut_ptr ( ) ) . migrations ,
349
- span. 0 . into ( ) . 0 ,
350
- span. 1 . into ( ) . 0 ,
351
- node. into ( ) . 0 ,
352
- source_dest. 0 . into ( ) . 0 ,
353
- source_dest. 1 . into ( ) . 0 ,
354
- time. into ( ) . 0 ,
355
- std:: ptr:: null ( ) ,
356
- 0 ,
357
- )
358
- } ;
359
- handle_tsk_return_value ! ( rv, MigrationId ( rv) )
360
- }
331
+ => add_migration, self , ( * self . inner) . migrations) ;
361
332
333
+ migration_table_add_row_with_metadata ! (
362
334
/// Add a row with optional metadata to the migration table
363
335
///
364
336
/// # Examples
@@ -388,38 +360,7 @@ impl TableCollection {
388
360
///
389
361
/// Migration tables are not currently supported
390
362
/// by tree sequence simplification.
391
- pub fn add_migration_with_metadata <
392
- L : Into < Position > ,
393
- R : Into < Position > ,
394
- N : Into < NodeId > ,
395
- SOURCE : Into < PopulationId > ,
396
- DEST : Into < PopulationId > ,
397
- MD : MigrationMetadata ,
398
- T : Into < Time > ,
399
- > (
400
- & mut self ,
401
- span : ( L , R ) ,
402
- node : N ,
403
- source_dest : ( SOURCE , DEST ) ,
404
- time : T ,
405
- metadata : & MD ,
406
- ) -> Result < MigrationId , TskitError > {
407
- let md = EncodedMetadata :: new ( metadata) ?;
408
- let rv = unsafe {
409
- ll_bindings:: tsk_migration_table_add_row (
410
- & mut ( * self . as_mut_ptr ( ) ) . migrations ,
411
- span. 0 . into ( ) . 0 ,
412
- span. 1 . into ( ) . 0 ,
413
- node. into ( ) . 0 ,
414
- source_dest. 0 . into ( ) . 0 ,
415
- source_dest. 1 . into ( ) . 0 ,
416
- time. into ( ) . 0 ,
417
- md. as_ptr ( ) ,
418
- md. len ( ) . into ( ) ,
419
- )
420
- } ;
421
- handle_tsk_return_value ! ( rv, MigrationId ( rv) )
422
- }
363
+ => add_migration_with_metadata, self , ( * self . inner) . migrations) ;
423
364
424
365
node_table_add_row ! (
425
366
/// Add a row to the node table
@@ -970,6 +911,7 @@ impl crate::traits::NodeListGenerator for TableCollection {}
970
911
#[ cfg( test) ]
971
912
mod test {
972
913
use super :: * ;
914
+ use crate :: metadata:: * ;
973
915
use crate :: prelude:: * ;
974
916
use crate :: NodeFlags ;
975
917
0 commit comments