summaryrefslogtreecommitdiffstats
path: root/common/Operation.cpp
blob: 79fd6d4b21fe1190383f30c7ee7015dfcff36b83 (plain)
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
/*
 * File:	Operation.cpp
 *
 * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
 * See included license file for license details.
 */

#include "Operation.h"

using namespace elftosb;

//! The operation object takes ownership of \a source.
//!
//! Cross references between the target and source are updated.
void LoadOperation::setSource(DataSource * source)
{
	m_source = source;
	
	if (m_target)
	{
		m_target->setSource(m_source);
	}
	if (m_source)
	{
		m_source->setTarget(m_target);
	}
}

//! The operation object takes ownership of \a target.
//!
//! Cross references between the target and source are updated.
void LoadOperation::setTarget(DataTarget * target)
{
	m_target = target;
	
	if (m_target)
	{
		m_target->setSource(m_source);
	}
	if (m_source)
	{
		m_source->setTarget(m_target);
	}
}

//! Disposes of operations objects in the sequence.
OperationSequence::~OperationSequence()
{
//	iterator_t it = begin();
//	for (; it != end(); ++it)
//	{
//		delete it->second;
//	}
}

void OperationSequence::append(const OperationSequence * other)
{
	const_iterator_t it = other->begin();
	for (; it != other->end(); ++it)
	{
		m_operations.push_back(*it);
	}
}