14#ifndef MULTIPLEDOUBLYINDEXED_HPP_
15#define MULTIPLEDOUBLYINDEXED_HPP_
25 namespace InterpreterClass
29 template<
class ValueClass >
37 std::list< ValueClass* >
38 operator()( std::pair< int, int >
const& indexPair );
43 std::list< ValueClass const* >
44 operator()( std::pair< int, int >
const& indexPair )
const;
46 std::list< ValueClass* >
48 int const secondIndex )
49 {
return (*
this)( std::make_pair( firstIndex,
51 std::list< ValueClass const* >
53 int const secondIndex )
const
54 {
return (*
this)( std::make_pair( firstIndex,
56 std::multimap< std::pair< int, int >, ValueClass >&
58 std::multimap< std::pair< int, int >, ValueClass >
const&
61 hasEntry( std::pair< int, int >
const& indexPair )
const;
65 int const secondIndex )
const
66 {
return hasEntry( std::make_pair( firstIndex,
68 virtual std::string
const&
78 std::multimap< std::pair< int, int >, ValueClass >::const_iterator
81 std::multimap< std::pair< int, int >, ValueClass >
valueMap;
92 template<
class ValueClass >
102 template<
class ValueClass >
109 template<
class ValueClass >
110 inline std::list< ValueClass* >
112 std::pair< int, int >
const& indexPair )
118 std::list< ValueClass* > returnList;
119 std::pair< mapIterator, mapIterator >
120 rangeIterators( valueMap.equal_range( indexPair ) );
121 while( rangeIterators.first != rangeIterators.second )
123 returnList.push_back( &(rangeIterators.first->second) );
124 ++(rangeIterators.first);
129 template<
class ValueClass >
130 inline std::list< ValueClass const* >
132 std::pair< int, int >
const& indexPair )
const
135 std::list< ValueClass const* > returnList;
136 std::pair< mapIterator, mapIterator >
137 rangeIterators( valueMap.equal_range( indexPair ) );
138 while( rangeIterators.first != rangeIterators.second )
140 returnList.push_back( &(rangeIterators.first->second) );
141 ++(rangeIterators.first);
146 template<
class ValueClass >
147 inline std::multimap< std::pair< int, int >, ValueClass >&
153 template<
class ValueClass >
154 inline std::multimap< std::pair< int, int >, ValueClass >
const&
160 template<
class ValueClass >
163 std::pair< int, int >
const& indexPair )
const
166 return ( 0 < valueMap.count( indexPair ) );
169 template<
class ValueClass >
170 inline std::string
const&
174 this->stringInterpretation.clear();
176 while( valueFinder != valueMap.end() )
178 this->indexPrintingVector[ 0 ] = valueFinder->first.first;
179 this->indexPrintingVector[ 1 ] = valueFinder->first.second;
180 this->stringInterpretation.append( this->indicesToPrintingString() );
181 this->stringInterpretation.append( this->valueToPrintingString(
182 valueFinder->second ) );
191 this->stringInterpretation.append(
"\n" );
194 return this->stringInterpretation;
197 template<
class ValueClass >
204 template<
class ValueClass >
208 for(
int whichLine( this->currentStringBlock->getNumberOfBodyLines() );
213 (*(this->currentStringBlock))[ whichLine ].first,
214 &(this->lineRemainderA),
216 if( !(this->currentWord.empty()) )
218 valueRecorder.first.first
221 this->lineRemainderA,
222 &(this->lineRemainderB),
224 if( !(this->currentWord.empty()) )
226 valueRecorder.first.second
230 this->lineRemainderB,
232 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::pair< std::pair< int, int >, ValueClass > valueRecorder
std::list< ValueClass * > operator()(int const firstIndex, int const secondIndex)
virtual ~MultipleDoublyIndexed()
std::list< ValueClass const * > operator()(int const firstIndex, int const secondIndex) const
std::multimap< std::pair< int, int >, ValueClass > valueMap
bool hasEntry(std::pair< int, int > const &indexPair) const
std::list< ValueClass * > operator()(std::pair< int, int > const &indexPair)
bool hasEntry(int const firstIndex, int const secondIndex) const
std::multimap< std::pair< int, int >, ValueClass > & getValueMap()
virtual void interpretCurrentStringBlock()
std::multimap< std::pair< int, int >, ValueClass >::const_iterator mapIterator
virtual void clearEntries()
virtual std::string const & getAsString()