TSP: The Transport Sample Protocol



Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

tsp_group_algo.c File Reference

#include "tsp_sys_headers.h"
#include "tsp_group_algo.h"
#include "tsp_group_algo_data.h"
#include "tsp_datapool.h"
#include "tsp_data_sender.h"

Go to the source code of this file.

Defines

#define PGCD(n1, n2, pgcd)
 pgcd will be equal to the GCD od n1 and n2

#define PPCM(n1, n2, ppcm)
 ppcm will be equal to the LCM of n1 and n2


Functions

int TSP_group_algo_get_nb_groups (const TSP_sample_symbol_info_list_t *symbols)
 Get the total number of groups.

void TSP_group_algo_destroy_symbols_table (TSP_groups_t *groups)
 Destroy the group table.

void TSP_group_algo_create_symbols_table_free_call (TSP_sample_symbol_info_list_t *symbols)
 Free the memory allocated by TSP_group_algo_create_symbols_table for out_symbols.

int TSP_group_algo_create_symbols_table (const TSP_sample_symbol_info_list_t *in_symbols, TSP_sample_symbol_info_list_t *out_symbols, TSP_groups_t *out_groups, TSP_datapool_t datapool)
 Create the groups table for a given symbol list.

int TSP_group_algo_get_group_number (TSP_groups_t *groups)
 Get the total number of computed groups.

int TSP_group_algo_get_biggest_group_size (TSP_groups_t *groups)
 Get the biggest group size of all computed groups.


Detailed Description

Header
/cvsroot/tsp/tsp/src/core/ctrl/tsp_group_algo.c,v 1.12 2004/09/22 14:25:58 tractobob Exp

-----------------------------------------------------------------------

TSP Library - core components for a generic Transport Sampling Protocol.

Copyright (c) 2002 Yves DUFRENNE, Stephane GALLES, Eric NOULARD and Robert PAGNOT

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

-----------------------------------------------------------------------

Project : TSP Maintainer : tsp@astrium-space.com Component : Provider

-----------------------------------------------------------------------

Purpose : Implementation for the function used to calculate and use groups

-----------------------------------------------------------------------

Definition in file tsp_group_algo.c.


Define Documentation

#define PGCD n1,
n2,
pgcd   ) 
 

Value:

{ \
    int ln2 = n2; \
    pgcd = n1; \
    if ( pgcd != ln2 ) \
        {for(;pgcd != ln2; (pgcd > ln2) ? (pgcd -= ln2) : (ln2 -= pgcd )); }\
}
pgcd will be equal to the GCD od n1 and n2

Definition at line 48 of file tsp_group_algo.c.

#define PPCM n1,
n2,
ppcm   ) 
 

Value:

{ \
    int pgcd; \
    PGCD(n1, n2, pgcd); \
    ppcm = (n1 * n2) / pgcd ; \
}
ppcm will be equal to the LCM of n1 and n2

Definition at line 57 of file tsp_group_algo.c.

Referenced by TSP_group_algo_get_nb_groups().


Function Documentation

int TSP_group_algo_create_symbols_table const TSP_sample_symbol_info_list_t *  symbols,
TSP_sample_symbol_info_list_t *  out_symbols,
TSP_groups_t out_groups,
TSP_datapool_t  datapool
 

Create the groups table for a given symbol list.

Parameters:
symbols The required symbol list
out_symbols The required symbol list with information added (group id ...)
out_groups The computed group table
datapool The associated datapool used to link the datapool suymbols address to the value in the group table
Returns:
TRUE=OK

< rank in a group

< id for a group

Definition at line 307 of file tsp_group_algo.c.

References TSP_data_sender_get_double_encoder(), and TSP_datapool_get_symbol_value().

Referenced by TSP_session_create_symbols_table_by_channel().

void TSP_group_algo_create_symbols_table_free_call TSP_sample_symbol_info_list_t *  old_out_symbols  ) 
 

Free the memory allocated by TSP_group_algo_create_symbols_table for out_symbols.

Parameters:
old_out_symbols List allocated by TSP_group_algo_create_symbols_table

Definition at line 289 of file tsp_group_algo.c.

Referenced by TSP_session_create_symbols_table_by_channel_free_call().

void TSP_group_algo_destroy_symbols_table TSP_groups_t groups  ) 
 

Destroy the group table.

Parameters:
old_out_symbols List allocated by TSP_group_algo_create_symbols_table

Definition at line 272 of file tsp_group_algo.c.

int TSP_group_algo_get_biggest_group_size TSP_groups_t groups  ) 
 

Get the biggest group size of all computed groups.

Returns:
Biggest group size

Definition at line 419 of file tsp_group_algo.c.

Referenced by TSP_session_create_data_sender_by_channel().

int TSP_group_algo_get_group_number TSP_groups_t groups  ) 
 

Get the total number of computed groups.

Returns:
Groups number

Definition at line 403 of file tsp_group_algo.c.

Referenced by TSP_session_create_symbols_table_by_channel().

int TSP_group_algo_get_nb_groups const TSP_sample_symbol_info_list_t *  symbols  ) 
 

Get the total number of groups.

list of symbols on which the number of groups must be calculated

Returns:
Total Number of groups for the list

Definition at line 79 of file tsp_group_algo.c.

References PPCM.

Framework Home Page.


Beware !! TSP wave is coming...