source: PSPA/madxPSPA/src/mad_array.h @ 447

Last change on this file since 447 was 430, checked in by touze, 11 years ago

import madx-5.01.00

File size: 2.5 KB
Line 
1#ifndef MAD_ARRAY_H
2#define MAD_ARRAY_H
3
4// types
5
6struct char_array               /* dynamic array of char */
7{
8  int stamp;
9  int max,                      /* max. array size */
10      curr;                     /* current occupation */
11  char* c;
12};
13
14struct char_p_array             /* dynamic array of char pointers */
15{
16  char name[NAME_L];
17  int  max,                     /* max. array size */
18       curr,                    /* current occupation */
19       flag;                    /* ancillary flag */
20  int stamp;
21  char** p;
22};
23
24struct int_array                /* dynamic array of int */
25{
26  int stamp;
27  char name[NAME_L];
28  int  max,                     /* max. array size */
29       curr;                    /* current occupation */
30  int* i;
31};
32
33struct double_array             /* dynamic array of double */
34{
35  int stamp;
36  int max,                      /* max. array size */
37      curr;                     /* current occupation */
38  double* a;
39};
40
41struct char_array_list
42{
43  char name[NAME_L];
44  int stamp;
45  int  max,                     /* max. pointer array size */
46       curr;                    /* current occupation */
47  struct char_array** ca;
48};
49
50// interface
51
52struct char_array*      new_char_array(int length);
53struct char_p_array*    new_char_p_array(int length);
54struct int_array*       new_int_array(int length);
55struct double_array*    new_double_array(int length);
56struct char_array_list* new_char_array_list(int size);
57struct char_p_array*    clone_char_p_array(struct char_p_array* p);
58struct int_array*       clone_int_array(struct int_array* p);
59struct double_array*    clone_double_array(struct double_array* p);
60struct char_array*      delete_char_array(struct char_array* pa);
61struct char_p_array*    delete_char_p_array(struct char_p_array* pa, int flag);
62struct int_array*       delete_int_array(struct int_array* i);
63struct double_array*    delete_double_array(struct double_array* a);
64void    dump_char_array(struct char_array* a);
65void    dump_char_p_array(struct char_p_array* p);
66void    dump_int_array(struct int_array* ia);
67void    grow_char_array(struct char_array* p);
68void    grow_char_p_array(struct char_p_array* p);
69void    grow_int_array(struct int_array* p);
70void    grow_double_array(struct double_array* p);
71void    grow_char_array_list(struct char_array_list* p);
72
73void    copy_double(double* source, double* target, int n);
74int     char_p_pos(char* name, struct char_p_array* p);
75void    ftoi_array(struct double_array* da, struct int_array* ia);
76int     int_in_array(int k, int n, int* array);
77
78#endif // MAD_ARRAY_H
79
Note: See TracBrowser for help on using the repository browser.