File: duplicate.cc

package info (click to toggle)
flexc%2B%2B 2.17.01-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,180 kB
  • sloc: cpp: 6,467; makefile: 148; sh: 130; ansic: 18
file content (20 lines) | stat: -rw-r--r-- 677 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "fpattern.ih"

// Returns a FPattern which is a duplicate of the current fpattern. It's a
// self-supporting fpattern, i.e., in the returned fpattern all its next1/next2
// links refer to the new fpattern's states, and the StateData elements are
// deep copies.

FPattern FPattern::duplicate(States &states) const
{
    Map map;
    map[0] = 0;             // the end link remains as-is and is implicitly
                            // available 

    // the pair-indices of the new fpattern are found in map[d_pair.first]
    // and map[d_pair.second];

    dupFPattern(map, states, d_pair.first);

    return FPattern(Pair(map[d_pair.first], map[d_pair.second]));
}