memory leak fixes
[dyninst.git] / visi / h / mrlist.h
1 #ifndef _mrlist_h
2 #define _mrlist_h
3 /*
4  * Copyright (c) 1993, 1994 Barton P. Miller, Jeff Hollingsworth,
5  *     Bruce Irvin, Jon Cargille, Krishna Kunchithapadam, Karen
6  *     Karavanic, Tia Newhall, Mark Callaghan.  All rights reserved.
7  * 
8  * This software is furnished under the condition that it may not be
9  * provided or otherwise made available to, or used by, any other
10  * person, except as provided for by the terms of applicable license
11  * agreements.  No title to or ownership of the software is hereby
12  * transferred.  The name of the principals may not be used in any
13  * advertising or publicity related to this software without specific,
14  * written prior authorization.  Any use of this software must include
15  * the above copyright notice.
16  *
17  */
18
19 /* $Log: mrlist.h,v $
20 /* Revision 1.4  1994/07/07 22:40:23  newhall
21 /* fixed compile warnings
22 /*
23  * Revision 1.3  1994/06/07  17:46:53  newhall
24  * added InList method function
25  *
26  * Revision 1.2  1994/05/11  17:11:06  newhall
27  * changed data values from double to float
28  *
29  * Revision 1.1  1994/03/14  20:27:30  newhall
30  * changed visi subdirectory structure
31  *  */ 
32  /////////////////////////////////////////////
33  // Class visi_MRList
34  //   this class allows visualization writer
35  //   to access and manipulate the list of
36  //   metrics and resources associated with
37  //   the data grid
38  //   changes to these lists do not effect
39  //   the contents of the data grid
40  /////////////////////////////////////////////
41
42 #include <malloc.h>
43 #include <string.h>
44 #include "visiTypes.h"
45
46
47 typedef struct{
48   int size;
49   char *list;
50 }visi_mrListType;
51
52  
53 class visi_MRList{
54   private:
55     int numElements;  // current number of list elements
56     visi_mrListType *list;  // list elements
57     int wildCard;     // 1-if wild card character is appended to list
58     int listSize; //removeing elements doesn't realloc space, so this
59                   //value can be greater than numElements
60   public:
61     visi_MRList(){listSize = numElements = 0; list = NULL;}
62     visi_MRList(int size,int wCard,char *members);
63     visi_MRList(int size,visi_metricType *metrics);
64     visi_MRList(int size,visi_resourceType *resources);
65     ~visi_MRList();
66     int   AddElements(int num,char *elements);
67     void  Print();
68     void  AddWildCard(){wildCard = 1;}
69     int   NumElements(){return(numElements);}
70     void  RemoveWildCard(){wildCard = 0;}
71     int   RemoveElement(int elmNum);
72     int   CreateMRList(char **elements);
73     int   ListSize(){return(listSize);}
74     int   InList(char *); // returns 1 if element in list, else returns 0
75 };
76 #endif