COPASI API  4.16.103
CCopasiVector.h
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/utilities/CCopasiVector.h,v $
3 // $Revision: 1.92 $
4 // $Name: $
5 // $Author: bergmann $
6 // $Date: 2012/05/14 05:55:34 $
7 // End CVS Header
8 
9 // Copyright (C) 2012 - 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
16 // and The University of Manchester.
17 // All rights reserved.
18 
19 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
20 // Properties, Inc. and EML Research, gGmbH.
21 // All rights reserved.
22 
23 #ifndef COPASI_CCopasiVector
24 #define COPASI_CCopasiVector
25 
26 #ifdef WIN32
27 # pragma warning (disable: 4786)
28 #endif // WIN32
29 
30 #include <vector>
31 #include <string>
32 #include <iostream>
33 
35 #include "utilities/utility.h"
36 
39 
40 #undef min
41 #undef max
42 #undef ERROR
43 
44 class CReadConfig;
45 
46 template <class CType> class CCopasiVector;
47 
48 template <class CType>
49 std::ostream &operator<<(std::ostream &os, const CCopasiVector<CType> & d);
50 
51 template < class CType > class CCopasiVector:
52  protected std::vector< CType * >, public CCopasiContainer
53 {
54 public:
55  typedef typename std::vector< CType * >::value_type value_type;
56  typedef typename std::vector< CType * >::iterator iterator;
57  typedef typename std::vector< CType * >::const_iterator const_iterator;
58 
59  // Operations
60 
61 public:
62  /**
63  * Default constructor
64  * @param const const std::string & name (Default: "NoName")
65  * @param const CCopasiContainer * pParent (Default: NULL)
66  * @param const size_t & flag (Default: flag | CCopasiObject::Vector)
67  */
68  CCopasiVector(const std::string & name = "NoName",
69  const CCopasiContainer * pParent = NULL,
70  const unsigned C_INT32 &
72  std::vector< CType * >(),
73  CCopasiContainer(name, pParent, "Vector", flag | CCopasiObject::Vector)
75 
76  /**
77  * Copy constructor
78  * @param const CCopasiVector < CType > & src
79  * @param const CCopasiContainer * pParent (Default: NULL)
80  */
82  const CCopasiContainer * pParent = NULL):
83  std::vector< CType * >(src),
84  CCopasiContainer(src, pParent)
85  {
87 
88  size_t i, imax = size();
89  iterator Target = begin();
90  const_iterator Source = src.begin();
91 
92  for (i = 0; i < imax; i++, Target++, Source++)
93  {
94  try
95  {
96  *Target = new CType(**Source, this);
97  }
98  catch (...)
99  {
100  *Target = NULL;
101  }
102 
103  if (*Target == NULL)
104  CCopasiMessage ex(CCopasiMessage::EXCEPTION, MCopasiBase + 1, imax * sizeof(CType));
105  }
106  }
107 
108  /**
109  * Destructor
110  */
111  virtual ~CCopasiVector()
112  {
113  cleanup();
115  }
116 
117  /**
118  * Assignment operator. The effect of this operator is that both vectors will
119  * share the same objects. However, the parentship of the objects is not affected
120  * This means that the assigned vector must be used with some care.
121  * @param const CCopasiVector< CType > & rhs
122  * @return CCopasiVector< CType > & lhs
123  */
125  {
126  cleanup();
127 
128  const_iterator it = rhs.begin();
129  const_iterator end = rhs.end();
130 
131  for (; it != end; ++it)
132  add(*it, false);
133 
134  return *this;
135  }
136 
137  /**
138  * Assignment operator.
139  * @param const std::vector< CType * > & rhs
140  * @return CCopasiVector< CType > & lhs
141  */
142  CCopasiVector< CType > & operator = (const std::vector< CType * > & rhs)
143  {
144  cleanup();
145 
146  typename std::vector< CType * >::const_iterator it = rhs.begin();
147  typename std::vector< CType * >::const_iterator end = rhs.end();
148 
149  for (; it != end; ++it)
150  add(*it, false);
151 
152  return *this;
153  }
154 
155  /**
156  * This creates a deep copy of the source, i.e., all objects are copied and
157  * the parent of these copies is the current vector.
158  * @param const CCopasiVector< CType > & source
159  */
160  void deepCopy(const CCopasiVector< CType > & source)
161  {
162  cleanup();
163  resize(source.size());
164 
165  size_t i, imax = size();
166  iterator Target = begin();
167  const_iterator Source = source.begin();
168 
169  for (i = 0; i < imax; i++, Target++, Source++)
170  {
171  try
172  {
173  *Target = new CType(**Source, this);
174  }
175  catch (...)
176  {
177  *Target = NULL;
178  }
179 
180  if (*Target == NULL)
181  CCopasiMessage ex(CCopasiMessage::EXCEPTION, MCopasiBase + 1, imax * sizeof(CType));
182  }
183  }
184 
186  {return std::vector< CType * >::begin();}
187 
189  {return std::vector< CType * >::begin();}
190 
192  {return std::vector< CType * >::end();}
193 
195  {return std::vector< CType * >::end();}
196 
197  /**
198  * Cleanup
199  */
200  virtual void cleanup()
201  {
202  iterator it = begin();
203  iterator End = end();
204 
205  for (; it != End; it++)
206  if (*it)
207  if ((*it)->getObjectParent() == this)
208  {
210  (*it)->setObjectParent(NULL);
211  delete(*it);
212  *it = NULL;
213  }
214 
216  }
217 
218  /**
219  * Add a copy of the object to the end of the vector.
220  * @param const CType & src
221  * @return bool success.
222  */
223  virtual bool add(const CType & src)
224  {
225  CType * Element;
226 
227  try
228  {
229  Element = new CType(src);
230  }
231  catch (...)
232  {
233  Element = NULL;
234  }
235 
236  if (Element == NULL)
237  CCopasiMessage ex(CCopasiMessage::EXCEPTION, MCopasiBase + 1, sizeof(CType));
238 
239  // This is not very efficient !!!
240  // It results in a lot of resizing of the vector !!!
241  std::vector< CType * >::push_back(Element);
242  return CCopasiContainer::add(Element);
243  }
244 
245  /**
246  * Swap two objects in the vector.
247  * @param const size_t & indexFrom
248  * @param const size_t & indexTo
249  */
250  virtual void swap(const size_t & indexFrom, const size_t & indexTo)
251  {
252  size_t Size = size();
253 
254  if (!(indexFrom < Size))
255  CCopasiMessage ex(CCopasiMessage::EXCEPTION, MCCopasiVector + 3, indexFrom, Size - 1);
256 
257  if (!(indexTo < Size))
258  CCopasiMessage ex(CCopasiMessage::EXCEPTION, MCCopasiVector + 3, indexTo, Size - 1);
259 
260  iterator from = begin() + indexFrom;
261  iterator to = begin() + indexTo;
262 
263  value_type tmp = *from;
264  *from = *to;
265  *to = tmp;
266  }
267 
268  /**
269  * Add an object to the end of the vector, if adobt is true the vector.
270  * becomes the parent of the object.
271  * @param CType * src
272  * @param const bool & adopt (Default: false)
273  * @return bool success
274  */
275  virtual bool add(CType * src, bool adopt = false)
276  {
277  // This is not very efficient !!!
278  // It results in a lot of resizing of the vector !!!
279  std::vector< CType * >::push_back(src);
280  return CCopasiContainer::add(src, adopt);
281  }
282 
283  /**
284  * Removes the index-th element from the vector
285  * @param const size_t & index
286  */
287  virtual void remove(const size_t & index)
288  {
289  if (!(index < size()))
290  return;
291 
292  iterator Target = begin() + index;
293 
294  if (*Target)
295  {
296  if ((*Target)->getObjectParent() == this)
297  {
298  // (*Target)->cleanup();
299  delete *Target;
300  }
301  else
302  {
303  CCopasiContainer::remove(*Target);
304  std::vector< CType * >::erase(Target, Target + 1);
305  }
306  }
307  }
308 
309  /**
310  * Removes the pointed to object from the vector
311  * @param CCopasiObject * pObject
312  * @return bool success
313  */
314  virtual bool remove(CCopasiObject * pObject)
315  {
316  const size_t index = getIndex(pObject);
317 
318  bool success = true;
319 
320  if (index != C_INVALID_INDEX)
321  {
322  iterator Target = begin() + index;
323  std::vector< CType * >::erase(Target, Target + 1);
324  }
325  else
326  success = false;
327 
328  success &= CCopasiContainer::remove(pObject);
329 
330  return success;
331  }
332 
333  /**
334  * Retrieve the indexed object.
335  * @param const size_t & index
336  * @return const value_type & object
337  */
338  const value_type & operator[](const size_t & index) const
339  {
340  if (!(index < size()))
342 
343  return *(begin() + index);
344  }
345 
346  /**
347  * Retrieve the indexed object.
348  * @param const size_t & index
349  * @return value_type & object
350  */
351  value_type & operator[](const size_t & index)
352  {
353  if (!(index < size()))
355 
356  return *(begin() + index);
357  }
358 
359  /**
360  * Retrieve a the CCopasiObject with the given name.
361  * @param const CCopasiObjectName &name
362  * @return const CObjectInterface * object
363  */
364  virtual const CObjectInterface * getObject(const CCopasiObjectName &name) const
365  {
366  size_t Index = name.getElementIndex();
367 
368  if (Index < size())
369  {
370  CCopasiObject * pObject = *(begin() + Index);
371 
372  if (name.getObjectType() == pObject->getObjectType())
373  return pObject; //exact match of type and name
374 
375  if (name.getObjectName() == "")
376  return pObject; //cn contains no "="; type cannot be checked
377  }
378 
379  return NULL;
380  }
381 
382  /**
383  * Retrieves the size of the vector
384  * @return size_t size
385  */
386  virtual size_t size() const
387  {return std::vector< CType * >::size();}
388 
389  /**
390  * Resizes the vector but does not create new member objects
391  * @param const size_t & newSize
392  */
393  virtual void resize(const size_t & newSize)
394  {
395  size_t OldSize = size();
396 
397  if (OldSize == newSize) return; // Nothing to do.
398 
399  if (OldSize < newSize)
400  {
401  std::vector< CType * >::resize(newSize);
402 
403  size_t i;
404  iterator Target = begin() + OldSize;
405 
406  for (i = OldSize; i < newSize; i++, Target++)
407  *Target = NULL;
408  }
409  else
410  {
411  iterator Target = begin() + newSize;
412  iterator End = end();
413 
414  for (; Target != End; Target++)
415  if (*Target)
416  {
417  if ((*Target)->getObjectParent() == this)
418  {
419  CCopasiContainer::remove(*Target);
420  (*Target)->setObjectParent(NULL);
421  delete *Target;
422  }
423  else
424  CCopasiContainer::remove(*Target);
425  }
426 
427  std::vector< CType * >::resize(newSize);
428  }
429  }
430 
431  virtual void clear()
432  {
433  size_t OldSize = size();
434 
435  if (OldSize == 0) return; // Nothing to do.
436 
437  iterator Target = begin();
438  iterator End = end();
439 
440  for (; Target != End; Target++)
441  if (*Target)
442  {
443  if ((*Target)->getObjectParent() == this)
444  {
445  CCopasiContainer::remove(*Target);
446  (*Target)->setObjectParent(NULL);
447  delete *Target;
448  }
449  else
450  CCopasiContainer::remove(*Target);
451  }
452 
453  std::vector< CType * >::resize(0);
454  }
455 
456  /**
457  * Retrieve the index of the pointed to object in the vector. If the object
458  * is not found C_INVALID_INDEX is returned.
459  * @param const CCopasiObject * pObject
460  * @return size_t index
461  */
462  virtual size_t getIndex(const CCopasiObject * pObject) const
463  {
464  size_t i, imax = size();
465  const_iterator Target = begin();
466 
467  for (i = 0; i < imax; i++, Target++)
468  {
469  const CCopasiObject * pTarget = static_cast< const CCopasiObject * >(*Target);
470 
471  if (pTarget == pObject)
472  {
473  return i;
474  }
475  }
476 
477  return C_INVALID_INDEX;
478  }
479 
480  /**
481  * ostream operator
482  * @param std::ostream & os
483  * @param const CCopasiVector<CType> & d
484  * @return std::ostream & os
485  */
486 #if defined SWIG
487  friend std::ostream &operator << (std::ostream &os,
488  const CCopasiVector<CType> & d);
489 #else
490 #if defined _MSC_VER && _MSC_VER < 1201 // 1200 Identifies Visual C++ 6.0
491  friend std::ostream &operator << (std::ostream &os,
492  const CCopasiVector<CType> & d);
493 #else
494  friend std::ostream &operator << <>(std::ostream &os,
495  const CCopasiVector<CType> & d);
496 #endif // WIN32
497 #endif // SWIG
498 };
499 
500 template < class CType > class CCopasiVectorS: public CCopasiVector < CType >
501 {
502 public:
503  typedef typename std::vector< CType * >::value_type value_type;
504  typedef typename std::vector< CType * >::iterator iterator;
505  typedef typename std::vector< CType * >::const_iterator const_iterator;
506 
507  // Operations
508 public:
509  /**
510  * Default constructor
511  * @param const std::string & name (Default: "NoName")
512  * @param const CCopasiContainer * pParent (Default: NULL)
513  */
514  CCopasiVectorS(const std::string & name = "NoName",
515  const CCopasiContainer * pParent = NULL):
516  CCopasiVector< CType >(name, pParent) {}
517 
518  /**
519  * Copy constructor
520  * @param const CCopasiVectorS < CType > & src
521  * @param const CCopasiContainer * pParent (Default: NULL)
522  */
524  const CCopasiContainer * pParent = NULL) :
525  CCopasiVector < CType > (src, pParent) {}
526 
527  /**
528  * Destructor
529  */
530  virtual ~CCopasiVectorS() {}
531 
532  /**
533  * Loads an object with data coming from a CReadConfig object.
534  * (CReadConfig object reads an input stream)
535  * @param CReadConfig & configbuffer
536  * @param const size_t & size
537  */
538  virtual void load(CReadConfig & configbuffer, size_t size)
539  {
540  size_t i;
541 
544 
546 
547  for (i = 0; i < size; i++, Target++)*Target = NULL;
548 
549  for (i = 0, Target = CCopasiVector< CType >::begin(); i < size; i++, Target++)
550  {
551  try
552  {
553  *Target = new CType("NoName", this);
554  }
555  catch (...)
556  {
557  *Target = NULL;
558  }
559 
560  if (*Target == NULL)
561  CCopasiMessage ex(CCopasiMessage::EXCEPTION, MCopasiBase + 1, size * sizeof(CType));
562 
563  (*Target)->load(configbuffer);
564  }
565  }
566 };
567 
568 template < class CType > class CCopasiVectorN: public CCopasiVector < CType >
569 {
570 public:
571  typedef typename std::vector< CType * >::value_type value_type;
572  typedef typename std::vector< CType * >::iterator iterator;
573  typedef typename std::vector< CType * >::const_iterator const_iterator;
574 
575  // Operations
576 public:
577  /**
578  * Default constructor
579  * @param const std::string & name (Default: "NoName")
580  * @param const CCopasiContainer * pParent (Default: NULL)
581  */
582  CCopasiVectorN(const std::string & name = "NoName",
583  const CCopasiContainer * pParent = NULL):
584  CCopasiVector< CType >(name, pParent,
588  {}
589 
590  /**
591  * Copy constructor
592  * @param const CCopasiVectorN < CType > & src
593  * @param const CCopasiContainer * pParent (Default: NULL)
594  */
596  const CCopasiContainer * pParent = NULL) :
597  CCopasiVector < CType > (src, pParent)
598  {}
599 
600  /**
601  * Destructor
602  */
603  virtual ~CCopasiVectorN() {}
604 
605  /**
606  * Assignment operator.
607  * @param const std::vector< CType * > & rhs
608  * @return CCopasiVectorN< CType > & lhs
609  */
610  CCopasiVectorN< CType > & operator = (const std::vector< CType * > & rhs)
611  {
613  return *this;
614  }
615 
616  /**
617  * Add a copy of the object to the end of the vector.
618  * @param const CType & src
619  * @return bool success.
620  */
621  virtual bool add(const CType & src)
622  {
623  if (!isInsertAllowed(&src))
624  {
626  MCCopasiVector + 2, src.getObjectName().c_str());
627  return false;
628  }
629 
630  CType * Element;
631 
632  try
633  {
634  Element = new CType(src);
635  }
636  catch (...)
637  {
638  Element = NULL;
639  }
640 
641  if (Element == NULL)
642  CCopasiMessage ex(CCopasiMessage::EXCEPTION, MCopasiBase + 1, sizeof(CType));
643 
644  std::vector< CType * >::push_back(Element);
645  return CCopasiContainer::add(Element);
646  }
647 
648  /**
649  * Add an object to the end of the vector, if adobt is true the vector.
650  * becomes the parent of the object.
651  * @param CType * src
652  * @param const bool & adopt (Default: false)
653  * @return bool success
654  */
655  virtual bool add(CType * src, const bool & adopt = false)
656  {
657  if (!isInsertAllowed(src))
658  {
660  MCCopasiVector + 2, src->getObjectName().c_str());
661  return false;
662  }
663 
664  // This is not very efficient !!!
665  // It results in a lot of resizing of the vector !!!
666  std::vector< CType * >::push_back(src);
667  return CCopasiContainer::add(src, adopt);
668  }
669 
670  /**
671  * Remove the object with the given name from the vector.
672  * @param const std::string & name
673  */
674  virtual void remove(const std::string & name)
675  {
676  size_t Index = getIndex(name);
677 
678  if (Index == C_INVALID_INDEX)
679  {
681  MCCopasiVector + 1, name.c_str());
682  return;
683  }
684 
686  return;
687  }
688 
689  /**
690  * Retrieve the indexed object.
691  * @param const size_t & index
692  * @return value_type & object
693  */
694  value_type & operator[](const size_t & index)
695  {return CCopasiVector< CType >::operator[](index);}
696 
697  /**
698  * Retrieve the indexed object.
699  * @param const size_t & index
700  * @return const value_type & object
701  */
702  const value_type & operator[](const size_t & index) const
703  {return CCopasiVector< CType >::operator[](index);}
704 
705  /**
706  * Retrieve the named object.
707  * @param const std::string & name
708  * @return value_type & object
709  */
710  value_type & operator[](const std::string & name)
711  {
712  size_t Index = getIndex(name);
713 
714  if (Index == C_INVALID_INDEX)
716  MCCopasiVector + 1, name.c_str());
717 
718  return *(CCopasiVector< CType >::begin() + Index);
719  }
720 
721  /**
722  * Retrieve the named object.
723  * @param const std::string & name
724  * @return const value_type & object
725  */
726  const value_type & operator[](const std::string &name) const
727  {
728  size_t Index = getIndex(name);
729 
730  if (Index == C_INVALID_INDEX)
732  MCCopasiVector + 1, name.c_str());
733 
734  return *(CCopasiVector< CType >::begin() + Index);
735  }
736 
737  /**
738  * Retrieve a pointer to the named object.
739  * @param const std::string & name
740  * @return const CObjectInterface * pObject
741  */
742  virtual const CObjectInterface * getObject(const CCopasiObjectName &name) const
743  {
744  size_t Index = getIndex(name.getElementName(0));
745 
746  if (Index == C_INVALID_INDEX) return NULL;
747 
748  CCopasiObject * pObject = *(CCopasiVector< CType >::begin() + Index);
749 
750  if (name.getObjectType() == pObject->getObjectType())
751  return pObject; //exact match of type and name
752 
753  if (name.getObjectName() == "")
754  return pObject; //cn contains no "="; type cannot be checked
755 
756 #ifdef COPASI_DEBUG
757  std::cout << "CCopasiVector::getObject: Vector contains object of right name but wrong type" << std::endl;
758  std::cout << " CN " << name << std::endl;
759  std::cout << " CN.getName(0) " << name.getElementName(0) << std::endl;
760  std::cout << " Index " << Index << std::endl;
761  std::cout << " CN.getObjName " << name.getObjectName() << std::endl;
762  std::cout << " CN.getObjType " << name.getObjectType() << std::endl << std::endl;
763 #endif // COPASI_DEBUG
764 
765  return NULL;
766  }
767 
768  /**
769  * Retrieve the index of the named object in the vector. If an object with the
770  * given name is not found C_INVALID_INDEX is returned.
771  * @param const std::string & name
772  * @return size_t index
773  */
774  virtual size_t getIndex(const std::string &name) const
775  {
776  size_t i, imax = CCopasiVector< CType >::size();
778 
779  std::string Name = unQuote(name);
780 
781  for (i = 0; i < imax; i++, Target++)
782  if (*Target &&
783  ((*Target)->getObjectName() == name ||
784  (*Target)->getObjectName() == Name)) return i;
785 
786  return C_INVALID_INDEX;
787  }
788 
789 private:
790  /**
791  * Check whether an insert of the given src into the vector is allowed
792  * to avoid naming conflicts.
793  * @param const CType * src
794  * @return bool insertAllowed
795  */
796  virtual bool isInsertAllowed(const CType * src)
797  {return (getIndex(src->getObjectName()) == C_INVALID_INDEX);}
798 };
799 
800 template < class CType > class CCopasiVectorNS: public CCopasiVectorN < CType >
801 {
802 public:
803  typedef typename std::vector< CType * >::value_type value_type;
804  typedef typename std::vector< CType * >::iterator iterator;
805  typedef typename std::vector< CType * >::const_iterator const_iterator;
806 
807  // Operations
808 public:
809  /**
810  * Default constructor
811  * @param const std::string & name (Default: "NoName")
812  * @param const CCopasiContainer * pParent (Default: NULL)
813  */
814  CCopasiVectorNS(const std::string & name = "NoName",
815  const CCopasiContainer * pParent = NULL):
816  CCopasiVectorN< CType >(name, pParent)
817  {}
818 
819  /**
820  * Copy constructor
821  * @param const CCopasiVectorNS < CType > & src
822  * @param const CCopasiContainer * pParent (Default: NULL)
823  */
825  const CCopasiContainer * pParent = NULL) :
826  CCopasiVectorN< CType >(src, pParent) {}
827 
828  /**
829  * Destructor
830  */
831  virtual ~CCopasiVectorNS() {}
832 
833  /**
834  * Loads an object with data coming from a CReadConfig object.
835  * (CReadConfig object reads an input stream)
836  * @param CReadConfig & configbuffer
837  * @param const size_t & size
838  */
839  virtual void load(CReadConfig & configbuffer, size_t size)
840  {
841  size_t i;
842 
845 
847 
848  for (i = 0; i < size; i++, Target++) *Target = NULL;
849 
850  for (i = 0, Target = CCopasiVector< CType >::begin(); i < size; i++, Target++)
851  {
852  try
853  {
854  *Target = new CType("NoName", this);
855  }
856  catch (...)
857  {
858  *Target = NULL;
859  }
860 
861  if (*Target == NULL)
862  CCopasiMessage ex(CCopasiMessage::EXCEPTION, MCopasiBase + 1, size * sizeof(CType));
863 
864  (*Target)->load(configbuffer);
865  }
866  }
867 };
868 
869 template <class CType>
870 std::ostream &operator<<(std::ostream &os, const CCopasiVector<CType> & d)
871 {
872  os << " +++Vektor; size: " << d.size() << std::endl;
873 
874  unsigned int i;
875 
876  for (i = 0; i < d.size(); i++)
877  os << " " << *(d[i]);
878 
879  if (d.size() == 0)
880  os << " empty" << std::endl;
881 
882  os << " ---Vektor" << std::endl;
883 
884  return os;
885 }
886 
887 #endif // COPASI_CCopasiVector
std::string unQuote(const std::string &name)
Definition: utility.cpp:120
value_type & operator[](const size_t &index)
size_t getElementIndex(const size_t &pos=0) const
const_iterator begin() const
const value_type & operator[](const size_t &index) const
virtual void swap(const size_t &indexFrom, const size_t &indexTo)
CCopasiVectorNS(const CCopasiVectorNS< CType > &src, const CCopasiContainer *pParent=NULL)
virtual void load(CReadConfig &configbuffer, size_t size)
CCopasiVectorS(const std::string &name="NoName", const CCopasiContainer *pParent=NULL)
std::vector< CType * >::iterator iterator
virtual size_t size() const
std::vector< CType * >::iterator iterator
iterator begin()
virtual ~CCopasiVector()
virtual void load(CReadConfig &configbuffer, size_t size)
std::vector< CType * >::value_type value_type
const std::string & getObjectType() const
#define C_INVALID_INDEX
Definition: copasi.h:222
std::string getObjectType() const
virtual size_t getIndex(const std::string &name) const
#define C_INT32
Definition: copasi.h:90
virtual ~CCopasiVectorN()
std::vector< CType * >::value_type value_type
friend std::ostream & operator<<(std::ostream &os, const CCopasiVector< CType > &d)
virtual const CObjectInterface * getObject(const CCopasiObjectName &name) const
CCopasiVectorN(const std::string &name="NoName", const CCopasiContainer *pParent=NULL)
virtual bool add(CType *src, bool adopt=false)
#define MCopasiBase
#define DESTRUCTOR_TRACE
Definition: copasi.h:206
iterator end()
std::vector< CType * >::const_iterator const_iterator
Definition: CCopasiVector.h:57
const_iterator end() const
CCopasiVector(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const unsigned C_INT32 &flag=CCopasiObject::Vector)
Definition: CCopasiVector.h:68
virtual bool add(const CType &src)
std::vector< CType * >::iterator iterator
void deepCopy(const CCopasiVector< CType > &source)
std::vector< CType * >::value_type value_type
virtual void cleanup()
virtual bool add(const CType &src)
virtual ~CCopasiVectorS()
std::string getElementName(const size_t &pos, const bool &unescape=true) const
CCopasiVectorN(const CCopasiVectorN< CType > &src, const CCopasiContainer *pParent=NULL)
virtual bool remove(CCopasiObject *pObject)
const value_type & operator[](const size_t &index) const
std::vector< CType * >::value_type value_type
Definition: CCopasiVector.h:55
CCopasiVector< CType > & operator=(const CCopasiVector< CType > &rhs)
Header file of class CCopasiContainer.
virtual void resize(const size_t &newSize)
virtual const CObjectInterface * getObject(const CCopasiObjectName &name) const
long int flag
Definition: f2c.h:52
virtual void remove(const size_t &index)
virtual bool add(CType *src, const bool &adopt=false)
CCopasiVector(const CCopasiVector< CType > &src, const CCopasiContainer *pParent=NULL)
Definition: CCopasiVector.h:81
const value_type & operator[](const std::string &name) const
virtual size_t getIndex(const CCopasiObject *pObject) const
CCopasiVectorS(const CCopasiVectorS< CType > &src, const CCopasiContainer *pParent=NULL)
std::vector< CType * >::const_iterator const_iterator
virtual bool isInsertAllowed(const CType *src)
std::vector< CType * >::iterator iterator
Definition: CCopasiVector.h:56
std::vector< CType * >::const_iterator const_iterator
virtual void clear()
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
virtual ~CCopasiVectorNS()
CCopasiVectorNS(const std::string &name="NoName", const CCopasiContainer *pParent=NULL)
std::vector< CType * >::const_iterator const_iterator
std::string getObjectName() const
CCopasiVectorN< CType > & operator=(const std::vector< CType * > &rhs)
#define MCCopasiVector
value_type & operator[](const size_t &index)
value_type & operator[](const std::string &name)
#define CONSTRUCTOR_TRACE
Definition: copasi.h:202