summaryrefslogtreecommitdiffstats
path: root/src/stateless/cp/trex_stream_vm.cpp
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-02-24 14:55:59 +0200
committerHanoh Haim <hhaim@cisco.com>2016-02-24 14:55:59 +0200
commit5a844c9d72411435842e5a0674c6fdc04e5d4e84 (patch)
treedc2738fe0638ac0ed856c70564bc7096bb33868e /src/stateless/cp/trex_stream_vm.cpp
parent9e616d8eecaefbf538174328edfce8fd96336ce6 (diff)
parent3eb4f868ef5bc728a46c8012c914f6a9381f4cdb (diff)
Merge GARP example
Diffstat (limited to 'src/stateless/cp/trex_stream_vm.cpp')
-rw-r--r--src/stateless/cp/trex_stream_vm.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/stateless/cp/trex_stream_vm.cpp b/src/stateless/cp/trex_stream_vm.cpp
index d8395ba4..7a1dc122 100644
--- a/src/stateless/cp/trex_stream_vm.cpp
+++ b/src/stateless/cp/trex_stream_vm.cpp
@@ -887,14 +887,14 @@ StreamVm::set_split_instruction(StreamVmInstructionVar *instr) {
}
/**
- * copy instructions from this VM to 'other'
+ * clone VM from this VM to 'other'
*
* @author imarom (22-Dec-15)
*
* @param other
*/
void
-StreamVm::copy_instructions(StreamVm &other) const {
+StreamVm::clone(StreamVm &other) const {
/* clear previous if any exists */
for (auto instr : other.m_inst_list) {
delete instr;
@@ -904,6 +904,7 @@ StreamVm::copy_instructions(StreamVm &other) const {
for (auto instr : m_inst_list) {
StreamVmInstruction *new_instr = instr->clone();
+
other.m_inst_list.push_back(new_instr);
/* for the split instruction - find the right one */
@@ -914,6 +915,7 @@ StreamVm::copy_instructions(StreamVm &other) const {
}
}
+ other.m_is_random_var = m_is_random_var;
}
/**
@@ -974,7 +976,7 @@ StreamVm::calc_expected_pkt_size(uint16_t regular_pkt_size) const {
StreamVm dummy;
- this->copy_instructions(dummy);
+ this->clone(dummy);
dummy.compile(regular_pkt_size);
assert(dummy.m_expected_pkt_size != 0);