1/*
2 * File:	Operation.cpp
3 *
4 * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
5 * See included license file for license details.
6 */
7
8#include "Operation.h"
9
10using namespace elftosb;
11
12//! The operation object takes ownership of \a source.
13//!
14//! Cross references between the target and source are updated.
15void LoadOperation::setSource(DataSource * source)
16{
17	m_source = source;
18
19	if (m_target)
20	{
21		m_target->setSource(m_source);
22	}
23	if (m_source)
24	{
25		m_source->setTarget(m_target);
26	}
27}
28
29//! The operation object takes ownership of \a target.
30//!
31//! Cross references between the target and source are updated.
32void LoadOperation::setTarget(DataTarget * target)
33{
34	m_target = target;
35
36	if (m_target)
37	{
38		m_target->setSource(m_source);
39	}
40	if (m_source)
41	{
42		m_source->setTarget(m_target);
43	}
44}
45
46//! Disposes of operations objects in the sequence.
47OperationSequence::~OperationSequence()
48{
49//	iterator_t it = begin();
50//	for (; it != end(); ++it)
51//	{
52//		delete it->second;
53//	}
54}
55
56void OperationSequence::append(const OperationSequence * other)
57{
58	const_iterator_t it = other->begin();
59	for (; it != other->end(); ++it)
60	{
61		m_operations.push_back(*it);
62	}
63}
64