1 |
< |
/* |
1 |
> |
/* |
2 |
|
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
|
* |
4 |
|
* The University of Notre Dame grants you ("Licensee") a |
48 |
|
|
49 |
|
namespace oopse { |
50 |
|
|
51 |
< |
struct SectionParserContext { |
51 |
> |
struct SectionParserContext { |
52 |
|
int priority; |
53 |
|
SectionParser* sectionParser; |
54 |
|
int lineNo; |
55 |
|
std::streampos offset; |
56 |
|
bool isActive; |
57 |
< |
}; |
57 |
> |
}; |
58 |
|
|
59 |
< |
class SameSectionParserFunctor { |
60 |
< |
public: |
61 |
< |
SameSectionParserFunctor(const std::string section) : section_(section) {} |
59 |
> |
class SameSectionParserFunctor { |
60 |
> |
public: |
61 |
> |
SameSectionParserFunctor(const std::string section) : section_(section) {} |
62 |
|
|
63 |
< |
bool operator()(SectionParserContext context) { |
64 |
< |
return context.sectionParser->getSectionName() == section_; |
65 |
< |
} |
63 |
> |
bool operator()(SectionParserContext context) { |
64 |
> |
return context.sectionParser->getSectionName() == section_; |
65 |
> |
} |
66 |
|
|
67 |
< |
private: |
68 |
< |
std::string section_; |
69 |
< |
}; |
70 |
< |
/** |
71 |
< |
* @class SectionParserManager SectionParserManager.hpp "io/SectionParserManager.hpp" |
72 |
< |
* SectionParserManager maintains a priority list |
73 |
< |
*/ |
74 |
< |
class SectionParserManager { |
67 |
> |
private: |
68 |
> |
std::string section_; |
69 |
> |
}; |
70 |
> |
/** |
71 |
> |
* @class SectionParserManager SectionParserManager.hpp "io/SectionParserManager.hpp" |
72 |
> |
* SectionParserManager maintains a priority list |
73 |
> |
*/ |
74 |
> |
class SectionParserManager { |
75 |
|
|
76 |
< |
public: |
77 |
< |
typedef std::list<SectionParserContext> SectionParserContextList; |
78 |
< |
typedef SectionParserContextList::iterator iterator; |
79 |
< |
typedef SectionParserContextList::const_iterator const_iterator; |
76 |
> |
public: |
77 |
> |
typedef std::list<SectionParserContext> SectionParserContextList; |
78 |
> |
typedef SectionParserContextList::iterator iterator; |
79 |
> |
typedef SectionParserContextList::const_iterator const_iterator; |
80 |
|
|
81 |
< |
SectionParserManager() : beginPriority_(0), priorityDifference_(100) {} |
82 |
< |
~SectionParserManager(); |
81 |
> |
SectionParserManager() : beginPriority_(0), priorityDifference_(100) {} |
82 |
> |
~SectionParserManager(); |
83 |
|
|
84 |
< |
void parse(std::istream& input, ForceField& ff); |
84 |
> |
void parse(std::istream& input, ForceField& ff); |
85 |
|
|
86 |
< |
void push_front(SectionParser* sp); |
86 |
> |
void push_front(SectionParser* sp); |
87 |
|
|
88 |
< |
void push_back(SectionParser* sp); |
88 |
> |
void push_back(SectionParser* sp); |
89 |
|
|
90 |
< |
void insert(SectionParser* sp, int priority); |
90 |
> |
void insert(SectionParser* sp, int priority); |
91 |
|
|
92 |
< |
const_iterator begin() const { |
93 |
< |
return sectionParsers_.begin(); |
94 |
< |
} |
92 |
> |
const_iterator begin() const { |
93 |
> |
return sectionParsers_.begin(); |
94 |
> |
} |
95 |
|
|
96 |
< |
const_iterator end() const{ |
97 |
< |
return sectionParsers_.end(); |
98 |
< |
} |
96 |
> |
const_iterator end() const{ |
97 |
> |
return sectionParsers_.end(); |
98 |
> |
} |
99 |
|
|
100 |
< |
private: |
101 |
< |
iterator findSectionParser(const std::string& sectionName); |
102 |
< |
const int beginPriority_; |
103 |
< |
int priorityDifference_; |
100 |
> |
private: |
101 |
> |
iterator findSectionParser(const std::string& sectionName); |
102 |
> |
const int beginPriority_; |
103 |
> |
int priorityDifference_; |
104 |
|
|
105 |
< |
SectionParserContextList sectionParsers_; |
106 |
< |
}; |
105 |
> |
SectionParserContextList sectionParsers_; |
106 |
> |
}; |
107 |
|
|
108 |
|
} |
109 |
|
#endif //IO_SECTIONPARSERMANAGER_HPP |