refactor: extract setpSeg typedef to own header
This commit is contained in:
parent
da174b54cd
commit
84715444c9
|
@ -9,7 +9,9 @@
|
||||||
#define CIRCUIT_H
|
#define CIRCUIT_H
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include "trans.h"
|
#include "setpSeg.h"
|
||||||
|
|
||||||
|
class Segment;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Builds a circuit, given one segment in that circuit.
|
* Builds a circuit, given one segment in that circuit.
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "SegmentCache.h"
|
#include "SegmentCache.h"
|
||||||
|
#include "trans.h"
|
||||||
|
|
||||||
Common Common::create(const SegmentCache& segs) {
|
Common Common::create(const SegmentCache& segs) {
|
||||||
return Common(
|
return Common(
|
||||||
|
|
3
Common.h
3
Common.h
|
@ -8,9 +8,10 @@
|
||||||
#ifndef COMMON_H
|
#ifndef COMMON_H
|
||||||
#define COMMON_H
|
#define COMMON_H
|
||||||
|
|
||||||
#include "trans.h"
|
#include "setpSeg.h"
|
||||||
|
|
||||||
class SegmentCache;
|
class SegmentCache;
|
||||||
|
class Segment;
|
||||||
|
|
||||||
class Common {
|
class Common {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
|
|
||||||
#define TRACEREG 1
|
#define TRACEREG 1
|
||||||
#define TRACESEG 1
|
//#define TRACESEG 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SegmentCache.h"
|
#include "SegmentCache.h"
|
||||||
|
#include "trans.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@ -42,3 +43,11 @@ Segment* SegmentCache::get(const std::string& id) const {
|
||||||
|
|
||||||
return this->cache.at(id).get();
|
return this->cache.at(id).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setpSeg SegmentCache::all() const {
|
||||||
|
setpSeg s;
|
||||||
|
for (auto i : this->cache) {
|
||||||
|
s.insert(i.second.get());
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
|
@ -8,13 +8,14 @@
|
||||||
#ifndef SEGMENTCACHE_H
|
#ifndef SEGMENTCACHE_H
|
||||||
#define SEGMENTCACHE_H
|
#define SEGMENTCACHE_H
|
||||||
|
|
||||||
#include "trans.h"
|
#include "setpSeg.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
class Common;
|
class Common;
|
||||||
|
class Segment;
|
||||||
|
|
||||||
class SegmentCache {
|
class SegmentCache {
|
||||||
public:
|
public:
|
||||||
|
@ -27,13 +28,7 @@ public:
|
||||||
|
|
||||||
Segment* getOrAdd(const std::string& id);
|
Segment* getOrAdd(const std::string& id);
|
||||||
|
|
||||||
setpSeg all() const {
|
setpSeg all() const;
|
||||||
setpSeg s;
|
|
||||||
for (auto i : this->cache) {
|
|
||||||
s.insert(i.second.get());
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::map<const std::string, std::shared_ptr<Segment > >::const_iterator begin() const {
|
std::map<const std::string, std::shared_ptr<Segment > >::const_iterator begin() const {
|
||||||
|
|
|
@ -9,7 +9,10 @@
|
||||||
#define STATECALCULATOR_H
|
#define STATECALCULATOR_H
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include "trans.h"
|
#include "setpSeg.h"
|
||||||
|
|
||||||
|
class Segment;
|
||||||
|
class Trans;
|
||||||
|
|
||||||
class StateCalculator {
|
class StateCalculator {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "Trace.h"
|
#include "Trace.h"
|
||||||
#include "SegmentCache.h"
|
#include "SegmentCache.h"
|
||||||
|
#include "trans.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* File: setpSeg.h
|
||||||
|
* Author: Christopher
|
||||||
|
*
|
||||||
|
* Created on December 15, 2013, 12:16 AM
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SETPSEG_H
|
||||||
|
#define SETPSEG_H
|
||||||
|
|
||||||
|
#include "ptr_less.h"
|
||||||
|
#include <set>
|
||||||
|
class Segment;
|
||||||
|
|
||||||
|
typedef std::set<Segment*,ptr_less<Segment>> setpSeg;
|
||||||
|
|
||||||
|
#endif /* SETPSEG_H */
|
||||||
|
|
3
trans.h
3
trans.h
|
@ -8,7 +8,7 @@
|
||||||
#ifndef TRANS_H
|
#ifndef TRANS_H
|
||||||
#define TRANS_H
|
#define TRANS_H
|
||||||
|
|
||||||
#include "ptr_less.h"
|
#include "setpSeg.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -62,7 +62,6 @@ private:
|
||||||
Segment& operator=(const Segment&) = delete;
|
Segment& operator=(const Segment&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::set<Segment*,ptr_less<Segment>> setpSeg;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue