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

# Content
1 /**********************************************************************
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 #include <algorithm>
21 #include "extradata.h"
22
23 /***********************************************************************
24 * Class TExtraData
25 ***********************************************************************/
26
27 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 TExtraData &TExtraData::operator =(const TExtraData &extraData)
40 {
41 if (this == &extraData)
42 return *this;
43
44 _ident = extraData._ident;
45 _type = extraData._type;
46 return *this;
47 }
48
49 /***********************************************************************
50 * Class TExtraDataList
51 ***********************************************************************/
52
53 void TExtraDataList::AddExtraData(TExtraData *extraData)
54 {
55 if (extraData != NULL)
56 {
57 push_back(extraData);
58 }
59
60 }
61
62 void TExtraDataList::RemoveExtraData(TExtraData *extraData)
63 {
64 vector<TExtraData *>::iterator i;
65
66 i = find(begin(), end(), extraData);
67
68 if (i != end())
69 {
70 erase(i);
71 }
72 else
73 {//warning
74
75 }
76
77 }
78
79 TExtraData *TExtraDataList::GetExtraData(int type)
80 {
81 vector<TExtraData *>::iterator i;
82
83 //Don't know the reason can not use functor here
84 // i = find_if(begin(), end(), TMatchExtraData(type));
85
86 for (i=begin(); i<end(); i++)
87 {
88 if ((*i)->GetType() == type)
89 return *i;
90 }
91
92 return NULL;
93 }
94
95 TExtraData *TExtraDataList::GetExtraData(string ident)
96 {
97 vector<TExtraData *>::iterator i;
98
99 //Don't know the reason can not use functor here
100 // i = find_if(begin(), end(), TMatchExtraData(ident));
101
102 for (i=begin(); i<end(); i++)
103 {
104 if ((*i)->GetIdent() == ident)
105 return *i;
106 }
107
108 return NULL;
109
110 }
111
112
113 /***********************************************************************
114 * Class TBitVector
115 ***********************************************************************/
116