[bcf653] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
[0aa122] | 4 | * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
|
---|
[94d5ac6] | 5 | *
|
---|
| 6 | *
|
---|
| 7 | * This file is part of MoleCuilder.
|
---|
| 8 | *
|
---|
| 9 | * MoleCuilder is free software: you can redistribute it and/or modify
|
---|
| 10 | * it under the terms of the GNU General Public License as published by
|
---|
| 11 | * the Free Software Foundation, either version 2 of the License, or
|
---|
| 12 | * (at your option) any later version.
|
---|
| 13 | *
|
---|
| 14 | * MoleCuilder is distributed in the hope that it will be useful,
|
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 17 | * GNU General Public License for more details.
|
---|
| 18 | *
|
---|
| 19 | * You should have received a copy of the GNU General Public License
|
---|
| 20 | * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
|
---|
[bcf653] | 21 | */
|
---|
| 22 |
|
---|
[6f43ab] | 23 | /*
|
---|
| 24 | * Formula.cpp
|
---|
| 25 | *
|
---|
| 26 | * Created on: Jul 21, 2010
|
---|
| 27 | * Author: crueger
|
---|
| 28 | */
|
---|
| 29 |
|
---|
[bf3817] | 30 | // include config.h
|
---|
| 31 | #ifdef HAVE_CONFIG_H
|
---|
| 32 | #include <config.h>
|
---|
| 33 | #endif
|
---|
| 34 |
|
---|
[ad011c] | 35 | #include "CodePatterns/MemDebug.hpp"
|
---|
[bbbad5] | 36 |
|
---|
[6f43ab] | 37 | #include "Formula.hpp"
|
---|
| 38 |
|
---|
| 39 | #include <sstream>
|
---|
| 40 |
|
---|
| 41 | #include "World.hpp"
|
---|
[3bdb6d] | 42 | #include "Element/periodentafel.hpp"
|
---|
| 43 | #include "Element/element.hpp"
|
---|
[ad011c] | 44 | #include "CodePatterns/Assert.hpp"
|
---|
| 45 | #include "CodePatterns/Range.hpp"
|
---|
[6f43ab] | 46 |
|
---|
| 47 | using namespace std;
|
---|
| 48 |
|
---|
| 49 | Formula::Formula() :
|
---|
| 50 | numElements(0)
|
---|
| 51 | {}
|
---|
| 52 |
|
---|
| 53 | Formula::Formula(const Formula &src) :
|
---|
| 54 | elementCounts(src.elementCounts),
|
---|
| 55 | numElements(src.numElements)
|
---|
| 56 | {}
|
---|
| 57 |
|
---|
[d03bb1] | 58 | Formula::Formula(const string &formula) :
|
---|
| 59 | numElements(0)
|
---|
| 60 | {
|
---|
| 61 | fromString(formula);
|
---|
| 62 | }
|
---|
| 63 |
|
---|
[6f43ab] | 64 | Formula::~Formula()
|
---|
| 65 | {}
|
---|
| 66 |
|
---|
| 67 | Formula &Formula::operator=(const Formula &rhs){
|
---|
| 68 | // No self-assignment check needed
|
---|
| 69 | elementCounts=rhs.elementCounts;
|
---|
| 70 | numElements=rhs.numElements;
|
---|
| 71 | return *this;
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | std::string Formula::toString() const{
|
---|
| 75 | stringstream sstr;
|
---|
[add42a] | 76 | for(const_iterator iter=end();iter!=begin();){
|
---|
| 77 | --iter;
|
---|
[2fe971] | 78 | sstr << (*iter).first->getSymbol();
|
---|
[a6d6a9] | 79 | if((*iter).second>1)
|
---|
| 80 | sstr << (*iter).second;
|
---|
[6f43ab] | 81 | }
|
---|
| 82 | return sstr.str();
|
---|
| 83 | }
|
---|
| 84 |
|
---|
[266875] | 85 | void Formula::fromString(const std::string &formula) throw(FormulaStringParseException){
|
---|
[4d1d43] | 86 | // make this transactional, in case an error is thrown
|
---|
| 87 | Formula res;
|
---|
| 88 | string::const_iterator begin = formula.begin();
|
---|
| 89 | string::const_iterator end = formula.end();
|
---|
| 90 | res.parseFromString(begin,end,static_cast<char>(0));
|
---|
| 91 | (*this)=res;
|
---|
| 92 | }
|
---|
| 93 |
|
---|
[955b91] | 94 | int Formula::parseMaybeNumber(std::string::const_iterator &it,string::const_iterator &end) throw(FormulaStringParseException){
|
---|
[4d1d43] | 95 | static const range<char> Numbers = makeRange('0',static_cast<char>('9'+1));
|
---|
| 96 | int count = 0;
|
---|
| 97 | while(it!=end && Numbers.isInRange(*it))
|
---|
| 98 | count = (count*10) + ((*it++)-Numbers.first);
|
---|
| 99 | // one is implicit
|
---|
| 100 | count = (count!=0)?count:1;
|
---|
| 101 | return count;
|
---|
| 102 | }
|
---|
| 103 |
|
---|
[955b91] | 104 | void Formula::parseFromString(std::string::const_iterator &it,string::const_iterator &end,char delimiter) throw(FormulaStringParseException){
|
---|
[d03bb1] | 105 | // some constants needed for parsing... Assumes ASCII, change if other encodings are used
|
---|
[ee86a0] | 106 | static const range<char> CapitalLetters = makeRange('A',static_cast<char>('Z'+1));
|
---|
| 107 | static const range<char> SmallLetters = makeRange('a',static_cast<char>('z'+1));
|
---|
[4d1d43] | 108 | map<char,char> delimiters;
|
---|
| 109 | delimiters['('] = ')';
|
---|
| 110 | delimiters['['] = ']';
|
---|
[d03bb1] | 111 | // clean the formula
|
---|
| 112 | clear();
|
---|
[4d1d43] | 113 | for(/*send from above*/;it!=end && *it!=delimiter;/*updated in loop*/){
|
---|
| 114 | // we might have a sub formula
|
---|
| 115 | if(delimiters.count(*it)){
|
---|
| 116 | Formula sub;
|
---|
| 117 | char nextdelim=delimiters[*it];
|
---|
| 118 | sub.parseFromString(++it,end,nextdelim);
|
---|
[38e075] | 119 | if(!sub.getElementCount()){
|
---|
[b88fe4] | 120 | throw FormulaStringParseException() << FormulaString( string(it, end) );
|
---|
[38e075] | 121 | }
|
---|
[4d1d43] | 122 | int count = parseMaybeNumber(++it,end);
|
---|
| 123 | addFormula(sub,count);
|
---|
| 124 | continue;
|
---|
| 125 | }
|
---|
[d03bb1] | 126 | string shorthand;
|
---|
| 127 | // Atom names start with a capital letter
|
---|
[ee86a0] | 128 | if(!CapitalLetters.isInRange(*it))
|
---|
[b88fe4] | 129 | throw FormulaStringParseException() << FormulaString( string(it, end) );
|
---|
[d03bb1] | 130 | shorthand+=(*it++);
|
---|
| 131 | // the rest of the name follows
|
---|
[ee86a0] | 132 | while(it!=end && SmallLetters.isInRange(*it))
|
---|
[d03bb1] | 133 | shorthand+=(*it++);
|
---|
[4d1d43] | 134 | int count = parseMaybeNumber(it,end);
|
---|
[fefe0d] | 135 | // test if the shorthand exists
|
---|
| 136 | if(!World::getInstance().getPeriode()->FindElement(shorthand))
|
---|
[b88fe4] | 137 | throw FormulaStringParseException() << FormulaString( string(it, end) );
|
---|
[d03bb1] | 138 | // done, we can get the next one
|
---|
| 139 | addElements(shorthand,count);
|
---|
| 140 | }
|
---|
[4d1d43] | 141 | if(it==end && delimiter!=0){
|
---|
[b88fe4] | 142 | throw FormulaStringParseException() << FormulaString( string(it, end) );
|
---|
[4d1d43] | 143 | }
|
---|
[d03bb1] | 144 | }
|
---|
| 145 |
|
---|
[a6d6a9] | 146 | unsigned int Formula::getElementCount() const{
|
---|
[6f43ab] | 147 | return numElements;
|
---|
| 148 | }
|
---|
| 149 |
|
---|
| 150 | bool Formula::hasElement(const element *element) const{
|
---|
| 151 | ASSERT(element,"Invalid pointer in Formula::hasElement(element*)");
|
---|
[ed26ae] | 152 | return hasElement(element->getAtomicNumber());
|
---|
[6f43ab] | 153 | }
|
---|
| 154 |
|
---|
| 155 | bool Formula::hasElement(atomicNumber_t Z) const{
|
---|
| 156 | ASSERT(Z>0,"Invalid atomic Number");
|
---|
| 157 | ASSERT(World::getInstance().getPeriode()->FindElement(Z),"No Element with this number in Periodentafel");
|
---|
| 158 | return elementCounts.size()>=Z && elementCounts[Z-1];
|
---|
| 159 | }
|
---|
| 160 |
|
---|
| 161 | bool Formula::hasElement(const string &shorthand) const{
|
---|
[e5c0a1] | 162 | const element * element = World::getInstance().getPeriode()->FindElement(shorthand);
|
---|
[6f43ab] | 163 | return hasElement(element);
|
---|
| 164 | }
|
---|
| 165 |
|
---|
| 166 | void Formula::operator+=(const element *element){
|
---|
| 167 | ASSERT(element,"Invalid pointer in increment of Formula");
|
---|
[ed26ae] | 168 | operator+=(element->getAtomicNumber());
|
---|
[6f43ab] | 169 | }
|
---|
| 170 |
|
---|
| 171 | void Formula::operator+=(atomicNumber_t Z){
|
---|
| 172 | ASSERT(Z>0,"Invalid atomic Number");
|
---|
| 173 | ASSERT(World::getInstance().getPeriode()->FindElement(Z),"No Element with this number in Periodentafel");
|
---|
[fefe0d] | 174 | elementCounts.resize(max<atomicNumber_t>(Z,elementCounts.size()),0); // No-op when we already have the right size
|
---|
[6f43ab] | 175 | // might need to update number of elements
|
---|
| 176 | if(!elementCounts[Z-1]){
|
---|
| 177 | numElements++;
|
---|
| 178 | }
|
---|
| 179 | elementCounts[Z-1]++; // atomic numbers start at 1
|
---|
| 180 | }
|
---|
| 181 |
|
---|
| 182 | void Formula::operator+=(const string &shorthand){
|
---|
[e5c0a1] | 183 | const element * element = World::getInstance().getPeriode()->FindElement(shorthand);
|
---|
[6f43ab] | 184 | operator+=(element);
|
---|
| 185 | }
|
---|
| 186 |
|
---|
| 187 | void Formula::operator-=(const element *element){
|
---|
| 188 | ASSERT(element,"Invalid pointer in decrement of Formula");
|
---|
[ed26ae] | 189 | operator-=(element->getAtomicNumber());
|
---|
[6f43ab] | 190 | }
|
---|
| 191 |
|
---|
| 192 | void Formula::operator-=(atomicNumber_t Z){
|
---|
| 193 | ASSERT(Z>0,"Invalid atomic Number");
|
---|
| 194 | ASSERT(World::getInstance().getPeriode()->FindElement(Z),"No Element with this number in Periodentafel");
|
---|
| 195 | ASSERT(elementCounts.size()>=Z && elementCounts[Z-1], "Element not in Formula upon decrement");
|
---|
| 196 | elementCounts[Z-1]--; // atomic numbers start at 1
|
---|
| 197 | // might need to update number of elements
|
---|
| 198 | if(!elementCounts[Z-1]){
|
---|
| 199 | numElements--;
|
---|
[d8a0ec] | 200 | // resize the Array if this was at the last position
|
---|
| 201 | if(Z==elementCounts.size()){
|
---|
| 202 | // find the first element from the back that is not equal to zero
|
---|
| 203 | set_t::reverse_iterator riter = find_if(elementCounts.rbegin(),
|
---|
| 204 | elementCounts.rend(),
|
---|
| 205 | bind1st(not_equal_to<mapped_type>(),0));
|
---|
| 206 | // see how many elements are in this range
|
---|
| 207 | set_t::reverse_iterator::difference_type diff = riter - elementCounts.rbegin();
|
---|
| 208 | elementCounts.resize(elementCounts.size()-diff);
|
---|
| 209 | }
|
---|
[6f43ab] | 210 | }
|
---|
| 211 | }
|
---|
| 212 |
|
---|
| 213 | void Formula::operator-=(const string &shorthand){
|
---|
[e5c0a1] | 214 | const element * element = World::getInstance().getPeriode()->FindElement(shorthand);
|
---|
[6f43ab] | 215 | operator-=(element);
|
---|
| 216 | }
|
---|
| 217 |
|
---|
[d03bb1] | 218 | void Formula::addElements(const element *element,unsigned int count){
|
---|
| 219 | ASSERT(element,"Invalid pointer in Formula::addElements(element*)");
|
---|
[ed26ae] | 220 | addElements(element->getAtomicNumber(),count);
|
---|
[d03bb1] | 221 | }
|
---|
| 222 |
|
---|
| 223 | void Formula::addElements(atomicNumber_t Z,unsigned int count){
|
---|
| 224 | if(count==0) return;
|
---|
| 225 | ASSERT(Z>0,"Invalid atomic Number");
|
---|
| 226 | ASSERT(World::getInstance().getPeriode()->FindElement(Z),"No Element with this number in Periodentafel");
|
---|
[fefe0d] | 227 | elementCounts.resize(max<atomicNumber_t>(Z,elementCounts.size()),0); // No-op when we already have the right size
|
---|
[d03bb1] | 228 | // might need to update number of elements
|
---|
| 229 | if(!elementCounts[Z-1]){
|
---|
| 230 | numElements++;
|
---|
| 231 | }
|
---|
| 232 | elementCounts[Z-1]+=count;
|
---|
| 233 | }
|
---|
| 234 |
|
---|
| 235 | void Formula::addElements(const string &shorthand,unsigned int count){
|
---|
[e5c0a1] | 236 | const element * element = World::getInstance().getPeriode()->FindElement(shorthand);
|
---|
[d03bb1] | 237 | addElements(element,count);
|
---|
| 238 | }
|
---|
| 239 |
|
---|
[9d5803] | 240 | void Formula::addFormula(const Formula &formula,unsigned int n){
|
---|
| 241 | for(Formula::const_iterator iter=formula.begin();iter!=formula.end();++iter){
|
---|
| 242 | this->addElements(iter->first,iter->second*n);
|
---|
| 243 | }
|
---|
| 244 | }
|
---|
| 245 |
|
---|
[426f2a] | 246 | enumeration<Formula::key_type> Formula::enumerateElements() const{
|
---|
| 247 | enumeration<key_type> res(1);
|
---|
| 248 | for(Formula::const_iterator iter=begin();iter!=end();++iter){
|
---|
| 249 | res.add(iter->first);
|
---|
| 250 | }
|
---|
| 251 | return res;
|
---|
| 252 | }
|
---|
| 253 |
|
---|
[a6d6a9] | 254 | const unsigned int Formula::operator[](const element *element) const{
|
---|
[6f43ab] | 255 | ASSERT(element,"Invalid pointer in access of Formula");
|
---|
[ed26ae] | 256 | return operator[](element->getAtomicNumber());
|
---|
[6f43ab] | 257 | }
|
---|
| 258 |
|
---|
[a6d6a9] | 259 | const unsigned int Formula::operator[](atomicNumber_t Z) const{
|
---|
[6f43ab] | 260 | ASSERT(Z>0,"Invalid atomic Number");
|
---|
| 261 | ASSERT(World::getInstance().getPeriode()->FindElement(Z),"No Element with this number in Periodentafel");
|
---|
[a6d6a9] | 262 | if(elementCounts.size()<Z)
|
---|
| 263 | return 0;
|
---|
[6f43ab] | 264 | return elementCounts[Z-1]; // atomic numbers start at 1
|
---|
| 265 | }
|
---|
| 266 |
|
---|
[955b91] | 267 | const unsigned int Formula::operator[](std::string shorthand) const{
|
---|
[e5c0a1] | 268 | const element * element = World::getInstance().getPeriode()->FindElement(shorthand);
|
---|
[6f43ab] | 269 | return operator[](element);
|
---|
| 270 | }
|
---|
| 271 |
|
---|
| 272 | bool Formula::operator==(const Formula &rhs) const{
|
---|
| 273 | // quick check... number of elements used
|
---|
| 274 | if(numElements != rhs.numElements){
|
---|
| 275 | return false;
|
---|
| 276 | }
|
---|
[d8a0ec] | 277 | // second quick check, size of vectors (== last element in formula)
|
---|
| 278 | if(elementCounts.size()!=rhs.elementCounts.size()){
|
---|
| 279 | return false;
|
---|
| 280 | }
|
---|
[6f43ab] | 281 | // slow check: all elements
|
---|
| 282 | // direct access to internal structure means all element-counts have to be compared
|
---|
| 283 | // this avoids access to periodentafel to find elements though and is probably faster
|
---|
| 284 | // in total
|
---|
| 285 | return equal(elementCounts.begin(),
|
---|
| 286 | elementCounts.end(),
|
---|
| 287 | rhs.elementCounts.begin());
|
---|
| 288 | }
|
---|
| 289 |
|
---|
| 290 | bool Formula::operator!=(const Formula &rhs) const{
|
---|
| 291 | return !operator==(rhs);
|
---|
| 292 | }
|
---|
| 293 |
|
---|
| 294 | Formula::iterator Formula::begin(){
|
---|
| 295 | return iterator(elementCounts,0);
|
---|
| 296 | }
|
---|
| 297 | Formula::const_iterator Formula::begin() const{
|
---|
[d8a0ec] | 298 | // this is the only place where this is needed, so this is better than making it mutable
|
---|
| 299 | return const_iterator(const_cast<set_t&>(elementCounts),0);
|
---|
[6f43ab] | 300 | }
|
---|
| 301 | Formula::iterator Formula::end(){
|
---|
| 302 | return iterator(elementCounts);
|
---|
| 303 | }
|
---|
| 304 | Formula::const_iterator Formula::end() const{
|
---|
[d8a0ec] | 305 | // this is the only place where this is needed, so this is better than making it mutable
|
---|
| 306 | return const_iterator(const_cast<set_t&>(elementCounts));
|
---|
[6f43ab] | 307 | }
|
---|
| 308 |
|
---|
[d03bb1] | 309 | void Formula::clear(){
|
---|
| 310 | elementCounts.clear();
|
---|
| 311 | numElements = 0;
|
---|
| 312 | }
|
---|
| 313 |
|
---|
[6f43ab] | 314 | /**************** Iterator structure ********************/
|
---|
| 315 |
|
---|
| 316 | template <class result_type>
|
---|
| 317 | Formula::_iterator<result_type>::_iterator(set_t &_set) :
|
---|
| 318 | set(&_set)
|
---|
| 319 | {
|
---|
| 320 | pos=set->size();
|
---|
| 321 | }
|
---|
| 322 |
|
---|
| 323 | template <class result_type>
|
---|
| 324 | Formula::_iterator<result_type>::_iterator(set_t &_set,size_t _pos) :
|
---|
| 325 | set(&_set),pos(_pos)
|
---|
| 326 | {
|
---|
| 327 | ASSERT(pos<=set->size(),"invalid position in iterator construction");
|
---|
[a6d6a9] | 328 | while(pos<set->size() && (*set)[pos]==0) ++pos;
|
---|
[6f43ab] | 329 | }
|
---|
| 330 |
|
---|
[a6d6a9] | 331 | template <class result_type>
|
---|
| 332 | Formula::_iterator<result_type>::_iterator(const _iterator &rhs) :
|
---|
| 333 | set(rhs.set),pos(rhs.pos)
|
---|
| 334 | {}
|
---|
| 335 |
|
---|
[6f43ab] | 336 | template <class result_type>
|
---|
| 337 | Formula::_iterator<result_type>::~_iterator(){}
|
---|
| 338 |
|
---|
| 339 | template <class result_type>
|
---|
| 340 | Formula::_iterator<result_type>&
|
---|
| 341 | Formula::_iterator<result_type>::operator=(const _iterator<result_type> &rhs){
|
---|
| 342 | set=rhs.set;
|
---|
| 343 | pos=rhs.pos;
|
---|
| 344 | return *this;
|
---|
| 345 | }
|
---|
| 346 |
|
---|
| 347 | template <class result_type>
|
---|
| 348 | bool
|
---|
| 349 | Formula::_iterator<result_type>::operator==(const _iterator<result_type> &rhs){
|
---|
| 350 | return set==rhs.set && pos==rhs.pos;
|
---|
| 351 | }
|
---|
| 352 |
|
---|
| 353 | template <class result_type>
|
---|
| 354 | bool
|
---|
| 355 | Formula::_iterator<result_type>::operator!=(const _iterator<result_type> &rhs){
|
---|
| 356 | return !operator==(rhs);
|
---|
| 357 | }
|
---|
| 358 |
|
---|
| 359 | template <class result_type>
|
---|
| 360 | Formula::_iterator<result_type>
|
---|
| 361 | Formula::_iterator<result_type>::operator++(){
|
---|
| 362 | ASSERT(pos!=set->size(),"Incrementing Formula::iterator beyond end");
|
---|
[a6d6a9] | 363 | pos++;
|
---|
| 364 | while(pos<set->size() && (*set)[pos]==0) ++pos;
|
---|
[6f43ab] | 365 | return *this;
|
---|
| 366 | }
|
---|
| 367 |
|
---|
[a6d6a9] | 368 | template <class result_type>
|
---|
| 369 | Formula::_iterator<result_type>
|
---|
| 370 | Formula::_iterator<result_type>::operator++(int){
|
---|
| 371 | Formula::_iterator<result_type> retval = *this;
|
---|
| 372 | ++(*this);
|
---|
| 373 | return retval;
|
---|
| 374 | }
|
---|
| 375 |
|
---|
[6f43ab] | 376 | template <class result_type>
|
---|
| 377 | Formula::_iterator<result_type>
|
---|
| 378 | Formula::_iterator<result_type>::operator--(){
|
---|
[a6d6a9] | 379 | ASSERT(pos!=0,"Decrementing Formula::iterator beyond begin");
|
---|
| 380 | pos--;
|
---|
| 381 | while(pos>0 && (*set)[pos]==0) --pos;
|
---|
[6f43ab] | 382 | return *this;
|
---|
| 383 | }
|
---|
| 384 |
|
---|
[a6d6a9] | 385 | template <class result_type>
|
---|
| 386 | Formula::_iterator<result_type>
|
---|
| 387 | Formula::_iterator<result_type>::operator--(int){
|
---|
| 388 | Formula::_iterator<result_type> retval = *this;
|
---|
| 389 | --(*this);
|
---|
| 390 | return retval;
|
---|
| 391 | }
|
---|
| 392 |
|
---|
[6f43ab] | 393 | template <class result_type>
|
---|
| 394 | result_type
|
---|
| 395 | Formula::_iterator<result_type>::operator*(){
|
---|
[e5c0a1] | 396 | const element *element = World::getInstance().getPeriode()->FindElement(pos+1);
|
---|
[6f43ab] | 397 | ASSERT(element,"Element with position of iterator not found");
|
---|
| 398 | return make_pair(element,(*set)[pos]);
|
---|
| 399 | }
|
---|
| 400 |
|
---|
| 401 | template <class result_type>
|
---|
| 402 | result_type*
|
---|
| 403 | Formula::_iterator<result_type>::operator->(){
|
---|
| 404 | // no one can keep this value around, so a static is ok to avoid temporaries
|
---|
| 405 | static value_type value=make_pair(reinterpret_cast<element*>(0),0); // no default constructor for std::pair
|
---|
[e5c0a1] | 406 | const element *element = World::getInstance().getPeriode()->FindElement(pos+1);
|
---|
[6f43ab] | 407 | ASSERT(element,"Element with position of iterator not found");
|
---|
| 408 | value = make_pair(element,(*set)[pos]);
|
---|
| 409 | return &value;
|
---|
| 410 | }
|
---|
| 411 |
|
---|
[a6d6a9] | 412 | // explicit instantiation of all iterator template methods
|
---|
| 413 | // this is quite ugly, but there is no better way unless we expose iterator implementation
|
---|
| 414 |
|
---|
| 415 | // instantiate Formula::iterator
|
---|
[c83b98] | 416 | template Formula::iterator::_iterator(set_t&);
|
---|
| 417 | template Formula::iterator::_iterator(set_t&,size_t);
|
---|
| 418 | template Formula::iterator::_iterator(const Formula::iterator&);
|
---|
| 419 | template Formula::iterator::~_iterator();
|
---|
| 420 | template Formula::iterator &Formula::iterator::operator=(const Formula::iterator&);
|
---|
| 421 | template bool Formula::iterator::operator==(const Formula::iterator&);
|
---|
| 422 | template bool Formula::iterator::operator!=(const Formula::iterator&);
|
---|
| 423 | template Formula::iterator Formula::iterator::operator++();
|
---|
| 424 | template Formula::iterator Formula::iterator::operator++(int);
|
---|
| 425 | template Formula::iterator Formula::iterator::operator--();
|
---|
| 426 | template Formula::iterator Formula::iterator::operator--(int);
|
---|
| 427 | template Formula::value_type Formula::iterator::operator*();
|
---|
| 428 | template Formula::value_type *Formula::iterator::operator->();
|
---|
[a6d6a9] | 429 |
|
---|
| 430 | // instantiate Formula::const_iterator
|
---|
[c83b98] | 431 | template Formula::const_iterator::_iterator(set_t&);
|
---|
| 432 | template Formula::const_iterator::_iterator(set_t&,size_t);
|
---|
| 433 | template Formula::const_iterator::_iterator(const Formula::const_iterator&);
|
---|
| 434 | template Formula::const_iterator::~_iterator();
|
---|
| 435 | template Formula::const_iterator &Formula::const_iterator::operator=(const Formula::const_iterator&);
|
---|
| 436 | template bool Formula::const_iterator::operator==(const Formula::const_iterator&);
|
---|
| 437 | template bool Formula::const_iterator::operator!=(const Formula::const_iterator&);
|
---|
| 438 | template Formula::const_iterator Formula::const_iterator::operator++();
|
---|
| 439 | template Formula::Formula::const_iterator Formula::const_iterator::operator++(int);
|
---|
| 440 | template Formula::Formula::const_iterator Formula::const_iterator::operator--();
|
---|
| 441 | template Formula::Formula::const_iterator Formula::const_iterator::operator--(int);
|
---|
| 442 | template const Formula::value_type Formula::const_iterator::operator*();
|
---|
| 443 | template const Formula::value_type *Formula::const_iterator::operator->();
|
---|
[a6d6a9] | 444 |
|
---|
[6f43ab] | 445 | /********************** I/O of Formulas ************************************************/
|
---|
| 446 |
|
---|
| 447 | std::ostream &operator<<(std::ostream &ost,const Formula &formula){
|
---|
| 448 | ost << formula.toString();
|
---|
| 449 | return ost;
|
---|
| 450 | }
|
---|