-
Notifications
You must be signed in to change notification settings - Fork 11
/
IsoPipeline.cpp
68 lines (55 loc) · 1.53 KB
/
IsoPipeline.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* IsoAlgo - piping Isometric drawing generation Algorithm.
* Copyright (C) 2013 to current year Shing Liu
*
* This program 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.
*
* Homepage:
* http://www.cppblog.com/eryar/
*
* Feedback:
*/
#include "IsoPipeline.h"
using namespace IsoAlgo;
IsoPipeline::IsoPipeline(void)
{
}
IsoPipeline::~IsoPipeline(void)
{
// free the memory.
for (std::vector<IsoComponent*>::iterator ic = myComponents.begin(); ic != myComponents.end(); ++ic)
{
delete *ic;
*ic = NULL;
}
for (std::map<std::string, IsoItemCode*>::iterator ii = myItemCodes.begin(); ii != myItemCodes.end(); ++ii)
{
delete ii->second;
ii->second = NULL;
}
}
void IsoPipeline::AddAttribute(const std::string &theKey, const std::string &theValue)
{
myAttributes.insert(std::make_pair(theKey, theValue));
}
void IsoPipeline::AddComponent(IsoComponent *theComponent)
{
myComponents.push_back(theComponent);
}
int IsoPipeline::GetComponentCount() const
{
return static_cast<int> (myComponents.size());
}
const IsoComponent* IsoPipeline::GetComponent(int theIndex) const
{
assert(theIndex >= 0 && theIndex < GetComponentCount());
return myComponents.at(theIndex);
}
void IsoPipeline::AddItemCode(IsoAlgo::IsoItemCode *theCode)
{
myItemCodes.insert(std::make_pair(theCode->GetCode(), theCode));
}