14#ifndef MULTIPLETRIPLYINDEXED_HPP_
15#define MULTIPLETRIPLYINDEXED_HPP_
25 namespace InterpreterClass
29 template<
class ValueClass >
37 std::list< ValueClass* >
39 std::pair< std::pair< int, int >,
int >
const& indexTriple );
44 std::list< ValueClass const* >
46 std::pair< std::pair< int, int >,
int >
const& indexTriple )
const;
48 std::list< ValueClass* >
50 int const secondIndex,
51 int const thirdIndex )
52 {
return (*
this)( std::make_pair( std::make_pair( firstIndex,
55 std::list< ValueClass const* >
57 int const secondIndex,
58 int const thirdIndex )
const
59 {
return (*
this)( std::make_pair( std::make_pair( firstIndex,
62 std::multimap< std::pair< std::pair< int, int >,
int >, ValueClass >&
64 std::multimap< std::pair< std::pair< int, int >,
int >,
69 std::pair< std::pair< int, int >,
int >
const& indexTriple )
const;
73 int const secondIndex,
74 int const thirdIndex )
const
75 {
return hasEntry( std::make_pair( std::make_pair( firstIndex,
78 virtual std::string
const&
88 std::multimap< std::pair< std::pair< int, int >,
int >,
91 std::multimap< std::pair< std::pair< int, int >,
int >, ValueClass >
93 std::pair< std::pair< std::pair< int, int >,
int >, ValueClass >
104 template<
class ValueClass >
114 template<
class ValueClass >
121 template<
class ValueClass >
122 inline std::list< ValueClass* >
124 std::pair< std::pair< int, int >,
int >
const& indexTriple )
130 std::list< ValueClass* > returnList;
131 std::pair< mapIterator, mapIterator >
132 rangeIterators( valueMap.equal_range( indexTriple ) );
133 while( rangeIterators.first != rangeIterators.second )
135 returnList.push_back( &(rangeIterators.first->second) );
136 ++(rangeIterators.first);
141 template<
class ValueClass >
142 inline std::list< ValueClass const* >
144 std::pair< std::pair< int, int >,
int >
const& indexTriple )
const
147 std::list< ValueClass const* > returnList;
148 std::pair< mapIterator, mapIterator >
149 rangeIterators( valueMap.equal_range( indexTriple ) );
150 while( rangeIterators.first != rangeIterators.second )
152 returnList.push_back( &(rangeIterators.first->second) );
153 ++(rangeIterators.first);
158 template<
class ValueClass >
159 inline std::multimap< std::pair< std::pair< int, int >,
int >,
166 template<
class ValueClass >
167 inline std::multimap< std::pair< std::pair< int, int >,
int >,
174 template<
class ValueClass >
177 std::pair< std::pair< int, int >,
int >
const& indexTriple )
const
180 return ( 0 < valueMap.count( indexTriple ) );
183 template<
class ValueClass >
184 inline std::string
const&
188 this->stringInterpretation.clear();
190 while( valueFinder != valueMap.end() )
192 this->indexPrintingVector[ 0 ] = valueFinder->first.first.first;
193 this->indexPrintingVector[ 1 ] = valueFinder->first.first.second;
194 this->indexPrintingVector[ 2 ] = valueFinder->first.second;
195 this->stringInterpretation.append( this->indicesToPrintingString() );
196 this->stringInterpretation.append( this->valueToPrintingString(
197 valueFinder->second ) );
206 this->stringInterpretation.append(
"\n" );
209 return this->stringInterpretation;
212 template<
class ValueClass >
219 template<
class ValueClass >
223 for(
int whichLine( this->currentStringBlock->getNumberOfBodyLines() );
228 (*(this->currentStringBlock))[ whichLine ].first,
229 &(this->lineRemainderA),
231 if( !(this->currentWord.empty()) )
233 valueRecorder.first.first.first
236 this->lineRemainderA,
237 &(this->lineRemainderB),
239 if( !(this->currentWord.empty()) )
241 valueRecorder.first.first.second
244 this->lineRemainderB,
245 &(this->lineRemainderA),
247 if( !(this->currentWord.empty()) )
249 valueRecorder.first.second
253 this->lineRemainderA,
255 valueMap.insert( valueRecorder );
static std::string firstWordOf(std::string const &stringToParse, std::string *const remainderString=NULL, std::string const &separatorChars=whitespaceChars)
static std::string const whitespaceAndNewlineChars
static std::string trimFromFrontAndBack(std::string const &stringToTrim, std::string const &charsToTrim=whitespaceAndNewlineChars)
static int stringToInt(std::string const &stringToInterpret)
std::list< ValueClass * > operator()(int const firstIndex, int const secondIndex, int const thirdIndex)
bool hasEntry(int const firstIndex, int const secondIndex, int const thirdIndex) const
virtual ~MultipleTriplyIndexed()
virtual void clearEntries()
std::multimap< std::pair< std::pair< int, int >, int >, ValueClass > & getValueMap()
std::list< ValueClass * > operator()(std::pair< std::pair< int, int >, int > const &indexTriple)
std::pair< std::pair< std::pair< int, int >, int >, ValueClass > valueRecorder
bool hasEntry(std::pair< std::pair< int, int >, int > const &indexTriple) const
std::list< ValueClass const * > operator()(int const firstIndex, int const secondIndex, int const thirdIndex) const
std::multimap< std::pair< std::pair< int, int >, int >, ValueClass > valueMap
virtual void interpretCurrentStringBlock()
virtual std::string const & getAsString()
std::multimap< std::pair< std::pair< int, int >, int >, ValueClass >::const_iterator mapIterator