ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/FAS/src/extradata.cpp
Revision: 88
Committed: Mon Aug 19 20:49:08 2002 UTC (21 years, 10 months ago) by tim
File size: 2784 byte(s)
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 tim 83 /**********************************************************************
2     * Copyright (C) 2002-2003 by Gezelter's Group
3     *This program is free software; you can redistribute it and/or modify
4     *it under the terms of the GNU General Public License as published by
5     *the Free Software Foundation version 2 of the License.
6     *
7     *This program is distributed in the hope that it will be useful,
8     *but WITHOUT ANY WARRANTY; without even the implied warranty of
9     *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10     *GNU General Public License for more details.
11     *
12     ************************************************************************
13     *Author: Teng Lin Email: tlin@nd.edu
14     *Date: 08/13/2002 Version: 1.0
15     *
16     ************************************************************************
17     *Description:
18     *
19     ***********************************************************************/
20 tim 66 #include <algorithm>
21     #include "extradata.h"
22    
23 tim 83 /***********************************************************************
24     * Class TExtraData
25     ***********************************************************************/
26    
27 tim 66 TExtraData::TExtraData()
28     {
29     _ident = "unknown";
30     _type = TExtraDataType::UNKNOWN;
31     }
32    
33     TExtraData::TExtraData(const TExtraData & extraData)
34     {
35     _ident = extraData._ident;
36     _type = extraData._type;
37     }
38    
39 tim 67 TExtraData &TExtraData::operator =(const TExtraData &extraData)
40 tim 66 {
41 tim 88 if (this == &extraData)
42 tim 66 return *this;
43 tim 88
44 tim 67 _ident = extraData._ident;
45 tim 66 _type = extraData._type;
46     return *this;
47     }
48    
49 tim 83 /***********************************************************************
50     * Class TExtraDataList
51     ***********************************************************************/
52 tim 88
53 tim 83 void TExtraDataList::AddExtraData(TExtraData *extraData)
54     {
55     if (extraData != NULL)
56     {
57 tim 88 push_back(extraData);
58 tim 83 }
59    
60     }
61    
62     void TExtraDataList::RemoveExtraData(TExtraData *extraData)
63     {
64     vector<TExtraData *>::iterator i;
65    
66 tim 88 i = find(begin(), end(), extraData);
67 tim 83
68 tim 88 if (i != end())
69 tim 83 {
70 tim 88 erase(i);
71 tim 83 }
72     else
73     {//warning
74    
75     }
76    
77     }
78    
79 tim 88 TExtraData *TExtraDataList::GetExtraData(int type)
80 tim 83 {
81 tim 88 vector<TExtraData *>::iterator i;
82 tim 83
83 tim 88 //Don't know the reason can not use functor here
84     // i = find_if(begin(), end(), TMatchExtraData(type));
85 tim 83
86 tim 88 for (i=begin(); i<end(); i++)
87     {
88     if ((*i)->GetType() == type)
89     return *i;
90     }
91 tim 83
92 tim 88 return NULL;
93 tim 83 }
94    
95 tim 88 TExtraData *TExtraDataList::GetExtraData(string ident)
96 tim 66 {
97 tim 88 vector<TExtraData *>::iterator i;
98 tim 66
99 tim 88 //Don't know the reason can not use functor here
100     // i = find_if(begin(), end(), TMatchExtraData(ident));
101 tim 66
102 tim 88 for (i=begin(); i<end(); i++)
103     {
104     if ((*i)->GetIdent() == ident)
105     return *i;
106     }
107 tim 66
108 tim 88 return NULL;
109 tim 66
110     }
111    
112    
113 tim 83 /***********************************************************************
114     * Class TBitVector
115     ***********************************************************************/
116